MCPcopy Index your code
hub / github.com/beetbox/beets / _safe_value

Function _safe_value

beetsplug/edit.py:87–95  ·  view source on GitHub ↗

Check whether the `value` is safe to represent in YAML and trust as returned from parsed YAML. This ensures that values do not change their type when the user edits their YAML representation.

(obj, key, value)

Source from the content-addressed store, hash-verified

85
86
87def _safe_value(obj, key, value):
88 """Check whether the `value` is safe to represent in YAML and trust as
89 returned from parsed YAML.
90
91 This ensures that values do not change their type when the user edits their
92 YAML representation.
93 """
94 typ = obj._type(key)
95 return isinstance(typ, SAFE_TYPES) and isinstance(value, typ.model_type)
96
97
98def flatten(obj, fields):

Callers 2

flattenFunction · 0.85
apply_Function · 0.85

Calls 1

_typeMethod · 0.80

Tested by

no test coverage detected