Skip to content

Commit ea09b35

Browse files
[pre-commit.ci] pre-commit autoupdate (#562)
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 da7fa3f commit ea09b35

File tree

145 files changed

+368
-369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+368
-369
lines changed

.pre-commit-config.yaml

+2-14
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@ repos:
2424
- id: python-check-mock-methods
2525
- id: python-no-log-warn
2626
- id: text-unicode-replacement-char
27-
- repo: https://github.com/asottile/reorder-python-imports
28-
rev: v3.12.0
29-
hooks:
30-
- id: reorder-python-imports
31-
args: [--py38-plus, --add-import, 'from __future__ import annotations']
32-
exclude: ^(docs_src/)
33-
- repo: https://github.com/asottile/reorder-python-imports
34-
rev: v3.12.0
35-
hooks:
36-
- id: reorder-python-imports
37-
args: [--py38-plus]
38-
files: ^(docs_src/)
3927
# - repo: https://github.com/tox-dev/pyproject-fmt
4028
# rev: 1.2.0
4129
# hooks:
@@ -45,7 +33,7 @@ repos:
4533
hooks:
4634
- id: sort-all
4735
- repo: https://github.com/astral-sh/ruff-pre-commit
48-
rev: v0.2.0
36+
rev: v0.3.1
4937
hooks:
5038
- id: ruff-format
5139
- id: ruff
@@ -90,7 +78,7 @@ repos:
9078
]
9179
files: (docs/.)
9280
- repo: https://github.com/nbQA-dev/nbQA
93-
rev: 1.7.1
81+
rev: 1.8.4
9482
hooks:
9583
- id: nbqa-black
9684
- id: nbqa-isort

