From bc25e89ec8d033589f8f1fe77e2b216781bae08e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 5 Jun 2022 19:40:05 +0200 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#1084) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/mirrors-mypy: v0.950 โ†’ v0.960](https://github.com/pre-commit/mirrors-mypy/compare/v0.950...v0.960) - [github.com/myint/rstcheck: v5.0.0 โ†’ v6.0.0rc3](https://github.com/myint/rstcheck/compare/v5.0.0...v6.0.0rc3) * ๐Ÿงน Reset rstcheck to stable version * Fix flake8 C417 errors. * ๐Ÿ”งโŒ Temporarily deactivated C417 for code that will be removed in PR #1060 * ๐Ÿ‘Œ๐Ÿ”ง Removed very verbose option from interrogate * ๐Ÿ‘ŒFix type in comment in tox.ini Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sebastian Weigand Co-authored-by: Joern Weissenborn Co-authored-by: Joris Snellenburg --- .pre-commit-config.yaml | 4 ++-- glotaran/model/property.py | 4 ++-- glotaran/model/test/test_model_property.py | 4 ++-- glotaran/plugin_system/data_io_registration.py | 2 +- glotaran/plugin_system/io_plugin_utils.py | 2 +- glotaran/plugin_system/megacomplex_registration.py | 2 +- glotaran/plugin_system/project_io_registration.py | 2 +- tox.ini | 2 ++ 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 69c29bfc1..2ecb01a6b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -106,7 +106,7 @@ repos: additional_dependencies: [flake8-docstrings, darglint==1.8.0] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.950 + rev: v0.960 hooks: - id: mypy files: "^glotaran/(plugin_system|utils|deprecation|testing|parameter|project|simulation|model/property.py|builtin/io/pandas)" @@ -117,7 +117,7 @@ repos: rev: 1.5.0 hooks: - id: interrogate - args: [-vv, --config=pyproject.toml, glotaran] + args: [--config=pyproject.toml, glotaran] pass_filenames: false additional_dependencies: [click<8] diff --git a/glotaran/model/property.py b/glotaran/model/property.py index f3c968656..25a32e82f 100644 --- a/glotaran/model/property.py +++ b/glotaran/model/property.py @@ -421,11 +421,11 @@ def setter(self, value: model_property.glotaran_property_type): # type: ignore[ if model_property.glotaran_is_scalar_property and not isinstance(value, Parameter): value = Parameter(full_label=str(value)) elif model_property.glotaran_is_sequence_property and all( - map(lambda v: not isinstance(v, Parameter), value) + not isinstance(v, Parameter) for v in value ): value = [Parameter(full_label=str(v)) for v in value] elif model_property.glotaran_is_mapping_property and all( - map(lambda v: not isinstance(v, Parameter), value.values()) + not isinstance(v, Parameter) for v in value.values() ): value = {k: Parameter(full_label=str(v)) for k, v in value.items()} setattr(self, f"_{model_property._name}", value) diff --git a/glotaran/model/test/test_model_property.py b/glotaran/model/test/test_model_property.py index 98f7ff4a4..b6fe18b30 100644 --- a/glotaran/model/test/test_model_property.py +++ b/glotaran/model/test/test_model_property.py @@ -91,14 +91,14 @@ class MockClass: p_sequence.fset(MockClass, names) value = p_sequence.fget(MockClass) assert isinstance(value, list) - assert all(map(lambda v: isinstance(v, Parameter), value)) + assert all(isinstance(v, Parameter) for v in value) assert [p.full_label for p in value] == names p_mapping = ModelProperty(MockClass, "mapping", Dict[str, Parameter], "", None, True) p_mapping.fset(MockClass, {f"{i}": n for i, n in enumerate(names)}) value = p_mapping.fget(MockClass) assert isinstance(value, dict) - assert all(map(lambda v: isinstance(v, Parameter), value.values())) + assert all(isinstance(v, Parameter) for v in value.values()) assert [p.full_label for p in value.values()] == names diff --git a/glotaran/plugin_system/data_io_registration.py b/glotaran/plugin_system/data_io_registration.py index 549ac20dc..6667554c9 100644 --- a/glotaran/plugin_system/data_io_registration.py +++ b/glotaran/plugin_system/data_io_registration.py @@ -336,7 +336,7 @@ def data_io_plugin_table(*, plugin_names: bool = False, full_names: bool = False header_values = ["Format name", *DATA_IO_METHODS] if plugin_names: header_values.append("Plugin name") - headers = tuple(map(lambda x: f"__{x}__", header_values)) + headers = tuple(f"__{x}__" for x in header_values) return MarkdownStr( tabulate( bool_table_repr(table_data), tablefmt="github", headers=headers, stralign="center" diff --git a/glotaran/plugin_system/io_plugin_utils.py b/glotaran/plugin_system/io_plugin_utils.py index 3a0ae6f5d..1e421f280 100644 --- a/glotaran/plugin_system/io_plugin_utils.py +++ b/glotaran/plugin_system/io_plugin_utils.py @@ -196,4 +196,4 @@ def bool_table_repr( --- - - """ bool_repr = partial(bool_str_repr, true_repr=true_repr, false_repr=false_repr) - return map(lambda value: map(bool_repr, value), table_data) + return ((bool_repr(value) for value in values) for values in table_data) diff --git a/glotaran/plugin_system/megacomplex_registration.py b/glotaran/plugin_system/megacomplex_registration.py index 103116a56..2719e7542 100644 --- a/glotaran/plugin_system/megacomplex_registration.py +++ b/glotaran/plugin_system/megacomplex_registration.py @@ -154,5 +154,5 @@ def megacomplex_plugin_table( else: table_data = [[f"`{megacomplex_name}`"] for megacomplex_name in megacomplex_names] - headers = tuple(map(lambda x: f"__{x}__", header_values)) + headers = tuple(f"__{x}__" for x in header_values) return MarkdownStr(tabulate(table_data, tablefmt="github", headers=headers, stralign="center")) diff --git a/glotaran/plugin_system/project_io_registration.py b/glotaran/plugin_system/project_io_registration.py index 2ac580188..c981702a0 100644 --- a/glotaran/plugin_system/project_io_registration.py +++ b/glotaran/plugin_system/project_io_registration.py @@ -554,7 +554,7 @@ def project_io_plugin_table( header_values = ["Format name", *PROJECT_IO_METHODS] if plugin_names: header_values.append("Plugin name") - headers = tuple(map(lambda x: f"__{x}__", header_values)) + headers = tuple(f"__{x}__" for x in header_values) return MarkdownStr( tabulate( bool_table_repr(table_data), tablefmt="github", headers=headers, stralign="center" diff --git a/tox.ini b/tox.ini index 35b8b268e..a2852c556 100644 --- a/tox.ini +++ b/tox.ini @@ -31,6 +31,8 @@ per-file-ignores = *.pyi: E301, E302, F401 # Allow printing in test file test_*.py: T201 + # Temporarily deactivated since the code will be removed in PR 1060 + glotaran/optimization/optimization_group_calculator_linked.py: C417 [pydocstyle] convention = numpy