From e93b49e109c75a1a32e449117f6fc4db07564259 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 18:03:49 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pycqa/isort: 5.10.1 → 5.13.2](https://github.com/pycqa/isort/compare/5.10.1...5.13.2) - [github.com/psf/black: 22.3.0 → 24.10.0](https://github.com/psf/black/compare/22.3.0...24.10.0) - [github.com/PyCQA/flake8: 4.0.1 → 7.1.1](https://github.com/PyCQA/flake8/compare/4.0.1...7.1.1) - [github.com/pre-commit/mirrors-mypy: v0.950 → v1.14.0](https://github.com/pre-commit/mirrors-mypy/compare/v0.950...v1.14.0) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5bd8813..4d14d67 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,17 +1,17 @@ repos: - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 24.10.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + rev: 7.1.1 hooks: - id: flake8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v0.950" + rev: "v1.14.0" hooks: - id: mypy From 95df179123caa9e97e84259bc28e4271bedb6422 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 18:03:59 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- napari_plugin_engine/callers.py | 1 + napari_plugin_engine/dist.py | 6 ++---- napari_plugin_engine/hooks.py | 1 + napari_plugin_engine/markers.py | 1 + setup.py | 1 + testing/conftest.py | 3 +-- testing/test_details.py | 3 +-- testing/test_discovery.py | 18 ++++++------------ testing/test_pluginmanager.py | 1 + testing/test_testsupport.py | 6 ++---- 10 files changed, 17 insertions(+), 24 deletions(-) diff --git a/napari_plugin_engine/callers.py b/napari_plugin_engine/callers.py index 81b5436..27bbdee 100644 --- a/napari_plugin_engine/callers.py +++ b/napari_plugin_engine/callers.py @@ -1,4 +1,5 @@ """Call loop machinery.""" + import sys from types import TracebackType from typing import Any, List, Optional, Tuple, Type, Union diff --git a/napari_plugin_engine/dist.py b/napari_plugin_engine/dist.py index 43390c1..0f23e25 100644 --- a/napari_plugin_engine/dist.py +++ b/napari_plugin_engine/dist.py @@ -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 diff --git a/napari_plugin_engine/hooks.py b/napari_plugin_engine/hooks.py index 0bf47ce..501828a 100644 --- a/napari_plugin_engine/hooks.py +++ b/napari_plugin_engine/hooks.py @@ -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 diff --git a/napari_plugin_engine/markers.py b/napari_plugin_engine/markers.py index 9d42994..81d9350 100644 --- a/napari_plugin_engine/markers.py +++ b/napari_plugin_engine/markers.py @@ -1,4 +1,5 @@ """Hook annotation decorators""" + from typing import Callable, Optional from .implementation import HookImplementation, HookSpecification diff --git a/setup.py b/setup.py index 25cd27b..d5b9b13 100644 --- a/setup.py +++ b/setup.py @@ -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( diff --git a/testing/conftest.py b/testing/conftest.py index c62106d..9e65533 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -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 diff --git a/testing/test_details.py b/testing/test_details.py index 3811cf3..7584df8 100644 --- a/testing/test_details.py +++ b/testing/test_details.py @@ -91,8 +91,7 @@ def myhook(self, arg1): def test_repr(): class Hook: @hookspec - def myhook(arg): - ... + def myhook(arg): ... class Plugin: @hookimpl diff --git a/testing/test_discovery.py b/testing/test_discovery.py index a5c88e7..f465efd 100644 --- a/testing/test_discovery.py +++ b/testing/test_discovery.py @@ -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_' @@ -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 @@ -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 @@ -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 @@ -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 @@ -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_' diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py index 942e8a9..d95ab0c 100644 --- a/testing/test_pluginmanager.py +++ b/testing/test_pluginmanager.py @@ -1,6 +1,7 @@ """ ``PluginManager`` unit and public API testing. """ + import pytest from napari_plugin_engine import ( diff --git a/testing/test_testsupport.py b/testing/test_testsupport.py index 9948dd7..06313aa 100644 --- a/testing/test_testsupport.py +++ b/testing/test_testsupport.py @@ -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') @@ -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()