Skip to content

Conversation

@emmanuel-ferdman
Copy link
Contributor

PR Summary

The namespaces parameter in xmltodict.parse() and unparse() now accepts None values, which are used to skip namespaces according to the xmltodict documentation. Previously, passing dict[str, None] caused a type error even though it's valid at runtime. Fixes #15165.

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
@github-actions

This comment has been minimized.

Copy link
Contributor

@donbarbos donbarbos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! In this case, Mapping[str, str | None] should be sufficient, and the _Namespaces type alias seems unnecessary. Using a single Mapping would improve clarity and consistency:

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@emmanuel-ferdman
Copy link
Contributor Author

@donbarbos Good point, updated. Thanks for the review!

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.

xmltodict typing for namespaces faulty

2 participants