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

Function pretty_print

xarray/core/formatting.py:41–47  ·  view source on GitHub ↗

Given an object `x`, call `str(x)` and format the returned string so that it is numchars long, padding with trailing spaces or truncating with ellipses as necessary

(x, numchars: int)

Source from the content-addressed store, hash-verified

39
40
41def pretty_print(x, numchars: int):
42 """Given an object `x`, call `str(x)` and format the returned string so
43 that it is numchars long, padding with trailing spaces or truncating with
44 ellipses as necessary
45 """
46 s = maybe_truncate(x, numchars)
47 return s + " " * max(numchars - len(s), 0)
48
49
50def maybe_truncate(obj, maxlen=500):

Callers 8

summarize_variableFunction · 0.85
summarize_attrFunction · 0.85
_mapping_reprFunction · 0.85
summarize_indexFunction · 0.85
_element_formatterFunction · 0.85
dataset_reprFunction · 0.85
dims_and_coords_reprFunction · 0.85
_datatree_node_reprFunction · 0.85

Calls 1

maybe_truncateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…