From 9fd8404e0f66ea46c8aaa2093dea1718909d2af8 Mon Sep 17 00:00:00 2001 From: grayson-helmholz Date: Fri, 18 Oct 2024 14:51:05 +0200 Subject: [PATCH] Revert "replaced other occurences of 'Any' with qn-types" This reverts commit 41e210fd01f1efb7e9817230b61ed5eebc7c6a8d. --- src/qrules/conservation_rules.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/qrules/conservation_rules.py b/src/qrules/conservation_rules.py index 9da17f4b..0ddc8017 100644 --- a/src/qrules/conservation_rules.py +++ b/src/qrules/conservation_rules.py @@ -55,12 +55,8 @@ from attrs.converters import optional from qrules.quantum_numbers import EdgeQuantumNumbers as EdgeQN -from qrules.quantum_numbers import ( - EdgeQuantumNumberTypes, - NodeQuantumNumberTypes, - arange, -) from qrules.quantum_numbers import NodeQuantumNumbers as NodeQN +from qrules.quantum_numbers import arange def _is_boson(spin_magnitude: float) -> bool: @@ -79,18 +75,15 @@ def __call__(self, qns: Any, /) -> bool: ... class EdgeQNConservationRule(Protocol): def __call__( - self, - ingoing_edge_qns: list[EdgeQuantumNumberTypes], - outgoing_edge_qns: list[EdgeQuantumNumberTypes], - /, + self, ingoing_edge_qns: list[Any], outgoing_edge_qns: list[Any], / ) -> bool: ... class ConservationRule(Protocol): def __call__( self, - ingoing_edge_qns: list[EdgeQuantumNumberTypes], - outgoing_edge_qns: list[EdgeQuantumNumberTypes], + ingoing_edge_qns: list[Any], + outgoing_edge_qns: list[Any], node_qns: Any, /, ) -> bool: ... @@ -100,7 +93,7 @@ def __call__( # __call__ method in a concrete version of the generic are still containing the # TypeVar types. See https://github.com/python/typing/issues/762 def additive_quantum_number_rule( - quantum_number: Union[EdgeQuantumNumberTypes, NodeQuantumNumberTypes], + quantum_number: type, ) -> Callable[[Any], EdgeQNConservationRule]: r"""Class decorator for creating an additive conservation rule.