diff --git a/src/ampform/helicity/__init__.py b/src/ampform/helicity/__init__.py index 03f96f39..b03fc187 100644 --- a/src/ampform/helicity/__init__.py +++ b/src/ampform/helicity/__init__.py @@ -61,10 +61,10 @@ from ampform.sympy import PoolSum, determine_indices from ampform.sympy._array_expressions import ArraySum -if sys.version_info < (3, 12): - from typing_extensions import override -else: +if sys.version_info >= (3, 12): from typing import override +else: + from typing_extensions import override if TYPE_CHECKING: from collections.abc import ( ItemsView, diff --git a/src/ampform/helicity/decay.py b/src/ampform/helicity/decay.py index 790e753e..942f3877 100644 --- a/src/ampform/helicity/decay.py +++ b/src/ampform/helicity/decay.py @@ -20,10 +20,10 @@ from typing import Literal -if sys.version_info < (3, 10): - from typing_extensions import TypeGuard -else: +if sys.version_info >= (3, 10): from typing import TypeGuard +else: + from typing_extensions import TypeGuard @frozen diff --git a/src/ampform/helicity/naming.py b/src/ampform/helicity/naming.py index 999e5fdb..9cdaff65 100644 --- a/src/ampform/helicity/naming.py +++ b/src/ampform/helicity/naming.py @@ -21,10 +21,10 @@ group_by_spin_projection, ) -if sys.version_info < (3, 12): - from typing_extensions import override -else: +if sys.version_info >= (3, 12): from typing import override +else: + from typing_extensions import override if TYPE_CHECKING: from collections.abc import Iterable diff --git a/src/ampform/kinematics/lorentz.py b/src/ampform/kinematics/lorentz.py index 9ba678fc..2991e86d 100644 --- a/src/ampform/kinematics/lorentz.py +++ b/src/ampform/kinematics/lorentz.py @@ -18,10 +18,10 @@ ) from ampform.sympy.math import ComplexSqrt -if sys.version_info < (3, 10): - from typing_extensions import TypeAlias -else: +if sys.version_info >= (3, 10): from typing import TypeAlias +else: + from typing_extensions import TypeAlias if TYPE_CHECKING: from qrules.topology import Topology from sympy.printing.latex import LatexPrinter diff --git a/src/ampform/sympy/__init__.py b/src/ampform/sympy/__init__.py index c3e4e1cf..845d4caf 100644 --- a/src/ampform/sympy/__init__.py +++ b/src/ampform/sympy/__init__.py @@ -43,14 +43,14 @@ make_commutative, # pyright: ignore[reportUnusedImport] # noqa: F401 ) -if sys.version_info < (3, 11): - from typing_extensions import Self -else: +if sys.version_info >= (3, 11): from typing import Self -if sys.version_info < (3, 12): - from typing_extensions import override else: + from typing_extensions import Self +if sys.version_info >= (3, 12): from typing import override +else: + from typing_extensions import override if TYPE_CHECKING: from collections.abc import Iterable, Sequence diff --git a/src/ampform/sympy/_array_expressions.py b/src/ampform/sympy/_array_expressions.py index 4beedb00..d8cb8343 100644 --- a/src/ampform/sympy/_array_expressions.py +++ b/src/ampform/sympy/_array_expressions.py @@ -27,14 +27,14 @@ get_shape, ) -if sys.version_info < (3, 11): - from typing_extensions import Self -else: +if sys.version_info >= (3, 11): from typing import Self -if sys.version_info < (3, 12): - from typing_extensions import override else: + from typing_extensions import Self +if sys.version_info >= (3, 12): from typing import override +else: + from typing_extensions import override if TYPE_CHECKING: from collections.abc import Iterable diff --git a/src/ampform/sympy/_decorator.py b/src/ampform/sympy/_decorator.py index 51a55be9..64c5c5c1 100644 --- a/src/ampform/sympy/_decorator.py +++ b/src/ampform/sympy/_decorator.py @@ -19,20 +19,20 @@ from sympy.core.basic import _aresame # noqa: PLC2701 from sympy.utilities.exceptions import SymPyDeprecationWarning -if sys.version_info < (3, 11): - from typing_extensions import dataclass_transform -else: +if sys.version_info >= (3, 11): from typing import dataclass_transform +else: + from typing_extensions import dataclass_transform if TYPE_CHECKING: from collections.abc import Hashable, Iterable from sympy.printing.latex import LatexPrinter - if sys.version_info < (3, 11): - from typing_extensions import ParamSpec, Unpack - else: + if sys.version_info >= (3, 11): from typing import ParamSpec, Unpack + else: + from typing_extensions import ParamSpec, Unpack H = TypeVar("H", bound=Hashable) P = ParamSpec("P") diff --git a/src/ampform/sympy/deprecated.py b/src/ampform/sympy/deprecated.py index 9f458efd..a4a6621d 100644 --- a/src/ampform/sympy/deprecated.py +++ b/src/ampform/sympy/deprecated.py @@ -13,10 +13,10 @@ import sympy as sp -if sys.version_info < (3, 12): - from typing_extensions import override -else: +if sys.version_info >= (3, 12): from typing import override +else: + from typing_extensions import override if TYPE_CHECKING: from sympy.printing.latex import LatexPrinter diff --git a/src/ampform/sympy/math.py b/src/ampform/sympy/math.py index 34afda9a..9d676548 100644 --- a/src/ampform/sympy/math.py +++ b/src/ampform/sympy/math.py @@ -11,10 +11,10 @@ from ampform.sympy import NumPyPrintable -if sys.version_info < (3, 12): - from typing_extensions import override -else: +if sys.version_info >= (3, 12): from typing import override +else: + from typing_extensions import override if TYPE_CHECKING: from sympy.printing.numpy import NumPyPrinter from sympy.printing.printer import Printer