Skip to content

Commit f9c4fb6

Browse files
authored
Allow more ruff rules. (#414)
1 parent 5c9c59a commit f9c4fb6

Some content is hidden

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

53 files changed

+296
-260
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
python-version: ['3.8', '3.9', '3.10', '3.11']
3131

3232
steps:
33-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
3434
- uses: mamba-org/setup-micromamba@v1
3535
with:
3636
environment-name: gha-testing

.github/workflows/publish-to-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
name: Build and publish Python 🐍 distributions 📦 to PyPI
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111

1212
- name: Set up Python 3.8
1313
uses: actions/setup-python@v4

.github/workflows/update-plugin-list.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
2525

docs/source/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
3030
- {pull}`410` allows to pass functions to `PythonNode(hash=...)`.
3131
- {pull}`412` adds protocols for tasks.
3232
- {pull}`413` removes scripts to generate `.svg`s.
33+
- {pull}`414` allow more ruff rules.
3334

3435
## 0.3.2 - 2023-06-07
3536

docs/source/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
from __future__ import annotations
88

99
from importlib.metadata import version
10+
from typing import TYPE_CHECKING
1011

11-
import sphinx
12+
if TYPE_CHECKING:
13+
import sphinx
1214

1315

1416
# -- Project information ---------------------------------------------------------------

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies:
1515
- click
1616
- click-default-group
1717
- networkx >=2.4
18-
- pluggy
18+
- pluggy >=1.0.0
1919
- optree >=0.9
2020
- rich
2121
- sqlalchemy >=1.4.36

pyproject.toml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ target-version = "py38"
3333
select = ["ALL"]
3434
fix = true
3535
extend-ignore = [
36+
"I", # ignore isort
3637
"TRY", # ignore tryceratops.
37-
"TCH", # ignore non-guarded type imports.
3838
# Numpy docstyle
3939
"D107",
4040
"D203",
@@ -46,25 +46,17 @@ extend-ignore = [
4646
"D416",
4747
"D417",
4848
# Others.
49-
"D404", # Do not start module docstring with "This".
50-
"RET504", # unnecessary variable assignment before return.
5149
"S101", # raise errors for asserts.
52-
"B905", # strict parameter for zip that was implemented in py310.
53-
"I", # ignore isort
5450
"ANN101", # type annotating self
5551
"ANN102", # type annotating cls
5652
"FBT", # flake8-boolean-trap
57-
"EM", # flake8-errmsg
5853
"ANN401", # flake8-annotate typing.Any
5954
"PD", # pandas-vet
6055
"COM812", # trailing comma missing, but black takes care of that
6156
"D401", # imperative mood for first line. too many false-positives.
6257
"SLF001", # access private members.
6358
"S603",
6459
"S607",
65-
# Temporary
66-
"TD002",
67-
"TD003",
6860
]
6961

7062

@@ -73,7 +65,7 @@ extend-ignore = [
7365
"src/_pytask/hookspecs.py" = ["ARG001"]
7466
"src/_pytask/outcomes.py" = ["N818"]
7567
"tests/test_capture.py" = ["T201", "PT011"]
76-
"tests/*" = ["D", "ANN", "PLR2004"]
68+
"tests/*" = ["D", "ANN", "PLR2004", "S101"]
7769
"scripts/*" = ["D", "INP001"]
7870
"docs/source/conf.py" = ["D401", "INP001"]
7971

scripts/update_plugin_list.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ def _escape_rst(text: str) -> str:
8181
.replace(">", "\\>")
8282
.replace("`", "\\`")
8383
)
84-
text = re.sub(r"_\b", "", text)
85-
return text
84+
return re.sub(r"_\b", "", text)
8685

8786

8887
def _iter_plugins() -> Generator[dict[str, str], None, None]: # noqa: C901

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ install_requires =
3636
networkx>=2.4
3737
optree>=0.9
3838
packaging
39-
pluggy
39+
pluggy>=1.0.0
4040
rich
4141
sqlalchemy>=1.4.36
4242
tomli>=1.0.0

src/_pytask/_inspect.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,15 @@ def get_annotations( # noqa: C901, PLR0912, PLR0915
9999
obj_locals = None
100100
unwrap = obj
101101
else:
102-
raise TypeError(f"{obj!r} is not a module, class, or callable.")
102+
msg = f"{obj!r} is not a module, class, or callable."
103+
raise TypeError(msg)
103104

104105
if ann is None:
105106
return {}
106107

107108
if not isinstance(ann, dict):
108-
raise ValueError(f"{obj!r}.__annotations__ is neither a dict nor None")
109+
msg = f"{obj!r}.__annotations__ is neither a dict nor None"
110+
raise ValueError(msg)
109111

110112
if not ann:
111113
return {}
@@ -131,10 +133,9 @@ def get_annotations( # noqa: C901, PLR0912, PLR0915
131133
locals = obj_locals # noqa: A001
132134

133135
eval_func = eval
134-
return_value = {
136+
return {
135137
key: value
136138
if not isinstance(value, str)
137139
else eval_func(value, globals, locals)
138140
for key, value in ann.items()
139141
}
140-
return return_value

0 commit comments

Comments
 (0)