Create model object from Python dictionary.
(
cls, data: Mapping, *, preferred_type: Type[ModelT] = None
)
| 298 | |
| 299 | @classmethod |
| 300 | def from_data( |
| 301 | cls, data: Mapping, *, preferred_type: Type[ModelT] = None |
| 302 | ) -> "Record": |
| 303 | """Create model object from Python dictionary.""" |
| 304 | # check for blessed key to see if another model should be used. |
| 305 | if hasattr(data, "__is_model__"): |
| 306 | return cast(Record, data) |
| 307 | else: |
| 308 | self_cls = cls._maybe_namespace(data, preferred_type=preferred_type) |
| 309 | cls._input_translate_fields(data) |
| 310 | return (self_cls or cls)(**data, __strict__=False) |
| 311 | |
| 312 | def __init__( |
| 313 | self, *args: Any, __strict__: bool = True, __faust: Any = None, **kwargs: Any |
no test coverage detected