Skip to content

Commit cf05f16

Browse files
committed
Fix.
1 parent df04fbe commit cf05f16

File tree

142 files changed

+357
-360
lines changed

Some content is hidden

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

142 files changed

+357
-360
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.2
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_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: ...

docs_src/tutorials/repeating_tasks_with_different_inputs1_py38.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
from pytask import task
55
from typing_extensions import Annotated
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: ...

docs_src/tutorials/repeating_tasks_with_different_inputs2_produces.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
from my_project.config import SRC
44
from pytask import task
55

6-
76
for seed in range(10):
87

98
@task
109
def task_create_random_data(
1110
path_to_parameters: Path = SRC / "parameters.yml",
1211
produces: Path = Path(f"data_{seed}.pkl"),
1312
seed: int = seed,
14-
) -> None:
15-
...
13+
) -> None: ...

docs_src/tutorials/repeating_tasks_with_different_inputs2_py310.py

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

8-
98
for seed in range(10):
109

1110
@task
1211
def task_create_random_data(
1312
path_to_parameters: Path = SRC / "parameters.yml",
1413
path_to_data: Annotated[Path, Product] = Path(f"data_{seed}.pkl"),
1514
seed: int = seed,
16-
) -> None:
17-
...
15+
) -> None: ...

docs_src/tutorials/repeating_tasks_with_different_inputs2_py38.py

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

8-
98
for seed in range(10):
109

1110
@task
1211
def task_create_random_data(
1312
path_to_parameters: Path = SRC / "parameters.yml",
1413
path_to_data: Annotated[Path, Product] = Path(f"data_{seed}.pkl"),
1514
seed: int = seed,
16-
) -> None:
17-
...
15+
) -> None: ...

docs_src/tutorials/repeating_tasks_with_different_inputs3_produces.py

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

44
from pytask import task
55

6-
76
for seed in ((0,), (1,)):
87

98
@task
109
def task_create_random_data(
1110
produces: Path = Path(f"data_{seed[0]}.pkl"), seed: Tuple[int] = seed
12-
) -> None:
13-
...
11+
) -> None: ...

docs_src/tutorials/repeating_tasks_with_different_inputs3_py310.py

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

7-
87
for seed in ((0,), (1,)):
98

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

0 commit comments

Comments
 (0)