Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 206 for Depends (0.15 sec)

  1. docs/em/docs/tutorial/dependencies/classes-as-dependencies.md

    ////
    
    **FastAPI** 🤙 `CommonQueryParams` 🎓. 👉 ✍ "👐" 👈 🎓 & 👐 🔜 🚶‍♀️ 🔢 `commons` 👆 🔢.
    
    ## 🆎 ✍ 🆚 `Depends`
    
    👀 ❔ 👥 ✍ `CommonQueryParams` 🕐 🔛 📟:
    
    ```Python
    commons: CommonQueryParams = Depends(CommonQueryParams)
    ```
    
    🏁 `CommonQueryParams`,:
    
    ```Python
    ... = Depends(CommonQueryParams)
    ```
    
    ...⚫️❔ **FastAPI** 🔜 🤙 ⚙️ 💭 ⚫️❔ 🔗.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  2. docs_src/sql_databases/tutorial002.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),
    ):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  3. docs/ru/docs/tutorial/dependencies/classes-as-dependencies.md

    ```Python
    commons: Annotated[CommonQueryParams, Depends()]
    ```
    
    ////
    
    //// tab | Python 3.6 без Annotated
    
    /// tip | "Подсказка"
    
    Рекомендуется использовать версию с `Annotated` если возможно.
    
    ///
    
    ```Python
    commons: CommonQueryParams = Depends()
    ```
    
    ////
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 16K bytes
    - Viewed (0)
  4. 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),
    ):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  5. docs_src/sql_databases/tutorial001_py39.py

    def on_startup():
        create_db_and_tables()
    
    
    @app.post("/heroes/")
    def create_hero(hero: Hero, session: Session = Depends(get_session)) -> Hero:
        session.add(hero)
        session.commit()
        session.refresh(hero)
        return hero
    
    
    @app.get("/heroes/")
    def read_heroes(
        session: Session = Depends(get_session),
        offset: int = 0,
        limit: int = Query(default=100, le=100),
    ) -> list[Hero]:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  6. docs/zh/docs/tutorial/dependencies/classes-as-dependencies.md

    ```
    
    ////
    
    **FastAPI** 调用 `CommonQueryParams` 类。这将创建该类的一个 "实例",该实例将作为参数 `commons` 被传递给你的函数。
    
    ## 类型注解 vs `Depends`
    
    注意,我们在上面的代码中编写了两次`CommonQueryParams`:
    
    ```Python
    commons: CommonQueryParams = Depends(CommonQueryParams)
    ```
    
    最后的 `CommonQueryParams`:
    
    ```Python
    ... = Depends(CommonQueryParams)
    ```
    
    ...实际上是 **Fastapi** 用来知道依赖项是什么的。
    
    FastAPI 将从依赖项中提取声明的参数,这才是 FastAPI 实际调用的。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6.4K bytes
    - Viewed (0)
  7. fastapi/dependencies/utils.py

    
    def get_parameterless_sub_dependant(*, depends: params.Depends, path: str) -> Dependant:
        assert callable(
            depends.dependency
        ), "A parameter-less dependency must have a callable dependency"
        return get_sub_dependant(depends=depends, dependency=depends.dependency, path=path)
    
    
    def get_sub_dependant(
        *,
        depends: params.Depends,
        dependency: Callable[..., Any],
        path: str,
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 21:46:26 UTC 2024
    - 34.7K bytes
    - Viewed (0)
  8. docs_src/sql_databases/tutorial002_py310.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),
    ):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  9. docs/ko/docs/tutorial/dependencies/classes-as-dependencies.md

    **FastAPI**는 `CommonQueryParams` 클래스를 호출합니다. 이것은 해당 클래스의 "인스턴스"를 생성하고 그 인스턴스는 함수의 매개변수 `commons`로 전달됩니다.
    
    ## 타입 힌팅 vs `Depends`
    
    위 코드에서 `CommonQueryParams`를 두 번 작성한 방식에 주목하십시오:
    
    ```Python
    commons: CommonQueryParams = Depends(CommonQueryParams)
    ```
    
    마지막 `CommonQueryParams` 변수를 보면:
    
    ```Python
    ... = Depends(CommonQueryParams)
    ```
    
    ... **FastAPI**가 실제로 어떤 것이 의존성인지 알기 위해서 사용하는 방법입니다.
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  10. docs/pt/docs/tutorial/dependencies/index.md

    ```
    
    ////
    
    Ainda que `Depends` seja utilizado nos parâmetros da função da mesma forma que `Body`, `Query`, etc, `Depends` funciona de uma forma um pouco diferente.
    
    Você fornece um único parâmetro para `Depends`.
    
    Esse parâmetro deve ser algo como uma função.
    
    Você **não chama a função** diretamente (não adicione os parênteses no final), apenas a passe como parâmetro de `Depends()`.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 12.6K bytes
    - Viewed (0)
Back to top