Skip to content

Commit

Permalink
Fix more mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaelman committed Oct 7, 2024
1 parent e6f8bfb commit 63f6bf5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/nomad_simulations/schema_packages/model_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

if TYPE_CHECKING:
from collections.abc import Generator
from typing import Callable, Optional
from typing import Callable, Optional, Any

import pint
from nomad.datamodel.datamodel import EntryArchive
Expand Down Expand Up @@ -232,6 +232,7 @@ def __init__(self, representative_variable):
def __hash__(self):
return self.representative_variable.__hash__()

@staticmethod
def _check_implemented(func: Callable):
"""
Decorator to restrict the comparison functions to the same class.
Expand Down Expand Up @@ -369,9 +370,9 @@ class Cell(GeometricSpace):
)

@staticmethod
def _generate_comparer(obj) -> Generator[HashedPositions, None, None]:
def _generate_comparer(obj) -> Generator[Any, None, None]:
try:
return (HashedPositions(pos) for pos in obj.positions)
return ((HashedPositions(pos)) for pos in obj.positions)
except AttributeError:
raise NotImplementedError

Expand Down Expand Up @@ -445,7 +446,7 @@ def __init__(self, m_def: 'Section' = None, m_context: 'Context' = None, **kwarg
@staticmethod
def _generate_comparer(
obj,
) -> Generator[HashedPositions, PartialOrderElement, None, None]:
) -> Generator[Any, None, None]:
# presumes `atoms_state` mapping 1-to-1 with `positions` and conserves the order
try:
return (
Expand Down
2 changes: 1 addition & 1 deletion tests/test_model_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class TestAtomicCell:
), # different position-symbol map
],
)
def test_partial_order(self, cell_1: Cell, cell_2: Cell, result: bool):
def test_partial_order(self, cell_1: Cell, cell_2: Cell, result: dict[str, bool]):
"""
Test the comparison operators of `Cell` and `AtomicCell`.
"""
Expand Down

0 comments on commit 63f6bf5

Please sign in to comment.