Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 683 for depends (0.09 sec)

  1. tests/test_depends_hashable.py

    # This is more or less a workaround to make Depends and Security hashable
    # as other tools that use them depend on that
    # Ref: https://github.com/fastapi/fastapi/pull/14320
    
    from fastapi import Depends, Security
    
    
    def dep():
        pass
    
    
    def test_depends_hashable():
        dep()  # just for coverage
        d1 = Depends(dep)
        d2 = Depends(dep)
        d3 = Depends(dep, scope="function")
        d4 = Depends(dep, scope="function")
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Nov 19 16:50:18 UTC 2025
    - 596 bytes
    - Viewed (0)
  2. tests/test_dependency_wrapped.py

    @app.get("/wrapped-dependency/")
    async def get_wrapped_dependency(value: bool = Depends(wrapped_dependency)):
        return value
    
    
    @app.get("/wrapped-gen-dependency/")
    async def get_wrapped_gen_dependency(value: bool = Depends(wrapped_gen_dependency)):
        return value
    
    
    @app.get("/async-wrapped-dependency/")
    async def get_async_wrapped_dependency(value: bool = Depends(async_wrapped_dependency)):
        return value
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 11.2K bytes
    - Viewed (0)
  3. tests/test_dependency_partial.py

    async def get_partial_function_dependency(
        value: Annotated[
            str, Depends(partial(function_dependency, "partial-function-dependency"))
        ],
    ) -> str:
        return value
    
    
    @app.get("/partial-async-function-dependency")
    async def get_partial_async_function_dependency(
        value: Annotated[
            str,
            Depends(
                partial(async_function_dependency, "partial-async-function-dependency")
            ),
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 6.3K bytes
    - Viewed (0)
  4. fastapi/dependencies/utils.py

            if isinstance(field_info, FieldInfo):
                field_info.annotation = type_annotation
    
        # Get Depends from type annotation
        if depends is not None and depends.dependency is None:
            # Copy `depends` before mutating it
            depends = copy(depends)
            depends = dataclasses.replace(depends, dependency=type_annotation)
    
        # Handle non-param type annotations like Request
        if lenient_issubclass(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 37.6K bytes
    - Viewed (3)
  5. docs/ru/docs/tutorial/dependencies/classes-as-dependencies.md

    ## Аннотация типа и `Depends` { #type-annotation-vs-depends }
    
    Обратите внимание, что в приведенном выше коде мы два раза пишем `CommonQueryParams`:
    
    //// tab | Python 3.9+
    
    ```Python
    commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
    ```
    
    ////
    
    //// tab | Python 3.9+ non-Annotated
    
    /// tip | Подсказка
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 10.7K bytes
    - Viewed (0)
  6. docs/es/docs/tutorial/dependencies/classes-as-dependencies.md

    ## Anotación de tipos vs `Depends` { #type-annotation-vs-depends }
    
    Nota cómo escribimos `CommonQueryParams` dos veces en el código anterior:
    
    //// tab | Python 3.9+
    
    ```Python
    commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
    ```
    
    ////
    
    //// tab | Python 3.9+ sin `Annotated`
    
    /// tip | Consejo
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 7.1K bytes
    - Viewed (0)
  7. tests/test_dependency_overrides.py

    @app.get("/decorator-depends/", dependencies=[Depends(common_parameters)])
    async def decorator_depends():
        return {"in": "decorator-depends"}
    
    
    @router.get("/router-depends/")
    async def router_depends(commons: dict = Depends(common_parameters)):
        return {"in": "router-depends", "params": commons}
    
    
    @router.get("/router-decorator-depends/", dependencies=[Depends(common_parameters)])
    async def router_decorator_depends():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 11.2K bytes
    - Viewed (0)
  8. tests/test_dependency_yield_scope.py

        yield
        raise HTTPException(status_code=503, detail="Exception after yield")
    
    
    SessionFuncDep = Annotated[Session, Depends(dep_session, scope="function")]
    SessionRequestDep = Annotated[Session, Depends(dep_session, scope="request")]
    SessionDefaultDep = Annotated[Session, Depends(dep_session)]
    
    
    class NamedSession:
        def __init__(self, name: str = "default") -> None:
            self.name = name
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 6.7K bytes
    - Viewed (0)
  9. tests/test_dependency_class.py

    ):
        return await instance(value)
    
    
    @app.get("/async-callable-gen-dependency-class")
    async def get_async_callable_gen_dependency_class(
        value: str, instance: AsyncCallableGenDependency = Depends()
    ):
        return await instance(value).__anext__()
    
    
    @app.get("/callable-dependency")
    async def get_callable_dependency(value: str = Depends(callable_dependency)):
        return value
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 4.4K bytes
    - Viewed (0)
  10. docs/en/docs/reference/dependencies.md

    # Dependencies - `Depends()` and `Security()`
    
    ## `Depends()`
    
    Dependencies are handled mainly with the special function `Depends()` that takes a callable.
    
    Here is the reference for it and its parameters.
    
    You can import it directly from `fastapi`:
    
    ```python
    from fastapi import Depends
    ```
    
    ::: fastapi.Depends
    
    ## `Security()`
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Apr 18 19:53:19 UTC 2024
    - 671 bytes
    - Viewed (0)
Back to top