On this page
  1. typing.ContextManager
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

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

REPL Inspect

from typing import ContextManager
help(ContextManager)

Linked from

Related notes