Skip to content

Commit

Permalink
Fix imports and use is_chunked_array instead of _chunkedarrayfunction…
Browse files Browse the repository at this point in the history
…_or_api
  • Loading branch information
andersy005 committed Feb 9, 2024
1 parent 6ac37b3 commit 42210a8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions xarray/backends/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from xarray.conventions import cf_encoder
from xarray.core import indexing
from xarray.core.utils import FrozenDict, NdimSizeLenMixin, is_remote_uri
from xarray.namedarray._typing import _chunkedarrayfunction_or_api
from xarray.namedarray.parallelcompat import get_chunked_array_type
from xarray.namedarray.pycompat import is_chunked_array

if TYPE_CHECKING:
from io import BufferedIOBase
Expand Down Expand Up @@ -232,7 +232,7 @@ def __init__(self, lock=None):
self.lock = lock

def add(self, source, target, region=None):
if isinstance(source, _chunkedarrayfunction_or_api):
if is_chunked_array(source):
self.sources.append(source)
self.targets.append(target)
self.regions.append(region)
Expand Down
2 changes: 1 addition & 1 deletion xarray/coding/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def lazy_elemwise_func(array, func: Callable, dtype: np.typing.DTypeLike):
if is_chunked_array(array):
chunkmanager = get_chunked_array_type(array)

return chunkmanager.map_blocks(func, array, dtype=dtype) # type: ignore
return chunkmanager.map_blocks(func, array, dtype=dtype) # type: ignore[arg-type]
else:
return _ElementwiseFunctionArray(array, func, dtype)

Expand Down
14 changes: 7 additions & 7 deletions xarray/core/duck_array_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
import pandas as pd
from numpy import all as array_all # noqa
from numpy import any as array_any # noqa
from numpy import (
from numpy import ( # noqa
around, # noqa
full_like,
gradient, # noqa
gradient,
isclose,
isin, # noqa
isin,
isnat,
take, # noqa
tensordot, # noqa
transpose, # noqa
unravel_index, # noqa
take,
tensordot,
transpose,
unravel_index,
)
from numpy import concatenate as _concatenate
from numpy.lib.stride_tricks import sliding_window_view # noqa
Expand Down

0 comments on commit 42210a8

Please sign in to comment.