- Sort Score
- Num 10 results
- Language All
Results 71 - 80 of 296 for yielded (0.05 seconds)
-
fastapi/.agents/skills/fastapi/references/dependencies.md
* They need to handle cleanup (e.g., DB sessions, file handles), using dependencies with `yield` * Their logic needs input data from the request, like headers, query parameters, etc. ## Dependencies with `yield` and `scope` When using dependencies with `yield`, they can have a `scope` that defines when the exit code is run.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 10:05:57 GMT 2026 - 3.2K bytes - Click Count (0) -
docs/es/docs/advanced/events.md
Lo primero que hay que notar es que estamos definiendo una función asíncrona con `yield`. Esto es muy similar a las Dependencias con `yield`. {* ../../docs_src/events/tutorial003_py310.py hl[14:19] *} La primera parte de la función, antes del `yield`, será ejecutada **antes** de que la aplicación comience. Y la parte después del `yield` será ejecutada **después** de que la aplicación haya terminado.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:15:55 GMT 2026 - 8.4K bytes - Click Count (0) -
docs/zh-hant/docs/advanced/events.md
也許你要啟動新版本,或只是不想再跑它了。🤷 /// ### Lifespan 函式 { #lifespan-function } 首先要注意的是,我們定義了一個帶有 `yield` 的 async 函式。這和帶有 `yield` 的依賴(Dependencies)非常相似。 {* ../../docs_src/events/tutorial003_py310.py hl[14:19] *} 函式在 `yield` 之前的部分,會在應用啟動前先執行。 `yield` 之後的部分,會在應用結束後再執行。 ### 非同步內容管理器(Async Context Manager) { #async-context-manager } 你會看到這個函式被 `@asynccontextmanager` 裝飾。 它會把函式轉換成所謂的「**非同步內容管理器(async context manager)**」。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 7.2K bytes - Click Count (0) -
tests/test_dependency_contextmanager.py
pass async def asyncgen_state(state: dict[str, str] = Depends(get_state)): state["/async"] = "asyncgen started" yield state["/async"] state["/async"] = "asyncgen completed" def generator_state(state: dict[str, str] = Depends(get_state)): state["/sync"] = "generator started" yield state["/sync"] state["/sync"] = "generator completed"
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 11.5K bytes - Click Count (0) -
docs/zh/docs/advanced/events.md
可能你需要启动一个新版本,或者你只是厌倦了运行它。 🤷 /// ### 生命周期函数 { #lifespan-function } 首先要注意的是,我们定义了一个带有 `yield` 的异步函数。这与带有 `yield` 的依赖项非常相似。 {* ../../docs_src/events/tutorial003_py310.py hl[14:19] *} 这个函数在 `yield` 之前的部分,会在应用启动前执行。 剩下的部分在 `yield` 之后,会在应用完成后执行。 ### 异步上下文管理器 { #async-context-manager } 如你所见,这个函数有一个装饰器 `@asynccontextmanager`。 它将函数转化为所谓的“**异步上下文管理器**”。 {* ../../docs_src/events/tutorial003_py310.py hl[1,13] *}Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 7.2K bytes - Click Count (0) -
tests/test_dependency_class.py
class CallableGenDependency: def __call__(self, value: str) -> Generator[str, None, None]: yield value class AsyncCallableDependency: async def __call__(self, value: str) -> str: return value class AsyncCallableGenDependency: async def __call__(self, value: str) -> AsyncGenerator[str, None]: yield value class MethodsDependency: def synchronous(self, value: str) -> str:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 4.4K bytes - Click Count (0) -
docs/ja/docs/advanced/stream-data.md
/// tip | 豆知識 async 関数内からブロッキングなコードを呼び出す必要がある場合、あるいはブロッキングな関数内から async 関数を呼び出す必要がある場合は、FastAPI の兄弟ライブラリである [Asyncer](https://asyncer.tiangolo.com) を利用できます。 /// ### `yield from` { #yield-from } ファイルライクオブジェクトのようなものをイテレートして各要素に対して `yield` している場合、`for` ループを省略して、`yield from` で各要素をそのまま送ることもできます。 これは FastAPI 固有ではなく単なる Python の機能ですが、知っておくと便利な小ワザです。 😎Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:55:22 GMT 2026 - 6.7K bytes - Click Count (0) -
android/guava/src/com/google/common/base/Splitter.java
* that order. * * <p>By default, {@code Splitter}'s behavior is simplistic and unassuming. The following * expression: * * {@snippet : * Splitter.on(',').split(" foo,,, bar ,") * } * * ... yields the substrings {@code [" foo", "", "", " bar ", ""]}. If this is not the desired * behavior, use configuration methods to obtain a <i>new</i> splitter instance with modified * behavior: * * {@snippet :Created: Fri Apr 03 12:43:13 GMT 2026 - Last Modified: Mon Feb 23 19:19:10 GMT 2026 - 23.8K bytes - Click Count (0) -
guava/src/com/google/common/base/Splitter.java
* that order. * * <p>By default, {@code Splitter}'s behavior is simplistic and unassuming. The following * expression: * * {@snippet : * Splitter.on(',').split(" foo,,, bar ,") * } * * ... yields the substrings {@code [" foo", "", "", " bar ", ""]}. If this is not the desired * behavior, use configuration methods to obtain a <i>new</i> splitter instance with modified * behavior: * * {@snippet :Created: Fri Apr 03 12:43:13 GMT 2026 - Last Modified: Mon Feb 23 19:19:10 GMT 2026 - 23.8K bytes - Click Count (0) -
docs_src/dependencies/tutorial013_an_py310.py
def get_session(): with Session(engine) as session: yield session def get_user(user_id: int, session: Annotated[Session, Depends(get_session)]): user = session.get(User, user_id) if not user: raise HTTPException(status_code=403, detail="Not authorized") def generate_stream(query: str): for ch in query: yield ch time.sleep(0.1)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Mon Sep 29 03:29:38 GMT 2025 - 937 bytes - Click Count (0)