docs/source/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html
55
66
"""
7+
78
from __future__ import annotations
89

910
import inspect

docs/source/tutorials/making_tasks_persist.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ in the database such that the subsequent execution will skip the task successful
1313

1414
## When is this useful?
1515

16-
- You ran a formatter like Black on the files in your project and want to prevent the
16+
- You ran a formatter like ruff on the files in your project and want to prevent the
1717
longest-running tasks from being rerun.
1818
- You extend a repetition of a task function but do not want to rerun all tasks.
1919
- You want to integrate a task that you have already run elsewhere. Copy over the

docs/source/tutorials/repeating_tasks_with_different_inputs.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,17 @@ auto-generated ids are used.
9393

9494
### Auto-generated ids
9595

96-
pytask construct ids by extending the task name with representations of the values used
96+
pytask constructs ids by extending the task name with representations of the values used
9797
for each iteration. Booleans, floats, integers, and strings enter the task id directly.
9898
For example, a task function that receives four arguments, `True`, `1.0`, `2`, and
99-
`"hello"`, one of each dtype, has the following id.
99+
`"hello"`, one of each data type, has the following id.
100100

101101
```
102102
task_data_preparation.py::task_create_random_data[True-1.0-2-hello]
103103
```
104104

105-
Arguments with other dtypes cannot be converted to strings and, thus, are replaced with
106-
a combination of the argument name and the iteration counter.
105+
Arguments with other data types cannot be converted to strings and, thus, are replaced
106+
with a combination of the argument name and the iteration counter.
107107

108108
For example, the following function is parametrized with tuples.
109109

@@ -136,7 +136,7 @@ For example, the following function is parametrized with tuples.
136136

137137
Since the tuples are not converted to strings, the ids of the two tasks are
138138

139-
```
139+
```text
140140
task_data_preparation.py::task_create_random_data[seed0]
141141
task_data_preparation.py::task_create_random_data[seed1]
142142
```
@@ -177,7 +177,7 @@ a unique name for the iteration.
177177

178178
produces these ids
179179

180-
```
180+
```text
181181
task_data_preparation.py::task_create_random_data[first]
182182
task_data_preparation.py::task_create_random_data[second]
183183
```

docs/source/tutorials/using_a_data_catalog.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ The following tabs show you how to use the data catalog given the interface you
6161
````{tab-item} Python 3.10+
6262
:sync: python310plus
6363
64-
Use `data_catalog["key"]` as an default argument to access the
64+
Use `data_catalog["data"]` as an default argument to access the
6565
{class}`~pytask.PickleNode` within the task. When you are done transforming your
6666
{class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`.
6767
@@ -74,7 +74,7 @@ Use `data_catalog["key"]` as an default argument to access the
7474
````{tab-item} Python 3.8+
7575
:sync: python38plus
7676
77-
Use `data_catalog["key"]` as an default argument to access the
77+
Use `data_catalog["data"]` as an default argument to access the
7878
{class}`~pytask.PickleNode` within the task. When you are done transforming your
7979
{class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`.
8080
@@ -87,7 +87,7 @@ Use `data_catalog["key"]` as an default argument to access the
8787
````{tab-item} ​produces
8888
:sync: produces
8989
90-
Use `data_catalog["key"]` as an default argument to access the
90+
Use `data_catalog["data"]` as an default argument to access the
9191
{class}`~pytask.PickleNode` within the task. When you are done transforming your
9292
{class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`.
9393
@@ -125,7 +125,7 @@ Following one of the interfaces gives you immediate access to the
125125
````{tab-item} Python 3.10+
126126
:sync: python310plus
127127
128-
Use `data_catalog["key"]` as an default argument to access the
128+
Use `data_catalog["data"]` as an default argument to access the
129129
{class}`~pytask.PickleNode` within the task. When you are done transforming your
130130
{class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`.
131131
@@ -138,7 +138,7 @@ Use `data_catalog["key"]` as an default argument to access the
138138
````{tab-item} Python 3.8+
139139
:sync: python38plus
140140
141-
Use `data_catalog["key"]` as an default argument to access the
141+
Use `data_catalog["data"]` as an default argument to access the
142142
{class}`~pytask.PickleNode` within the task. When you are done transforming your
143143
{class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`.
144144

docs_src/how_to_guides/bp_scaling_tasks_1.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from my_project.config import BLD
55
from my_project.config import SRC
66

7-
87
DATA = {
98
"data_0": {"subset": "subset_1"},
109
"data_1": {"subset": "subset_2"},

docs_src/how_to_guides/bp_scaling_tasks_3.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from my_project.config import BLD
55
from my_project.data_preparation.config import DATA
66

7-
87
_MODELS = ["linear_probability", "logistic_model", "decision_tree"]
98

109

docs_src/how_to_guides/bp_structure_of_task_files.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ def task_prepare_census_data(
2626
df.to_pickle(path_to_census)
2727

2828

29-
def _clean_data(df: pd.DataFrame) -> None:
30-
...
29+
def _clean_data(df: pd.DataFrame) -> None: ...
3130

3231

33-
def _create_new_variables(df: pd.DataFrame) -> None:
34-
...
32+
def _create_new_variables(df: pd.DataFrame) -> None: ...

docs_src/how_to_guides/interfaces/dependencies_annotation.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
from pytask import PathNode
55

66

7-
def task_example(path: Annotated[Path, PathNode(path=Path("input.txt"))]) -> None:
8-
...
7+
def task_example(path: Annotated[Path, PathNode(path=Path("input.txt"))]) -> None: ...
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from pathlib import Path
22

33

4-
def task_example(path: Path = Path("input.txt")) -> None:
5-
...
4+
def task_example(path: Path = Path("input.txt")) -> None: ...

docs_src/how_to_guides/interfaces/dependencies_task_kwargs.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44

55

66
@task(kwargs={"path": Path("input.txt")})
7-
def task_example(path: Path) -> None:
8-
...
7+
def task_example(path: Path) -> None: ...

docs_src/how_to_guides/migrating_from_scripts_to_pytask_1.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Content of task_data_management.py
22
import pandas as pd
33

4-
54
df = pd.read_csv("data.csv")
65

76
# Many operations.

docs_src/how_to_guides/remote_files/https.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from upath import UPath
55

6-
76
url = UPath("https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data")
87

98

docs_src/how_to_guides/using_task_returns_example_2_task.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from pytask import task
44

5-
65
func = lambda *x: "This is the content of the text file."
76

87

docs_src/how_to_guides/using_task_returns_example_3_task.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from pytask import task
44

5-
65
func = lambda *x: "This is the first content.", "This is the second content."
76

87

docs_src/how_to_guides/using_task_returns_example_4_py310.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from pytask import PythonNode
55

6-
76
nodes = [
87
{"first": PythonNode(name="dict1"), "second": PythonNode(name="dict2")},
98
(PythonNode(name="tuple1"), PythonNode(name="tuple2")),

docs_src/how_to_guides/using_task_returns_example_4_py38.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from pytask import PythonNode
44
from typing_extensions import Annotated
55

6-
76
nodes = [
87
{"first": PythonNode(name="dict1"), "second": PythonNode(name="dict2")},
98
(PythonNode(name="tuple1"), PythonNode(name="tuple2")),

docs_src/how_to_guides/using_task_returns_example_4_task.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from pytask import PythonNode
22
from pytask import task
33

4-
54
nodes = [
65
{"first": PythonNode(name="dict1"), "second": PythonNode(name="dict2")},
76
(PythonNode(name="tuple1"), PythonNode(name="tuple2")),

docs_src/how_to_guides/writing_custom_nodes_example_2_py310.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
from pytask import Product
66

77

8-
class PickleNode:
9-
...
8+
class PickleNode: ...
109

1110

1211
in_node = PickleNode.from_path(Path(__file__).parent / "in.pkl")

docs_src/how_to_guides/writing_custom_nodes_example_2_py310_return.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
import pandas as pd
55

66

7-
class PickleNode:
8-
...
7+
class PickleNode: ...
98

109

1110
in_node = PickleNode.from_path(Path(__file__).parent / "in.pkl")

docs_src/how_to_guides/writing_custom_nodes_example_2_py38.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
from typing_extensions import Annotated
66

77

8-
class PickleNode:
9-
...
8+
class PickleNode: ...
109

1110

1211
in_node = PickleNode.from_path(Path(__file__).parent / "in.pkl")

docs_src/how_to_guides/writing_custom_nodes_example_2_py38_return.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
from typing_extensions import Annotated
55

66

7-
class PickleNode:
8-
...
7+
class PickleNode: ...
98

109

1110
in_node = PickleNode.from_path(Path(__file__).parent / "in.pkl")

docs_src/tutorials/defining_dependencies_products_multiple1_produces.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33

44
from my_project.config import BLD
55

6-
76
_PRODUCTS = {"first": BLD / "data_0.pkl", "second": BLD / "data_1.pkl"}
87

98

109
def task_plot_data(
1110
path_to_data_0: Path = BLD / "data_0.pkl",
1211
path_to_data_1: Path = BLD / "data_1.pkl",
1312
produces: Dict[str, Path] = _PRODUCTS,
14-
) -> None:
15-
...
13+
) -> None: ...

docs_src/tutorials/defining_dependencies_products_multiple1_py310.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ def task_plot_data(
1010
path_to_data_1: Path = BLD / "data_1.pkl",
1111
path_to_plot_0: Annotated[Path, Product] = BLD / "plot_0.png",
1212
path_to_plot_1: Annotated[Path, Product] = BLD / "plot_1.png",
13-
) -> None:
14-
...
13+
) -> None: ...

docs_src/tutorials/defining_dependencies_products_multiple1_py38.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ def task_plot_data(
1010
path_to_data_1: Path = BLD / "data_1.pkl",
1111
path_to_plot_0: Annotated[Path, Product] = BLD / "plot_0.png",
1212
path_to_plot_1: Annotated[Path, Product] = BLD / "plot_1.png",
13-
) -> None:
14-
...
13+
) -> None: ...

docs_src/tutorials/defining_dependencies_products_multiple2_produces.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@
1515
def task_plot_data(
1616
path_to_data: dict[str, Path] = _DEPENDENCIES,
1717
produces: dict[str, Path] = _PRODUCTS,
18-
) -> None:
19-
...
18+
) -> None: ...

docs_src/tutorials/defining_dependencies_products_multiple2_py310.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
from my_project.config import BLD
55
from pytask import Product
66

7-
87
_DEPENDENCIES = {"data_0": BLD / "data_0.pkl", "data_1": BLD / "data_1.pkl"}
98
_PRODUCTS = {"plot_0": BLD / "plot_0.png", "plot_1": BLD / "plot_1.png"}
109

1110

1211
def task_plot_data(
1312
path_to_data: dict[str, Path] = _DEPENDENCIES,
1413
path_to_plots: Annotated[dict[str, Path], Product] = _PRODUCTS,
15-
) -> None:
16-
...
14+
) -> None: ...

docs_src/tutorials/defining_dependencies_products_multiple2_py38.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
from pytask import Product
66
from typing_extensions import Annotated
77

8-
98
_DEPENDENCIES = {"data_0": BLD / "data_0.pkl", "data_1": BLD / "data_1.pkl"}
109
_PRODUCTS = {"plot_0": BLD / "plot_0.png", "plot_1": BLD / "plot_1.png"}
1110

1211

1312
def task_plot_data(
1413
path_to_data: Dict[str, Path] = _DEPENDENCIES,
1514
path_to_plots: Annotated[Dict[str, Path], Product] = _PRODUCTS,
16-
) -> None:
17-
...
15+
) -> None: ...
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from pathlib import Path
22

33

4-
def task_create_random_data(produces: Path = Path("../bld/data.pkl")) -> None:
5-
...
4+
def task_create_random_data(produces: Path = Path("../bld/data.pkl")) -> None: ...

docs_src/tutorials/defining_dependencies_products_relative_py310.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66

77
def task_create_random_data(
88
path_to_data: Annotated[Path, Product] = Path("../bld/data.pkl"),
9-
) -> None:
10-
...
9+
) -> None: ...

docs_src/tutorials/defining_dependencies_products_relative_py38.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66

77
def task_create_random_data(
88
path_to_data: Annotated[Path, Product] = Path("../bld/data.pkl"),
9-
) -> None:
10-
...
9+
) -> None: ...

docs_src/tutorials/repeating_tasks_with_different_inputs1_produces.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
from pytask import task
44

5-
65
for seed in range(10):
76

87
@task
98
def task_create_random_data(
109
produces: Path = Path(f"data_{seed}.pkl"), seed: int = seed
11-
) -> None:
12-
...
10+
) -> None: ...

docs_src/tutorials/repeating_tasks_with_different_inputs1_py310.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
from pytask import Product
55
from pytask import task
66

7-
87
for seed in range(10):
98

109
@task
1110
def task_create_random_data(
1211
path: Annotated[Path, Product] = Path(f"data_{seed}.pkl"), seed: int = seed
13-
) -> None:
14-
...
12+
) -> None: ...

0 commit comments

Comments
 (0)