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 Aug 5, 2024
1 parent 036d548 commit 142d256
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 24 deletions.
1 change: 1 addition & 0 deletions napari_plugin_engine/callers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Call loop machinery."""

import sys
from types import TracebackType
from typing import Any, List, Optional, Tuple, Type, Union
Expand Down
6 changes: 2 additions & 4 deletions napari_plugin_engine/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,13 @@ def get_version(plugin) -> str:


@overload
def get_metadata(plugin, arg: str, *args: None) -> Optional[str]:
...
def get_metadata(plugin, arg: str, *args: None) -> Optional[str]: ...


@overload # noqa: F811
def get_metadata( # noqa: F811
plugin, arg: str, *args: str
) -> Dict[str, Optional[str]]:
...
) -> Dict[str, Optional[str]]: ...


def get_metadata(plugin, *args): # noqa: F811
Expand Down
1 change: 1 addition & 0 deletions napari_plugin_engine/hooks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Internal hook annotation, representation and calling machinery.
"""

import warnings
from collections.abc import Sequence
from typing import Any, Callable, List, Optional, Union
Expand Down
1 change: 1 addition & 0 deletions napari_plugin_engine/markers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Hook annotation decorators"""

from typing import Callable, Optional

from .implementation import HookImplementation, HookSpecification
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
PEP 517 doesn’t support editable installs
so this file is currently here to support "pip install -e ."
"""

from setuptools import setup

setup(
Expand Down
3 changes: 1 addition & 2 deletions testing/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ def he_pm(request, pm):

class Hooks:
@hookspec
def he_method1(self, arg):
...
def he_method1(self, arg): ...

pm.add_hookspecs(request.param(Hooks))
return pm
Expand Down
3 changes: 1 addition & 2 deletions testing/test_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ def myhook(self, arg1):
def test_repr():
class Hook:
@hookspec
def myhook(arg):
...
def myhook(arg): ...

class Plugin:
@hookimpl
Expand Down
18 changes: 6 additions & 12 deletions testing/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ def full_plugin_manager(
double_convention_plugin,
):
@add_specification
def test_specification(arg1, arg2):
...
def test_specification(arg1, arg2): ...

test_plugin_manager.discover_entry_point = 'app.plugin'
test_plugin_manager.discover_prefix = 'app_'
Expand Down Expand Up @@ -194,8 +193,7 @@ def test_double_convention(
"""Plugins using both naming convention and entrypoints only register once."""

@add_specification
def test_specification(arg1, arg2):
...
def test_specification(arg1, arg2): ...

assert not test_plugin_manager.plugins

Expand Down Expand Up @@ -241,8 +239,7 @@ def test_plugin_discovery_by_prefix(
"""Make sure discovery by package prefix works"""

@add_specification
def test_specification(arg1, arg2):
...
def test_specification(arg1, arg2): ...

assert test_plugin_manager.hook.test_specification.spec
assert not test_plugin_manager.plugins
Expand Down Expand Up @@ -299,8 +296,7 @@ def test_plugin_discovery_by_entry_point(
invalid_entrypoint_plugin,
):
@add_specification
def test_specification(arg1, arg2):
...
def test_specification(arg1, arg2): ...

hook_caller = test_plugin_manager.hook.test_specification
assert hook_caller.spec
Expand Down Expand Up @@ -383,8 +379,7 @@ def test_lazy_autodiscovery(
with test_plugin_manager.discovery_blocked():

@add_specification
def test_specification(arg1, arg2):
...
def test_specification(arg1, arg2): ...

assert test_plugin_manager.hook._needs_discovery is True

Expand Down Expand Up @@ -436,8 +431,7 @@ def test_env_var_disable(
monkeypatch,
):
@add_specification
def test_specification(arg1, arg2):
...
def test_specification(arg1, arg2): ...

test_plugin_manager.discover_entry_point = 'app.plugin'
test_plugin_manager.discover_prefix = 'app_'
Expand Down
1 change: 1 addition & 0 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 pytest

from napari_plugin_engine import (
Expand Down
6 changes: 2 additions & 4 deletions testing/test_testsupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ def test_spec(test_plugin_manager, add_specification):
assert not hasattr(test_plugin_manager.hook, 'my_spec')

@add_specification
def my_spec(arg1, arg2):
...
def my_spec(arg1, arg2): ...

assert hasattr(test_plugin_manager.hook, 'my_spec')
assert hasattr(test_plugin_manager.hook.my_spec, 'spec')
Expand All @@ -15,8 +14,7 @@ def test_full(test_plugin_manager, add_specification, add_implementation):
assert not relay.items()

@add_specification
def my_spec(arg1, arg2):
...
def my_spec(arg1, arg2): ...

assert hasattr(relay, 'my_spec')
assert not relay.my_spec.get_hookimpls()
Expand Down

0 comments on commit 142d256

Please sign in to comment.