Commit b06f1047 authored by oroulet's avatar oroulet Committed by oroulet

lint

parent ea611693
......@@ -678,7 +678,7 @@ class Client:
get_values = read_values # legacy compatibility
set_values = write_values # legacy compatibility
async def browse_nodes(self, nodes):
"""
Browses multiple nodes in one ua call
......@@ -696,4 +696,3 @@ class Client:
parameters.NodesToBrowse = nodestobrowse
results = await self.uaclient.browse(parameters)
return list(zip(nodes, results))
......@@ -70,8 +70,8 @@ async def new_struct(
sdef = ua.StructureDefinition()
sdef.StructureType = ua.StructureType.Structure
for field in fields:
if field.IsOptional:
for sfield in fields:
if sfield.IsOptional:
sdef.StructureType = ua.StructureType.StructureWithOptionalFields
break
sdef.Fields = fields
......@@ -269,8 +269,8 @@ async def _recursive_parse(server, base_node, dtypes, parent_sdef=None):
continue
name = clean_name(desc.BrowseName.Name)
if parent_sdef:
for field in reversed(parent_sdef.Fields):
sdef.Fields.insert(0, field)
for sfield in reversed(parent_sdef.Fields):
sdef.Fields.insert(0, sfield)
dtypes.append(DataTypeSorter(desc.NodeId, name, desc, sdef))
await _recursive_parse(server, server.get_node(desc.NodeId), dtypes, parent_sdef=sdef)
......@@ -324,9 +324,9 @@ class {name}(IntEnum):
"""
for field in edef.Fields:
name = clean_name(field.Name)
value = field.Value
for sfield in edef.Fields:
name = clean_name(sfield.Name)
value = sfield.Value
code += f" {name} = {value}\n"
return code
......
......@@ -90,5 +90,6 @@ class Buffer:
self._cur_pos = cur_pos
self._size = len(self._data) - cur_pos
def create_nonce(size=32):
return os.urandom(size)
......@@ -403,4 +403,3 @@ class XMLParser:
# check if ModelUri X, in Version Y from time Z was already imported
required_models.append(child.attrib)
return required_models
......@@ -501,7 +501,7 @@ class SyncNode:
def read_data_type_as_variant_type(self):
pass
get_data_type_as_variant_type = read_data_type_as_variant_type #legacy
get_data_type_as_variant_type = read_data_type_as_variant_type # legacy
@syncmethod
def call_method(self, methodid, *args):
......
......@@ -258,7 +258,7 @@ def to_binary(uatype, val):
Pack a python object to binary given a type hint
"""
if type_is_list(uatype):
return list_to_binary(_from_list(uatype), val)
return list_to_binary(type_from_list(uatype), val)
if hasattr(Primitives, uatype.__name__):
return getattr(Primitives, uatype.__name__).pack(val)
if isinstance(val, (IntEnum, Enum)):
......
......@@ -417,7 +417,7 @@ class NodeId:
def __lt__(self, other):
if not isinstance(other, NodeId):
raise AttributeError("Can only compare to NodeId")
print (self.NodeIdType, self.NamespaceIndex, self.Identifier, other.NodeIdType, other.NamespaceIndex, other.Identifier)
print(self.NodeIdType, self.NamespaceIndex, self.Identifier, other.NodeIdType, other.NamespaceIndex, other.Identifier)
return (self.NodeIdType, self.NamespaceIndex, self.Identifier) < (other.NodeIdType, other.NamespaceIndex, other.Identifier)
def is_null(self):
......@@ -871,11 +871,6 @@ class Variant:
)
def _split_list(l, n):
n = max(1, n)
return [l[i : i + n] for i in range(0, len(l), n)]
def flatten_and_get_shape(mylist):
dims = [len(mylist)]
while isinstance(mylist[0], (list, tuple)):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment