Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def is_text(self, node):
return node.nodeType in (Node.TEXT_NODE,
Node.PROCESSING_INSTRUCTION_NODE,
Node.CDATA_SECTION_NODE, )
def is_readonly(self, node):
return node.nodeType in (Node.DOCUMENT_TYPE_NODE,
Node.NOTATION_NODE,
Node.ENTITY_REFERENCE_NODE,
Node.ENTITY_NODE, )
for p in self.tag.contents:
if getattr(p, '_node', None) is None:
continue
if newChildHash == hash(p._node):
p.extract()
if self.is_text(newChild):
self.tag.append(newChild.data.output_ready(formatter = lambda x: x))
return newChild
if newChild.nodeType in (Node.COMMENT_NODE, ):
self.tag.append(newChild.data)
return newChild
if newChild.nodeType in (Node.DOCUMENT_FRAGMENT_NODE, ):
node = self.tag
for p in newChild.tag.find_all_next():
node.append(p)
node = p
return newChild
self.tag.append(newChild.tag)
return newChild
def is_readonly(self, node):
return node.nodeType in (Node.DOCUMENT_TYPE_NODE,
Node.NOTATION_NODE,
Node.ENTITY_REFERENCE_NODE,
Node.ENTITY_NODE, )
def is_readonly(self, node):
return node.nodeType in (Node.DOCUMENT_TYPE_NODE,
Node.NOTATION_NODE,
Node.ENTITY_REFERENCE_NODE,
Node.ENTITY_NODE, )
def is_text(self, node):
return node.nodeType in (Node.TEXT_NODE,
Node.PROCESSING_INSTRUCTION_NODE,
Node.CDATA_SECTION_NODE, )
def nextSibling(self):
return Node.wrap(self.doc, self.tag.next_sibling)
#!/usr/bin/env python
from .Node import Node
class Notation(Node): # pragma: no cover
@property
def publicId(self):
return None
@property
def systemId(self):
return None
@property
def nodeName(self):
pass
@property
def nodeType(self):
return Node.NOTATION_NODE
def nodeType(self):
return Node.ATTRIBUTE_NODE
def is_readonly(self, node):
return node.nodeType in (Node.DOCUMENT_TYPE_NODE,
Node.NOTATION_NODE,
Node.ENTITY_REFERENCE_NODE,
Node.ENTITY_NODE, )