- Sort Score
- Result 10 results
- Languages All
Results 1 - 9 of 9 for get_model (0.21 sec)
-
tests/test_compat.py
model_config=BaseConfig, ) assert not is_pv1_scalar_field(field) @needs_pydanticv2 def test_get_model_config(): # For coverage in Pydantic v2 class Foo(BaseModel): model_config = ConfigDict(from_attributes=True) foo = Foo() config = _get_model_config(foo) assert config == {"from_attributes": True} def test_complex(): app = FastAPI() @app.post("/")
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Sep 28 04:14:40 GMT 2023 - 2.8K bytes - Viewed (0) -
tests/test_tutorial/test_path_params/test_tutorial005.py
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Sep 28 04:14:40 GMT 2023 - 5K bytes - Viewed (0) -
tests/test_datetime_custom_encoder.py
app = FastAPI() model = ModelWithDatetimeField(dt_field=datetime(2019, 1, 1, 8)) @app.get("/model", response_model=ModelWithDatetimeField) def get_model(): return model client = TestClient(app) with client: response = client.get("/model") assert response.json() == {"dt_field": "2019-01-01T08:00:00+00:00"}
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 1.6K bytes - Viewed (0) -
tests/test_filter_pydantic_sub_model_pv2.py
raise ValueError("name must end in A") return name async def get_model_c() -> ModelC: return ModelC(username="test-user", password="test-password") @app.get("/model/{name}", response_model=ModelA) async def get_model_a(name: str, model_c=Depends(get_model_c)): return {"name": name, "description": "model-a-desc", "foo": model_c} client = TestClient(app)
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:40:57 GMT 2024 - 6.3K bytes - Viewed (0) -
docs_src/path_params/tutorial005.py
from fastapi import FastAPI class ModelName(str, Enum): alexnet = "alexnet" resnet = "resnet" lenet = "lenet" app = FastAPI() @app.get("/models/{model_name}") async def get_model(model_name: ModelName): if model_name is ModelName.alexnet: return {"model_name": model_name, "message": "Deep Learning FTW!"} if model_name.value == "lenet":
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Aug 26 13:26:03 GMT 2022 - 546 bytes - Viewed (0) -
tests/test_filter_pydantic_sub_model/app_pv1.py
if not name.endswith("A"): raise ValueError("name must end in A") return name async def get_model_c() -> ModelC: return ModelC(username="test-user", password="test-password") @app.get("/model/{name}", response_model=ModelA) async def get_model_a(name: str, model_c=Depends(get_model_c)):
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 784 bytes - Viewed (0) -
fastapi/_compat.py
def _model_dump( model: BaseModel, mode: Literal["json", "python"] = "json", **kwargs: Any ) -> Any: return model.model_dump(mode=mode, **kwargs) def _get_model_config(model: BaseModel) -> Any: return model.model_config def get_schema_from_model_field( *, field: ModelField, schema_generator: GenerateJsonSchema,
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:40:57 GMT 2024 - 22.6K bytes - Viewed (0) -
tests/test_filter_pydantic_sub_model/test_filter_pydantic_sub_model_pv1.py
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 4.5K bytes - Viewed (0) -
fastapi/routing.py
Dict, List, Optional, Sequence, Set, Tuple, Type, Union, ) from fastapi import params from fastapi._compat import ( ModelField, Undefined, _get_model_config, _model_dump, _normalize_errors, lenient_issubclass, ) from fastapi.datastructures import Default, DefaultPlaceholder from fastapi.dependencies.models import Dependant
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Apr 02 02:48:51 GMT 2024 - 170.1K bytes - Viewed (0)