Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 44 for get_model (0.42 sec)

  1. 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 Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 784 bytes
    - Viewed (0)
  2. 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 Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 6.3K bytes
    - Viewed (0)
  3. 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 Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.6K bytes
    - Viewed (0)
  4. 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 Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  5. 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 Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 22.6K bytes
    - Viewed (0)
  6. 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 Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Aug 26 13:26:03 GMT 2022
    - 546 bytes
    - Viewed (0)
  7. tests/test_filter_pydantic_sub_model/test_filter_pydantic_sub_model_pv1.py

            "info": {"title": "FastAPI", "version": "0.1.0"},
            "paths": {
                "/model/{name}": {
                    "get": {
                        "summary": "Get Model A",
                        "operationId": "get_model_a_model__name__get",
                        "parameters": [
                            {
                                "required": True,
                                "schema": {"title": "Name", "type": "string"},
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.5K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_path_params/test_tutorial005.py

            "info": {"title": "FastAPI", "version": "0.1.0"},
            "paths": {
                "/models/{model_name}": {
                    "get": {
                        "summary": "Get Model",
                        "operationId": "get_model_models__model_name__get",
                        "parameters": [
                            {
                                "required": True,
                                "schema": {"$ref": "#/components/schemas/ModelName"},
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 5K bytes
    - Viewed (0)
  9. maven-core/src/main/java/org/apache/maven/project/MavenProject.java

            if ((groupId == null) && (getModel().getParent() != null)) {
                groupId = getModel().getParent().getGroupId();
            }
    
            return groupId;
        }
    
        public void setArtifactId(String artifactId) {
            getModel().setArtifactId(artifactId);
        }
    
        public String getArtifactId() {
            return getModel().getArtifactId();
        }
    
    Java
    - Registered: Sun Apr 21 03:35:09 GMT 2024
    - Last Modified: Fri Mar 01 17:18:13 GMT 2024
    - 56.6K bytes
    - Viewed (0)
  10. 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 Apr 21 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 170.1K bytes
    - Viewed (0)
Back to top