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

Function safe_setitem

xarray/coding/common.py:112–121  ·  view source on GitHub ↗
(dest, key: Hashable, value, name: T_Name = None)

Source from the content-addressed store, hash-verified

110
111
112def safe_setitem(dest, key: Hashable, value, name: T_Name = None):
113 if key in dest:
114 var_str = f" on variable {name!r}" if name else ""
115 raise ValueError(
116 f"Key '{key}' already exists in attrs{var_str}, and will not be overwritten. "
117 "This is probably an encoding field used by xarray to describe "
118 "how a variable is serialized. To proceed, remove this key from "
119 "the variable's attributes manually."
120 )
121 dest[key] = value
122
123
124def pop_to(

Callers 5

encodeMethod · 0.90
encodeMethod · 0.90
decodeMethod · 0.90
pop_toFunction · 0.85
encodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…