Skip to content

xmltodict typing for namespaces faulty #15165

@Kane610

Description

@Kane610

Using these versions

"xmltodict==1.0.2"
"types-xmltodict==v1.0.1.20250920"

I get this report by mypy

axis/models/event.py:198: error: Argument "namespaces" to "parse" has incompatible type "dict[str, None]"; expected "dict[str, str] | None" [arg-type] link to code

the type should be dict[str, str | None] not just dict[str, str]

The documentation for xmltodict explicitly states it can be None

>>> namespaces = {
...     'http://defaultns.com/': None, # skip this namespace
...     'http://a.com/': 'ns_a', # collapse "http://a.com/" -> "ns_a"
... }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions