On this page
typing.ContextManager
Prev: typing.Container | Up: typing | Next: typing.Coroutine
Rel: typing.AbstractSet, typing.Annotated, typing.Any, typing.assert_never
Ref: docs.python.org — typing.ContextManager
Tags: #public #python3 #stdlib #typing
Import
import typing
from typing import ContextManager
Signature & Overview
typing.ContextManager(*args, **kwargs)
Deprecated alias to contextlib.AbstractContextManager.
Usage
from typing import ContextManager
# Deprecated alias for contextlib.AbstractContextManager (Python 3.9+)
assert ContextManager[int] is not None
Gotchas
- Prefer
contextlib.AbstractContextManager[T]in Python 3.9+.
REPL Inspect
from typing import ContextManager
help(ContextManager)
Linked from
Related notes
- tuts/python3/stdlib_module/typing/Container Linked here; links to this page; shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/Coroutine Linked here; links to this page; shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/typing/AbstractSet Linked here; shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/Annotated Linked here; shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/Any Linked here; shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/assert_never Linked here; shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/assert_type shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/AsyncContextManager shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/AsyncGenerator shared tags: #stdlib, #typing