Skip to content

Commit

Permalink
always use dask_array_type for instance checking
Browse files Browse the repository at this point in the history
  • Loading branch information
keewis committed Feb 21, 2020
1 parent 90e734a commit b6b1ca9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion xarray/core/dask_array_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import numpy as np

from .pycompat import dask_array_type

try:
import dask.array as da
from dask import __version__ as dask_version
Expand Down Expand Up @@ -36,7 +38,7 @@ def meta_from_array(x, ndim=None, dtype=None):
"""
# If using x._meta, x must be a Dask Array, some libraries (e.g. zarr)
# implement a _meta attribute that are incompatible with Dask Array._meta
if hasattr(x, "_meta") and isinstance(x, da.Array):
if hasattr(x, "_meta") and isinstance(x, dask_array_type):
x = x._meta

if dtype is None and x is None:
Expand Down
6 changes: 3 additions & 3 deletions xarray/core/duck_array_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def f(*args, **kwargs):
dispatch_args = args[0]
else:
dispatch_args = args[array_args]
if any(isinstance(a, dask_array.Array) for a in dispatch_args):
if any(isinstance(a, dask_array_type) for a in dispatch_args):
try:
wrapped = getattr(dask_module, name)
except AttributeError as e:
Expand Down Expand Up @@ -189,8 +189,8 @@ def lazy_array_equiv(arr1, arr2):
return False
if (
dask_array
and isinstance(arr1, dask_array.Array)
and isinstance(arr2, dask_array.Array)
and isinstance(arr1, dask_array_type)
and isinstance(arr2, dask_array_type)
):
# GH3068
if arr1.name == arr2.name:
Expand Down

0 comments on commit b6b1ca9

Please sign in to comment.