From afab0257fcc8f80dcaeeef0b5ba6bb31295846e3 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 15 Oct 2023 13:39:48 +0200 Subject: [PATCH 1/2] Fix typing for app_context. --- src/antsibull_core/app_context.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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]: ... From 0b9fc9a260e1d5dfd9e88ec7caddd7ba6cc29aa8 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 15 Oct 2023 13:48:07 +0200 Subject: [PATCH 2/2] Add changelog fragment. --- changelogs/fragments/109-typing.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/109-typing.yml 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)."