From 78431e1dde7caa1daa77db96c56aee5657a241ac Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 19 Sep 2023 20:07:50 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pluggy/_callers.py | 4 +++- src/pluggy/_hooks.py | 9 ++------- src/pluggy/_result.py | 6 ++++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/pluggy/_callers.py b/src/pluggy/_callers.py index 77ce1d0f..0d4b81b6 100644 --- a/src/pluggy/_callers.py +++ b/src/pluggy/_callers.py @@ -2,10 +2,12 @@ Call loop machinery """ from __future__ import annotations + from ._hooks import HookImpl from ._result import _raise_wrapfail from ._result import HookCallError from ._result import Result + TYPE_CHECKING = False if TYPE_CHECKING: from typing import cast @@ -17,7 +19,7 @@ # Need to distinguish between old- and new-style hook wrappers. # Wrapping one a singleton tuple is the fastest type-safe way I found to do it. - Teardown = Union[ + Teardown = Union[ Tuple[Generator[None, Result[object], None]], Generator[None, object, object], ] diff --git a/src/pluggy/_hooks.py b/src/pluggy/_hooks.py index dd3a13c9..1ac74bd0 100644 --- a/src/pluggy/_hooks.py +++ b/src/pluggy/_hooks.py @@ -30,7 +30,6 @@ from ._result import Result - _T = TypeVar("_T") _F = TypeVar("_F", bound=Callable[..., object]) _Namespace = Union[ModuleType, type] @@ -41,7 +40,6 @@ _HookImplFunction = Callable[..., Union[_T, Generator[None, Result[_T], None]]] _CallHistory = List[Tuple[Mapping[str, object], Optional[Callable[[Any], None]]]] - class HookspecOpts(TypedDict): """Options for a hook specification.""" @@ -52,7 +50,6 @@ class HookspecOpts(TypedDict): #: Whether the hook :ref:`warns when implemented `. warn_on_impl: Warning | None - class HookimplOpts(TypedDict): """Options for a hook implementation.""" @@ -74,11 +71,11 @@ class HookimplOpts(TypedDict): specname: str | None else: + def final(func: _F) -> _F: return func - overload = final - + overload = final @final @@ -377,8 +374,6 @@ def __getattr__(self, name: str) -> HookCaller: _HookRelay = HookRelay - - class HookCaller: """A caller of all registered implementations of a hook specification.""" diff --git a/src/pluggy/_result.py b/src/pluggy/_result.py index d17993c7..b3f21f3b 100644 --- a/src/pluggy/_result.py +++ b/src/pluggy/_result.py @@ -2,6 +2,7 @@ Hook wrapper "result" utilities. """ from __future__ import annotations + TYPE_CHECKING = False if TYPE_CHECKING: from types import TracebackType @@ -16,7 +17,6 @@ from typing import Type from typing import TypeVar - _ExcInfo = Tuple[Type[BaseException], BaseException, Optional[TracebackType]] ResultType = TypeVar("ResultType") else: @@ -24,8 +24,10 @@ class Generic: """fake generic""" - def __class_getitem__(cls, key)-> type[object]: + + def __class_getitem__(cls, key) -> type[object]: return object + ResultType = "ResultType"