Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#487)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](astral-sh/ruff-pre-commit@v0.2.2...v0.3.2)
- [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](pre-commit/mirrors-mypy@v1.8.0...v1.9.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed Mar 13, 2024
1 parent c65e5d9 commit afb9f75
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 46 deletions.
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"]
Expand Down Expand Up @@ -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/)
Expand Down
15 changes: 5 additions & 10 deletions src/pluggy/_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -173,8 +171,7 @@ def __call__(
trylast: bool = ...,
specname: str | None = ...,
wrapper: bool = ...,
) -> _F:
...
) -> _F: ...

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

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

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

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

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

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

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

0 comments on commit afb9f75

Please sign in to comment.