diff --git a/geoutils/_typing.py b/geoutils/_typing.py index 4890766e..97a594a7 100644 --- a/geoutils/_typing.py +++ b/geoutils/_typing.py @@ -6,9 +6,6 @@ import numpy as np -# Mypy has issues with the builtin Number type (https://github.com/python/mypy/issues/3186) -Number = Union[int, float, np.integer[Any], np.floating[Any]] - # Only for Python >= 3.9 if sys.version_info.minor >= 9: @@ -18,6 +15,9 @@ NDArray, ) + # Mypy has issues with the builtin Number type (https://github.com/python/mypy/issues/3186) + Number = Union[int, float, np.integer[Any], np.floating[Any]] + # Simply define here if they exist DTypeLike = DTypeLike ArrayLike = ArrayLike @@ -32,6 +32,9 @@ # For backward compatibility before Python 3.9 else: + # Mypy has issues with the builtin Number type (https://github.com/python/mypy/issues/3186) + Number = Union[int, float, np.integer, np.floating] # type: ignore + # Make an array-like type (since the array-like numpy type only exists in numpy>=1.20) ArrayLike = Union[np.ndarray, np.ma.masked_array, List[Any], Tuple[Any]] # type: ignore DTypeLike = Union[str, type, np.dtype] # type: ignore