diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/python3/src/Lib/xml/dom | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Lib/xml/dom')
-rw-r--r-- | contrib/tools/python3/src/Lib/xml/dom/expatbuilder.py | 8 | ||||
-rw-r--r-- | contrib/tools/python3/src/Lib/xml/dom/minidom.py | 86 | ||||
-rw-r--r-- | contrib/tools/python3/src/Lib/xml/dom/pulldom.py | 14 |
3 files changed, 54 insertions, 54 deletions
diff --git a/contrib/tools/python3/src/Lib/xml/dom/expatbuilder.py b/contrib/tools/python3/src/Lib/xml/dom/expatbuilder.py index 199c22d0af..88eefd2552 100644 --- a/contrib/tools/python3/src/Lib/xml/dom/expatbuilder.py +++ b/contrib/tools/python3/src/Lib/xml/dom/expatbuilder.py @@ -204,11 +204,11 @@ class ExpatBuilder: buffer = file.read(16*1024) if not buffer: break - parser.Parse(buffer, False) + parser.Parse(buffer, False) if first_buffer and self.document.documentElement: self._setup_subset(buffer) first_buffer = False - parser.Parse(b"", True) + parser.Parse(b"", True) except ParseEscape: pass doc = self.document @@ -637,7 +637,7 @@ class FragmentBuilder(ExpatBuilder): nsattrs = self._getNSattrs() # get ns decls from node's ancestors document = _FRAGMENT_BUILDER_TEMPLATE % (ident, subset, nsattrs) try: - parser.Parse(document, True) + parser.Parse(document, True) except: self.reset() raise @@ -697,7 +697,7 @@ class FragmentBuilder(ExpatBuilder): self.fragment = self.document.createDocumentFragment() self.curNode = self.fragment try: - parser.Parse(self._source, True) + parser.Parse(self._source, True) finally: self.curNode = old_cur_node self.document = old_document diff --git a/contrib/tools/python3/src/Lib/xml/dom/minidom.py b/contrib/tools/python3/src/Lib/xml/dom/minidom.py index d09ef5e7d0..64cc7ecc48 100644 --- a/contrib/tools/python3/src/Lib/xml/dom/minidom.py +++ b/contrib/tools/python3/src/Lib/xml/dom/minidom.py @@ -43,11 +43,11 @@ class Node(xml.dom.Node): def __bool__(self): return True - def toxml(self, encoding=None, standalone=None): - return self.toprettyxml("", "", encoding, standalone) + def toxml(self, encoding=None, standalone=None): + return self.toprettyxml("", "", encoding, standalone) - def toprettyxml(self, indent="\t", newl="\n", encoding=None, - standalone=None): + def toprettyxml(self, indent="\t", newl="\n", encoding=None, + standalone=None): if encoding is None: writer = io.StringIO() else: @@ -57,7 +57,7 @@ class Node(xml.dom.Node): newline='\n') if self.nodeType == Node.DOCUMENT_NODE: # Can pass encoding only to document, to put it into XML header - self.writexml(writer, "", indent, newl, encoding, standalone) + self.writexml(writer, "", indent, newl, encoding, standalone) else: self.writexml(writer, "", indent, newl) if encoding is None: @@ -719,14 +719,14 @@ class Element(Node): Node.unlink(self) def getAttribute(self, attname): - """Returns the value of the specified attribute. - - Returns the value of the element's attribute named attname as - a string. An empty string is returned if the element does not - have such an attribute. Note that an empty string may also be - returned as an explicitly given attribute value, use the - hasAttribute method to distinguish these two cases. - """ + """Returns the value of the specified attribute. + + Returns the value of the element's attribute named attname as + a string. An empty string is returned if the element does not + have such an attribute. Note that an empty string may also be + returned as an explicitly given attribute value, use the + hasAttribute method to distinguish these two cases. + """ if self._attrs is None: return "" try: @@ -832,16 +832,16 @@ class Element(Node): # Restore this since the node is still useful and otherwise # unlinked node.ownerDocument = self.ownerDocument - return node + return node removeAttributeNodeNS = removeAttributeNode def hasAttribute(self, name): - """Checks whether the element has an attribute with the specified name. - - Returns True if the element has an attribute with the specified name. - Otherwise, returns False. - """ + """Checks whether the element has an attribute with the specified name. + + Returns True if the element has an attribute with the specified name. + Otherwise, returns False. + """ if self._attrs is None: return False return name in self._attrs @@ -852,11 +852,11 @@ class Element(Node): return (namespaceURI, localName) in self._attrsNS def getElementsByTagName(self, name): - """Returns all descendant elements with the given tag name. - - Returns the list of all descendant elements (not direct children - only) with the specified tag name. - """ + """Returns all descendant elements with the given tag name. + + Returns the list of all descendant elements (not direct children + only) with the specified tag name. + """ return _get_elements_by_tagName_helper(self, name, NodeList()) def getElementsByTagNameNS(self, namespaceURI, localName): @@ -867,11 +867,11 @@ class Element(Node): return "<DOM Element: %s at %#x>" % (self.tagName, id(self)) def writexml(self, writer, indent="", addindent="", newl=""): - """Write an XML element to a file-like object - - Write the element to the writer object that must provide - a write method (e.g. a file or StringIO object). - """ + """Write an XML element to a file-like object + + Write the element to the writer object that must provide + a write method (e.g. a file or StringIO object). + """ # indent = current indentation # addindent = indentation to add to higher levels # newl = newline string @@ -879,15 +879,15 @@ class Element(Node): attrs = self._get_attributes() - for a_name in attrs.keys(): + for a_name in attrs.keys(): writer.write(" %s=\"" % a_name) _write_data(writer, attrs[a_name].value) writer.write("\"") if self.childNodes: writer.write(">") if (len(self.childNodes) == 1 and - self.childNodes[0].nodeType in ( - Node.TEXT_NODE, Node.CDATA_SECTION_NODE)): + self.childNodes[0].nodeType in ( + Node.TEXT_NODE, Node.CDATA_SECTION_NODE)): self.childNodes[0].writexml(writer, '', '', '') else: writer.write(newl) @@ -1811,17 +1811,17 @@ class Document(Node, DocumentLS): raise xml.dom.NotSupportedErr("cannot import document type nodes") return _clone_node(node, deep, self) - def writexml(self, writer, indent="", addindent="", newl="", encoding=None, - standalone=None): - declarations = [] - - if encoding: - declarations.append(f'encoding="{encoding}"') - if standalone is not None: - declarations.append(f'standalone="{"yes" if standalone else "no"}"') - - writer.write(f'<?xml version="1.0" {" ".join(declarations)}?>{newl}') - + def writexml(self, writer, indent="", addindent="", newl="", encoding=None, + standalone=None): + declarations = [] + + if encoding: + declarations.append(f'encoding="{encoding}"') + if standalone is not None: + declarations.append(f'standalone="{"yes" if standalone else "no"}"') + + writer.write(f'<?xml version="1.0" {" ".join(declarations)}?>{newl}') + for node in self.childNodes: node.writexml(writer, indent, addindent, newl) diff --git a/contrib/tools/python3/src/Lib/xml/dom/pulldom.py b/contrib/tools/python3/src/Lib/xml/dom/pulldom.py index 96a8d59519..228ea40202 100644 --- a/contrib/tools/python3/src/Lib/xml/dom/pulldom.py +++ b/contrib/tools/python3/src/Lib/xml/dom/pulldom.py @@ -217,13 +217,13 @@ class DOMEventStream: self.parser.setContentHandler(self.pulldom) def __getitem__(self, pos): - import warnings - warnings.warn( - "DOMEventStream's __getitem__ method ignores 'pos' parameter. " - "Use iterator protocol instead.", - DeprecationWarning, - stacklevel=2 - ) + import warnings + warnings.warn( + "DOMEventStream's __getitem__ method ignores 'pos' parameter. " + "Use iterator protocol instead.", + DeprecationWarning, + stacklevel=2 + ) rc = self.getEvent() if rc: return rc |