- Sort Score
- Result 10 results
- Languages All
Results 1 - 4 of 4 for asynccontextmanager (0.58 sec)
-
docs/en/docs/tutorial/dependencies/dependencies-with-yield.md
* <a href="https://docs.python.org/3/library/contextlib.html#contextlib.asynccontextmanager" class="external-link" target="_blank">`@contextlib.asynccontextmanager`</a> would be valid to use as a **FastAPI** dependency. In fact, FastAPI uses those two decorators internally. ///
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 12.7K bytes - Viewed (0) -
docs/en/docs/advanced/events.md
And the part after the `yield` will be executed **after** the application has finished. ### Async Context Manager { #async-context-manager } If you check, the function is decorated with an `@asynccontextmanager`. That converts the function into something called an "**async context manager**". {* ../../docs_src/events/tutorial003.py hl[1,13] *}
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 7.9K bytes - Viewed (0) -
docs/ko/docs/advanced/events.md
{* ../../docs_src/events/tutorial003.py hl[14:19] *} 함수의 첫 번째 부분, 즉 `yield` 이전의 코드는 애플리케이션이 시작되기 **전에** 실행됩니다. 그리고 `yield` 이후의 부분은 애플리케이션이 완료된 후 **나중에** 실행됩니다. ### 비동기 컨텍스트 매니저 함수를 확인해보면, `@asynccontextmanager`로 장식되어 있습니다. 이것은 함수를 "**비동기 컨텍스트 매니저**"라고 불리는 것으로 변환시킵니다. {* ../../docs_src/events/tutorial003.py hl[1,13] *} 파이썬에서 **컨텍스트 매니저**는 `with` 문에서 사용할 수 있는 것입니다. 예를 들어, `open()`은 컨텍스트 매니저로 사용할 수 있습니다:
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Fri May 30 13:33:53 UTC 2025 - 9.2K bytes - Viewed (0) -
docs/en/docs/release-notes.md
For example: ```Python from contextlib import asynccontextmanager from fastapi import FastAPI def fake_answer_to_everything_ml_model(x: float): return x * 42 ml_models = {} @asynccontextmanager async def lifespan(app: FastAPI): # Load the ML model
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Fri Sep 05 12:48:45 UTC 2025 - 544.1K bytes - Viewed (0)