Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parseXML(self, xmlelement):
Node.parseXML(self, xmlelement)
for (at, av) in xmlelement.attributes.items():
if at == "ContainsNoLoops":
self.containsNoLoops = "false" not in av.lower()
if at == "EventNotifier":
self.eventNotifier = "false" not in av.lower()
self.inverseName = str(unicode(x.firstChild.data))
class ObjectNode(Node):
def __init__(self, xmlelement=None):
Node.__init__(self)
self.eventNotifier = 0
if xmlelement:
ObjectNode.parseXML(self, xmlelement)
def parseXML(self, xmlelement):
Node.parseXML(self, xmlelement)
for (at, av) in xmlelement.attributes.items():
if at == "EventNotifier":
self.eventNotifier = int(av)
class VariableNode(Node):
def __init__(self, xmlelement=None):
Node.__init__(self)
self.dataType = None
self.valueRank = None
self.arrayDimensions = []
# Set access levels to read by default
self.accessLevel = 1
self.userAccessLevel = 1
self.minimumSamplingInterval = 0.0
self.historizing = False
self.value = None
self.xmlValueDef = None
if xmlelement:
VariableNode.parseXML(self, xmlelement)
def parseXML(self, xmlelement):
self.userExecutable = True
self.methodDecalaration = None
if xmlelement:
MethodNode.parseXML(self, xmlelement)
def parseXML(self, xmlelement):
Node.parseXML(self, xmlelement)
for (at, av) in xmlelement.attributes.items():
if at == "Executable":
self.executable = "false" not in av.lower()
if at == "UserExecutable":
self.userExecutable = "false" not in av.lower()
if at == "MethodDeclarationId":
self.methodDeclaration = str(av)
class ObjectTypeNode(Node):
def __init__(self, xmlelement=None):
Node.__init__(self)
self.isAbstract = False
if xmlelement:
ObjectTypeNode.parseXML(self, xmlelement)
def parseXML(self, xmlelement):
Node.parseXML(self, xmlelement)
for (at, av) in xmlelement.attributes.items():
if at == "IsAbstract":
self.isAbstract = "false" not in av.lower()
class DataTypeNode(Node):
""" DataTypeNode is a subtype of Node describing DataType nodes.
DataType contain definitions and structure information usable for Variables.
if xmlelement:
VariableTypeNode.parseXML(self, xmlelement)
def parseXML(self, xmlelement):
VariableNode.parseXML(self, xmlelement)
for (at, av) in xmlelement.attributes.items():
if at == "IsAbstract":
self.isAbstract = "false" not in av.lower()
for x in xmlelement.childNodes:
if x.nodeType != x.ELEMENT_NODE:
continue
if x.localName == "IsAbstract":
self.isAbstract = "false" not in av.lower()
class MethodNode(Node):
def __init__(self, xmlelement=None):
Node.__init__(self)
self.executable = True
self.userExecutable = True
self.methodDecalaration = None
if xmlelement:
MethodNode.parseXML(self, xmlelement)
def parseXML(self, xmlelement):
Node.parseXML(self, xmlelement)
for (at, av) in xmlelement.attributes.items():
if at == "Executable":
self.executable = "false" not in av.lower()
if at == "UserExecutable":
self.userExecutable = "false" not in av.lower()
if at == "MethodDeclarationId":
def __init__(self, xmlelement=None):
Node.__init__(self)
self.executable = True
self.userExecutable = True
self.methodDecalaration = None
if xmlelement:
MethodNode.parseXML(self, xmlelement)
self.methodDeclaration = str(av)
class ObjectTypeNode(Node):
def __init__(self, xmlelement=None):
Node.__init__(self)
self.isAbstract = False
if xmlelement:
ObjectTypeNode.parseXML(self, xmlelement)
def parseXML(self, xmlelement):
Node.parseXML(self, xmlelement)
for (at, av) in xmlelement.attributes.items():
if at == "IsAbstract":
self.isAbstract = "false" not in av.lower()
class DataTypeNode(Node):
""" DataTypeNode is a subtype of Node describing DataType nodes.
DataType contain definitions and structure information usable for Variables.
The format of this structure is determined by buildEncoding()
Two definition styles are distinguished in XML:
1) A DataType can be a structure of fields, each field having a name and a type.
The type must be either an encodable builtin node (ex. UInt32) or point to
another DataType node that inherits its encoding from a builtin type using
a inverse "hasSubtype" (hasSuperType) reference.
2) A DataType may be an enumeration, in which each field has a name and a numeric
value.
The definition is stored as an ordered list of tuples. Depending on which
definition style was used, the __definition__ will hold
1) A list of ("Fieldname", Node) tuples.
2) A list of ("Fieldname", int) tuples.
def parseXML(self, xmlelement):
Node.parseXML(self, xmlelement)
for (at, av) in xmlelement.attributes.items():
if at == "Symmetric":
self.symmetric = "false" not in av.lower()
elif at == "InverseName":
self.inverseName = str(av)
elif at == "IsAbstract":
self.isAbstract = "false" not in av.lower()
for x in xmlelement.childNodes:
if x.nodeType == x.ELEMENT_NODE:
if x.localName == "InverseName" and x.firstChild:
self.inverseName = str(unicode(x.firstChild.data))
class ObjectNode(Node):
def __init__(self, xmlelement=None):
Node.__init__(self)
self.eventNotifier = 0
if xmlelement:
ObjectNode.parseXML(self, xmlelement)
def parseXML(self, xmlelement):
Node.parseXML(self, xmlelement)
for (at, av) in xmlelement.attributes.items():
if at == "EventNotifier":
self.eventNotifier = int(av)
class VariableNode(Node):
def __init__(self, xmlelement=None):
Node.__init__(self)
self.dataType = None
self.references = new_refs
def replaceNamespaces(self, nsMapping):
self.id.ns = nsMapping[self.id.ns]
self.browseName.ns = nsMapping[self.browseName.ns]
if hasattr(self, 'dataType') and isinstance(self.dataType, NodeId):
self.dataType.ns = nsMapping[self.dataType.ns]
new_refs = set()
for ref in self.references:
ref.source.ns = nsMapping[ref.source.ns]
ref.target.ns = nsMapping[ref.target.ns]
ref.referenceType.ns = nsMapping[ref.referenceType.ns]
new_refs.add(ref)
self.references = new_refs
class ReferenceTypeNode(Node):
def __init__(self, xmlelement=None):
Node.__init__(self)
self.isAbstract = False
self.symmetric = False
self.inverseName = ""
if xmlelement:
ReferenceTypeNode.parseXML(self, xmlelement)
def parseXML(self, xmlelement):
Node.parseXML(self, xmlelement)
for (at, av) in xmlelement.attributes.items():
if at == "Symmetric":
self.symmetric = "false" not in av.lower()
elif at == "InverseName":
self.inverseName = str(av)
elif at == "IsAbstract":
self.__definition__ = enumDict
self.__isEnum__ = True
logger.debug( prefix+"Int32* -> enumeration with dictionary " + str(enumDict) + " encodable " + str(self.__encodable__))
return self.__baseTypeEncoding__
if indent==0:
if not self.__encodable__:
logger.debug( "Not encodable (partial): " + str(self.__baseTypeEncoding__))
else:
logger.debug( "Encodable as: " + str(self.__baseTypeEncoding__))
self.__isEnum__ = False
self.__definition__ = typeDict
logger.debug( "")
return self.__baseTypeEncoding__
class ViewNode(Node):
def __init__(self, xmlelement=None):
Node.__init__(self)
self.containsNoLoops = False
self.eventNotifier = False
if xmlelement:
ViewNode.parseXML(self, xmlelement)
def parseXML(self, xmlelement):
Node.parseXML(self, xmlelement)
for (at, av) in xmlelement.attributes.items():
if at == "ContainsNoLoops":
self.containsNoLoops = "false" not in av.lower()
if at == "EventNotifier":
self.eventNotifier = "false" not in av.lower()