Repository navigation
feat: add encoder_by_name factory function - #54
sumanjeet0012 wants to merge 2 commits into
Conversation
acul71
left a comment
There was a problem hiding this comment.
Review summary (maintainer)
Thanks for the clean encoder_by_name() addition — it matches issue #39 and go-multibase’s name/prefix factory pattern, keeps Encoder.__init__ backward compatible, and local/CI checks look good.
Blocker (must fix)
Missing newsfragment. Please add:
newsfragments/39.feature.rst
with a short user-facing ReST note (trailing newline required), e.g. that encoder_by_name() creates an Encoder from an encoding name or multibase prefix character.
Also please address
- Rebase onto
origin/master— branch is 6 commits behind (dry-run merge currently clean, but please sync). - Input hardening —
encoder_by_name(b"f")currently yieldsencoding == b"f"; non-strvalues likeNoneraiseAttributeError. Prefer requiringstror normalizing to the codec name. - Docs — README still only shows
Encoder('base64'); add a briefencoder_by_nameexample. - Tests (nice-to-have) — assert
.encode()via the factory, not only.encoding.
Notes
- No merge conflicts vs current
origin/master. - Informational: overlaps with PR #53 on
multibase.py/ tests. - Full review: local
downloads/AI-PR-REVIEWS/54/AI-PR-REVIEW-54-0.md.
Requesting changes until the newsfragment (and preferably rebase) is done.
|
Hi @sumanjeet0012 — friendly follow-up. I requested changes on this PR on 2026-09-07 (mainly the missing towncrier newsfragment, plus the other notes in that review). I don’t see any new commits addressing those items yet. Are you still willing / able to carry this PR forward? If yes, please push the requested updates when you can and I’ll re-review promptly. If your bandwidth has changed, no worries — just say so and we can close it or leave it for someone else to pick up. |
🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
f96058f to
2f4b35b
Compare
acul71
left a comment
There was a problem hiding this comment.
Re-review — newsfragment + sync OK; two items still open
Thanks for adding newsfragments/39.feature.rst. Branch is also already up to date with origin/master (0 behind / 2 ahead).
Still please address
- Input hardening —
encoder_by_name(b"f")andencoder_by_name(None)still raiseAttributeError('…' object has no attribute 'encode'). Prefer requiringstr(or normalizing) and raisingTypeError/UnsupportedEncodingError. - Docs — README still only shows
Encoder('base64'); please add a shortencoder_by_nameexample.
Nice-to-have (non-blocking): assert .encode() via the factory in tests, not only .encoding.
Validation (git worktree)
- Local:
make lint,typecheck,test(359 passed, 9 skipped),docs-ci— all green. - GitHub CI: all checks green.
Happy to approve once hardening + README are in.
Fixes #39
Description
This pull request adds an
encoder_by_name()factory function, which enables creating anEncoderfrom a single-character prefix as well as the standard name, bringing the python implementation into alignment with thego-multibasereference implementation.Changes
encoder_by_name()inmultibase/multibase.pywhich inspects the given string and resolves it if it matches either a name or a prefix.encoder_by_namefrom__init__.py.encoder_by_namedemonstrating successful construction from prefix, name, and base256emoji, as well as proper exception handling for unsupported/invalid strings.