How should a context manager be annotated with Python type hints?
import typing @contextlib.contextmanager def foo() -> ???: yield
The return type of the function wrapped by a context manager is Iterator[None].
Iterator[None]
from contextlib import contextmanager from typing import Iterator @contextmanager def foo() -> Iterator[None]: yield