Skip to content

Commit

Permalink
prefer the objects _repr_inline_ over xarray's custom reprs (pydata#5352
Browse files Browse the repository at this point in the history
)
  • Loading branch information
keewis authored May 25, 2021
1 parent ad41e7a commit 55e5b5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xarray/core/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,12 @@ def inline_variable_array_repr(var, max_width):
"""Build a one-line summary of a variable's data."""
if var._in_memory:
return format_array_flat(var, max_width)
elif hasattr(var._data, "_repr_inline_"):
return var._data._repr_inline_(max_width)
elif isinstance(var._data, dask_array_type):
return inline_dask_repr(var.data)
elif isinstance(var._data, sparse_array_type):
return inline_sparse_repr(var.data)
elif hasattr(var._data, "_repr_inline_"):
return var._data._repr_inline_(max_width)
elif hasattr(var._data, "__array_function__"):
return maybe_truncate(repr(var._data).replace("\n", " "), max_width)
else:
Expand Down

0 comments on commit 55e5b5a

Please sign in to comment.