You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
by this comment i felt strongly encouraged refactor code in order to use an empty string as key for the default namespace in a namespace mapping, but soon found inconsistencies with the current annotations and implementation.
with error: Argument "nsmap" to "makeelement" of "_Element" has incompatible type "Dict[Optional[str], str]"; expected "Optional[Mapping[str, str]]".
then, the empty string as key isn't even the default:
In [1]: from lxml import etree
In [2]: t = etree.fromstring("<element xmlns='test'/>")
In[3]: t.nsmap.get(None)
Out[3]: 'test'
In[4]: t.nsmap.get("")
Out[[4]:
i have no proposal how to solve these issues, but i consider the first demo a bug and the latter at least confusing.
The text was updated successfully, but these errors were encountered:
by this comment i felt strongly encouraged refactor code in order to use an empty string as key for the default namespace in a namespace mapping, but soon found inconsistencies with the current annotations and implementation.
first, mypy complains about this:
with
error: Argument "nsmap" to "makeelement" of "_Element" has incompatible type "Dict[Optional[str], str]"; expected "Optional[Mapping[str, str]]"
.then, the empty string as key isn't even the default:
i have no proposal how to solve these issues, but i consider the first demo a bug and the latter at least confusing.
The text was updated successfully, but these errors were encountered: