Skip to content

fix: add missing type stubs for xml.dom.minidom.DOMImplementation, where possible #8556

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

Merged
merged 3 commits into from
Aug 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions stdlib/xml/dom/minidom.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,10 @@ class Notation(Identified, Childless, Node):
def __init__(self, name, publicId, systemId) -> None: ...

class DOMImplementation(DOMImplementationLS):
def hasFeature(self, feature, version) -> bool: ...
def createDocument(self, namespaceURI: str | None, qualifiedName: str | None, doctype): ...
def createDocumentType(self, qualifiedName: str | None, publicId, systemId): ...
def getInterface(self, feature): ...
def hasFeature(self, feature: str, version: str | None) -> bool: ...
def createDocument(self, namespaceURI: str | None, qualifiedName: str | None, doctype: DocumentType | None) -> Document: ...
Copy link
Member

Choose a reason for hiding this comment

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

I couldn't find definitive evidence for this in the source code, but the documentation for this method confirms this type annotation. Looks good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had been trying to use https://cs.github.com/?scopeName=All+repos&scope=&q=repo%3Apython%2Fcpython+path%3ALib%2Fxml%2Fdom+%22.createDocument%28%22 to work backwards through what calls were being used and comparing it to the documentation as my way of trying to find evidence, if that helps

Copy link
Member

Choose a reason for hiding this comment

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

Oh, that is helpful, thanks! Especially with xml, it's sometimes pretty difficult to figure out the types just by studying the source code, so hints as to how you figured out non-obvious types are definitely appreciated :)

def createDocumentType(self, qualifiedName: str | None, publicId: str, systemId: str) -> DocumentType: ...
def getInterface(self: Self, feature: str) -> Self | None: ...

class ElementInfo:
tagName: Any
Expand Down