- Sort Score
- Num 10 results
- Language All
Results 11 - 20 of 1,598 for yield (0.02 seconds)
-
docs/tr/docs/tutorial/dependencies/dependencies-with-yield.md
# `yield` ile Dependency'ler { #dependencies-with-yield } FastAPI, işini bitirdikten sonra <dfn title='bazen "exit code", "cleanup code", "teardown code", "closing code", "context manager exit code" vb. olarak da adlandırılır'>ek adımlar</dfn> çalıştıran dependency'leri destekler. Bunu yapmak için `return` yerine `yield` kullanın ve ek adımları (kodu) `yield` satırından sonra yazın. /// tip | İpucu
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 07:53:17 GMT 2026 - 13.4K bytes - Click Count (0) -
docs/uk/docs/tutorial/dependencies/dependencies-with-yield.md
# Залежності з yield { #dependencies-with-yield } FastAPI підтримує залежності, які виконують деякі <dfn title='інколи також називається «код виходу», «код очищення», «код завершення», «код закриття», «код виходу менеджера контексту» тощо'>додаткові кроки після завершення</dfn>. Щоб це зробити, використовуйте `yield` замість `return` і напишіть додаткові кроки (код) після нього. /// tip | ПорадаCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:27:41 GMT 2026 - 18.4K bytes - Click Count (0) -
src/bytes/iter.go
} if !yield(line[:len(line):len(line)]) { return } } } } // splitSeq is SplitSeq or SplitAfterSeq, configured by how many // bytes of sep to include in the results (none or all). func splitSeq(s, sep []byte, sepSave int) iter.Seq[[]byte] { return func(yield func([]byte) bool) { if len(sep) == 0 { for len(s) > 0 { _, size := utf8.DecodeRune(s) if !yield(s[:size:size]) { returnCreated: Tue Apr 07 11:13:11 GMT 2026 - Last Modified: Wed Sep 03 14:04:47 GMT 2025 - 3.6K bytes - Click Count (0) -
tests/test_sse.py
yield ServerSentEvent(comment="just a comment") yield ServerSentEvent(data="retry-test", retry=5000) @app.get("/items/stream-mixed", response_class=EventSourceResponse) async def sse_items_mixed() -> AsyncIterable[Item]: yield items[0] yield ServerSentEvent(data="custom-event", event="special") yield items[1] @app.get("/items/stream-string", response_class=EventSourceResponse)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 09:21:52 GMT 2026 - 9.8K bytes - Click Count (0) -
fastapi/.agents/skills/fastapi/references/streaming.md
## Stream JSON Lines To stream JSON Lines, declare the return type and use `yield` to return the data. ```python @app.get("/items/stream") async def stream_items() -> AsyncIterable[Item]: for item in items: yield item ``` ## Server-Sent Events (SSE) To stream Server-Sent Events, use `response_class=EventSourceResponse` and `yield` items from the endpoint.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 10:05:57 GMT 2026 - 2.5K bytes - Click Count (0) -
tests/test_dependency_yield_scope.py
class Session: def __init__(self) -> None: self.open = True def dep_session() -> Any: s = Session() yield s s.open = False def raise_after_yield() -> Any: yield raise HTTPException(status_code=503, detail="Exception after yield") SessionFuncDep = Annotated[Session, Depends(dep_session, scope="function")]Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 6.7K bytes - Click Count (0) -
docs_src/stream_data/tutorial002_py310.py
with read_image() as image_file: for chunk in image_file: yield chunk @app.get("/image/stream-no-async", response_class=PNGStreamingResponse) def stream_image_no_async() -> Iterable[bytes]: with read_image() as image_file: for chunk in image_file: yield chunk @app.get("/image/stream-no-async-yield-from", response_class=PNGStreamingResponse)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Feb 27 20:51:40 GMT 2026 - 5.6K bytes - Click Count (0) -
tests/test_dependency_after_yield_raise.py
class CustomError(Exception): pass def catching_dep() -> Any: try: yield "s" except CustomError as err: raise HTTPException(status_code=418, detail="Session error") from err def broken_dep() -> Any: yield "s" raise ValueError("Broken after yield") app = FastAPI() @app.get("/catching") def catching(d: Annotated[str, Depends(catching_dep)]) -> Any:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 1.7K bytes - Click Count (0) -
docs/ja/docs/advanced/advanced-dependencies.md
バージョン 0.121.0 で、`yield` を使う依存関係に対して `Depends(scope="function")` がサポートされました。 `Depends(scope="function")` を使うと、`yield` の後の終了コードは、クライアントへレスポンスが返される前、*path operation 関数* が終了した直後に実行されます。 そして、`Depends(scope="request")`(デフォルト)を使う場合、`yield` の後の終了コードはレスポンス送信後に実行されます。 詳しくはドキュメント「[`yield` を使う依存関係 - 早期終了と `scope`](../tutorial/dependencies/dependencies-with-yield.md#early-exit-and-scope)」を参照してください。
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 11.4K bytes - Click Count (0) -
tests/test_stream_json_validation_error.py
@app.get("/items/stream-invalid") async def stream_items_invalid() -> AsyncIterable[Item]: yield {"name": "valid", "price": 1.0} yield {"name": "invalid", "price": "not-a-number"} @app.get("/items/stream-invalid-sync") def stream_items_invalid_sync() -> Iterable[Item]: yield {"name": "valid", "price": 1.0} yield {"name": "invalid", "price": "not-a-number"} client = TestClient(app)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Feb 27 18:56:47 GMT 2026 - 991 bytes - Click Count (0)