How should a context manager be annotated with Python type hints?
import typing @contextlib.contextmanager def foo() -> ???: yield
With my PyCharm, I do the following to make its type hinting work:
from contextlib import contextmanager from typing import ContextManager @contextmanager def session() -> ContextManager[Session]: yield Session(...)