Skip to content

Commit

Permalink
Made dask.array imports safe (#3719)
Browse files Browse the repository at this point in the history
* Made dask.array imports safe

* Fixed flake
  • Loading branch information
philippjfr committed May 17, 2019
1 parent 475aa96 commit 269384f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions holoviews/core/data/interface.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import absolute_import

import sys
import warnings

import param
Expand All @@ -13,8 +12,8 @@

def get_array_types():
array_types = (np.ndarray,)
if 'dask' in sys.modules:
import dask.array as da
da = dask_array_module()
if da is not None:
array_types += (da.Array,)
return array_types

Expand All @@ -26,9 +25,8 @@ def dask_array_module():
return None

def is_dask(array):
if 'dask' in sys.modules:
import dask.array as da
else:
da = dask_array_module()
if da is None:
return False
return da and isinstance(array, da.Array)

Expand Down

0 comments on commit 269384f

Please sign in to comment.