|
9 | 9 |
|
10 | 10 | import inspect |
11 | 11 | from fractions import Fraction |
12 | | -from typing import TYPE_CHECKING, Any, Callable, Generic, TypeVar, Union |
| 12 | +from typing import TYPE_CHECKING, Any, Generic, TypeVar, Union |
13 | 13 |
|
14 | 14 | import attrs |
15 | 15 |
|
|
21 | 21 | from qrules.quantum_numbers import EdgeQuantumNumber, NodeQuantumNumber, Parity |
22 | 22 |
|
23 | 23 | if TYPE_CHECKING: |
24 | | - from collections.abc import Sequence |
| 24 | + from collections.abc import Callable, Sequence |
25 | 25 |
|
26 | | -Scalar = Union[int, float, Fraction] |
27 | | - |
28 | | -Rule = Union[GraphElementRule, EdgeQNConservationRule, ConservationRule] |
| 26 | +Scalar = int | float | Fraction |
| 27 | +Rule = GraphElementRule | EdgeQNConservationRule | ConservationRule |
29 | 28 | """Any type of rule""" |
30 | 29 |
|
31 | 30 | _ElementType = TypeVar("_ElementType") |
@@ -95,7 +94,7 @@ def wrapper(states_list: Sequence[Any]) -> bool: |
95 | 94 |
|
96 | 95 | def _check_all_arguments(checks: list[Callable]) -> Callable[..., bool]: |
97 | 96 | def wrapper(*args: Any) -> bool: |
98 | | - return all(check(arg) for check, arg in zip(checks, args)) |
| 97 | + return all(check(arg) for check, arg in zip(checks, args, strict=False)) |
99 | 98 |
|
100 | 99 | return wrapper |
101 | 100 |
|
@@ -171,7 +170,7 @@ def wrapper(states_list: Sequence[Any]) -> list[Any]: |
171 | 170 |
|
172 | 171 | def _build_all_arguments(checks: list[Callable]) -> Callable: |
173 | 172 | def wrapper(*args: Any) -> list[Any]: |
174 | | - return [check(arg) for check, arg in zip(checks, args) if arg] |
| 173 | + return [check(arg) for check, arg in zip(checks, args, strict=False) if arg] |
175 | 174 |
|
176 | 175 | return wrapper |
177 | 176 |
|
|
0 commit comments