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
f5301a41
Commit
f5301a41
authored
Oct 18, 2021
by
oroulet
Committed by
oroulet
Oct 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up some if clauses in Variant
parent
4d5c5b9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
asyncua/ua/uatypes.py
asyncua/ua/uatypes.py
+11
-14
No files found.
asyncua/ua/uatypes.py
View file @
f5301a41
...
...
@@ -792,7 +792,7 @@ class Variant:
:ivar VariantType:
:vartype VariantType: VariantType
:ivar Dimension:
:vartype Dimensions: The length of each dimensions. Usually guessed from value.
:vartype Dimensions: The length of each dimensions. Usually guessed from value.
[0] mean 1D array without length limit
"""
Value: Any = None
...
...
@@ -817,20 +817,17 @@ class Variant:
else:
raise ValueError("
VariantType
argument
must
be
an
instance
of
VariantType
")
if (
self.Value is None
and not self.is_array
and self.VariantType
not in (
VariantType.Null,
VariantType.String,
VariantType.DateTime,
VariantType.ExtensionObject,
)
):
if self.Value is None and self.VariantType == VariantType.NodeId:
if self.Value is None and not self.is_array:
# only some types of Variants can be NULL when not in an array
if self.VariantType == VariantType.NodeId:
# why do we rewrite this case and not the others?
object.__setattr__(self, "
Value
", NodeId(0, 0))
else:
elif self.VariantType not in (
VariantType.Null,
VariantType.String,
VariantType.DateTime,
VariantType.ExtensionObject,
):
raise UaError(
f"
Non
array
Variant
of
type
{
self
.
VariantType
}
cannot
have
value
None
"
)
...
...
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