diff --git a/scripts/release.py b/scripts/release.py index 912d9822..ab94d4a8 100644 --- a/scripts/release.py +++ b/scripts/release.py @@ -1,6 +1,7 @@ """ Release script. """ + import argparse import sys from subprocess import check_call diff --git a/src/pluggy/_callers.py b/src/pluggy/_callers.py index 787f56ba..cf9d014d 100644 --- a/src/pluggy/_callers.py +++ b/src/pluggy/_callers.py @@ -1,6 +1,7 @@ """ Call loop machinery """ + from __future__ import annotations import warnings diff --git a/src/pluggy/_hooks.py b/src/pluggy/_hooks.py index 7c8420f4..f5c36bd5 100644 --- a/src/pluggy/_hooks.py +++ b/src/pluggy/_hooks.py @@ -1,6 +1,7 @@ """ Internal hook annotation, representation and calling machinery. """ + from __future__ import annotations import inspect @@ -91,8 +92,7 @@ def __call__( firstresult: bool = False, historic: bool = False, warn_on_impl: Warning | None = None, - ) -> _F: - ... + ) -> _F: ... @overload # noqa: F811 def __call__( # noqa: F811 @@ -101,8 +101,7 @@ def __call__( # noqa: F811 firstresult: bool = ..., historic: bool = ..., warn_on_impl: Warning | None = ..., - ) -> Callable[[_F], _F]: - ... + ) -> Callable[[_F], _F]: ... def __call__( # noqa: F811 self, @@ -172,8 +171,7 @@ def __call__( trylast: bool = ..., specname: str | None = ..., wrapper: bool = ..., - ) -> _F: - ... + ) -> _F: ... @overload # noqa: F811 def __call__( # noqa: F811 @@ -185,8 +183,7 @@ def __call__( # noqa: F811 trylast: bool = ..., specname: str | None = ..., wrapper: bool = ..., - ) -> Callable[[_F], _F]: - ... + ) -> Callable[[_F], _F]: ... def __call__( # noqa: F811 self, @@ -356,8 +353,7 @@ def __init__(self) -> None: if TYPE_CHECKING: - def __getattr__(self, name: str) -> HookCaller: - ... + def __getattr__(self, name: str) -> HookCaller: ... # Historical name (pluggy<=1.2), kept for backward compatibility. diff --git a/src/pluggy/_result.py b/src/pluggy/_result.py index aa21fa13..f9a081c4 100644 --- a/src/pluggy/_result.py +++ b/src/pluggy/_result.py @@ -1,6 +1,7 @@ """ Hook wrapper "result" utilities. """ + from __future__ import annotations from types import TracebackType diff --git a/src/pluggy/_tracing.py b/src/pluggy/_tracing.py index de1e13a7..cd238ad7 100644 --- a/src/pluggy/_tracing.py +++ b/src/pluggy/_tracing.py @@ -1,6 +1,7 @@ """ Tracing utils """ + from __future__ import annotations from typing import Any diff --git a/testing/benchmark.py b/testing/benchmark.py index 906d8fe5..d13e50aa 100644 --- a/testing/benchmark.py +++ b/testing/benchmark.py @@ -1,6 +1,7 @@ """ Benchmarking and performance tests. """ + import pytest from pluggy import HookimplMarker diff --git a/testing/test_hookcaller.py b/testing/test_hookcaller.py index 9eb6f979..df7a2b81 100644 --- a/testing/test_hookcaller.py +++ b/testing/test_hookcaller.py @@ -211,20 +211,17 @@ def m1(): assert funcs(hc.get_hookimpls()) == [m1] @addmeth() - def m2() -> None: - ... + def m2() -> None: ... assert funcs(hc.get_hookimpls()) == [m2, m1] @addmeth(trylast=True) - def m3() -> None: - ... + def m3() -> None: ... assert funcs(hc.get_hookimpls()) == [m3, m2, m1] @addmeth(hookwrapper=True) - def m4() -> None: - ... + def m4() -> None: ... assert funcs(hc.get_hookimpls()) == [m3, m2, m1, m4] @@ -235,14 +232,12 @@ def m5(): assert funcs(hc.get_hookimpls()) == [m3, m2, m1, m4, m5] @addmeth(tryfirst=True) - def m6() -> None: - ... + def m6() -> None: ... assert funcs(hc.get_hookimpls()) == [m3, m2, m6, m1, m4, m5] @addmeth() - def m7() -> None: - ... + def m7() -> None: ... assert funcs(hc.get_hookimpls()) == [m3, m2, m7, m6, m1, m4, m5] @@ -253,20 +248,17 @@ def m8(): assert funcs(hc.get_hookimpls()) == [m3, m2, m7, m6, m1, m4, m8, m5] @addmeth(trylast=True) - def m9() -> None: - ... + def m9() -> None: ... assert funcs(hc.get_hookimpls()) == [m9, m3, m2, m7, m6, m1, m4, m8, m5] @addmeth(tryfirst=True) - def m10() -> None: - ... + def m10() -> None: ... assert funcs(hc.get_hookimpls()) == [m9, m3, m2, m7, m6, m10, m1, m4, m8, m5] @addmeth(hookwrapper=True, trylast=True) - def m11() -> None: - ... + def m11() -> None: ... assert funcs(hc.get_hookimpls()) == [m9, m3, m2, m7, m6, m10, m11, m1, m4, m8, m5] @@ -290,8 +282,7 @@ def m12(): ] @addmeth() - def m13() -> None: - ... + def m13() -> None: ... assert funcs(hc.get_hookimpls()) == [ m9, diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py index d3bcac4e..5208c90c 100644 --- a/testing/test_pluginmanager.py +++ b/testing/test_pluginmanager.py @@ -1,6 +1,7 @@ """ ``PluginManager`` unit and public API testing. """ + import importlib.metadata from typing import Any from typing import List @@ -176,8 +177,7 @@ def he_method1(self): def test_register(pm: PluginManager) -> None: class MyPlugin: @hookimpl - def he_method1(self): - ... + def he_method1(self): ... my = MyPlugin() pm.register(my) @@ -251,8 +251,7 @@ def he_method1(self, arg): def test_historic_with_subset_hook_caller(pm: PluginManager) -> None: class Hooks: @hookspec(historic=True) - def he_method1(self, arg): - ... + def he_method1(self, arg): ... pm.add_hookspecs(Hooks) @@ -515,33 +514,27 @@ class PluginNo: def test_get_hookcallers(pm: PluginManager) -> None: class Hooks: @hookspec - def he_method1(self): - ... + def he_method1(self): ... @hookspec - def he_method2(self): - ... + def he_method2(self): ... pm.add_hookspecs(Hooks) class Plugin1: @hookimpl - def he_method1(self): - ... + def he_method1(self): ... @hookimpl - def he_method2(self): - ... + def he_method2(self): ... class Plugin2: @hookimpl - def he_method1(self): - ... + def he_method1(self): ... class Plugin3: @hookimpl - def he_method2(self): - ... + def he_method2(self): ... plugin1 = Plugin1() pm.register(plugin1)