Skip to content

Commit

Permalink
Use is_dask_collection function instead of dask.typing.DaskCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
andersy005 committed Feb 2, 2024
1 parent b3b5a62 commit 541049f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions xarray/namedarray/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ def module_available(module: str, minversion: str | None = None) -> bool:

def is_dask_collection(x: object) -> TypeGuard[DaskCollection]:
if module_available("dask"):
from dask.typing import DaskCollection
from dask.base import is_dask_collection

return isinstance(x, DaskCollection)
# use is_dask_collection function instead of dask.typing.DaskCollection
# see https://github.com/pydata/xarray/pull/8241#discussion_r1476276023
return is_dask_collection(x)
return False


Expand Down

0 comments on commit 541049f

Please sign in to comment.