MCPcopy
hub / github.com/Agenta-AI/agenta / parse_obj_as

Function parse_obj_as

sdk/agenta/client/backend/core/pydantic_utilities.py:59–67  ·  view source on GitHub ↗
(type_: typing.Type[T], object_: typing.Any)

Source from the content-addressed store, hash-verified

57
58
59def parse_obj_as(type_: typing.Type[T], object_: typing.Any) -> T:
60 dealiased_object = convert_and_respect_annotation_metadata(
61 object_=object_, annotation=type_, direction="read"
62 )
63 if IS_PYDANTIC_V2:
64 adapter = pydantic.TypeAdapter(type_) # type: ignore # Pydantic v2
65 return adapter.validate_python(dealiased_object)
66 else:
67 return pydantic.parse_obj_as(type_, dealiased_object)
68
69
70def to_jsonable_with_fallback(

Callers 15

list_api_keysMethod · 0.85
create_api_keyMethod · 0.85
delete_api_keyMethod · 0.85
validate_api_keyMethod · 0.85
list_organizationsMethod · 0.85
create_organizationMethod · 0.85
get_own_orgMethod · 0.85
update_organizationMethod · 0.85
resend_invitationMethod · 0.85
accept_invitationMethod · 0.85

Tested by

no test coverage detected