Skip to content

Commit 30fc57b

Browse files
pre-commit-ci[bot]gaborbernat
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
1 parent e9b4dad commit 30fc57b

File tree

7 files changed

+20
-15
lines changed

7 files changed

+20
-15
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
rev: "1.8.0"
2424
hooks:
2525
- id: pyproject-fmt
26-
additional_dependencies: ["tox>=4.12.1"]
26+
additional_dependencies: ["tox>=4.14.2"]
2727
- repo: https://github.com/astral-sh/ruff-pre-commit
2828
rev: "v0.4.1"
2929
hooks:
@@ -34,7 +34,7 @@ repos:
3434
rev: 1.16.0
3535
hooks:
3636
- id: blacken-docs
37-
additional_dependencies: [black==23.12.1]
37+
additional_dependencies: [black==24.4]
3838
- repo: https://github.com/pre-commit/pygrep-hooks
3939
rev: v1.10.0
4040
hooks:

src/tox/config/loader/convert.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ def _to_typing(self, raw: T, of_type: type[V], factory: Factory[V]) -> V: # noq
6464
elif origin == Union: # handle Optional values
6565
args: list[type[Any]] = of_type.__args__ # type: ignore[attr-defined]
6666
none = type(None)
67-
if len(args) == 2 and none in args: # type: ignore[comparison-overlap] # noqa: PLR2004
67+
if len(args) == 2 and none in args: # noqa: PLR2004
6868
if isinstance(raw, str):
6969
raw = raw.strip() # type: ignore[assignment]
7070
if not raw:
7171
result = None
7272
else:
73-
new_type = next(i for i in args if i != none) # type: ignore[comparison-overlap] # pragma: no cover
73+
new_type = next(i for i in args if i != none) # pragma: no cover
7474
result = self.to(raw, new_type, factory)
7575
elif origin in {Literal, type(Literal)}:
7676
choice = of_type.__args__ # type: ignore[attr-defined]

src/tox/session/cmd/show_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def print_key_value(is_colored: bool, key: str, value: str, multi_line: bool = F
9595

9696

9797
def print_conf(is_colored: bool, conf: ConfigSet, keys: Iterable[str]) -> None: # noqa: FBT001
98-
for key in keys if keys else conf:
98+
for key in keys or conf:
9999
if key not in conf:
100100
continue
101101
key = conf.primary_key(key) # noqa: PLW2901

src/tox/tox_env/python/pip/pip_install.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import logging
4+
import operator
45
from collections import defaultdict
56
from pathlib import Path
67
from typing import TYPE_CHECKING, Any, Callable, Sequence
@@ -132,7 +133,9 @@ def _install_requirement_file(self, arguments: PythonDeps, section: str, of_type
132133
if not eq: # pragma: no branch
133134
if old is not None:
134135
self._recreate_if_diff("install flag(s)", new_options, old["options"], lambda i: i)
135-
self._recreate_if_diff("constraint(s)", new_constraints, old["constraints"], lambda i: i[3:])
136+
self._recreate_if_diff(
137+
"constraint(s)", new_constraints, old["constraints"], operator.itemgetter(slice(3, None))
138+
)
136139
missing_requirement = set(old["requirements"]) - set(new_requirements)
137140
if missing_requirement:
138141
msg = f"requirements removed: {' '.join(missing_requirement)}"

src/tox/util/cpu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def auto_detect_cpus() -> int:
1010
n: int | None = multiprocessing.cpu_count()
1111
except NotImplementedError:
1212
n = None
13-
return n if n else 1
13+
return n or 1
1414

1515

1616
__all__ = ("auto_detect_cpus",)

tests/util/test_ci.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
import operator
4+
35
import pytest
46

57
from tox.util.ci import _ENV_VARS, is_ci # noqa: PLC2701
@@ -22,7 +24,7 @@
2224
"TEAMCITY_VERSION": None, # TeamCity
2325
"TRAVIS": "true", # Travis CI
2426
}.items(),
25-
ids=lambda v: v[0],
27+
ids=operator.itemgetter(0),
2628
)
2729
def test_is_ci(env_var: tuple[str, str | None], monkeypatch: pytest.MonkeyPatch) -> None:
2830
for var in _ENV_VARS:
@@ -41,7 +43,7 @@ def test_is_ci(env_var: tuple[str, str | None], monkeypatch: pytest.MonkeyPatch)
4143
"GITHUB_ACTIONS": "", # GitHub Actions
4244
"TRAVIS": "", # Travis CI
4345
}.items(),
44-
ids=lambda v: v[0],
46+
ids=operator.itemgetter(0),
4547
)
4648
def test_is_ci_bad_set(env_var: tuple[str, str], monkeypatch: pytest.MonkeyPatch) -> None:
4749
for var in _ENV_VARS:

tox.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ commands =
4040
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
4141
skip_install = true
4242
deps =
43-
pre-commit>=3.6
43+
pre-commit>=3.7
4444
pass_env =
4545
{[testenv]passenv}
4646
PROGRAMDATA
@@ -51,7 +51,7 @@ commands =
5151
[testenv:type]
5252
description = run type check on code base
5353
deps =
54-
mypy==1.8
54+
mypy==1.9
5555
types-cachetools>=5.3.0.7
5656
types-chardet>=5.0.4.6
5757
commands =
@@ -71,9 +71,9 @@ commands =
7171
description = check that the long description is valid
7272
skip_install = true
7373
deps =
74-
build[virtualenv]>=1.0.3
74+
build[virtualenv]>=1.2.1
7575
check-wheel-contents>=0.6
76-
twine>=4.0.2
76+
twine>=5
7777
commands =
7878
python -m build -o {envtmpdir} -s -w .
7979
twine check {envtmpdir}{/}*
@@ -83,8 +83,8 @@ commands =
8383
description = do a release, required posarg of the version number
8484
skip_install = true
8585
deps =
86-
gitpython>=3.1.41
87-
packaging>=23.2
86+
gitpython>=3.1.43
87+
packaging>=24
8888
towncrier>=23.11
8989
commands =
9090
python {toxinidir}/tasks/release.py --version {posargs}

0 commit comments

Comments
 (0)