Skip to content

Commit 82fbf17

Browse files
[pre-commit.ci] pre-commit autoupdate (#70)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com.> Co-authored-by: Tobias Raabe <[email protected]>
1 parent 54dcd4e commit 82fbf17

File tree

6 files changed

+25
-47
lines changed

6 files changed

+25
-47
lines changed

.pre-commit-config.yaml

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com./pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v4.5.0
44
hooks:
55
- id: check-added-large-files
66
args: ['--maxkb=25']
@@ -31,24 +31,15 @@ repos:
3131
rev: v2.5.0
3232
hooks:
3333
- id: setup-cfg-fmt
34-
- repo: https://github.com./psf/black
35-
rev: 23.9.1
36-
hooks:
37-
- id: black
3834
- repo: https://github.com./astral-sh/ruff-pre-commit
39-
rev: v0.0.292
35+
rev: v0.1.6
4036
hooks:
4137
- id: ruff
38+
- id: ruff-format
4239
- repo: https://github.com./dosisod/refurb
43-
rev: v1.21.0
40+
rev: v1.24.0
4441
hooks:
4542
- id: refurb
46-
args: [--ignore, FURB126]
47-
- repo: https://github.com./econchick/interrogate
48-
rev: 1.5.0
49-
hooks:
50-
- id: interrogate
51-
args: [-v, --fail-under=40, src, tests]
5243
- repo: https://github.com./executablebooks/mdformat
5344
rev: 0.7.17
5445
hooks:
@@ -63,7 +54,7 @@ repos:
6354
hooks:
6455
- id: codespell
6556
- repo: https://github.com./pre-commit/mirrors-mypy
66-
rev: 'v1.5.1'
57+
rev: 'v1.7.1'
6758
hooks:
6859
- id: mypy
6960
args: [
@@ -85,7 +76,7 @@ repos:
8576
hooks:
8677
- id: check-manifest
8778
args: [--no-build-isolation]
88-
additional_dependencies: [setuptools-scm, toml]
79+
additional_dependencies: [setuptools-scm, toml, wheel]
8980
- repo: meta
9081
hooks:
9182
- id: check-hooks-apply

pyproject.toml

+4-22
Original file line numberDiff line numberDiff line change
@@ -29,38 +29,20 @@ target-version = "py38"
2929
select = ["ALL"]
3030
fix = true
3131
extend-ignore = [
32+
"I", # ignore isort
3233
"TRY", # ignore tryceratops.
3334
"TCH", # ignore non-guarded type imports.
34-
# Numpy docstyle
35-
"D107",
36-
"D203",
37-
"D212",
38-
"D213",
39-
"D402",
40-
"D413",
41-
"D415",
42-
"D416",
43-
"D417",
4435
# Others.
45-
"D404", # Do not start module docstring with "This".
46-
"RET504", # unnecessary variable assignment before return.
47-
"S101", # raise errors for asserts.
48-
"B905", # strict parameter for zip that was implemented in py310.
49-
"I", # ignore isort
5036
"ANN101", # type annotating self
5137
"ANN102", # type annotating cls
52-
"FBT", # flake8-boolean-trap
53-
"EM", # flake8-errmsg
5438
"ANN401", # flake8-annotate typing.Any
55-
"PD", # pandas-vet
56-
"COM812", # trailing comma missing, but black takes care of that
57-
"D401", # imperative mood for first line. too many false-positives.
58-
"SLF001", # access private members.
39+
"COM812", # Comply with ruff-format.
40+
"ISC001", # Comply with ruff-format.
5941
]
6042

6143

6244
[tool.ruff.per-file-ignores]
63-
"tests/*" = ["D", "ANN", "PLR2004"]
45+
"tests/*" = ["D", "ANN", "PLR2004", "S101"]
6446

6547

6648
[tool.ruff.pydocstyle]

src/pytask_parallel/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""This module is the main namespace of the package."""
1+
"""Contains the main namespace of the package."""
22
from __future__ import annotations
33

44
try:

src/pytask_parallel/backends.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""This module configures the available backends."""
1+
"""Configures the available backends."""
22
from __future__ import annotations
33

44
import enum
@@ -23,7 +23,10 @@ class CloudpickleProcessPoolExecutor(ProcessPoolExecutor):
2323

2424
# The type signature is wrong for version above Py3.7. Fix when 3.7 is deprecated.
2525
def submit( # type: ignore[override]
26-
self, fn: Callable[..., Any], *args: Any, **kwargs: Any # noqa: ARG002
26+
self,
27+
fn: Callable[..., Any],
28+
*args: Any, # noqa: ARG002
29+
**kwargs: Any,
2730
) -> Future[Any]:
2831
"""Submit a new task."""
2932
return super().submit(

src/pytask_parallel/config.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def pytask_parse_config(config: dict[str, Any]) -> None:
1717

1818
if (
1919
isinstance(config["parallel_backend"], str)
20-
and config["parallel_backend"] in ParallelBackend._value2member_map_
20+
and config["parallel_backend"] in ParallelBackend._value2member_map_ # noqa: SLF001
2121
):
2222
config["parallel_backend"] = ParallelBackend(config["parallel_backend"])
2323
elif (
@@ -26,7 +26,8 @@ def pytask_parse_config(config: dict[str, Any]) -> None:
2626
):
2727
pass
2828
else:
29-
raise ValueError("Invalid value for 'parallel_backend'.")
29+
msg = f"Invalid value for 'parallel_backend'. Got {config['parallel_backend']}."
30+
raise ValueError(msg)
3031

3132
config["delay"] = 0.1
3233

src/pytask_parallel/execute.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,12 @@ def pytask_execute_task(session: Session, task: PTask) -> Future[Any] | None:
211211

212212

213213
def _raise_exception_on_breakpoint(*args: Any, **kwargs: Any) -> None: # noqa: ARG001
214-
raise RuntimeError(
214+
msg = (
215215
"You cannot use 'breakpoint()' or 'pdb.set_trace()' while parallelizing the "
216216
"execution of tasks with pytask-parallel. Please, remove the breakpoint or run "
217217
"the task without parallelization to debug it."
218218
)
219+
raise RuntimeError(msg)
219220

220221

221222
def _patch_set_trace_and_breakpoint() -> None:
@@ -235,7 +236,7 @@ def _patch_set_trace_and_breakpoint() -> None:
235236
def _execute_task( # noqa: PLR0913
236237
task: PTask,
237238
kwargs: dict[str, Any],
238-
show_locals: bool,
239+
show_locals: bool, # noqa: FBT001
239240
console_options: ConsoleOptions,
240241
session_filterwarnings: tuple[str, ...],
241242
task_filterwarnings: tuple[Mark, ...],
@@ -251,7 +252,7 @@ def _execute_task( # noqa: PLR0913
251252

252253
with warnings.catch_warnings(record=True) as log:
253254
# mypy can't infer that record=True means log is not None; help it.
254-
assert log is not None
255+
assert log is not None # noqa: S101
255256

256257
for arg in session_filterwarnings:
257258
warnings.filterwarnings(*parse_warning_filter(arg, escape=False))
@@ -284,7 +285,7 @@ def _execute_task( # noqa: PLR0913
284285
nodes = tree_leaves(task.produces["return"])
285286
values = structure_return.flatten_up_to(out)
286287
for node, value in zip(nodes, values):
287-
node.save(value) # type: ignore[attr-defined]
288+
node.save(value)
288289

289290
processed_exc_info = None
290291

@@ -305,7 +306,7 @@ def _execute_task( # noqa: PLR0913
305306

306307
def _process_exception(
307308
exc_info: tuple[type[BaseException], BaseException, TracebackType | None],
308-
show_locals: bool,
309+
show_locals: bool, # noqa: FBT001
309310
console_options: ConsoleOptions,
310311
) -> tuple[type[BaseException], BaseException, str]:
311312
"""Process the exception and convert the traceback to a string."""

0 commit comments

Comments
 (0)