Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 29, 2024
1 parent ac330de commit 9b61cf9
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 44 deletions.
1 change: 1 addition & 0 deletions scripts/release.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Release script.
"""

import argparse
import sys
from subprocess import check_call
Expand Down
1 change: 1 addition & 0 deletions src/pluggy/_callers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Call loop machinery
"""

Check warning on line 4 in src/pluggy/_callers.py

View check run for this annotation

Codecov / codecov/patch

src/pluggy/_callers.py#L4

Added line #L4 was not covered by tests
from __future__ import annotations

import warnings
Expand Down
16 changes: 6 additions & 10 deletions src/pluggy/_hooks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Internal hook annotation, representation and calling machinery.
"""

Check warning on line 4 in src/pluggy/_hooks.py

View check run for this annotation

Codecov / codecov/patch

src/pluggy/_hooks.py#L4

Added line #L4 was not covered by tests
from __future__ import annotations

import inspect
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -172,8 +171,7 @@ def __call__(
trylast: bool = ...,
specname: str | None = ...,
wrapper: bool = ...,
) -> _F:
...
) -> _F: ...

@overload # noqa: F811
def __call__( # noqa: F811
Expand All @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/pluggy/_result.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Hook wrapper "result" utilities.
"""

Check warning on line 4 in src/pluggy/_result.py

View check run for this annotation

Codecov / codecov/patch

src/pluggy/_result.py#L4

Added line #L4 was not covered by tests
from __future__ import annotations

from types import TracebackType
Expand Down
1 change: 1 addition & 0 deletions src/pluggy/_tracing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Tracing utils
"""

Check warning on line 4 in src/pluggy/_tracing.py

View check run for this annotation

Codecov / codecov/patch

src/pluggy/_tracing.py#L4

Added line #L4 was not covered by tests
from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions testing/benchmark.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Benchmarking and performance tests.
"""

import pytest

from pluggy import HookimplMarker
Expand Down
27 changes: 9 additions & 18 deletions testing/test_hookcaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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]

Expand All @@ -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]

Expand All @@ -290,8 +282,7 @@ def m12():
]

@addmeth()
def m13() -> None:
...
def m13() -> None: ...

assert funcs(hc.get_hookimpls()) == [
m9,
Expand Down
25 changes: 9 additions & 16 deletions testing/test_pluginmanager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
``PluginManager`` unit and public API testing.
"""

import importlib.metadata
from typing import Any
from typing import List
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9b61cf9

Please sign in to comment.