Skip to content

Commit bd352a3

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent e9b4dad commit bd352a3

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

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: 2 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,7 @@ 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("constraint(s)", new_constraints, old["constraints"], operator.itemgetter(slice(3, None)))
136137
missing_requirement = set(old["requirements"]) - set(new_requirements)
137138
if missing_requirement:
138139
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:

0 commit comments

Comments
 (0)