From 555b8bd47a8a64cd7dfb9f2bffd2d39792ce70f3 Mon Sep 17 00:00:00 2001 From: Jakub Wlodek Date: Fri, 26 Jul 2024 15:49:13 -0400 Subject: [PATCH 1/3] [MNT] Update error message printed on overlapping cycles to be more verbose --- cycler/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cycler/__init__.py b/cycler/__init__.py index 94b5f71..ad40377 100644 --- a/cycler/__init__.py +++ b/cycler/__init__.py @@ -82,7 +82,8 @@ def _process_keys( l_key: set[K] = set(l_peek.keys()) r_key: set[K] = set(r_peek.keys()) if l_key & r_key: - raise ValueError("Can not compose overlapping cycles") + raise ValueError(f"Cannot compose overlapping cycles, duplicate key(s): {l_key & r_key}") + return l_key | r_key From da2514cc17c49c790e018e540e19a5601e1847dd Mon Sep 17 00:00:00 2001 From: Jakub Wlodek Date: Tue, 30 Jul 2024 09:34:51 -0400 Subject: [PATCH 2/3] Utilize walrus operator --- cycler/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cycler/__init__.py b/cycler/__init__.py index ad40377..02f50c7 100644 --- a/cycler/__init__.py +++ b/cycler/__init__.py @@ -81,8 +81,8 @@ def _process_keys( r_peek: dict[K, V] = next(iter(right)) if right is not None else {} l_key: set[K] = set(l_peek.keys()) r_key: set[K] = set(r_peek.keys()) - if l_key & r_key: - raise ValueError(f"Cannot compose overlapping cycles, duplicate key(s): {l_key & r_key}") + if common_keys := l_key & r_key: + raise ValueError(f"Cannot compose overlapping cycles, duplicate key(s): {common_keys}") return l_key | r_key From 2a858e4cb711322cc06c16043ad6146d07d2e64b Mon Sep 17 00:00:00 2001 From: Jakub Wlodek Date: Fri, 2 Aug 2024 13:25:45 -0400 Subject: [PATCH 3/3] Fix linting error --- cycler/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cycler/__init__.py b/cycler/__init__.py index 02f50c7..1f05670 100644 --- a/cycler/__init__.py +++ b/cycler/__init__.py @@ -82,7 +82,9 @@ def _process_keys( l_key: set[K] = set(l_peek.keys()) r_key: set[K] = set(r_peek.keys()) if common_keys := l_key & r_key: - raise ValueError(f"Cannot compose overlapping cycles, duplicate key(s): {common_keys}") + raise ValueError( + f"Cannot compose overlapping cycles, duplicate key(s): {common_keys}" + ) return l_key | r_key