MCPcopy
hub / github.com/pydantic/pydantic / get_model

Function get_model

pydantic/v1/utils.py:301–311  ·  view source on GitHub ↗
(obj: Union[Type['BaseModel'], Type['Dataclass']])

Source from the content-addressed store, hash-verified

299
300
301def get_model(obj: Union[Type['BaseModel'], Type['Dataclass']]) -> Type['BaseModel']:
302 from pydantic.v1.main import BaseModel
303
304 try:
305 model_cls = obj.__pydantic_model__ # type: ignore
306 except AttributeError:
307 model_cls = obj
308
309 if not issubclass(model_cls, BaseModel):
310 raise TypeError('Unsupported type, must be either BaseModel or dataclass')
311 return model_cls
312
313
314def to_camel(string: str) -> str:

Callers 2

schemaFunction · 0.90
model_schemaFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected