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

Function _item_or_default

xarray/conventions.py:343–347  ·  view source on GitHub ↗

Return item by key if obj is mapping and key is present, else return default value.

(obj: Mapping[Any, T | U] | T, key: Hashable, default: T)

Source from the content-addressed store, hash-verified

341
342
343def _item_or_default(obj: Mapping[Any, T | U] | T, key: Hashable, default: T) -> T | U:
344 """
345 Return item by key if obj is mapping and key is present, else return default value.
346 """
347 return obj.get(key, default) if isinstance(obj, Mapping) else obj
348
349
350def decode_cf_variables(

Callers 1

decode_cf_variablesFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…