MCPcopy
hub / github.com/pydantic/pydantic / parse_obj_as

Function parse_obj_as

pydantic/v1/tools.py:36–38  ·  view source on GitHub ↗
(type_: Type[T], obj: Any, *, type_name: Optional[NameFactory] = None)

Source from the content-addressed store, hash-verified

34
35
36def parse_obj_as(type_: Type[T], obj: Any, *, type_name: Optional[NameFactory] = None) -> T:
37 model_type = _get_parsing_type(type_, type_name=type_name) # type: ignore[arg-type]
38 return model_type(__root__=obj).__root__
39
40
41def parse_file_as(

Callers 11

test_deprecated_moduleFunction · 0.90
test_parse_objFunction · 0.90
test_parse_obj_as_modelFunction · 0.90
test_parse_obj_failsFunction · 0.90
test_parse_as_dataclassFunction · 0.90
test_parse_mapping_asFunction · 0.90
parse_file_asFunction · 0.70
parse_raw_asFunction · 0.70

Calls 1

_get_parsing_typeFunction · 0.85

Tested by 9

test_deprecated_moduleFunction · 0.72
test_parse_objFunction · 0.72
test_parse_obj_as_modelFunction · 0.72
test_parse_obj_failsFunction · 0.72
test_parse_as_dataclassFunction · 0.72
test_parse_mapping_asFunction · 0.72