Skip to content

Commit 4cfa6b8

Browse files
authored
simplify dask check (#1254)
* simplify dask check * simplify
1 parent 5a453d6 commit 4cfa6b8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

icechunk-python/python/icechunk/xarray.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import importlib
21
from collections.abc import Hashable, Mapping, MutableMapping
32
from dataclasses import dataclass, field
3+
from importlib.util import find_spec
44
from typing import Any, Literal, overload
55

66
import numpy as np
@@ -22,7 +22,7 @@
2222

2323

2424
try:
25-
has_dask = importlib.util.find_spec("dask") is not None
25+
has_dask = find_spec("dask") is not None
2626
except ImportError:
2727
has_dask = False
2828

@@ -45,9 +45,9 @@
4545

4646
def is_dask_collection(x: Any) -> bool:
4747
if has_dask:
48-
import dask
48+
from dask.base import is_dask_collection
4949

50-
return dask.base.is_dask_collection(x)
50+
return is_dask_collection(x)
5151
else:
5252
return False
5353

0 commit comments

Comments
 (0)