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)
| 85 | |
| 86 | |
| 87 | def _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 | |
| 98 | def flatten(obj, fields): |