Skip to content

Commit

Permalink
replaced other occurences of 'Any' with qn-types
Browse files Browse the repository at this point in the history
  • Loading branch information
grayson-helmholz committed Oct 18, 2024
1 parent 4fdb854 commit 41e210f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/qrules/conservation_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@
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:
Expand All @@ -75,15 +79,18 @@ def __call__(self, qns: Any, /) -> bool: ...

class EdgeQNConservationRule(Protocol):
def __call__(
self, ingoing_edge_qns: list[Any], outgoing_edge_qns: list[Any], /
self,
ingoing_edge_qns: list[EdgeQuantumNumberTypes],
outgoing_edge_qns: list[EdgeQuantumNumberTypes],
/,
) -> bool: ...


class ConservationRule(Protocol):
def __call__(
self,
ingoing_edge_qns: list[Any],
outgoing_edge_qns: list[Any],
ingoing_edge_qns: list[EdgeQuantumNumberTypes],
outgoing_edge_qns: list[EdgeQuantumNumberTypes],
node_qns: Any,
/,
) -> bool: ...
Expand All @@ -93,7 +100,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: type,
quantum_number: Union[EdgeQuantumNumberTypes, NodeQuantumNumberTypes],
) -> Callable[[Any], EdgeQNConservationRule]:
r"""Class decorator for creating an additive conservation rule.
Expand Down

0 comments on commit 41e210f

Please sign in to comment.