mypy-safe

This commit is contained in:
Martin Diehl 2022-03-06 19:37:46 +01:00
parent d5965e5f89
commit 425d148ea8
2 changed files with 5 additions and 4 deletions

View File

@ -1183,8 +1183,9 @@ class Grid:
np.in1d(stencil,np.array(list(set(selection) - {me}))))
offset_ = np.nanmax(self.material)+1 if offset is None else offset
selection_ = util.tbd(selection) if not invert_selection else \
list(set(self.material.flatten()) - set(util.tbd(selection)))
selection_ = util.tbd(selection)
if selection_ is not None and invert_selection:
selection_ = list(set(self.material.flatten()) - set(selection_))
mask = ndimage.filters.generic_filter(self.material,
tainted_neighborhood,
size=1+2*vicinity,

View File

@ -16,7 +16,7 @@ import numpy as np
import h5py
from . import version
from ._typehints import FloatSequence, NumpyRngSeed
from ._typehints import FloatSequence, NumpyRngSeed, IntCollection
# limit visibility
__all__=[
@ -752,7 +752,7 @@ def tail_repack(extended: Union[str, Sequence[str]],
list(extended[len(existing):]))
def tbd(arg) -> List:
def tbd(arg: Union[IntCollection,int,None]) -> Union[List,None]:
if arg is None:
return None
elif isinstance(arg,(np.ndarray,Collection)):