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
8d83f126
Commit
8d83f126
authored
Mar 26, 2021
by
oroulet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure no field is using keyword string
parent
4fb0d26b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
asyncua/common/structures104.py
asyncua/common/structures104.py
+7
-5
tests/test_common.py
tests/test_common.py
+2
-2
No files found.
asyncua/common/structures104.py
View file @
8d83f126
...
...
@@ -4,6 +4,7 @@ from datetime import datetime
import
uuid
import
logging
import
re
import
keyword
from
typing
import
Union
,
List
,
TYPE_CHECKING
,
Tuple
,
Optional
,
Any
from
dataclasses
import
dataclass
,
field
...
...
@@ -108,13 +109,14 @@ def clean_name(name):
Remove characters that might be present in OPC UA structures
but cannot be part of of Python class names
"""
if
keyword
.
iskeyword
(
name
):
return
name
+
"_"
if
name
.
isidentifier
():
return
name
else
:
newname
=
re
.
sub
(
r'\
W+
', '
_
', name)
newname = re.sub(r'
^
[
0
-
9
]
+
', r'
_
\
g
<
0
>
', newname)
logger.warning("renamed %s to %s due to Python syntax", name, newname)
return newname
newname
=
re
.
sub
(
r'\
W+
', '
_
', name)
newname = re.sub(r'
^
[
0
-
9
]
+
', r'
_
\
g
<
0
>
', newname)
logger.warning("renamed %s to %s due to Python syntax", name, newname)
return newname
def get_default_value(uatype, enums=None):
...
...
tests/test_common.py
View file @
8d83f126
...
...
@@ -1124,12 +1124,12 @@ async def test_duplicated_browsenames_different_ns(opc):
return
async
def
test_custom_enum
(
opc
):
async
def
test_custom_enum
_x
(
opc
):
idx
=
4
await
new_enum
(
opc
.
opc
,
idx
,
"MyCustEnum"
,
[
"titi"
,
"toto"
,
"
tutu
"
,
"
None
"
,
])
await
opc
.
opc
.
load_data_type_definitions
()
...
...
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