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})))) np.in1d(stencil,np.array(list(set(selection) - {me}))))
offset_ = np.nanmax(self.material)+1 if offset is None else offset offset_ = np.nanmax(self.material)+1 if offset is None else offset
selection_ = util.tbd(selection) if not invert_selection else \ selection_ = util.tbd(selection)
list(set(self.material.flatten()) - set(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, mask = ndimage.filters.generic_filter(self.material,
tainted_neighborhood, tainted_neighborhood,
size=1+2*vicinity, size=1+2*vicinity,

View File

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