Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-asyncio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
opcua-asyncio
Commits
d4e3b869
Commit
d4e3b869
authored
Aug 24, 2016
by
olivier R-D
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get_current_path -> get_path and avoid circular loops
parent
1fc97eac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
opcua/common/node.py
opcua/common/node.py
+9
-3
No files found.
opcua/common/node.py
View file @
d4e3b869
...
@@ -353,20 +353,26 @@ class Node(object):
...
@@ -353,20 +353,26 @@ class Node(object):
return
None
return
None
return
references
[
0
].
NodeId
return
references
[
0
].
NodeId
def
get_
current_path
(
self
):
def
get_
path
(
self
,
max_length
=
20
):
"""
"""
Attempt to find
current path of
node and return it as a list of strings.
Attempt to find
path of node from root
node and return it as a list of strings.
There might several possible paths to a node, this function will return one
There might several possible paths to a node, this function will return one
Some nodes may be missing references, so this method may
Some nodes may be missing references, so this method may
return an empty list
return an empty list
Since address space may have circular references, a max length is specified
"""
"""
path
=
[]
path
=
[
self
.
get_browse_name
().
to_string
()
]
node
=
self
node
=
self
count
=
0
while
True
:
while
True
:
refs
=
node
.
get_references
(
refs
=
ua
.
ObjectIds
.
HierarchicalReferences
,
direction
=
ua
.
BrowseDirection
.
Inverse
)
refs
=
node
.
get_references
(
refs
=
ua
.
ObjectIds
.
HierarchicalReferences
,
direction
=
ua
.
BrowseDirection
.
Inverse
)
if
len
(
refs
)
>
0
:
if
len
(
refs
)
>
0
:
path
.
insert
(
0
,
refs
[
0
].
BrowseName
.
to_string
())
path
.
insert
(
0
,
refs
[
0
].
BrowseName
.
to_string
())
node
=
Node
(
self
.
server
,
refs
[
0
].
NodeId
)
node
=
Node
(
self
.
server
,
refs
[
0
].
NodeId
)
count
+=
1
if
count
>
max_length
:
return
path
else
:
else
:
return
path
return
path
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment