From eefdbd1a3c410c03fcb7ff353d7a8f87655025fb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 23:41:03 +0000 Subject: [PATCH 1/3] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0) - [github.com/asottile/pyupgrade: v3.15.1 → v3.17.0](https://github.com/asottile/pyupgrade/compare/v3.15.1...v3.17.0) - [github.com/psf/black: 24.2.0 → 24.8.0](https://github.com/psf/black/compare/24.2.0...24.8.0) - [github.com/nbQA-dev/nbQA: 1.8.4 → 1.8.7](https://github.com/nbQA-dev/nbQA/compare/1.8.4...1.8.7) - [github.com/PyCQA/flake8: 7.0.0 → 7.1.1](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.1) - [github.com/PyCQA/flake8: 7.0.0 → 7.1.1](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.1) - [github.com/pre-commit/mirrors-mypy: v1.9.0 → v1.11.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.9.0...v1.11.1) - [github.com/econchick/interrogate: 1.5.0 → 1.7.0](https://github.com/econchick/interrogate/compare/1.5.0...1.7.0) - [github.com/rstcheck/rstcheck: v6.2.0 → v6.2.4](https://github.com/rstcheck/rstcheck/compare/v6.2.0...v6.2.4) - [github.com/codespell-project/codespell: v2.2.6 → v2.3.0](https://github.com/codespell-project/codespell/compare/v2.2.6...v2.3.0) --- .pre-commit-config.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ae61ade96..694c9c9e8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ default_language_version: repos: # Formatters - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-ast - id: check-builtin-literals @@ -19,7 +19,7 @@ repos: args: [--remove] - repo: https://github.com/asottile/pyupgrade - rev: v3.15.1 + rev: v3.17.0 hooks: - id: pyupgrade types: [file] @@ -36,7 +36,7 @@ repos: types_or: [python, pyi] - repo: https://github.com/psf/black - rev: 24.2.0 + rev: 24.8.0 hooks: - id: black types: [file] @@ -68,7 +68,7 @@ repos: - "metadata.vscode metadata.language_info.version" - repo: https://github.com/nbQA-dev/nbQA - rev: 1.8.4 + rev: 1.8.7 hooks: - id: nbqa-black additional_dependencies: [black==22.6.0] @@ -92,7 +92,7 @@ repos: additional_dependencies: [flake8-docstrings, flake8-print>=5.0.0] - repo: https://github.com/PyCQA/flake8 - rev: 7.0.0 + rev: 7.1.1 hooks: - id: flake8 name: "flake8 lint code" @@ -104,7 +104,7 @@ repos: - "--count" - repo: https://github.com/PyCQA/flake8 - rev: 7.0.0 + rev: 7.1.1 hooks: - id: flake8 alias: flake8-docs @@ -116,14 +116,14 @@ repos: additional_dependencies: [flake8-docstrings, darglint==1.8.0] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.11.1 hooks: - id: mypy exclude: "docs|benchmark/|.*/tests?/.*" additional_dependencies: [types-tabulate, types-attrs] - repo: https://github.com/econchick/interrogate - rev: 1.5.0 + rev: 1.7.0 hooks: - id: interrogate args: [--config=pyproject.toml, glotaran] @@ -131,7 +131,7 @@ repos: additional_dependencies: [click<8] - repo: https://github.com/rstcheck/rstcheck - rev: "v6.2.0" + rev: "v6.2.4" hooks: - id: rstcheck additional_dependencies: [sphinx] @@ -150,7 +150,7 @@ repos: - id: rst-inline-touching-normal - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell types: [file] From 5885f531062eb6a563b54ce5967d38c751174486 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 17 Aug 2024 18:48:52 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- glotaran/model/dataset_model.py | 4 ++-- glotaran/model/model.py | 4 ++-- glotaran/parameter/parameters.py | 4 ++-- glotaran/plugin_system/base_registry.py | 6 +++--- glotaran/plugin_system/data_io_registration.py | 2 +- glotaran/plugin_system/project_io_registration.py | 2 +- glotaran/testing/plugin_system.py | 10 +++++----- glotaran/utils/io.py | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/glotaran/model/dataset_model.py b/glotaran/model/dataset_model.py index 3f700beb6..8d07c5ee1 100644 --- a/glotaran/model/dataset_model.py +++ b/glotaran/model/dataset_model.py @@ -250,7 +250,7 @@ def get_dataset_model_model_dimension(dataset_model: DatasetModel) -> str: def iterate_dataset_model_megacomplexes( dataset_model: DatasetModel, -) -> Generator[tuple[Parameter | str | None, Megacomplex | str], None, None]: +) -> Generator[tuple[Parameter | str | None, Megacomplex | str]]: """Iterate the dataset model's megacomplexes. Parameters @@ -274,7 +274,7 @@ def iterate_dataset_model_megacomplexes( def iterate_dataset_model_global_megacomplexes( dataset_model: DatasetModel, -) -> Generator[tuple[Parameter | str | None, Megacomplex | str], None, None]: +) -> Generator[tuple[Parameter | str | None, Megacomplex | str]]: """Iterate the dataset model's global megacomplexes. Parameters diff --git a/glotaran/model/model.py b/glotaran/model/model.py index 452b7118d..7d8300d73 100644 --- a/glotaran/model/model.py +++ b/glotaran/model/model.py @@ -344,7 +344,7 @@ def get_dataset_groups(self) -> dict[str, DatasetGroup]: def iterate_items( self, - ) -> Generator[tuple[str, dict[str, Item] | list[Item]], None, None]: + ) -> Generator[tuple[str, dict[str, Item] | list[Item]]]: """Iterate items. Yields @@ -356,7 +356,7 @@ def iterate_items( if META_ITEMS in attr.metadata: yield attr.name, getattr(self, attr.name) - def iterate_all_items(self) -> Generator[Item, None, None]: + def iterate_all_items(self) -> Generator[Item]: """Iterate the individual items. Yields diff --git a/glotaran/parameter/parameters.py b/glotaran/parameter/parameters.py index 763f3e613..8a4571bd0 100644 --- a/glotaran/parameter/parameters.py +++ b/glotaran/parameter/parameters.py @@ -259,7 +259,7 @@ def copy(self) -> Parameters: {label: parameter.copy() for label, parameter in self._parameters.items()} ) - def all(self) -> Generator[Parameter, None, None]: + def all(self) -> Generator[Parameter]: """Iterate over all parameters. Yields @@ -445,7 +445,7 @@ def __eq__(self, other: object) -> bool: def flatten_parameter_dict( parameter_dict: dict, -) -> Generator[tuple[str, list[Any], dict[str, Any] | None], None, None]: +) -> Generator[tuple[str, list[Any], dict[str, Any] | None]]: """Flatten a parameter dictionary. Parameters diff --git a/glotaran/plugin_system/base_registry.py b/glotaran/plugin_system/base_registry.py index 0d4a69550..cbd31c681 100644 --- a/glotaran/plugin_system/base_registry.py +++ b/glotaran/plugin_system/base_registry.py @@ -419,7 +419,7 @@ def methods_differ_from_baseclass( method_names: str | Sequence[str], plugin: GenericPluginInstance | type[GenericPluginInstance], base_class: type[GenericPluginInstance], -) -> Generator[bool, None, None]: +) -> Generator[bool]: """Check if a plugins methods implementation differ from its baseclass. Based on the assumption that ``base_class`` didn't implement the methods @@ -454,7 +454,7 @@ def methods_differ_from_baseclass_table( get_plugin_function: Callable[[str], GenericPluginInstance | type[GenericPluginInstance]], base_class: type[GenericPluginInstance], plugin_names: bool = False, -) -> Generator[list[str | bool], None, None]: +) -> Generator[list[str | bool]]: """Create table of which plugins methods differ from their baseclass. This uses the assumption that all plugins have the same ``base_class``. @@ -511,7 +511,7 @@ def supported_file_extensions( plugin_registry_keys: str | Sequence[str], get_plugin_function: Callable[[str], GenericPluginInstance | type[GenericPluginInstance]], base_class: type[GenericPluginInstance], -) -> Generator[str, None, None]: +) -> Generator[str]: """Get file extensions for plugins that support all methods in ``method_names``. Parameters diff --git a/glotaran/plugin_system/data_io_registration.py b/glotaran/plugin_system/data_io_registration.py index 22918710c..7a7bc3c85 100644 --- a/glotaran/plugin_system/data_io_registration.py +++ b/glotaran/plugin_system/data_io_registration.py @@ -343,7 +343,7 @@ def data_io_plugin_table(*, plugin_names: bool = False, full_names: bool = False def supported_file_extensions_data_io( method_names: str | Sequence[str], -) -> Generator[str, None, None]: +) -> Generator[str]: """Get data io formats that support all methods in ``method_names``. Parameters diff --git a/glotaran/plugin_system/project_io_registration.py b/glotaran/plugin_system/project_io_registration.py index 50d01e7ef..5c9752c38 100644 --- a/glotaran/plugin_system/project_io_registration.py +++ b/glotaran/plugin_system/project_io_registration.py @@ -558,7 +558,7 @@ def project_io_plugin_table( def supported_file_extensions_project_io( method_names: str | Sequence[str], -) -> Generator[str, None, None]: +) -> Generator[str]: """Get project io formats that support all methods in ``method_names``. Parameters diff --git a/glotaran/testing/plugin_system.py b/glotaran/testing/plugin_system.py index 93b092276..60387b2d0 100644 --- a/glotaran/testing/plugin_system.py +++ b/glotaran/testing/plugin_system.py @@ -24,7 +24,7 @@ def _monkeypatch_plugin_registry( register_name: str, test_registry: MutableMapping[str, _PluginType] | None = None, create_new_registry: bool = False, -) -> Generator[None, None, None]: +) -> Generator[None]: """Contextmanager to monkeypatch any Pluginregistry with name ``register_name``. Parameters @@ -64,7 +64,7 @@ def _monkeypatch_plugin_registry( def monkeypatch_plugin_registry_megacomplex( test_megacomplex: MutableMapping[str, type[Megacomplex]] | None = None, create_new_registry: bool = False, -) -> Generator[None, None, None]: +) -> Generator[None]: """Monkeypatch the :class:`Megacomplex` registry. Parameters @@ -89,7 +89,7 @@ def monkeypatch_plugin_registry_megacomplex( def monkeypatch_plugin_registry_data_io( test_data_io: MutableMapping[str, DataIoInterface] | None = None, create_new_registry: bool = False, -) -> Generator[None, None, None]: +) -> Generator[None]: """Monkeypatch the :class:`DataIoInterface` registry. Parameters @@ -114,7 +114,7 @@ def monkeypatch_plugin_registry_data_io( def monkeypatch_plugin_registry_project_io( test_project_io: MutableMapping[str, ProjectIoInterface] | None = None, create_new_registry: bool = False, -) -> Generator[None, None, None]: +) -> Generator[None]: """Monkeypatch the :class:`ProjectIoInterface` registry. Parameters @@ -142,7 +142,7 @@ def monkeypatch_plugin_registry( test_data_io: MutableMapping[str, DataIoInterface] | None = None, test_project_io: MutableMapping[str, ProjectIoInterface] | None = None, create_new_registry: bool = False, -) -> Generator[None, None, None]: +) -> Generator[None]: """Contextmanager to monkeypatch multiple plugin registries at once. Parameters diff --git a/glotaran/utils/io.py b/glotaran/utils/io.py index 158db704e..2b4577cd2 100644 --- a/glotaran/utils/io.py +++ b/glotaran/utils/io.py @@ -193,7 +193,7 @@ def load_datasets(dataset_mappable: DatasetMappable) -> DatasetMapping: @contextmanager -def chdir_context(folder_path: StrOrPath) -> Generator[Path, None, None]: +def chdir_context(folder_path: StrOrPath) -> Generator[Path]: """Context manager to change directory to ``folder_path``. Parameters From 950339095b93075dde0c226b0c555e46e145b60d Mon Sep 17 00:00:00 2001 From: s-weigand Date: Sat, 17 Aug 2024 20:55:49 +0200 Subject: [PATCH 3/3] =?UTF-8?q?=E2=8C=A8=EF=B8=8F=F0=9F=A9=B9=20Fix=20mypy?= =?UTF-8?q?=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- glotaran/project/dataclass_helpers.py | 4 +++- glotaran/utils/tee.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/glotaran/project/dataclass_helpers.py b/glotaran/project/dataclass_helpers.py index 1be721364..f28a9ebae 100644 --- a/glotaran/project/dataclass_helpers.py +++ b/glotaran/project/dataclass_helpers.py @@ -186,7 +186,9 @@ def asdict(dataclass: DataclassInstance, folder: Path | None = None) -> dict[str for field_item in fields(dataclass): if "exclude_from_dict" not in field_item.metadata: value = getattr(dataclass, field_item.name) - dataclass_dict[field_item.name] = asdict(value) if is_dataclass(value) else value + dataclass_dict[field_item.name] = ( + asdict(value) if is_dataclass(value) else value # type:ignore[arg-type] + ) if "file_loader" in field_item.metadata: value = getattr(dataclass, field_item.name) if value.source_path is not None: diff --git a/glotaran/utils/tee.py b/glotaran/utils/tee.py index f079961c8..edc01636d 100644 --- a/glotaran/utils/tee.py +++ b/glotaran/utils/tee.py @@ -27,7 +27,7 @@ def __enter__(self) -> TeeContext: TeeContext Instance that can be read from. """ - sys.stdout = self # type:ignore[assignment] + sys.stdout = self return self def __exit__(