Skip to content

Commit

Permalink
fix nodeid parameter to take int
Browse files Browse the repository at this point in the history
  • Loading branch information
pinterior authored and oroulet committed Nov 13, 2023
1 parent e9978c1 commit abe511d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions asyncua/common/manage_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _parse_nodeid_qname(*args):
)


async def create_folder(parent: asyncua.Node, nodeid: Union[ua.NodeId, str], bname: Union[ua.QualifiedName, str]) -> asyncua.Node:
async def create_folder(parent: asyncua.Node, nodeid: Union[ua.NodeId, str, int], bname: Union[ua.QualifiedName, str]) -> asyncua.Node:
"""
create a child node folder
arguments are nodeid, browsename
Expand All @@ -60,7 +60,7 @@ async def create_folder(parent: asyncua.Node, nodeid: Union[ua.NodeId, str], bna

async def create_object(
parent: asyncua.Node,
nodeid: Union[ua.NodeId, str],
nodeid: Union[ua.NodeId, str, int],
bname: Union[ua.QualifiedName, str],
objecttype: Optional[Union[ua.NodeId, int]] = None,
instantiate_optional: bool = True,
Expand All @@ -86,7 +86,7 @@ async def create_object(

async def create_property(
parent: asyncua.Node,
nodeid: Union[ua.NodeId, str],
nodeid: Union[ua.NodeId, str, int],
bname: Union[ua.QualifiedName, str],
val: Any,
varianttype: Optional[ua.VariantType] = None,
Expand All @@ -111,7 +111,7 @@ async def create_property(

async def create_variable(
parent: asyncua.Node,
nodeid: Union[ua.NodeId, str],
nodeid: Union[ua.NodeId, str, int],
bname: Union[ua.QualifiedName, str],
val: Any,
varianttype: Optional[ua.VariantType] = None,
Expand All @@ -136,7 +136,7 @@ async def create_variable(


async def create_variable_type(
parent: asyncua.Node, nodeid: Union[ua.NodeId, str], bname: Union[ua.QualifiedName, str], datatype: Union[ua.NodeId, int]
parent: asyncua.Node, nodeid: Union[ua.NodeId, str, int], bname: Union[ua.QualifiedName, str], datatype: Union[ua.NodeId, int]
) -> asyncua.Node:
"""
Create a new variable type
Expand All @@ -156,7 +156,7 @@ async def create_variable_type(


async def create_reference_type(
parent: asyncua.Node, nodeid: Union[ua.NodeId, str], bname: Union[ua.QualifiedName, str], symmetric: bool = True, inversename: Optional[str] = None
parent: asyncua.Node, nodeid: Union[ua.NodeId, str, int], bname: Union[ua.QualifiedName, str, int], symmetric: bool = True, inversename: Optional[str] = None
) -> asyncua.Node:
"""
Create a new reference type
Expand All @@ -170,7 +170,7 @@ async def create_reference_type(
)


async def create_object_type(parent: asyncua.Node, nodeid: Union[ua.NodeId, str], bname: Union[ua.QualifiedName, str]):
async def create_object_type(parent: asyncua.Node, nodeid: Union[ua.NodeId, str, int], bname: Union[ua.QualifiedName, str]):
"""
Create a new object type to be instantiated in address space.
arguments are nodeid, browsename
Expand Down Expand Up @@ -338,7 +338,7 @@ async def _create_variable_type(session, parentnodeid, nodeid, qname, datatype,


async def create_data_type(
parent: asyncua.Node, nodeid: Union[ua.NodeId, str], bname: Union[ua.QualifiedName, str], description: Optional[str] = None
parent: asyncua.Node, nodeid: Union[ua.NodeId, str, int], bname: Union[ua.QualifiedName, str], description: Optional[str] = None
) -> asyncua.Node:
"""
Create a new data type to be used in new variables, etc ..
Expand Down Expand Up @@ -380,7 +380,7 @@ async def create_data_type(
return make_node(parent.session, new_node_id)


async def create_encoding(parent, nodeid: Union[ua.NodeId, str], bname: Union[ua.QualifiedName, str]) -> asyncua.Node:
async def create_encoding(parent, nodeid: Union[ua.NodeId, str, int], bname: Union[ua.QualifiedName, str]) -> asyncua.Node:
"""
Create a new encoding object to be instantiated in address space.
arguments are nodeid, browsename
Expand Down
16 changes: 8 additions & 8 deletions asyncua/common/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,12 +802,12 @@ async def set_modelling_rule(self, mandatory: bool) -> None:
rule = ua.ObjectIds.ModellingRule_Mandatory if mandatory else ua.ObjectIds.ModellingRule_Optional
await self.add_reference(rule, ua.ObjectIds.HasModellingRule, True, False)

async def add_folder(self, nodeid: Union[ua.NodeId, str], bname: Union[ua.QualifiedName, str]) -> "Node":
async def add_folder(self, nodeid: Union[ua.NodeId, str, int], bname: Union[ua.QualifiedName, str]) -> "Node":
return await create_folder(self, nodeid, bname)

async def add_object(
self,
nodeid: Union[ua.NodeId, str],
nodeid: Union[ua.NodeId, str, int],
bname: Union[ua.QualifiedName, str],
objecttype: Optional[int] = None,
instantiate_optional: bool = True,
Expand All @@ -816,26 +816,26 @@ async def add_object(

async def add_variable(
self,
nodeid: Union[ua.NodeId, str],
nodeid: Union[ua.NodeId, str, int],
bname: Union[ua.QualifiedName, str],
val: Any,
varianttype: Optional[ua.VariantType] = None,
datatype: Optional[Union[ua.NodeId, int]] = None,
) -> "Node":
return await create_variable(self, nodeid, bname, val, varianttype, datatype)

async def add_object_type(self, nodeid: Union[ua.NodeId, str], bname: Union[ua.QualifiedName, str]) -> "Node":
async def add_object_type(self, nodeid: Union[ua.NodeId, str, int], bname: Union[ua.QualifiedName, str]) -> "Node":
return await create_object_type(self, nodeid, bname)

async def add_variable_type(self, nodeid: Union[ua.NodeId, str], bname: Union[ua.QualifiedName, str], datatype: Union[ua.NodeId, int]) -> "Node":
async def add_variable_type(self, nodeid: Union[ua.NodeId, str, int], bname: Union[ua.QualifiedName, str], datatype: Union[ua.NodeId, int]) -> "Node":
return await create_variable_type(self, nodeid, bname, datatype)

async def add_data_type(self, nodeid: Union[ua.NodeId, str], bname: Union[ua.QualifiedName, str], description: Optional[str] = None) -> "Node":
async def add_data_type(self, nodeid: Union[ua.NodeId, str, int], bname: Union[ua.QualifiedName, str], description: Optional[str] = None) -> "Node":
return await create_data_type(self, nodeid, bname, description=description)

async def add_property(
self,
nodeid: Union[ua.NodeId, str],
nodeid: Union[ua.NodeId, str, int],
bname: Union[ua.QualifiedName, str],
val: Any,
varianttype: Optional[ua.VariantType] = None,
Expand All @@ -847,7 +847,7 @@ async def add_method(self, *args) -> "Node":
return await create_method(self, *args)

async def add_reference_type(
self, nodeid: Union[ua.NodeId, str], bname: Union[ua.QualifiedName, str], symmetric: bool = True, inversename: Optional[str] = None
self, nodeid: Union[ua.NodeId, str, int], bname: Union[ua.QualifiedName, str], symmetric: bool = True, inversename: Optional[str] = None
) -> "Node":
return await create_reference_type(self, nodeid, bname, symmetric, inversename)

Expand Down

0 comments on commit abe511d

Please sign in to comment.