Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 748 for dependencies (0.29 sec)

  1. docs/zh/docs/tutorial/dependencies/dependencies-with-yield.md

    例如,您可以使用这种方式创建一个数据库会话,并在完成后关闭它。
    
    在发送响应之前,只会执行 `yield` 语句及之前的代码:
    
    ```Python hl_lines="2-4"
    {!../../../docs_src/dependencies/tutorial007.py!}
    ```
    
    生成的值会注入到*路径操作*和其他依赖项中:
    
    ```Python hl_lines="4"
    {!../../../docs_src/dependencies/tutorial007.py!}
    ```
    
    "yield"语句后面的代码会在发送响应后执行::
    
    ```Python hl_lines="5-6"
    {!../../../docs_src/dependencies/tutorial007.py!}
    ```
    
    !!! tip "提示"
    
        您可以使用 `async` 或普通函数。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 10.3K bytes
    - Viewed (0)
  2. docs/zh/docs/advanced/advanced-dependencies.md

    这里说的不是类本身(类本就是可调用项),而是类实例。
    
    为此,需要声明 `__call__` 方法:
    
    ```Python hl_lines="10"
    {!../../../docs_src/dependencies/tutorial011.py!}
    ```
    
    本例中,**FastAPI**  使用 `__call__` 检查附加参数及子依赖项,稍后,还要调用它向*路径操作函数*传递值。
    
    ## 参数化实例
    
    接下来,使用 `__init__` 声明用于**参数化**依赖项的实例参数:
    
    ```Python hl_lines="7"
    {!../../../docs_src/dependencies/tutorial011.py!}
    ```
    
    本例中,**FastAPI** 不使用 `__init__`,我们要直接在代码中使用。
    
    ## 创建实例
    
    使用以下代码创建类实例:
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Jan 28 18:26:57 GMT 2024
    - 2K bytes
    - Viewed (0)
  3. docs/em/docs/advanced/advanced-dependencies.md

    👈, 👥 📣 👩‍🔬 `__call__`:
    
    ```Python hl_lines="10"
    {!../../../docs_src/dependencies/tutorial011.py!}
    ```
    
    👉 💼, 👉 `__call__` ⚫️❔ **FastAPI** 🔜 ⚙️ ✅ 🌖 🔢 & 🎧-🔗, & 👉 ⚫️❔ 🔜 🤙 🚶‍♀️ 💲 🔢 👆 *➡ 🛠️ 🔢* ⏪.
    
    ## 🔗 👐
    
    & 🔜, 👥 💪 ⚙️ `__init__` 📣 🔢 👐 👈 👥 💪 ⚙️ "🔗" 🔗:
    
    ```Python hl_lines="7"
    {!../../../docs_src/dependencies/tutorial011.py!}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 2K bytes
    - Viewed (0)
  4. docs/de/docs/advanced/testing-dependencies.md

    Nils Lindemann <******@****.***> 1711829852 +0100
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 20:17:32 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  5. docs/em/docs/advanced/testing-dependencies.md

    LeeeeT <******@****.***> 1680341164 +0300
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 1.8K bytes
    - Viewed (0)
  6. docs/zh/docs/advanced/testing-dependencies.md

    jaystone776 <******@****.***> 1711838753 +0800
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 22:45:53 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  7. docs/de/docs/tutorial/dependencies/dependencies-with-yield.md

        {!> ../../../docs_src/dependencies/tutorial008_an_py39.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="17-18  25-26"
        {!> ../../../docs_src/dependencies/tutorial008_an.py!}
        ```
    
    === "Python 3.8+ nicht annotiert"
    
        !!! tip "Tipp"
            Bevorzugen Sie die `Annotated`-Version, falls möglich.
    
        ```Python hl_lines="16-17  24-25"
        {!> ../../../docs_src/dependencies/tutorial008.py!}
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 18:10:29 GMT 2024
    - 13.5K bytes
    - Viewed (0)
  8. docs/de/docs/tutorial/dependencies/classes-as-dependencies.md

    === "Python 3.10+"
    
        ```Python hl_lines="9"
        {!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
        ```
    
    === "Python 3.9+"
    
        ```Python hl_lines="11"
        {!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="12"
        {!> ../../../docs_src/dependencies/tutorial001_an.py!}
        ```
    
    === "Python 3.10+ nicht annotiert"
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 18:01:58 GMT 2024
    - 12.3K bytes
    - Viewed (0)
  9. docs/en/docs/tutorial/dependencies/dependencies-with-yield.md

    ```Python hl_lines="2-4"
    {!../../../docs_src/dependencies/tutorial007.py!}
    ```
    
    The yielded value is what is injected into *path operations* and other dependencies:
    
    ```Python hl_lines="4"
    {!../../../docs_src/dependencies/tutorial007.py!}
    ```
    
    The code following the `yield` statement is executed after the response has been delivered:
    
    ```Python hl_lines="5-6"
    {!../../../docs_src/dependencies/tutorial007.py!}
    ```
    
    !!! tip
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 14.1K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/dependencies/classes-as-dependencies.md

        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="12"
        {!> ../../../docs_src/dependencies/tutorial001_an.py!}
        ```
    
    === "Python 3.10+ non-Annotated"
    
        !!! tip
            Prefer to use the `Annotated` version if possible.
    
        ```Python hl_lines="7"
        {!> ../../../docs_src/dependencies/tutorial001_py310.py!}
        ```
    
    === "Python 3.8+ non-Annotated"
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.4K bytes
    - Viewed (0)
Back to top