From f6e467e95268b9ea3f1d1b76dba698b6c05684c3 Mon Sep 17 00:00:00 2001 From: Tejas Shastry <48762726+tanekere@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:04:17 +0200 Subject: [PATCH 1/4] Fix function signature Fixed a function signature of `read_array_dimensions` in asyncua/common/node. ArrayDimentions is always a list of ints because OPC UA has support for multidimentional arrays. But the return type was is specified as int. --- asyncua/common/node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asyncua/common/node.py b/asyncua/common/node.py index 1fd7fd4eb..948efa501 100644 --- a/asyncua/common/node.py +++ b/asyncua/common/node.py @@ -227,7 +227,7 @@ async def write_array_dimensions(self, value: int) -> None: v = ua.Variant(value, ua.VariantType.UInt32) await self.write_attribute(ua.AttributeIds.ArrayDimensions, ua.DataValue(v)) - async def read_array_dimensions(self) -> int: + async def read_array_dimensions(self) -> list[int]: """ Read and return ArrayDimensions attribute of node """ From 394eb86ce4dff09560abf9f50d07c7c95bf89548 Mon Sep 17 00:00:00 2001 From: Tejas Shastry <48762726+tanekere@users.noreply.github.com> Date: Wed, 31 Jul 2024 14:19:48 +0200 Subject: [PATCH 2/4] change type hint to legacy style for 3.7 --- asyncua/common/node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asyncua/common/node.py b/asyncua/common/node.py index 948efa501..bfe2adb4b 100644 --- a/asyncua/common/node.py +++ b/asyncua/common/node.py @@ -227,7 +227,7 @@ async def write_array_dimensions(self, value: int) -> None: v = ua.Variant(value, ua.VariantType.UInt32) await self.write_attribute(ua.AttributeIds.ArrayDimensions, ua.DataValue(v)) - async def read_array_dimensions(self) -> list[int]: + async def read_array_dimensions(self) -> List[int]: """ Read and return ArrayDimensions attribute of node """ From 2c0bc23099f948fef7bf715b5584a0b181bc632a Mon Sep 17 00:00:00 2001 From: Tejas Shastry <48762726+tanekere@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:29:55 +0200 Subject: [PATCH 3/4] same change is reflected in the sync wrapper --- asyncua/sync.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asyncua/sync.py b/asyncua/sync.py index 0c5fc6091..5fe7d3040 100644 --- a/asyncua/sync.py +++ b/asyncua/sync.py @@ -739,7 +739,7 @@ def read_data_type(self) -> ua.NodeId: # type: ignore[empty-body] pass @syncmethod - def read_array_dimensions(self) -> int: # type: ignore[empty-body] + def read_array_dimensions(self) -> List[int]: # type: ignore[empty-body] pass @syncmethod From 9fbb45c6ad57f94d3f68083bff590848a3cb38d4 Mon Sep 17 00:00:00 2001 From: Tejas Shastry <48762726+tanekere@users.noreply.github.com> Date: Wed, 7 Aug 2024 17:27:25 +0200 Subject: [PATCH 4/4] updated CHANGELOG with fix info --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 251b6e4a5..4e00e4956 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix inconsistent type annotations as reported by mypy [#1277](https://github.com/FreeOpcUa/opcua-asyncio/pull/1277) - +- Fixed incorrect function signature in Node and it's Sync wrapper + [#1690](https://github.com/FreeOpcUa/opcua-asyncio/pull/1690) + ## [1.0.2] - 2022-04-05 ### Added