From 2f7532d58f06d042dbe0f4399e93da38d3cb7511 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 20 Dec 2023 16:45:38 +0100 Subject: [PATCH] MAINT: put `TypeVar` definitions under `TYPE_CHECKING` --- src/ampform/sympy/_decorator.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/ampform/sympy/_decorator.py b/src/ampform/sympy/_decorator.py index f23ce09ae..138ec3698 100644 --- a/src/ampform/sympy/_decorator.py +++ b/src/ampform/sympy/_decorator.py @@ -18,17 +18,23 @@ from typing import Protocol, TypedDict if sys.version_info < (3, 11): - from typing_extensions import ParamSpec, Unpack, dataclass_transform + from typing_extensions import dataclass_transform else: - from typing import ParamSpec, Unpack, dataclass_transform + from typing import dataclass_transform if TYPE_CHECKING: from sympy.printing.latex import LatexPrinter + if sys.version_info < (3, 11): + from typing_extensions import ParamSpec, Unpack + else: + from typing import ParamSpec, Unpack + + H = TypeVar("H", bound=Hashable) + P = ParamSpec("P") + T = TypeVar("T") + ExprClass = TypeVar("ExprClass", bound=sp.Expr) -P = ParamSpec("P") -T = TypeVar("T") -H = TypeVar("H", bound=Hashable) class SymPyAssumptions(TypedDict, total=False):