Skip to content

Commit b164545

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 56a0ef3 commit b164545

9 files changed

Lines changed: 48 additions & 72 deletions

File tree

pyglotaran_extras/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,6 @@
7373

7474
SCRIPT_DIR = _find_script_dir_at_import(__file__)
7575
"""User script dir determined during import."""
76+
7677
CONFIG = load_config(SCRIPT_DIR)
7778
"""Global config instance."""

pyglotaran_extras/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ class CyclerColor(TypedDict):
4545

4646
DatasetConvertible: TypeAlias = xr.Dataset | xr.DataArray | str | Path
4747
"""Types of data which can be converted to a dataset."""
48+
4849
ResultLike: TypeAlias = (
4950
Result | DatasetConvertible | Mapping[str, DatasetConvertible] | Sequence[DatasetConvertible]
5051
)
5152
"""Result like data which can be converted to a per dataset mapping."""
5253

53-
5454
BuiltinSubPlotLabelFormatFunctionKey: TypeAlias = Literal[
5555
"number", "upper_case_letter", "lower_case_letter"
5656
]

pyproject.toml

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -76,28 +76,55 @@ docs = [
7676
]
7777

7878
[tool.hatch]
79+
version.path = "pyglotaran_extras/__init__.py"
7980
build.targets.sdist.include = [
80-
"/pyglotaran_extras",
8181
"/docs",
82+
"/pyglotaran_extras",
8283
"/tests",
8384
"changelog.md",
8485
]
85-
version.path = "pyglotaran_extras/__init__.py"
8686

8787
[tool.docformatter]
8888
black = true
8989
wrap-summaries = 99
9090
wrap-descriptions = 99
9191

9292
# For now this is not used because pydoclint does not support toml when used with flake8
93-
9493
[tool.pydoclint]
9594
skip-checking-short-docstrings = false
9695
style = "numpy"
9796
exclude = "^(docs/|tests?/)"
9897
require-return-section-when-returning-none = false
9998
allow-init-docstring = true
10099

