From 9993445e4723bd158320016555c058caf2f4ec61 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:39:59 +0200 Subject: [PATCH] MAINT: address linting issues --- .cspell.json | 1 + pyproject.toml | 1 - src/ampform/helicity/decay.py | 13 ++++--------- src/symplot/__init__.py | 8 ++------ 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/.cspell.json b/.cspell.json index f06f8003e..a49073f36 100644 --- a/.cspell.json +++ b/.cspell.json @@ -267,6 +267,7 @@ "parametrizations", "permutate", "pydocstyle", + "PyPA", "pyplot", "pytest", "qrules", diff --git a/pyproject.toml b/pyproject.toml index 0a275ce3e..3d4121a13 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -153,7 +153,6 @@ branch = true source = ["src"] [tool.mypy] -enable_incomplete_feature = "Unpack" exclude = "_build" show_error_codes = true warn_unused_configs = true diff --git a/src/ampform/helicity/decay.py b/src/ampform/helicity/decay.py index f65e8cfdc..11c76cd7c 100644 --- a/src/ampform/helicity/decay.py +++ b/src/ampform/helicity/decay.py @@ -123,15 +123,10 @@ def _is_qrules_state_transition(obj) -> TypeGuard[StateTransition]: if isinstance(obj, FrozenTransition): if any(not isinstance(s, State) for s in obj.states.values()): return False - if any( - not isinstance(i, InteractionProperties) - for i in obj.interactions.values() - ): - return False - return True - if get_qrules_version() < (0, 10) and isinstance(obj, StateTransition): # type: ignore[misc] - return True - return False + return all( + isinstance(i, InteractionProperties) for i in obj.interactions.values() + ) + return get_qrules_version() < (0, 10) and isinstance(obj, StateTransition) # type: ignore[misc] @lru_cache(maxsize=None) diff --git a/src/symplot/__init__.py b/src/symplot/__init__.py index 9a775819e..9b7409200 100644 --- a/src/symplot/__init__.py +++ b/src/symplot/__init__.py @@ -214,17 +214,13 @@ def set_ranges( def _is_min_max( range_def: RangeDefinition, ) -> TypeGuard[tuple[float, float]]: - if len(range_def) == 2: # noqa: PLR2004 - return True - return False + return len(range_def) == 2 # noqa: PLR2004 def _is_min_max_step( range_def: RangeDefinition, ) -> TypeGuard[tuple[float, float, float | int]]: - if len(range_def) == 3: # noqa: PLR2004 - return True - return False + return len(range_def) == 3 # noqa: PLR2004 ValueType = TypeVar("ValueType")