- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 157 for cdef (0.14 sec)
-
docs/en/docs/advanced/dataclasses.md
Again, you can combine `dataclasses` with standard type annotations. 8. Notice that this *path operation function* uses regular `def` instead of `async def`. As always, in FastAPI you can combine `def` and `async def` as needed.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 4.1K bytes - Viewed (0) -
docs/zh/docs/tutorial/dependencies/index.md
只要把它传递给 `Depends`,**FastAPI** 就知道该如何执行后续操作。 ## 要不要使用 `async`? **FastAPI** 调用依赖项的方式与*路径操作函数*一样,因此,定义依赖项函数,也要应用与路径操作函数相同的规则。 即,既可以使用异步的 `async def`,也可以使用普通的 `def` 定义依赖项。 在普通的 `def` *路径操作函数*中,可以声明异步的 `async def` 依赖项;也可以在异步的 `async def` *路径操作函数*中声明普通的 `def` 依赖项。 上述这些操作都是可行的,**FastAPI** 知道该怎么处理。 !!! note "笔记" 如里不了解异步,请参阅[异步:*“着急了?”*](../../async.md){.internal-link target=_blank} 一章中 `async` 和 `await` 的内容。
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Jun 24 14:47:15 GMT 2023 - 7K bytes - Viewed (0) -
docs/pl/docs/index.md
app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: Union[str, None] = None): return {"item_id": item_id, "q": q} ``` <details markdown="1"> <summary>Albo użyj <code>async def</code>...</summary> Jeżeli twój kod korzysta z `async` / `await`, użyj `async def`: ```Python hl_lines="9 14"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Mon Apr 29 05:18:04 GMT 2024 - 19.4K bytes - Viewed (0) -
docs/ru/docs/index.md
app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: Union[str, None] = None): return {"item_id": item_id, "q": q} ``` <details markdown="1"> <summary>Или используйте <code>async def</code>...</summary> Если ваш код использует `async` / `await`, используйте `async def`: ```Python hl_lines="9 14"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Mon Apr 29 05:18:04 GMT 2024 - 25.8K bytes - Viewed (0) -
docs/it/docs/index.md
app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: str = Optional[None]): return {"item_id": item_id, "q": q} ``` <details markdown="1"> <summary>Oppure usa <code>async def</code>...</summary> Se il tuo codice usa `async` / `await`, allora usa `async def`: ```Python hl_lines="7 12"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 23:58:47 GMT 2024 - 19.3K bytes - Viewed (0) -
docs/zh/docs/index.md
app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: Union[str, None] = None): return {"item_id": item_id, "q": q} ``` <details markdown="1"> <summary>或者使用 <code>async def</code>...</summary> 如果你的代码里会出现 `async` / `await`,请使用 `async def`: ```Python hl_lines="9 14" from typing import Union
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Mon Apr 29 05:18:04 GMT 2024 - 18.2K bytes - Viewed (0) -
docs/ja/docs/tutorial/background-tasks.md
**FastAPI** は、`BackgroundTasks` 型のオブジェクトを作成し、そのパラメーターに渡します。 ## タスク関数の作成 バックグラウンドタスクとして実行される関数を作成します。 これは、パラメーターを受け取ることができる単なる標準的な関数です。 これは `async def` または通常の `def` 関数であり、**FastAPI** はこれを正しく処理します。 ここで、タスク関数はファイル書き込みを実行します (メール送信のシミュレーション)。 また、書き込み操作では `async` と `await` を使用しないため、通常の `def` で関数を定義します。 ```Python hl_lines="6-9" {!../../../docs_src/background_tasks/tutorial001.py!} ``` ## バックグラウンドタスクの追加
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Mon Jan 15 16:12:39 GMT 2024 - 6.1K bytes - Viewed (0) -
docs/de/docs/tutorial/dependencies/sub-dependencies.md
=== "Python 3.8+" ```Python hl_lines="1" async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]): return {"fresh_value": fresh_value} ``` === "Python 3.8+ nicht annotiert" !!! tip "Tipp" Bevorzugen Sie die `Annotated`-Version, falls möglich. ```Python hl_lines="1" async def needy_dependency(fresh_value: str = Depends(get_value, use_cache=False)):
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Mar 30 18:09:48 GMT 2024 - 6.3K bytes - Viewed (0) -
docs/zh/docs/tutorial/sql-databases.md
### 关于 `def` 对比 `async def` *在这里,我们在路径操作函数*和依赖项中都使用着 SQLAlchemy 模型,它将与外部数据库进行通信。 这会需要一些“等待时间”。 但是由于 SQLAlchemy 不具有`await`直接使用的兼容性,因此类似于: ```Python user = await db.query(User).first() ``` ...相反,我们可以使用: ```Python user = db.query(User).first() ``` 然后我们应该声明*路径操作函数*和不带 的依赖关系`async def`,只需使用普通的`def`,如下: ```Python hl_lines="2"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 27K bytes - Viewed (0) -
docs/en/docs/tutorial/testing.md
```Python hl_lines="2 12 15-18" {!../../../docs_src/app_testing/tutorial001.py!} ``` !!! tip Notice that the testing functions are normal `def`, not `async def`. And the calls to the client are also normal calls, not using `await`. This allows you to use `pytest` directly without complications. !!! note "Technical Details"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 6.2K bytes - Viewed (0)