Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 34 for generator (0.27 sec)

  1. tests/test_dependency_contextmanager.py

        state["/async"] = "asyncgen started"
        yield state["/async"]
        state["/async"] = "asyncgen completed"
    
    
    def generator_state(state: Dict[str, str] = Depends(get_state)):
        state["/sync"] = "generator started"
        yield state["/sync"]
        state["/sync"] = "generator completed"
    
    
    async def asyncgen_state_try(state: Dict[str, str] = Depends(get_state)):
        state["/async_raise"] = "asyncgen raise started"
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  2. tests/test_dependency_class.py

    from typing import AsyncGenerator, Generator
    
    import pytest
    from fastapi import Depends, FastAPI
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    class CallableDependency:
        def __call__(self, value: str) -> str:
            return value
    
    
    class CallableGenDependency:
        def __call__(self, value: str) -> Generator[str, None, None]:
            yield value
    
    
    class AsyncCallableDependency:
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sun Aug 09 10:54:05 GMT 2020
    - 3.3K bytes
    - Viewed (0)
  3. fastapi/_compat.py

            )
            inputs = [
                (field, override_mode or field.mode, field._type_adapter.core_schema)
                for field in fields
            ]
            field_mapping, definitions = schema_generator.generate_definitions(
                inputs=inputs
            )
            return field_mapping, definitions  # type: ignore[return-value]
    
        def is_scalar_field(field: ModelField) -> bool:
            from fastapi import params
    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)
  4. fastapi/param_functions.py

                It will affect the generated OpenAPI (e.g. visible at `/docs`).
                """
            ),
        ] = None,
        include_in_schema: Annotated[
            bool,
            Doc(
                """
                To include (or not) this parameter field in the generated OpenAPI.
                You probably don't need it, but it's available.
    
                This affects the generated OpenAPI (e.g. visible at `/docs`).
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 62.5K bytes
    - Viewed (0)
  5. fastapi/openapi/utils.py

        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 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 21.8K bytes
    - Viewed (0)
  6. fastapi/routing.py

            if isinstance(generate_unique_id_function, DefaultPlaceholder):
                current_generate_unique_id: Callable[
                    ["APIRoute"], str
                ] = generate_unique_id_function.value
            else:
                current_generate_unique_id = generate_unique_id_function
            self.unique_id = self.operation_id or current_generate_unique_id(self)
            # normalize enums e.g. http.HTTPStatus
    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)
  7. docs_src/dependencies/tutorial008_an_py39.py

    from typing import Annotated
    
    from fastapi import Depends
    
    
    async def dependency_a():
        dep_a = generate_dep_a()
        try:
            yield dep_a
        finally:
            dep_a.close()
    
    
    async def dependency_b(dep_a: Annotated[DepA, Depends(dependency_a)]):
        dep_b = generate_dep_b()
        try:
            yield dep_b
        finally:
            dep_b.close(dep_a)
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 521 bytes
    - Viewed (0)
  8. docs_src/generate_clients/tutorial003.py

    from typing import List
    
    from fastapi import FastAPI
    from fastapi.routing import APIRoute
    from pydantic import BaseModel
    
    
    def custom_generate_unique_id(route: APIRoute):
        return f"{route.tags[0]}-{route.name}"
    
    
    app = FastAPI(generate_unique_id_function=custom_generate_unique_id)
    
    
    class Item(BaseModel):
        name: str
        price: float
    
    
    class ResponseMessage(BaseModel):
        message: str
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Mar 04 22:02:18 GMT 2022
    - 939 bytes
    - Viewed (0)
  9. docs/sts/web-identity.py

    )
    
    app = Flask(__name__)
    
    
    @app.route('/')
    def homepage():
        text = '<a href="%s">Authenticate with keycloak</a>'
        return text % make_authorization_url()
    
    
    def make_authorization_url():
        # Generate a random string for the state parameter
        # Save it for use later to prevent xsrf attacks
    
        state = str(uuid4())
        params = {"client_id": client_id,
                  "response_type": "code",
    Python
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Wed Jul 28 01:37:51 GMT 2021
    - 2.9K bytes
    - Viewed (1)
  10. fastapi/applications.py

                    [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function).
                    """
                ),
            ] = Default(generate_unique_id),
            separate_input_output_schemas: Annotated[
                bool,
                Doc(
                    """
                    Whether to generate separate OpenAPI schemas for request body and
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 172.2K bytes
    - Viewed (0)
Back to top