Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 17 for __aexit__ (0.09 seconds)

  1. fastapi/routing.py

        async def __aenter__(self) -> _T:
            return self._cm.__enter__()
    
        async def __aexit__(
            self,
            exc_type: type[BaseException] | None,
            exc_value: BaseException | None,
            traceback: types.TracebackType | None,
        ) -> bool | None:
            return self._cm.__exit__(exc_type, exc_value, traceback)
    
    
    # Vendored from starlette.routing to avoid importing private symbols
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 15 11:44:39 GMT 2026
    - 193K bytes
    - Click Count (0)
  2. fastapi/concurrency.py

    async def contextmanager_in_threadpool(
        cm: AbstractContextManager[_T],
    ) -> AsyncGenerator[_T, None]:
        # blocking __exit__ from running waiting on a free thread
        # can create race conditions/deadlocks if the context manager itself
        # has its own internal pool (e.g. a database connection pool)
        # to avoid this we let __exit__ run without a capacity limit
        # since we're creating a new limiter for each call, any non-zero limit
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 1.5K bytes
    - Click Count (0)
  3. docs_src/dependencies/tutorial010_py310.py

    class MySuperContextManager:
        def __init__(self):
            self.db = DBSession()
    
        def __enter__(self):
            return self.db
    
        def __exit__(self, exc_type, exc_value, traceback):
            self.db.close()
    
    
    async def get_db():
        with MySuperContextManager() as db:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 292 bytes
    - Click Count (0)
  4. tests/test_dependency_class.py

    
    @app.get("/async-callable-gen-dependency-class")
    async def get_async_callable_gen_dependency_class(
        value: str, instance: AsyncCallableGenDependency = Depends()
    ):
        return await instance(value).__anext__()
    
    
    @app.get("/callable-dependency")
    async def get_callable_dependency(value: str = Depends(callable_dependency)):
        return value
    
    
    @app.get("/callable-gen-dependency")
    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)
  5. scripts/people.py

            time.sleep(max(final_wait_time, 1))
    
            self.last_request_start_time = datetime.now(tz=timezone.utc)
            return self
    
        def __exit__(self, exc_type, exc_val, exc_tb) -> None:
            pass
    
        def update_request_info(self, cost: int, remaining: int, reset_at: str) -> None:
            self.last_query_cost = cost
            self.remaining_points = remaining
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Mar 23 13:51:24 GMT 2026
    - 15K bytes
    - Click Count (0)
  6. docs/tr/docs/tutorial/dependencies/dependencies-with-yield.md

    Bu, az çok "ileri seviye" bir fikirdir.
    
    **FastAPI**'ye yeni başlıyorsanız şimdilik bunu atlamak isteyebilirsiniz.
    
    ///
    
    Python'da Context Manager'ları, [iki method'a sahip bir class oluşturarak: `__enter__()` ve `__exit__()`](https://docs.python.org/3/reference/datamodel.html#context-managers) yaratabilirsiniz.
    
    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)
  7. docs/fr/docs/tutorial/dependencies/dependencies-with-yield.md

    Si vous débutez avec **FastAPI**, vous voudrez peut-être l'ignorer pour le moment.
    
    ///
    
    En Python, vous pouvez créer des gestionnaires de contexte en [créant une classe avec deux méthodes : `__enter__()` et `__exit__()`](https://docs.python.org/3/reference/datamodel.html#context-managers).
    
    Vous pouvez également les utiliser dans des dépendances **FastAPI** avec `yield` en utilisant
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:37:13 GMT 2026
    - 13.9K bytes
    - Click Count (0)
  8. docs/uk/docs/tutorial/dependencies/dependencies-with-yield.md

    Це, загалом, «просунута» ідея.
    
    Якщо ви тільки починаєте з **FastAPI**, можливо, варто наразі пропустити це.
    
    ///
    
    У Python ви можете створювати Менеджери контексту, [створивши клас із двома методами: `__enter__()` і `__exit__()`](https://docs.python.org/3/reference/datamodel.html#context-managers).
    
    Ви також можете використовувати їх усередині залежностей **FastAPI** з `yield`, використовуючи
    `with` або `async with` у середині функції залежності:
    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)
  9. docs/es/docs/tutorial/dependencies/dependencies-with-yield.md

    Si apenas estás comenzando con **FastAPI**, podrías querer omitirlo por ahora.
    
    ///
    
    En Python, puedes crear Context Managers [creando una clase con dos métodos: `__enter__()` y `__exit__()`](https://docs.python.org/3/reference/datamodel.html#context-managers).
    
    También puedes usarlos dentro de las dependencias de **FastAPI** con `yield` usando
    `with` o `async with` en la función de dependencia:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:15:55 GMT 2026
    - 13.3K bytes
    - Click Count (0)
  10. docs/zh-hant/docs/tutorial/dependencies/dependencies-with-yield.md

    ### 在含 `yield` 的相依中使用情境管理器 { #using-context-managers-in-dependencies-with-yield }
    
    /// warning
    
    這大致算是一個「進階」概念。
    
    如果你剛開始學習 **FastAPI**,此處可以先跳過。
    
    ///
    
    在 Python 中,你可以透過[建立一個擁有 `__enter__()` 與 `__exit__()` 兩個方法的類別](https://docs.python.org/3/reference/datamodel.html#context-managers)來建立情境管理器。
    
    你也可以在 **FastAPI** 的含 `yield` 相依中,於相依函式內使用 `with` 或 `async with` 陳述式來使用它們:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 11.9K bytes
    - Click Count (0)
Back to Top