Skip to content

Commit fcdc810

Browse files
Correct typing for _sparsearray (#8395)
* Update _typing.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update _typing.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 8a2f29b commit fcdc810

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

xarray/namedarray/_typing.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from collections.abc import Hashable, Iterable, Mapping, Sequence
44
from types import ModuleType
55
from typing import (
6-
TYPE_CHECKING,
76
Any,
87
Callable,
98
Protocol,
@@ -16,10 +15,6 @@
1615

1716
import numpy as np
1817

19-
if TYPE_CHECKING:
20-
from numpy.typing import NDArray
21-
22-
2318
# https://stackoverflow.com/questions/74633074/how-to-type-hint-a-generic-numpy-array
2419
_T = TypeVar("_T")
2520
_T_co = TypeVar("_T_co", covariant=True)
@@ -234,7 +229,7 @@ class _sparsearray(
234229
Corresponds to np.ndarray.
235230
"""
236231

237-
def todense(self) -> NDArray[_ScalarType_co]:
232+
def todense(self) -> np.ndarray[Any, _DType_co]:
238233
...
239234

240235

0 commit comments

Comments
 (0)