MCPcopy
hub / github.com/pydata/xarray / shorten_list_repr

Function shorten_list_repr

xarray/core/formatting.py:1285–1295  ·  view source on GitHub ↗
(items: Sequence, max_items: int)

Source from the content-addressed store, hash-verified

1283
1284
1285def shorten_list_repr(items: Sequence, max_items: int) -> str:
1286 if len(items) <= max_items:
1287 return repr(items)
1288 else:
1289 first_half = repr(items[: max_items // 2])[
1290 1:-1
1291 ] # Convert to string and remove brackets
1292 second_half = repr(items[-max_items // 2 :])[
1293 1:-1
1294 ] # Convert to string and remove brackets
1295 return f"[{first_half}, ..., {second_half}]"
1296
1297
1298def render_human_readable_nbytes(

Callers 1

__getitem__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…