Skip to content

Commit

Permalink
Update _typing.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Jul 9, 2024
1 parent ce879ca commit 6cc75cc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions xarray/namedarray/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
Literal,
Protocol,
SupportsIndex,
TypeAlias,
TypeVar,
Union,
overload,
Expand Down Expand Up @@ -44,7 +43,7 @@ class Default(Enum):
_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)

_generic: TypeAlias = Any
_generic = Any
# _generic = np.generic


Expand All @@ -69,8 +68,8 @@ def __eq__(self, other: _DType2[_generic], /) -> bool:


_dtype = np.dtype
_DType = TypeVar("_DType", bound=np.dtype[Any])
_DType_co = TypeVar("_DType_co", covariant=True, bound=np.dtype[Any])
_DType = TypeVar("_DType", bound=_dtype[Any])
_DType_co = TypeVar("_DType_co", covariant=True, bound=_dtype[Any])
# A subset of `npt.DTypeLike` that can be parametrized w.r.t. `np.generic`

# _ScalarType = TypeVar("_ScalarType", bound=_generic)
Expand All @@ -87,9 +86,9 @@ def dtype(self) -> _DType_co: ...


_DTypeLike = Union[
np.dtype[_ScalarType],
_dtype[_ScalarType],
type[_ScalarType],
_SupportsDType[np.dtype[_ScalarType]],
_SupportsDType[_dtype[_ScalarType]],
]

# For unknown shapes Dask uses np.nan, array_api uses None:
Expand Down Expand Up @@ -249,7 +248,7 @@ def __array_namespace__(self) -> ModuleType: ...
]

# Corresponds to np.typing.NDArray:
DuckArray = _arrayfunction[Any, np.dtype[_ScalarType_co]]
DuckArray = _arrayfunction[Any, _dtype[_ScalarType_co]]


@runtime_checkable
Expand Down

0 comments on commit 6cc75cc

Please sign in to comment.