Skip to content

Commit 10ed397

Browse files
[pre-commit.ci] pre-commit autoupdate (#335)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Tobias Raabe <raabe@posteo.de>
1 parent b6ec2cd commit 10ed397

Some content is hidden

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

64 files changed

+427
-452
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ jobs:
3131

3232
steps:
3333
- uses: actions/checkout@v2
34-
- uses: conda-incubator/setup-miniconda@v2
34+
- uses: conda-incubator/setup-miniconda@v2.2.0
3535
with:
3636
auto-update-conda: false
3737
python-version: ${{ matrix.python-version }}
3838
channels: conda-forge,nodefaults
39-
mamba-version: "*"
39+
miniforge-variant: Mambaforge
4040

4141
- name: Install core dependencies.
4242
shell: bash -l {0}

.pre-commit-config.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
args: [--branch, main]
1818
- id: trailing-whitespace
1919
- repo: https://github.com/pre-commit/pygrep-hooks
20-
rev: v1.9.0
20+
rev: v1.10.0
2121
hooks:
2222
- id: python-check-blanket-noqa
2323
- id: python-check-mock-methods
@@ -35,21 +35,16 @@ repos:
3535
rev: v2.2.0
3636
hooks:
3737
- id: setup-cfg-fmt
38-
- repo: https://github.com/PyCQA/docformatter
39-
rev: v1.5.1
40-
hooks:
41-
- id: docformatter
42-
args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank]
4338
- repo: https://github.com/psf/black
4439
rev: 22.12.0
4540
hooks:
4641
- id: black
4742
- repo: https://github.com/charliermarsh/ruff-pre-commit
48-
rev: v0.0.205
43+
rev: v0.0.228
4944
hooks:
5045
- id: ruff
5146
- repo: https://github.com/dosisod/refurb
52-
rev: v1.9.1
47+
rev: v1.10.0
5348
hooks:
5449
- id: refurb
5550
args: [--ignore, FURB126]
@@ -113,7 +108,7 @@ repos:
113108
--ignore-missing-imports,
114109
]
115110
additional_dependencies: [
116-
attrs>=19.2.0,
111+
attrs>=21.3.0,
117112
click,
118113
types-setuptools
119114
]

pyproject.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,19 @@ extend-ignore = [
5555
"EM", # flake8-errmsg
5656
"ANN401", # flake8-annotate typing.Any
5757
"PD", # pandas-vet
58+
"COM812", # trailing comma missing, but black takes care of that
59+
"D401", # imperative mood for first line. too many false-positives.
5860
]
5961

6062

6163
[tool.ruff.per-file-ignores]
6264
"src/_pytask/capture.py" = ["PGH003"]
6365
"src/_pytask/hookspecs.py" = ["ARG001"]
6466
"src/_pytask/outcomes.py" = ["N818"]
65-
"tests/test_capture.py" = ["T201"]
66-
"tests/*" = ["D", "ANN"]
67-
"scripts/*" = ["D"]
67+
"tests/test_capture.py" = ["T201", "PT011"]
68+
"tests/*" = ["D", "ANN", "PLR2004"]
69+
"scripts/*" = ["D", "INP001"]
70+
"docs/source/conf.py" = ["D401", "INP001"]
6871

6972

7073
[tool.ruff.pydocstyle]

scripts/svgs/task_capture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def task_func1() -> None:
1111

1212
def task_func2() -> None:
1313
print("Debug statement") # noqa: T201
14-
assert False # noqa: B011
14+
raise AssertionError()
1515

1616

1717
if __name__ == "__main__":

scripts/svgs/task_warning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
def _create_df() -> pd.DataFrame:
1111
df = pd.DataFrame({"a": range(10), "b": range(10, 20)})
12-
df[df["a"] < 5]["b"] = 1
12+
df[df["a"] < 5]["b"] = 1 # noqa: PLR2004
1313
return df
1414

1515

scripts/update_plugin_list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def _escape_rst(text: str) -> str:
8888
def _iter_plugins() -> Generator[dict[str, str], None, None]:
8989
"""Iterate over all plugins and format entries."""
9090
regex = r">([\d\w-]*)</a>"
91-
response = requests.get("https://pypi.org/simple")
91+
response = requests.get("https://pypi.org/simple", timeout=20)
9292

