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
90bcd3a1
Commit
90bcd3a1
authored
Nov 19, 2016
by
Cody
Committed by
ORD
Nov 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid mutable default arguments
parent
c38b0f0b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
6 deletions
+26
-6
opcua/common/ua_utils.py
opcua/common/ua_utils.py
+3
-1
opcua/server/server.py
opcua/server/server.py
+23
-5
No files found.
opcua/common/ua_utils.py
View file @
90bcd3a1
...
...
@@ -233,7 +233,7 @@ def get_base_data_type(datatype):
raise
ua
.
UaError
(
"Datatype must be a subtype of builtin types %s"
%
datatype
)
def
get_nodes_of_namespace
(
server
,
namespaces
=
[]
):
def
get_nodes_of_namespace
(
server
,
namespaces
=
None
):
"""
Get the nodes of one or more namespaces .
Args:
...
...
@@ -242,6 +242,8 @@ def get_nodes_of_namespace(server, namespaces=[]):
Returns:
List of nodes that are part of the provided namespaces
"""
if
namespaces
is
None
:
namespaces
=
[]
ns_available
=
server
.
get_namespace_array
()
if
not
namespaces
:
...
...
opcua/server/server.py
View file @
90bcd3a1
...
...
@@ -359,19 +359,35 @@ class Server(object):
etype
=
BaseEvent
()
return
EventGenerator
(
self
.
iserver
.
isession
,
etype
,
source
)
def
create_custom_data_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseDataType
,
properties
=
[]):
def
create_custom_data_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseDataType
,
properties
=
None
):
if
properties
is
None
:
properties
=
[]
return
self
.
_create_custom_type
(
idx
,
name
,
basetype
,
properties
,
[],
[])
def
create_custom_event_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseEventType
,
properties
=
[]):
def
create_custom_event_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseEventType
,
properties
=
None
):
if
properties
is
None
:
properties
=
[]
return
self
.
_create_custom_type
(
idx
,
name
,
basetype
,
properties
,
[],
[])
def
create_custom_object_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseObjectType
,
properties
=
[],
variables
=
[],
methods
=
[]):
def
create_custom_object_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseObjectType
,
properties
=
None
,
variables
=
None
,
methods
=
None
):
if
properties
is
None
:
properties
=
[]
if
variables
is
None
:
variables
=
[]
if
methods
is
None
:
methods
=
[]
return
self
.
_create_custom_type
(
idx
,
name
,
basetype
,
properties
,
variables
,
methods
)
# def create_custom_reference_type(self, idx, name, basetype=ua.ObjectIds.BaseReferenceType, properties=[]):
# return self._create_custom_type(idx, name, basetype, properties)
def
create_custom_variable_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseVariableType
,
properties
=
[],
variables
=
[],
methods
=
[]):
def
create_custom_variable_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseVariableType
,
properties
=
None
,
variables
=
None
,
methods
=
None
):
if
properties
is
None
:
properties
=
[]
if
variables
is
None
:
variables
=
[]
if
methods
is
None
:
methods
=
[]
return
self
.
_create_custom_type
(
idx
,
name
,
basetype
,
properties
,
variables
,
methods
)
def
_create_custom_type
(
self
,
idx
,
name
,
basetype
,
properties
,
variables
,
methods
):
...
...
@@ -413,7 +429,7 @@ class Server(object):
exp
.
build_etree
(
nodes
)
return
exp
.
write_xml
(
path
)
def
export_xml_by_ns
(
self
,
path
,
namespaces
=
[]
):
def
export_xml_by_ns
(
self
,
path
,
namespaces
=
None
):
"""
Export nodes of one or more namespaces to an XML file.
Namespaces used by nodes are always exported for consistency.
...
...
@@ -424,6 +440,8 @@ class Server(object):
Returns:
"""
if
namespaces
is
None
:
namespaces
=
[]
nodes
=
get_nodes_of_namespace
(
self
,
namespaces
)
self
.
export_xml
(
nodes
,
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