_AsyncLiftContextManager Class — fastapi Architecture
Architecture documentation for the _AsyncLiftContextManager class in routing.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 8652cc0c_3716_8afc_1202_3bf59e12972d["_AsyncLiftContextManager"] de395a51_26f8_3424_1af0_2f5bef39c893["routing.py"] 8652cc0c_3716_8afc_1202_3bf59e12972d -->|defined in| de395a51_26f8_3424_1af0_2f5bef39c893 f875a222_c671_e932_4b72_a7c44889af1f["__init__()"] 8652cc0c_3716_8afc_1202_3bf59e12972d -->|method| f875a222_c671_e932_4b72_a7c44889af1f 2a5b16ca_bd6f_5811_e6f6_45c174388fc9["__aenter__()"] 8652cc0c_3716_8afc_1202_3bf59e12972d -->|method| 2a5b16ca_bd6f_5811_e6f6_45c174388fc9 e2abb018_56f9_f355_4c0c_bf74922bf538["__aexit__()"] 8652cc0c_3716_8afc_1202_3bf59e12972d -->|method| e2abb018_56f9_f355_4c0c_bf74922bf538
Relationship Graph
Source Code
fastapi/routing.py lines 156–175
class _AsyncLiftContextManager(AbstractAsyncContextManager[_T]):
"""
Wraps a synchronous context manager to make it async.
This is vendored from Starlette to avoid importing private symbols.
"""
def __init__(self, cm: AbstractContextManager[_T]) -> None:
self._cm = cm
async def __aenter__(self) -> _T:
return self._cm.__enter__()
async def __aexit__(
self,
exc_type: Optional[type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[types.TracebackType],
) -> Optional[bool]:
return self._cm.__exit__(exc_type, exc_value, traceback)
Domain
Defined In
Source
Frequently Asked Questions
What is the _AsyncLiftContextManager class?
_AsyncLiftContextManager is a class in the fastapi codebase, defined in fastapi/routing.py.
Where is _AsyncLiftContextManager defined?
_AsyncLiftContextManager is defined in fastapi/routing.py at line 156.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free