Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#1084)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/mirrors-mypy: v0.950 → v0.960](pre-commit/mirrors-mypy@v0.950...v0.960)
- [github.com/myint/rstcheck: v5.0.0 → v6.0.0rc3](rstcheck/rstcheck@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 <s.weigand.phy@gmail.com>
Co-authored-by: Joern Weissenborn <joern.weissenborn@gmail.com>
Co-authored-by: Joris Snellenburg <jsnel@users.noreply.github.com>
  • Loading branch information
4 people authored Jun 5, 2022
1 parent 80a488d commit bc25e89
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand All @@ -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]

Expand Down
4 changes: 2 additions & 2 deletions glotaran/model/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions glotaran/model/test/test_model_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


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 @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion glotaran/plugin_system/io_plugin_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion glotaran/plugin_system/megacomplex_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
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 @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bc25e89

Please sign in to comment.