Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 9, 2023
1 parent 3179c7c commit 77ad83a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
9 changes: 3 additions & 6 deletions src/qrules/conservation_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,13 @@ def _is_particle_antiparticle_pair(pid1: int, pid2: int) -> bool:


class GraphElementRule(Protocol):
def __call__(self, __qns: Any) -> bool:
...
def __call__(self, __qns: Any) -> bool: ...


class EdgeQNConservationRule(Protocol):
def __call__(
self, __ingoing_edge_qns: List[Any], __outgoing_edge_qns: List[Any]
) -> bool:
...
) -> bool: ...


class ConservationRule(Protocol):
Expand All @@ -92,8 +90,7 @@ def __call__(
__ingoing_edge_qns: List[Any],
__outgoing_edge_qns: List[Any],
__node_qns: Any,
) -> bool:
...
) -> bool: ...


# Note a generic would be more fitting here. However the type annotations of
Expand Down
15 changes: 5 additions & 10 deletions src/qrules/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@

class _Comparable(Protocol):
@abstractmethod
def __lt__(self, other: Any) -> bool:
...
def __lt__(self, other: Any) -> bool: ...


KT = TypeVar("KT", bound=_Comparable)
Expand Down Expand Up @@ -875,28 +874,24 @@ def unfreeze(self) -> "MutableTransition[EdgeType, NodeType]":
return MutableTransition(self.topology, self.states, self.interactions)

@overload
def convert(self) -> "FrozenTransition[EdgeType, NodeType]":
...
def convert(self) -> "FrozenTransition[EdgeType, NodeType]": ...

@overload
def convert(
self, state_converter: Callable[[EdgeType], NewEdgeType]
) -> "FrozenTransition[NewEdgeType, NodeType]":
...
) -> "FrozenTransition[NewEdgeType, NodeType]": ...

@overload
def convert(
self, *, interaction_converter: Callable[[NodeType], NewNodeType]
) -> "FrozenTransition[EdgeType, NewNodeType]":
...
) -> "FrozenTransition[EdgeType, NewNodeType]": ...

@overload
def convert(
self,
state_converter: Callable[[EdgeType], NewEdgeType],
interaction_converter: Callable[[NodeType], NewNodeType],
) -> "FrozenTransition[NewEdgeType, NewNodeType]":
...
) -> "FrozenTransition[NewEdgeType, NewNodeType]": ...

def convert(self, state_converter=None, interaction_converter=None): # type: ignore[no-untyped-def]
"""Cast the edge and/or node properties to another type."""
Expand Down
6 changes: 2 additions & 4 deletions src/qrules/transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,10 @@ def add_final_state_grouping(
@overload
def get_allowed_interaction_types(
self,
) -> Union[List[InteractionType], Dict[int, List[InteractionType]]]:
...
) -> Union[List[InteractionType], Dict[int, List[InteractionType]]]: ...

@overload
def get_allowed_interaction_types(self, node_id: int) -> List[InteractionType]:
...
def get_allowed_interaction_types(self, node_id: int) -> List[InteractionType]: ...

def get_allowed_interaction_types(self, node_id=None): # type: ignore[no-untyped-def]
if node_id is None:
Expand Down

0 comments on commit 77ad83a

Please sign in to comment.