Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #1440

Merged
merged 3 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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]
Expand Down Expand Up @@ -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]
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -116,22 +116,22 @@ 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]
pass_filenames: false
additional_dependencies: [click<8]

- repo: https://github.com/rstcheck/rstcheck
rev: "v6.2.0"
rev: "v6.2.4"
hooks:
- id: rstcheck
additional_dependencies: [sphinx]
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions glotaran/model/dataset_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions glotaran/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions glotaran/parameter/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions glotaran/plugin_system/base_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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``.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion glotaran/plugin_system/data_io_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion glotaran/plugin_system/project_io_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion glotaran/project/dataclass_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions glotaran/testing/plugin_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion glotaran/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion glotaran/utils/tee.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down
Loading