100+
[tool.interrogate]
101+
fail-under = 100
102+
ignore-init-module = true
103+
exclude = [
104+
"docs",
105+
"tests/*",
106+
]
107+
108+
[tool.mypy]
109+
ignore_missing_imports = true
110+
python_version = "3.10"
111+
disallow_untyped_calls = true
112+
disallow_untyped_defs = true
113+
disallow_incomplete_defs = true
114+
check_untyped_defs = true
115+
warn_unused_ignores = true
116+
plugins = [
117+
"pydantic.mypy",
118+
]
119+
scripts_are_modules = true
120+
warn_unused_configs = true
121+
overrides = [
122+
{ module = "tests.*", disallow_untyped_defs = false, disallow_incomplete_defs = false },
123+
]
124+
no_implicit_optional = true
125+
no_implicit_reexport = true
126+
show_error_codes = true
127+
101128
[tool.coverage]
102129
run.branch = true
103130
run.omit = [
@@ -123,31 +150,3 @@ report.exclude_lines = [
123150
"raise AssertionError",
124151
"raise NotImplementedError",
125152
]
126-
127-
[tool.mypy]
128-
plugins = [
129-
"pydantic.mypy",
130-
]
131-
python_version = "3.10"
132-
ignore_missing_imports = true
133-
scripts_are_modules = true
134-
show_error_codes = true
135-
warn_unused_ignores = true
136-
no_implicit_optional = true
137-
disallow_incomplete_defs = true
138-
disallow_untyped_defs = true
139-
disallow_untyped_calls = true
140-
no_implicit_reexport = true
141-
warn_unused_configs = true
142-
check_untyped_defs = true
143-
overrides = [
144-
{ module = "tests.*", disallow_incomplete_defs = false, disallow_untyped_defs = false },
145-
]
146-
147-
[tool.interrogate]
148-
exclude = [
149-
"docs",
150-
"tests/*",
151-
]
152-
ignore-init-module = true
153-
fail-under = 100

tests/config/test_config.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ def test_config_reset(tmp_path: Path, test_config_values: dict[str, Any]):
7676
7777
If another config is passed all values (including source files) are reset.
7878
"""
79-
8079
test_config_path = tmp_path / f"{CONFIG_FILE_STEM}.yml"
8180
test_config = Config.model_validate(test_config_values)
8281
test_config._source_files = [test_config_path]
@@ -97,7 +96,6 @@ def test_config_reset(tmp_path: Path, test_config_values: dict[str, Any]):
9796

9897
def test_config_reload(tmp_path: Path, test_config_values: dict[str, Any]):
9998
"""Config values get reloaded from file."""
100-
10199
test_config_path = tmp_path / f"{CONFIG_FILE_STEM}.yml"
102100
test_config = Config.model_validate(test_config_values)
103101
test_config._source_files = [test_config_path]
@@ -119,7 +117,6 @@ def test_config_reload(tmp_path: Path, test_config_values: dict[str, Any]):
119117

120118
def test_config_load(tmp_path: Path, test_config_values: dict[str, Any], test_config_file: Path):
121119
"""Loading config replaces its values and and source files."""
122-
123120
test_config = Config()
124121
test_config._source_files = [test_config_file]
125122
test_config.reload()
@@ -358,8 +355,8 @@ def test_load_config_files(tmp_path: Path, test_config_file: Path):
358355
def test_merge_configs():
359356
"""Check that the most right config overrides other values.
360357
361-
Since we already tested all permutations for 2 configs in ``test_config_merge``
362-
this test can fucus on the case with more than 2 configs.
358+
Since we already tested all permutations for 2 configs in ``test_config_merge`` this test can
359+
fucus on the case with more than 2 configs.
363360
"""
364361
assert merge_configs([]) == Config()
365362

tests/config/test_plot_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ def func(
466466

467467
def test_find_axes():
468468
"""Get axes value from iterable of values."""
469-
470469
data_array = xr.DataArray([[0, 1]], coords={"time": [0], "spectral": [500, 510]})
471470
data_set = xr.Dataset({"data": data_array})
472471

tests/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def result_sequential_spectral_decay():
8787
@pytest.fixture
8888
def mock_home(monkeypatch: pytest.MonkeyPatch, tmp_path: Path):
8989
"""Mock ``pathlib.Path.home`` to return ``tmp_path/"home"``."""
90-
9190
mock_home_path = tmp_path / "home"
9291
mock_home_path.mkdir()
9392

tests/deprecation/test_deprecation_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ def test_warn_deprecated():
125125
@pytest.mark.usefixtures("_pyglotaran_extras_1_0_0")
126126
def test_warn_deprecated_overdue_deprecation(monkeypatch: MonkeyPatch):
127127
"""Current version is equal or bigger than drop_version."""
128-
129128
with pytest.raises(OverdueDeprecationError) as excinfo:
130129
warn_deprecated(
131130
deprecated_qual_name_usage=DEPRECATION_QUAL_NAME,

tests/inspect/test_utils.py

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@
4040
5,
4141
False,
4242
dedent(
43-
"""
44-
<details >
43+
"""<details >
4544
46-
FOO
47-
<br>
48-
</details>"""
45+
FOO <br> </details>
46+
"""
4947
),
5048
id="heading no summary",
5149
),
@@ -55,12 +53,10 @@
5553
None,
5654
True,
5755
dedent(
58-
"""
59-
<details open>
56+
"""<details open>
6057
61-
FOO
62-
<br>
63-
</details>"""
58+
FOO <br> </details>
59+
"""
6460
),
6561
id="defaults open details",
6662
),
@@ -70,15 +66,10 @@
7066
None,
7167
False,
7268
dedent(
73-
"""
74-
<details >
75-
<summary>
76-
Bar
77-
</summary>
69+
"""<details > <summary> Bar </summary>
7870
79-
FOO
80-
<br>
81-
</details>"""
71+
FOO <br> </details>
72+
"""
8273
),
8374
id="defaults with simple summary",
8475
),
@@ -88,17 +79,10 @@
8879
5,
8980
False,
9081
dedent(
91-
"""
92-
<details >
93-
<summary>
94-
<h5 style="display:inline;">
95-
Bar
96-
</h5>
97-
</summary>
82+
"""<details > <summary> <h5 style="display:inline;"> Bar </h5> </summary>
9883
99-
FOO
100-
<br>
101-
</details>"""
84+
FOO <br> </details>
85+
"""
10286
),
10387
id="defaults with heading summary",
10488
),

tests/io/test_setup_case_study.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ def test_get_script_dir_tmp_path(tmp_path: Path):
3434
"""File in temp folder."""
3535
tmp_file = tmp_path / "foo.py"
3636
content = dedent(
37-
"""
38-
from pyglotaran_extras.io.setup_case_study import get_script_dir
39-
print(get_script_dir())
40-
"""
37+
"""From pyglotaran_extras.io.setup_case_study import get_script_dir
38+
print(get_script_dir())"""
4139
)
4240
tmp_file.write_text(content)
4341
printed_result = subprocess.run(

0 commit comments

Comments
 (0)