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

Function format_attrs

xarray/coding/cftimeindex.py:211–222  ·  view source on GitHub ↗

Format attributes of CFTimeIndex for __repr__.

(index, separator=", ")

Source from the content-addressed store, hash-verified

209
210
211def format_attrs(index, separator=", "):
212 """Format attributes of CFTimeIndex for __repr__."""
213 attrs = {
214 "dtype": f"'{index.dtype}'",
215 "length": f"{len(index)}",
216 "calendar": f"{index.calendar!r}",
217 "freq": f"{index.freq!r}",
218 }
219
220 attrs_str = [f"{k}={v}" for k, v in attrs.items()]
221 attrs_str = f"{separator}".join(attrs_str)
222 return attrs_str
223
224
225class CFTimeIndex(pd.Index):

Callers 1

__repr__Method · 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…