Skip to content

Commit

Permalink
Update daskmanager.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Apr 14, 2024
1 parent 6b525ae commit 587a73a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions xarray/namedarray/daskmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,22 @@

dask_available = module_available("dask")

_T_DaskArray = TypeVar("_T_DaskArray", bound="DaskArray")


class DaskManager(ChunkManagerEntrypoint):
# array_cls: type[DaskArray]
available: bool = dask_available

def __init__(self) -> None:
# TODO can we replace this with a class attribute instead?

from dask.array.core import Array

self.array_cls = Array
# TODO: error: Incompatible types in assignment (expression has type "type[Array]", variable has type "type[_chunkedarrayfunction[Any, Any]] | type[_chunkedarrayapi[Any, Any]]") [assignment]
self.array_cls = Array # type: ignore[assignment]

def is_chunked_array(self, data: duckarray[Any, Any]) -> bool:
return is_duck_dask_array(data)

def chunks(self, data: chunkedduckarray[Any, Any]) -> _Chunks:
def chunks(self, data: chunkedduckarray[Any, _dtype[Any]]) -> _Chunks:
return data.chunks

def normalize_chunks(
Expand Down Expand Up @@ -93,7 +91,7 @@ def compute(
) -> tuple[duckarray[Any, _DType], ...]:
from dask.base import compute

out: tuple[np.ndarray[Any, np.dtype[np.generic]], ...]
out: tuple[duckarray[Any, _DType], ...]
out = compute(*data, **kwargs) # type: ignore[no-untyped-call]
return out

Expand Down

0 comments on commit 587a73a

Please sign in to comment.