9393
matches = [
9494
match
@@ -99,7 +99,7 @@ def _iter_plugins() -> Generator[dict[str, str], None, None]:
9999

100100
for match in tqdm(matches, smoothing=0):
101101
name = match.groups()[0]
102-
response = requests.get(f"https://pypi.org/pypi/{name}/json")
102+
response = requests.get(f"https://pypi.org/pypi/{name}/json", timeout=20)
103103
response.raise_for_status()
104104
info = response.json()["info"]
105105

src/_pytask/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""This module should not contain any imports except for the version."""
1+
"""Should not contain any imports except for the version."""
22
from __future__ import annotations
33

44

src/_pytask/capture.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def __init__(self, targetfd: int) -> None:
368368
self.targetfd_save = os.dup(targetfd)
369369

370370
if targetfd == 0:
371-
self.tmpfile = open(os.devnull, encoding="utf-8")
371+
self.tmpfile = open(os.devnull, encoding="utf-8") # noqa: SIM115
372372
self.syscapture = SysCapture(targetfd)
373373
else:
374374
self.tmpfile = EncodedFile(
@@ -494,9 +494,7 @@ class CaptureResult(Generic[AnyStr]):
494494
This class was a namedtuple, but due to mypy limitation [0]_ it could not be made
495495
generic, so was replaced by a regular class which tries to emulate the pertinent
496496
parts of a namedtuple. If the mypy limitation is ever lifted, can make it a
497-
namedtuple again.
498-
499-
.. [0] https://github.com/python/mypy/issues/685
497+
namedtuple again (https://github.com/python/mypy/issues/685).
500498
501499
"""
502500

@@ -512,7 +510,7 @@ def __len__(self) -> int:
512510
def __iter__(self) -> Iterator[AnyStr]:
513511
return iter((self.out, self.err))
514512

515-
def __getitem__(self, item: int) -> AnyStr: # noqa: ARG002
513+
def __getitem__(self, item: int) -> AnyStr:
516514
return tuple(self)[item]
517515

518516
def _replace(
@@ -634,14 +632,8 @@ def is_started(self) -> bool:
634632
return self._state == "started"
635633

636634
def readouterr(self) -> CaptureResult[AnyStr]:
637-
if self.out:
638-
out = self.out.snap()
639-
else:
640-
out = ""
641-
if self.err:
642-
err = self.err.snap()
643-
else:
644-
err = ""
635+
out = self.out.snap() if self.out else ""
636+
err = self.err.snap() if self.err else ""
645637
return CaptureResult(out, err) # type: ignore
646638

647639

src/_pytask/cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def pytask_add_hooks(pm: pluggy.PluginManager) -> None:
105105
@click.version_option(**_VERSION_OPTION_KWARGS)
106106
def cli() -> None:
107107
"""Manage your tasks with pytask."""
108-
pass
109108

110109

111110
_extend_command_line_interface(cli)

src/_pytask/click.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def _print_options(
157157
if param.name == "help":
158158
opt1 = highlighter("-h")
159159
opt2 = highlighter("--help")
160-
elif len(param.opts) == 2:
160+
elif len(param.opts) == 2: # noqa: PLR2004
161161
opt1 = highlighter(param.opts[0])
162162
opt2 = highlighter(param.opts[1])
163163
elif len(param.opts) == 1 == len(param.secondary_opts):
@@ -205,13 +205,12 @@ def _format_help_text(param: click.Parameter, ctx: click.Context) -> str: # noq
205205
if getattr(param, "show_envvar", None):
206206
envvar = getattr(param, "envvar", None)
207207

208-
if envvar is None:
209-
if (
210-
getattr(param, "allow_from_autoenv", None)
211-
and ctx.auto_envvar_prefix is not None
212-
and param.name is not None
213-
):
214-
envvar = f"{ctx.auto_envvar_prefix}_{param.name.upper()}"
208+
if envvar is None and (
209+
getattr(param, "allow_from_autoenv", None)
210+
and ctx.auto_envvar_prefix is not None
211+
and param.name is not None
212+
):
213+
envvar = f"{ctx.auto_envvar_prefix}_{param.name.upper()}"
215214

216215
if envvar is not None:
217216
var_str = (

0 commit comments

Comments
 (0)