From 55e5b5aaa6d9c27adcf9a7cb1f6ac3bf71c10dea Mon Sep 17 00:00:00 2001 From: keewis Date: Tue, 25 May 2021 23:57:56 +0200 Subject: [PATCH] prefer the objects _repr_inline_ over xarray's custom reprs (#5352) --- xarray/core/formatting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xarray/core/formatting.py b/xarray/core/formatting.py index c3e7187abed..a3c21bdd4b0 100644 --- a/xarray/core/formatting.py +++ b/xarray/core/formatting.py @@ -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: