- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 606 for Depends (0.04 seconds)
-
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")
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Nov 19 16:50:18 GMT 2025 - 596 bytes - Click Count (0) -
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
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 11.2K bytes - Click Count (0) -
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") ),
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 6.3K bytes - Click Count (0) -
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 | ПодсказкаCreated: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 10.7K bytes - Click Count (0) -
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 | ConsejoCreated: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 7.1K bytes - Click Count (0) -
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(
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 12:54:56 GMT 2025 - 37.6K bytes - Click Count (3) -
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():
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 18:19:10 GMT 2025 - 11.2K bytes - Click Count (0) -
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 valueCreated: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 4.4K bytes - Click Count (0) -
docs_src/sql_databases/tutorial002_py39.py
@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate, session: Session = Depends(get_session)): db_hero = Hero.model_validate(hero) session.add(db_hero) session.commit() session.refresh(db_hero) return db_hero @app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes( session: Session = Depends(get_session), offset: int = 0, limit: int = Query(default=100, le=100), ):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Oct 09 19:44:42 GMT 2024 - 2.6K bytes - Click Count (0) -
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()`
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 671 bytes - Click Count (0)