PyDocs

Python Runtime Services

contextlib

Utilities for with-statement contexts.  See PEP 343.
Symbols in contextlib

a

AbstractAsyncContextManager
An abstract base class for asynchronous context managers.
AbstractContextManager
An abstract base class for context managers.
aclosing
Async context manager for safely finalizing an asynchronously cleaned-up resource such as an async generator, calling its ``aclose()`` method.
AsyncContextDecorator
A base class or mixin that enables async context managers to work as decorators.
asynccontextmanager
@asynccontextmanager decorator.
AsyncExitStack
Async context manager for dynamic management of a stack of exit callbacks.

c

chdir
Non thread-safe context manager to change the current working directory.
closing
Context to automatically close something at the end of a block.
ContextDecorator
A base class or mixin that enables context managers to work as decorators.
contextmanager
@contextmanager decorator.

e

ExitStack
Context manager for dynamic management of a stack of exit callbacks.

n

nullcontext
Context manager that does no additional processing.

r

redirect_stderr
Context manager for temporarily redirecting stderr to another file.
redirect_stdout
Context manager for temporarily redirecting stdout to another file.

s

suppress
Context manager to suppress specified exceptions