Skip to content

[pre-commit.ci] pre-commit autoupdate #487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.2.2"
rev: "v0.3.2"
hooks:
- id: ruff
args: ["--fix"]
@@ -43,7 +43,7 @@ repos:
language: python
additional_dependencies: [pygments, restructuredtext_lint]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
files: ^(src/|testing/)
15 changes: 5 additions & 10 deletions src/pluggy/_hooks.py
Original file line number Diff line number Diff line change
@@ -92,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
@@ -102,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,
@@ -173,8 +171,7 @@ def __call__(
trylast: bool = ...,
specname: str | None = ...,
wrapper: bool = ...,
) -> _F:
...
) -> _F: ...

@overload # noqa: F811
def __call__( # noqa: F811
@@ -186,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,
@@ -357,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.
27 changes: 9 additions & 18 deletions testing/test_hookcaller.py
Original file line number Diff line number Diff line change
@@ -212,20 +212,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]

@@ -236,14 +233,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]

@@ -254,20 +249,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]

@@ -291,8 +283,7 @@ def m12():
]

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

assert funcs(hc.get_hookimpls()) == [
m9,
24 changes: 8 additions & 16 deletions testing/test_pluginmanager.py
Original file line number Diff line number Diff line change
@@ -181,8 +181,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)
@@ -256,8 +255,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)

@@ -520,33 +518,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)