Skip to content

Commit

Permalink
fix typing and issues reported by mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
roosre committed Sep 5, 2024
1 parent bd533e9 commit 1de65e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ansys/dpf/composites/_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def by_id_as_array(self, entity_id: int) -> Optional[NDArray[np.int64]]:

def _has_data_pointer(field: PropertyField | Field) -> bool:
if (
field._data_pointer is not None and field._data_pointer.any() # pylint: disable=protected-access
field._data_pointer is not None
and field._data_pointer.any() # pylint: disable=protected-access
):
return True
return False
Expand Down Expand Up @@ -388,7 +389,7 @@ def by_id(self, entity_id: int) -> Optional[np.double]:
entity_id
"""
values = self.by_id_as_array(entity_id)
if len(values) == 0:
if values is None or len(values) == 0:
return None
if len(values) == 1:
return values[0]
Expand Down

0 comments on commit 1de65e0

Please sign in to comment.