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

Function array_section

xarray/core/formatting_html.py:240–260  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

238
239
240def array_section(obj) -> str:
241 # "unique" id to expand/collapse the section
242 data_id = "section-" + str(uuid.uuid4())
243 collapsed = (
244 "checked"
245 if _get_boolean_with_default("display_expand_data", default=True)
246 else ""
247 )
248 variable = getattr(obj, "variable", obj)
249 preview = escape(inline_variable_array_repr(variable, max_width=70))
250 data_repr = short_data_repr_html(obj)
251 data_icon = _icon("icon-database")
252
253 return (
254 "<div class='xr-array-wrap'>"
255 f"<input id='{data_id}' class='xr-array-in' type='checkbox' {collapsed}>"
256 f"<label for='{data_id}' title='Show/hide data repr'>{data_icon}</label>"
257 f"<div class='xr-array-preview xr-preview'><span>{preview}</span></div>"
258 f"<div class='xr-array-data'>{data_repr}</div>"
259 "</div>"
260 )
261
262
263coord_section = partial(

Callers 1

array_reprFunction · 0.85

Calls 4

short_data_repr_htmlFunction · 0.85
_iconFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…