|
12 | 12 |
|
13 | 13 | from .duck_array_ops import array_equiv
|
14 | 14 | from .options import OPTIONS
|
15 |
| -from .pycompat import dask_array_type, is_duck_dask_array, sparse_array_type |
| 15 | +from .pycompat import dask_array_type, sparse_array_type |
| 16 | +from .utils import is_duck_array |
16 | 17 |
|
17 | 18 |
|
18 | 19 | def pretty_print(x, numchars: int):
|
@@ -457,9 +458,7 @@ def short_data_repr(array):
|
457 | 458 | internal_data = getattr(array, "variable", array)._data
|
458 | 459 | if isinstance(array, np.ndarray):
|
459 | 460 | return short_numpy_repr(array)
|
460 |
| - elif hasattr(internal_data, "__array_function__") or is_duck_dask_array( |
461 |
| - internal_data |
462 |
| - ): |
| 461 | + elif is_duck_array(internal_data): |
463 | 462 | return limit_lines(repr(array.data), limit=40)
|
464 | 463 | elif array._in_memory or array.size < 1e5:
|
465 | 464 | return short_numpy_repr(array)
|
@@ -527,13 +526,6 @@ def diff_dim_summary(a, b):
|
527 | 526 |
|
528 | 527 |
|
529 | 528 | def _diff_mapping_repr(a_mapping, b_mapping, compat, title, summarizer, col_width=None):
|
530 |
| - def is_duck_array(value): |
531 |
| - return ( |
532 |
| - hasattr(value, "ndim") |
533 |
| - and hasattr(value, "shape") |
534 |
| - and hasattr(value, "dtype") |
535 |
| - ) |
536 |
| - |
537 | 529 | def extra_items_repr(extra_keys, mapping, ab_side):
|
538 | 530 | extra_repr = [summarizer(k, mapping[k], col_width) for k in extra_keys]
|
539 | 531 | if extra_repr:
|
|
0 commit comments