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

Method get_path

opcua/common/node.py:406–420  ·  view source on GitHub ↗

Attempt to find path of node from root node and return it as a list of Nodes. There might several possible paths to a node, this function will return one Some nodes may be missing references, so this method may return an empty list Since address space may hav

(self, max_length=20, as_string=False)

Source from the content-addressed store, hash-verified

404 return references[0].NodeId
405
406 def get_path(self, max_length=20, as_string=False):
407 """
408 Attempt to find path of node from root node and return it as a list of Nodes.
409 There might several possible paths to a node, this function will return one
410 Some nodes may be missing references, so this method may
411 return an empty list
412 Since address space may have circular references, a max length is specified
413
414 """
415 path = self._get_path(max_length)
416 path = [Node(self.server, ref.NodeId) for ref in path]
417 path.append(self)
418 if as_string:
419 path = [el.get_browse_name().to_string() for el in path]
420 return path
421
422 def _get_path(self, max_length=20):
423 """

Callers 2

test_path_stringMethod · 0.80
test_pathMethod · 0.80

Calls 4

_get_pathMethod · 0.95
NodeClass · 0.85
get_browse_nameMethod · 0.80
to_stringMethod · 0.45

Tested by 2

test_path_stringMethod · 0.64
test_pathMethod · 0.64