Skip to content

mode.utils.contexts

Context manager utilities.

asyncnullcontext

Bases: AbstractAsyncContextManager

Context for async-with statement doing nothing.

Source code in mode/utils/contexts.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class asyncnullcontext(AbstractAsyncContextManager):
    """Context for async-with statement doing nothing."""

    enter_result: Any

    def __init__(self, enter_result: Any = None) -> None:
        self.enter_result = enter_result

    async def __aenter__(self) -> Any:
        return self.enter_result

    async def __aexit__(
        self,
        exc_type: Optional[Type[BaseException]] = None,
        exc_val: Optional[BaseException] = None,
        exc_tb: Optional[TracebackType] = None,
    ) -> None: ...