Skip to content

Annotate tag()'s tag_mapping parameter - #412

Open
NorthIsUp wants to merge 1 commit into
datamade:mainfrom
NorthIsUp:type-tag-mapping
Open

NorthIsUp wants to merge 1 commit into
datamade:mainfrom
NorthIsUp:type-tag-mapping

Conversation

@NorthIsUp

Copy link
Copy Markdown

tag() leaves tag_mapping unannotated in both __init__.py and the new __init__.pyi, so pyright in strict mode reports reportUnknownMemberType on every usaddress.tag(...) call (its signature is (address_string: str, tag_mapping: Unknown | None = None)).

This annotates it as Optional[Mapping[str, str]], matching the docstring ({'OldTag': 'NewTag'}) and the body, which only calls .get() on it. No runtime change.

Checked: mypy usaddress clean, black --check clean, pytest tests 4972 passed.

Unannotated, strict type checkers (pyright strict) report every call to
usaddress.tag as partially unknown.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant