Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 33 for Model (0.17 sec)

  1. tests/test_filter_pydantic_sub_model_pv2.py

                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)
        return client
    
    
    @needs_pydanticv2
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 6.3K bytes
    - Viewed (0)
  2. tests/test_jsonable_encoder.py

    
    def test_encode_model_with_alias_raises():
        with pytest.raises(ValidationError):
            ModelWithAlias(foo="Bar")
    
    
    def test_encode_model_with_alias():
        model = ModelWithAlias(Foo="Bar")
        assert jsonable_encoder(model) == {"Foo": "Bar"}
    
    
    def test_encode_model_with_default():
        model = ModelWithDefault(foo="foo", bar="bar")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 9K bytes
    - Viewed (0)
  3. fastapi/openapi/utils.py

        all_fields = get_fields_from_routes(list(routes or []) + list(webhooks or []))
        model_name_map = get_compat_model_name_map(all_fields)
        schema_generator = GenerateJsonSchema(ref_template=REF_TEMPLATE)
        field_mapping, definitions = get_definitions(
            fields=all_fields,
            schema_generator=schema_generator,
            model_name_map=model_name_map,
            separate_input_output_schemas=separate_input_output_schemas,
        )
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 21.8K bytes
    - Viewed (0)
  4. .github/actions/people/app/main.py

        )
        graphql_response = DiscussionsResponse.model_validate(data)
        return graphql_response.data.repository.discussions.edges
    
    
    def get_graphql_pr_edges(*, settings: Settings, after: Union[str, None] = None):
        data = get_graphql_response(settings=settings, query=prs_query, after=after)
        graphql_response = PRsResponse.model_validate(data)
        return graphql_response.data.repository.pullRequests.edges
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 17:38:21 GMT 2024
    - 19.2K bytes
    - Viewed (1)
  5. fastapi/security/api_key.py

                    provided in one of multiple optional ways (for example, in a query
                    parameter or in an HTTP Bearer token).
                    """
                ),
            ] = True,
        ):
            self.model: APIKey = APIKey(
                **{"in": APIKeyIn.query},  # type: ignore[arg-type]
                name=name,
                description=description,
            )
            self.scheme_name = scheme_name or self.__class__.__name__
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 23 22:29:18 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  6. docs_src/app_testing/app_b_py310/main.py

    
    @app.get("/items/{item_id}", response_model=Item)
    async def read_main(item_id: str, x_token: str = Header()):
        if x_token != fake_secret_token:
            raise HTTPException(status_code=400, detail="Invalid X-Token header")
        if item_id not in fake_db:
            raise HTTPException(status_code=404, detail="Item not found")
        return fake_db[item_id]
    
    
    @app.post("/items/", response_model=Item)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 09 14:44:08 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  7. docs_src/security/tutorial004_an_py310.py

        access_token = create_access_token(
            data={"sub": user.username}, expires_delta=access_token_expires
        )
        return Token(access_token=access_token, token_type="bearer")
    
    
    @app.get("/users/me/", response_model=User)
    async def read_users_me(
        current_user: Annotated[User, Depends(get_current_active_user)],
    ):
        return current_user
    
    
    @app.get("/users/me/items/")
    async def read_own_items(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  8. docs_src/security/tutorial005_an.py

            data={"sub": user.username, "scopes": form_data.scopes},
            expires_delta=access_token_expires,
        )
        return Token(access_token=access_token, token_type="bearer")
    
    
    @app.get("/users/me/", response_model=User)
    async def read_users_me(
        current_user: Annotated[User, Depends(get_current_active_user)],
    ):
        return current_user
    
    
    @app.get("/users/me/items/")
    async def read_own_items(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  9. fastapi/dependencies/utils.py

        # That is combined (embedded) with other body fields
        for param in flat_dependant.body_params:
            setattr(param.field_info, "embed", True)  # noqa: B010
        model_name = "Body_" + name
        BodyModel = create_body_model(
            fields=flat_dependant.body_params, model_name=model_name
        )
        required = any(True for f in flat_dependant.body_params if f.required)
        BodyFieldInfo_kwargs: Dict[str, Any] = {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:52:56 GMT 2024
    - 29.5K bytes
    - Viewed (0)
  10. docs_src/security/tutorial004_py310.py

        access_token = create_access_token(
            data={"sub": user.username}, expires_delta=access_token_expires
        )
        return Token(access_token=access_token, token_type="bearer")
    
    
    @app.get("/users/me/", response_model=User)
    async def read_users_me(current_user: User = Depends(get_current_active_user)):
        return current_user
    
    
    @app.get("/users/me/items/")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4K bytes
    - Viewed (0)
Back to top