MCPcopy
hub / github.com/faust-streaming/faust / from_data

Method from_data

faust/models/record.py:300–310  ·  view source on GitHub ↗

Create model object from Python dictionary.

(
        cls, data: Mapping, *, preferred_type: Type[ModelT] = None
    )

Source from the content-addressed store, hash-verified

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

Callers 4

maybe_modelFunction · 0.45
_maybe_reconstructMethod · 0.45
_from_data_fieldMethod · 0.45
loadsMethod · 0.45

Calls 1

_maybe_namespaceMethod · 0.80

Tested by

no test coverage detected