diff --git a/changelogs/fragments/109-typing.yml b/changelogs/fragments/109-typing.yml new file mode 100644 index 0000000..3934169 --- /dev/null +++ b/changelogs/fragments/109-typing.yml @@ -0,0 +1,2 @@ +bugfixes: + - "Fix typing for ``antsibull_core.app_context.app_context()`` functions (https://github.com/ansible-community/antsibull-core/pull/109)." diff --git a/src/antsibull_core/app_context.py b/src/antsibull_core/app_context.py index 6520efe..a12c97b 100644 --- a/src/antsibull_core/app_context.py +++ b/src/antsibull_core/app_context.py @@ -107,7 +107,7 @@ def run(args): import contextvars import typing as t from collections.abc import Iterable, Mapping -from contextlib import contextmanager +from contextlib import AbstractContextManager, contextmanager from .schemas.context import AppContext, LibContext from .vendored.collections import ImmutableDict @@ -368,14 +368,12 @@ def lib_context( @t.overload -@contextmanager -def app_context() -> t.ContextManager[AppContext]: +def app_context() -> AbstractContextManager[AppContext]: ... @t.overload -@contextmanager -def app_context(new_context: AppContextT) -> t.ContextManager[AppContextT]: +def app_context(new_context: AppContextT) -> AbstractContextManager[AppContextT]: ...