Skip to content

Commit

Permalink
ci: [pre-commit.ci] autoupdate (#360)
Browse files Browse the repository at this point in the history
<!--pre-commit.ci start-->
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.6.0 →
v5.0.0](pre-commit/pre-commit-hooks@v4.6.0...v5.0.0)
- [github.com/psf/black: 24.8.0 →
24.10.0](psf/black@24.8.0...24.10.0)
- [github.com/astral-sh/ruff-pre-commit: v0.6.4 →
v0.8.6](astral-sh/ruff-pre-commit@v0.6.4...v0.8.6)
- [github.com/pre-commit/mirrors-mypy: v1.11.2 →
v1.14.1](pre-commit/mirrors-mypy@v1.11.2...v1.14.1)
<!--pre-commit.ci end-->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Draga Doncila Pop <[email protected]>
Co-authored-by: Draga Doncila <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2025
1 parent 0029e21 commit 2f77b9f
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 41 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ exclude: _docs/example_plugin/some_module.py

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-docstring-first
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.4
rev: v0.8.6
hooks:
- id: ruff

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
10 changes: 5 additions & 5 deletions src/npe2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
from .manifest import PackageMetadata, PluginManifest

__all__ = [
"__version__",
"DynamicPlugin",
"fetch_manifest",
"get_manifest_from_wheel",
"PackageMetadata",
"PluginContext",
"PluginManager",
"PluginManifest",
"read_get_reader",
"__version__",
"fetch_manifest",
"get_manifest_from_wheel",
"read",
"write_get_writer",
"read_get_reader",
"write",
"write_get_writer",
]
4 changes: 2 additions & 2 deletions src/npe2/_inspection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

__all__ = [
"NPE2PluginModuleVisitor",
"find_npe2_module_contributions",
"find_npe1_module_contributions",
"compile",
"find_npe1_module_contributions",
"find_npe2_module_contributions",
]
2 changes: 1 addition & 1 deletion src/npe2/_inspection/_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
NPE2_ENTRY_POINT = "napari.manifest"
__all__ = [
"fetch_manifest",
"get_pypi_url",
"get_hub_plugin",
"get_pypi_url",
]


Expand Down
15 changes: 4 additions & 11 deletions src/npe2/_plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,8 @@ def __init__(
pass
else: # pragma: no cover
vsplit = nv.split(".")[:4]
if (
"dev" in nv
and vsplit < ["0", "4", "16", "dev4"]
or "dev" not in nv
and vsplit < ["0", "4", "16"]
if ("dev" in nv and vsplit < ["0", "4", "16", "dev4"]) or (
"dev" not in nv and vsplit < ["0", "4", "16"]
):
self.discover()

Expand Down Expand Up @@ -698,12 +695,8 @@ def get_writer(

for writer in self.iter_compatible_writers(layer_types):
if not plugin_name or writer.command.startswith(plugin_name):
if (
ext
and ext in writer.filename_extensions
or not ext
and len(layer_types) != 1
and not writer.filename_extensions
if (ext and ext in writer.filename_extensions) or (
not ext and len(layer_types) != 1 and not writer.filename_extensions
):
return writer, path
elif not ext and len(layer_types) == 1: # No extension, single layer.
Expand Down
14 changes: 7 additions & 7 deletions src/npe2/_pydantic_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@


__all__ = (
"SHAPE_LIST",
"BaseModel",
"ErrorWrapper",
"Extra",
"Field",
"ValidationError",
"root_validator",
"validator",
"GenericModel",
"ModelMetaclass",
"PrivateAttr",
"ValidationError",
"color",
"conlist",
"constr",
"ModelMetaclass",
"ErrorWrapper",
"GenericModel",
"SHAPE_LIST",
"root_validator",
"validator",
)
2 changes: 1 addition & 1 deletion src/npe2/implements.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def writer(
id: str,
title: str,
layer_types: list[str],
filename_extensions: list[str] = [], # noqa: B006
filename_extensions: list[str] = [],
display_name: str = "",
ensure_args_valid: bool = False,
) -> Callable[[T], T]:
Expand Down
2 changes: 1 addition & 1 deletion src/npe2/manifest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ._package_metadata import PackageMetadata
from .schema import ENTRY_POINT, PluginManifest

__all__ = ["PackageMetadata", "PluginManifest", "ENTRY_POINT"]
__all__ = ["ENTRY_POINT", "PackageMetadata", "PluginManifest"]
6 changes: 3 additions & 3 deletions src/npe2/manifest/contributions/_contributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
from ._writers import WriterContribution

__all__ = [
"ContributionPoints",
"CommandContribution",
"ContributionPoints",
"KeyBindingContribution",
"MenuItem",
"ReaderContribution",
"SampleDataContribution",
"SampleDataGenerator",
"SampleDataURI",
"SubmenuContribution",
"ThemeContribution",
"WidgetContribution",
"WriterContribution",
"SampleDataGenerator",
"SampleDataURI",
]


Expand Down
11 changes: 5 additions & 6 deletions src/npe2/manifest/contributions/_json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
ValidationError = Exception

__all__ = [
"ValidationError",
"Draft04JsonSchema",
"Draft06JsonSchema",
"Draft07JsonSchema",
"ValidationError",
]

JsonType = Literal["array", "boolean", "integer", "null", "number", "object", "string"]
Expand Down Expand Up @@ -169,14 +169,13 @@ def is_array(self) -> bool:
@property
def is_object(self) -> bool:
"""Return True if this schema is an object schema."""
return (
self.properties is not None
or self.type == "object"
return self.properties is not None or (
self.type == "object"
and not self.all_of
and not self.one_of
and not self.any_of
and not getattr(self, "ref", False) # draft 6+
)
and not getattr(self, "ref", False)
) # draft 6+

@property
def json_validator(self) -> Type[Validator]:
Expand Down

0 comments on commit 2f77b9f

Please sign in to comment.