diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/python3/src/Lib/xml/dom/minidom.py | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Lib/xml/dom/minidom.py')
-rw-r--r-- | contrib/tools/python3/src/Lib/xml/dom/minidom.py | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/contrib/tools/python3/src/Lib/xml/dom/minidom.py b/contrib/tools/python3/src/Lib/xml/dom/minidom.py index 64cc7ecc48..d09ef5e7d0 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) |