- Sort Score
- Num 10 results
- Language All
Results 211 - 220 of 784 for badsync (0.04 seconds)
-
docs/fr/docs/tutorial/server-sent-events.md
/// ### Fonctions de chemin d'accès non async { #non-async-path-operation-functions } Vous pouvez aussi utiliser des fonctions `def` normales (sans `async`), et utiliser `yield` de la même façon. FastAPI s’assure qu’elles s’exécutent correctement pour ne pas bloquer la boucle d’événements. Dans ce cas la fonction n’est pas async, le type de retour approprié serait `Iterable[Item]` :Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:33:45 GMT 2026 - 5.3K bytes - Click Count (0) -
tests/test_request_params/test_header/test_optional_str.py
# Without aliases @app.get("/optional-str") async def read_optional_str(p: Annotated[str | None, Header()] = None): return {"p": p} class HeaderModelOptionalStr(BaseModel): p: str | None = None @app.get("/model-optional-str") async def read_model_optional_str(p: Annotated[HeaderModelOptionalStr, Header()]): return {"p": p.p}
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 8.5K bytes - Click Count (0) -
tests/test_param_include_in_schema.py
from fastapi.testclient import TestClient from inline_snapshot import snapshot app = FastAPI() @app.get("/hidden_cookie") async def hidden_cookie( hidden_cookie: str | None = Cookie(default=None, include_in_schema=False), ): return {"hidden_cookie": hidden_cookie} @app.get("/hidden_header") async def hidden_header( hidden_header: str | None = Header(default=None, include_in_schema=False), ):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 8.6K bytes - Click Count (0) -
docs/zh/docs/advanced/stream-data.md
### 文件与异步 { #files-and-async } 大多数情况下,类文件对象默认与 async 和 await 不兼容。 例如,它们没有 `await file.read()`,也不支持 `async for chunk in file`。 而且很多情况下,读取它们是一个阻塞操作(可能会阻塞事件循环),因为数据来自磁盘或网络。 /// info | 信息 上面的示例其实是个例外,因为 `io.BytesIO` 对象已经在内存中,所以读取它不会阻塞。 但在许多情况下,读取文件或类文件对象会发生阻塞。 /// 为避免阻塞事件循环,你可以简单地把*路径操作函数*声明为常规的 `def`(而不是 `async def`),这样 FastAPI 会在一个线程池工作线程上运行它,从而避免阻塞主事件循环。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:29:48 GMT 2026 - 5.2K bytes - Click Count (0) -
docs/zh-hant/docs/tutorial/stream-json-lines.md
如果你要回傳的每個 JSON 項目型別都是 `Item`(一個 Pydantic 模型),而且該函式是 async,你可以將回傳型別宣告為 `AsyncIterable[Item]`: {* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[1:24] hl[9:11,22] *} 如果你宣告了回傳型別,FastAPI 會用它來進行資料的**驗證**、在 OpenAPI 中**文件化**、**過濾**,並使用 Pydantic 進行**序列化**。 /// tip 由於 Pydantic 會在 **Rust** 端進行序列化,宣告回傳型別可獲得比未宣告時高得多的**效能**。 /// ### 非 async 的*路徑操作函式* { #non-async-path-operation-functions }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:33:04 GMT 2026 - 4.2K bytes - Click Count (0) -
tests/test_generic_parameterless_depends.py
app = FastAPI() T = TypeVar("T") Dep = Annotated[T, Depends()] class A: pass class B: pass @app.get("/a") async def a(dep: Dep[A]): return {"cls": dep.__class__.__name__} @app.get("/b") async def b(dep: Dep[B]): return {"cls": dep.__class__.__name__} client = TestClient(app) def test_generic_parameterless_depends():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 2K bytes - Click Count (0) -
misc/wasm/wasm_exec.html
(see https://caniuse.com/#feat=textencoder) --> <script src="../../lib/wasm/wasm_exec.js"></script> <script> if (!WebAssembly.instantiateStreaming) { // polyfill WebAssembly.instantiateStreaming = async (resp, importObject) => { const source = await (await resp).arrayBuffer(); return await WebAssembly.instantiate(source, importObject); }; } const go = new Go(); let mod, inst;
Created: Tue Apr 07 11:13:11 GMT 2026 - Last Modified: Fri Aug 30 19:15:21 GMT 2024 - 1.3K bytes - Click Count (0) -
docs/ja/docs/tutorial/dependencies/index.md
これは **大規模なコードベース** で、**同じ依存関係** を **多くの *path operation*** で何度も使う場合に特に役立ちます。 ## `async`にするかどうか { #to-async-or-not-to-async } 依存関係は **FastAPI**(*path operation 関数*と同じ)からも呼び出されるため、関数を定義する際にも同じルールが適用されます。 `async def`や通常の`def`を使用することができます。 また、通常の`def`*path operation 関数*の中に`async def`を入れて依存関係を宣言したり、`async def`*path operation 関数*の中に`def`を入れて依存関係を宣言したりすることなどができます。 それは重要ではありません。**FastAPI** は何をすべきかを知っています。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 11.9K bytes - Click Count (0) -
docs/ko/docs/advanced/stream-data.md
이 예시처럼 메모리 상의 가짜 파일(`io.BytesIO`)이라면 크게 중요하지 않지만, 실제 파일의 경우 작업이 끝난 뒤 파일을 닫는 것이 매우 중요합니다. ### 파일과 비동기 { #files-and-async } 대부분의 경우 파일 유사 객체는 기본적으로 async/await와 호환되지 않습니다. 예를 들어 `await file.read()`나 `async for chunk in file`과 같은 패턴을 지원하지 않습니다. 또한 디스크나 네트워크에서 읽기 때문에, 많은 경우 읽기 작업은 이벤트 루프를 막을 수 있는 블로킹 연산입니다. /// info | 정보Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:56:39 GMT 2026 - 6.2K bytes - Click Count (0) -
tests/test_request_params/test_file/test_optional.py
# Without aliases @app.post("/optional-bytes", operation_id="optional_bytes") async def read_optional_bytes(p: Annotated[bytes | None, File()] = None): return {"file_size": len(p) if p else None} @app.post("/optional-uploadfile", operation_id="optional_uploadfile") async def read_optional_uploadfile(p: Annotated[UploadFile | None, File()] = None): return {"file_size": p.size if p else None}
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Feb 21 13:01:31 GMT 2026 - 9.8K bytes - Click Count (0)