MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / _rdesc_from_node

Function _rdesc_from_node

opcua/common/copy_node.py:49–65  ·  view source on GitHub ↗
(parent, node)

Source from the content-addressed store, hash-verified

47
48
49def _rdesc_from_node(parent, node):
50 results = node.get_attributes([ua.AttributeIds.NodeClass, ua.AttributeIds.BrowseName, ua.AttributeIds.DisplayName])
51 nclass, qname, dname = [res.Value.Value for res in results]
52
53 rdesc = ua.ReferenceDescription()
54 rdesc.NodeId = node.nodeid
55 rdesc.BrowseName = qname
56 rdesc.DisplayName = dname
57 rdesc.NodeClass = nclass
58 if parent.get_type_definition() == ua.NodeId(ua.ObjectIds.FolderType):
59 rdesc.ReferenceTypeId = ua.NodeId(ua.ObjectIds.Organizes)
60 else:
61 rdesc.ReferenceTypeId = ua.NodeId(ua.ObjectIds.HasComponent)
62 typedef = node.get_type_definition()
63 if typedef:
64 rdesc.TypeDefinition = typedef
65 return rdesc
66
67
68def _read_and_copy_attrs(node_type, struct, addnode):

Callers 2

instantiateFunction · 0.90
copy_nodeFunction · 0.85

Calls 2

get_type_definitionMethod · 0.80
get_attributesMethod · 0.45

Tested by

no test coverage detected