From 5cf4473b89eab8d54cca01f418fd3f6e36311ac8 Mon Sep 17 00:00:00 2001 From: Vasileios Vasilopoulos Date: Thu, 25 Jul 2024 12:27:40 +0200 Subject: [PATCH 1/4] Fix error on yakut/cmd/monitor/_model.py System Configuration: Ubuntu -> 24.04 LTS Python -> 3.12.3 Interface -> Cyphal Serial While passing a Node List (7519.List.1.0.dsdl) from a hardware node to Ubuntu, yakut monitor produces the following error: pycyphal.util._broadcast: Unhandled exception in : The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() File "/home/$USER/.local/lib/python3.12/site-packages/yakut/cmd/monitor/_model.py", line 195, in expand_subjects if m.mask: ^^^^^^ ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() The node list is produced using .h files produced by nnvg and the "mask_bitpacked_" field is used instead of "sparse_list" The error is solved by first checking that the mask is not None and then checking if it is empty with .any(). --------- Authored-by" Vasileios Vasilopoulos --- yakut/cmd/monitor/_model.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yakut/cmd/monitor/_model.py b/yakut/cmd/monitor/_model.py index 8add024..2696a72 100644 --- a/yakut/cmd/monitor/_model.py +++ b/yakut/cmd/monitor/_model.py @@ -191,8 +191,9 @@ def __repr__(self) -> str: def expand_subjects(m: uavcan.node.port.SubjectIDList_1) -> AbstractSet[int]: if m.sparse_list is not None: return frozenset(int(x.value) for x in m.sparse_list) - if m.mask: - return expand_mask(m.mask) + if m.mask is not None: + if m.mask.any(): + return expand_mask(m.mask) if m.total: return _COMPLETE_SUBJECT_SET assert False From cf2cc8a7698407e1b7db9438a706f50ae899e2e7 Mon Sep 17 00:00:00 2001 From: Vasileios Georgios Vasilopoulos Date: Fri, 26 Jul 2024 09:47:02 +0200 Subject: [PATCH 2/4] Update yakut/cmd/monitor/_model.py Co-authored-by: Pavel Kirienko --- yakut/cmd/monitor/_model.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yakut/cmd/monitor/_model.py b/yakut/cmd/monitor/_model.py index 2696a72..eaa28e9 100644 --- a/yakut/cmd/monitor/_model.py +++ b/yakut/cmd/monitor/_model.py @@ -191,8 +191,7 @@ def __repr__(self) -> str: def expand_subjects(m: uavcan.node.port.SubjectIDList_1) -> AbstractSet[int]: if m.sparse_list is not None: return frozenset(int(x.value) for x in m.sparse_list) - if m.mask is not None: - if m.mask.any(): + if m.mask is not None and m.mask.any(): return expand_mask(m.mask) if m.total: return _COMPLETE_SUBJECT_SET From a2442f01f72f9ef6d976fe68e3149172e80e6e18 Mon Sep 17 00:00:00 2001 From: Vasileios Vasilopoulos Date: Fri, 26 Jul 2024 10:02:03 +0200 Subject: [PATCH 3/4] bump version --- yakut/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yakut/VERSION b/yakut/VERSION index 9beb74d..288adf5 100644 --- a/yakut/VERSION +++ b/yakut/VERSION @@ -1 +1 @@ -0.13.2 +0.13.3 From 2d83975105a982b73d44edb4bf5bc7f7453b47fe Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Mon, 29 Jul 2024 14:06:23 +0300 Subject: [PATCH 4/4] Update test-and-release.yml Runs on PRs from forks --- .github/workflows/test-and-release.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index ebf768c..9ea622c 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -1,5 +1,5 @@ -name: 'Test and Release Yakut' -on: push +name: 'Test and release Yakut' +on: [ push, pull_request ] # Ensures that only one workflow is running at a time concurrency: @@ -9,6 +9,8 @@ concurrency: jobs: yakut-test: name: Test Yakut + # https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=edited#pull_request + if: (github.event_name == 'push') || github.event.pull_request.head.repo.fork strategy: fail-fast: false matrix: @@ -71,7 +73,9 @@ jobs: yakut-release: name: Release Yakut runs-on: ubuntu-latest - if: contains(github.event.head_commit.message, '#release') || contains(github.ref, '/main') + if: > + (github.event_name == 'push') && + (contains(github.event.head_commit.message, '#release') || contains(github.ref, '/main')) needs: yakut-test steps: - name: Check out