refactor: expand types in xml module#8590
refactor: expand types in xml module#8590AlexWaygood merged 10 commits intopython:masterfrom kkirsche:xml/dom-pulldom
Conversation
|
Also, some of the parameter names of node are misleading, as the isinstance checks are checking for Attr nodes specifically, which is deceptive on a first pass: |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
JelleZijlstra
left a comment
There was a problem hiding this comment.
Thanks, I have a few comments.
| prefix: Any | ||
| def __init__( | ||
| self, qName: str, namespaceURI: str | None = ..., localName: Any | None = ..., prefix: Any | None = ... | ||
| self, qName: str, namespaceURI: str | None = ..., localName: str | None = ..., prefix: Any | None = ... |
There was a problem hiding this comment.
The localName argument is actually ignored: https://github.com/python/cpython/blob/18b1782192f85bd26db89f5bc850f8bee4247c1a/Lib/xml/dom/minidom.py#L355.
Seems like it wants a if localName is not None: self._localName = localName. Are you interested in contributing that to CPython?
There was a problem hiding this comment.
X-Ref: python/typeshed#8590 (comment) This adds a missing assignment to `_localName`
This comment has been minimized.
This comment has been minimized.
JelleZijlstra
left a comment
There was a problem hiding this comment.
My comments were addressed, thanks. Still need to resolve @AlexWaygood's concern.
AlexWaygood
left a comment
There was a problem hiding this comment.
I haven't reviewed in detail, but my concerns have been addressed, and I'll defer to @JelleZijlstra on the rest! :)
This comment has been minimized.
This comment has been minimized.
1 similar comment
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
…Attr` (#96176) X-Ref: python/typeshed#8590 (comment) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
…nidom.Attr` (python#96176) X-Ref: python/typeshed#8590 (comment) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
encodingchanged fromAny | Nonetostr | Noneas it's used as a parameter to TextIOWrapperstandalonechanged fromAny | Nonetobool | Noneper https://docs.python.org/3/library/xml.dom.minidom.html#xml.dom.minidom.Node.writexmllocalNamechanged fromAny | Nonetostr | NoneasNode'slocalNameproperty returnsstr | Noneobjectas they useidto do the comparisons, not object specific behavior: https://github.com/python/cpython/blob/main/Lib/xml/dom/minidom.py#L534TypeInfopartially typed based on https://cs.github.com/python/cpython/blob/5ed584cb6b4e544d307f2f1b6f28667078cc20af/Lib/xml/dom/expatbuilder.py?q=repo%3Apython%2Fcpython+path%3ALib%2Fxml%2F+TypeInfo#L47-L58get*Itemcheck with a try / except: https://github.com/python/cpython/blob/main/Lib/xml/dom/minidom.py#L571