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

Function format_dims

xarray/core/formatting_html.py:50–64  ·  view source on GitHub ↗
(dim_sizes, dims_with_index)

Source from the content-addressed store, hash-verified

48
49
50def format_dims(dim_sizes, dims_with_index) -> str:
51 if not dim_sizes:
52 return ""
53
54 dim_css_map = {
55 dim: " class='xr-has-index'" if dim in dims_with_index else ""
56 for dim in dim_sizes
57 }
58
59 dims_li = "".join(
60 f"<li><span{dim_css_map[dim]}>{escape(str(dim))}</span>: {size}</li>"
61 for dim, size in dim_sizes.items()
62 )
63
64 return f"<ul class='xr-dim-list'>{dims_li}</ul>"
65
66
67def summarize_attrs(attrs) -> str:

Callers 2

dim_sectionFunction · 0.85
array_reprFunction · 0.85

Calls 2

itemsMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…