-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
refactor: expand types in xml module #8590
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments were addressed, thanks. Still need to resolve @AlexWaygood's concern.
AlexWaygood
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
…nidom.Attr` (python#96176) X-Ref: python/typeshed#8590 (comment) Co-authored-by: Jelle Zijlstra <[email protected]>
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