Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSMapArg type definition is incorrect. #76

Open
dapper91 opened this issue Jan 8, 2023 · 1 comment
Open

NSMapArg type definition is incorrect. #76

dapper91 opened this issue Jan 8, 2023 · 1 comment

Comments

@dapper91
Copy link

dapper91 commented Jan 8, 2023

nsmap argument of Element function is of type Optional[_NSMapArg] where _NSMapArg is Mapping[str, str].

But according to the documentation here namespace key for the default namespace supposed to be None:

...
>>> NSMAP = {None : XHTML_NAMESPACE} # the default namespace (no prefix)

>>> xhtml = etree.Element(XHTML + "html", nsmap=NSMAP) # lxml only!
...

So it seems like _NSMapArg should be Mapping[Optional[str], str]

@ajnelson-nist
Copy link

I also just encountered this issue, and agree that the documentation disagrees with the type stubs.

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

No branches or pull requests

2 participants