From 3aab6f1348189ac50960119582bb57a644b7ab96 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 7 Dec 2021 16:40:33 +0000 Subject: [PATCH] Add missing properties to `xml.dom.minidom` (#6526) --- stdlib/xml/dom/minidom.pyi | 23 ++++++++++++++++++++--- tests/stubtest_allowlists/py3_common.txt | 11 ----------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/stdlib/xml/dom/minidom.pyi b/stdlib/xml/dom/minidom.pyi index 4d1d7a9d0..e9a26e30d 100644 --- a/stdlib/xml/dom/minidom.pyi +++ b/stdlib/xml/dom/minidom.pyi @@ -70,6 +70,10 @@ class Attr(Node): self, qName: str, namespaceURI: str | None = ..., localName: Any | None = ..., prefix: Any | None = ... ) -> None: ... def unlink(self) -> None: ... + @property + def isId(self) -> bool: ... + @property + def schemaType(self) -> Any: ... class NamedNodeMap: def __init__(self, attrs, attrsNS, ownerElement) -> None: ... @@ -96,6 +100,8 @@ class NamedNodeMap: def setNamedItem(self, node): ... def setNamedItemNS(self, node): ... def __delitem__(self, attname_or_tuple) -> None: ... + @property + def length(self) -> int: ... AttributeList = NamedNodeMap @@ -110,6 +116,7 @@ class Element(Node): schemaType: Any parentNode: Any tagName: str + nodeName: str prefix: Any namespaceURI: str | None childNodes: Any @@ -139,6 +146,8 @@ class Element(Node): def setIdAttribute(self, name) -> None: ... def setIdAttributeNS(self, namespaceURI: str, localName) -> None: ... def setIdAttributeNode(self, idAttr) -> None: ... + @property + def attributes(self) -> NamedNodeMap: ... class Childless: attributes: Any @@ -173,6 +182,8 @@ class CharacterData(Childless, Node): def insertData(self, offset: int, arg: str) -> None: ... def deleteData(self, offset: int, count: int) -> None: ... def replaceData(self, offset: int, count: int, arg: str) -> None: ... + @property + def length(self) -> int: ... class Text(CharacterData): nodeType: Any @@ -182,6 +193,10 @@ class Text(CharacterData): def splitText(self, offset): ... def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... def replaceWholeText(self, content): ... + @property + def isWhitespaceInElementContent(self) -> bool: ... + @property + def wholeText(self) -> str: ... class Comment(CharacterData): nodeType: Any @@ -205,15 +220,17 @@ class ReadOnlySequentialNamedNodeMap: def removeNamedItemNS(self, namespaceURI: str, localName) -> None: ... def setNamedItem(self, node) -> None: ... def setNamedItemNS(self, node) -> None: ... + @property + def length(self) -> int: ... -class Identified: ... +class Identified: + publicId: Any + systemId: Any class DocumentType(Identified, Childless, Node): nodeType: Any nodeValue: Any name: Any - publicId: Any - systemId: Any internalSubset: Any entities: Any notations: Any diff --git a/tests/stubtest_allowlists/py3_common.txt b/tests/stubtest_allowlists/py3_common.txt index ff143515a..e4f17e335 100644 --- a/tests/stubtest_allowlists/py3_common.txt +++ b/tests/stubtest_allowlists/py3_common.txt @@ -686,16 +686,5 @@ wave.Wave_read.initfp wave.Wave_write.initfp xml.dom xml.dom.InvalidCharacterErr -xml.dom.minidom.Attr.isId -xml.dom.minidom.Attr.schemaType -xml.dom.minidom.CharacterData.length -xml.dom.minidom.Element.attributes -xml.dom.minidom.Element.nodeName -xml.dom.minidom.Identified.publicId -xml.dom.minidom.Identified.systemId -xml.dom.minidom.NamedNodeMap.length -xml.dom.minidom.ReadOnlySequentialNamedNodeMap.length -xml.dom.minidom.Text.isWhitespaceInElementContent -xml.dom.minidom.Text.wholeText xml.etree xml.sax