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
31b0f658
Commit
31b0f658
authored
Apr 26, 2022
by
Jürg Rast
Committed by
oroulet
Apr 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed code generator for structures and enums
parent
018c93bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
asyncua/common/structures.py
asyncua/common/structures.py
+7
-2
No files found.
asyncua/common/structures.py
View file @
31b0f658
...
...
@@ -83,12 +83,15 @@ class {self.name}:
"""
for
sfield
in
self
.
fields
:
uatype
=
f"
ua.
{
sfield
.
uatype
}
"
uatype
=
f"
'ua.
{
sfield
.
uatype
}
'
"
if
sfield
.
array
:
uatype
=
f"List[
{
uatype
}
]"
if
uatype
==
'List[ua.Char]'
:
uatype
=
'String'
code
+=
f"
{
sfield
.
name
}
:
{
uatype
}
=
{
sfield
.
value
}\
n
"
uavalue
=
sfield
.
value
if
isinstance
(
uavalue
,
str
)
and
uavalue
.
startswith
(
"ua."
):
uavalue
=
f"field(default_factory=lambda:
{
uavalue
}
)"
code
+=
f"
{
sfield
.
name
}
:
{
uatype
}
=
{
uavalue
}\
n
"
return
code
...
...
@@ -168,6 +171,8 @@ class StructGenerator(object):
def
_make_registration
(
self
):
code
=
"
\
n
\
n
"
for
struct
in
self
.
model
:
if
isinstance
(
struct
,
EnumType
):
continue
# No registration required for enums
code
+=
f"ua.register_extension_object('
{
struct
.
name
}
',"
\
f" ua.NodeId.from_string('
{
struct
.
typeid
}
'),
{
struct
.
name
}
)
\
n
"
return
code
...
...
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