Skip to content

Commit a66296b

Browse files
[pre-commit.ci] pre-commit autoupdate (#3061)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent c2613ca commit a66296b

File tree

18 files changed

+30
-34
lines changed

18 files changed

+30
-34
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ repos:
1414
- id: tox-ini-fmt
1515
args: ["-p", "fix"]
1616
- repo: https://github.com/tox-dev/pyproject-fmt
17-
rev: "0.12.1"
17+
rev: "0.13.0"
1818
hooks:
1919
- id: pyproject-fmt
20-
additional_dependencies: ["tox>=4.6.3"]
20+
additional_dependencies: ["tox>=4.6.4"]
2121
- repo: https://github.com/pre-commit/mirrors-prettier
22-
rev: "v3.0.0-alpha.9-for-vscode"
22+
rev: "v3.0.0"
2323
hooks:
2424
- id: prettier
2525
args: ["--print-width=120", "--prose-wrap=always"]
2626
- repo: https://github.com/asottile/blacken-docs
27-
rev: 1.14.0
27+
rev: 1.15.0
2828
hooks:
2929
- id: blacken-docs
3030
additional_dependencies: [black==23.3]
3131
- repo: https://github.com/astral-sh/ruff-pre-commit
32-
rev: "v0.0.275"
32+
rev: "v0.0.277"
3333
hooks:
3434
- id: ruff
3535
args: [--fix, --exit-non-zero-on-fix]

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ dependencies = [
5454
"filelock>=3.12.2",
5555
'importlib-metadata>=6.7; python_version < "3.8"',
5656
"packaging>=23.1",
57-
"platformdirs>=3.8",
57+
"platformdirs>=3.8.1",
5858
"pluggy>=1.2",
59-
"pyproject-api>=1.5.2",
59+
"pyproject-api>=1.5.3",
6060
'tomli>=2.0.1; python_version < "3.11"',
61-
'typing-extensions>=4.6.3; python_version < "3.8"',
61+
'typing-extensions>=4.7.1; python_version < "3.8"',
6262
"virtualenv>=20.23.1",
6363
]
6464
optional-dependencies.docs = [

src/tox/config/cli/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def get_type(action: Action) -> type[Any]:
6464
loc = locals()
6565
loc["Literal"] = Literal
6666
as_literal = f"Literal[{', '.join(repr(i) for i in action.choices)}]"
67-
of_type = eval(as_literal, globals(), loc) # noqa: PGH001
67+
of_type = eval(as_literal, globals(), loc) # noqa: PGH001, S307
6868
elif action.default is not None:
6969
of_type = type(action.default)
7070
elif isinstance(action, argparse._StoreConstAction) and action.const is not None: # noqa: SLF001

src/tox/config/loader/ini/replace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def replace_reference( # noqa: PLR0912, C901
255255
if isinstance(src, SectionProxy):
256256
return loader.process_raw(conf, conf_args.env_name, src[key])
257257
value = src.load(key, conf_args.chain)
258-
except KeyError as exc: # if fails, keep trying maybe another source can satisfy
258+
except KeyError as exc: # if fails, keep trying maybe another source can satisfy # noqa: PERF203
259259
exception = exc
260260
else:
261261
as_str, _ = stringify(value)

src/tox/config/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def get_section_config( # noqa: PLR0913
140140
if for_env is not None:
141141
conf_set.loaders.extend(self.memory_seed_loaders.get(for_env, []))
142142
for loader in self._src.get_loaders(section, base, self._overrides, conf_set):
143-
conf_set.loaders.append(loader)
143+
conf_set.loaders.append(loader) # noqa: PERF402
144144
if loaders is not None:
145145
conf_set.loaders.extend(loaders)
146146
return conf_set

src/tox/config/of_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def __call__(
9595
args.chain.append(chain_key)
9696
try:
9797
value = loader.load(key, self.of_type, self.factory, conf, args)
98-
except KeyError:
98+
except KeyError: # noqa: PERF203
9999
continue
100100
else:
101101
break

src/tox/config/source/discover.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def discover_source(config_file: Path | None, root_dir: Path | None) -> Source:
3636
try:
3737
src = src_type(candidate)
3838
break
39-
except ValueError:
39+
except ValueError: # noqa: PERF203
4040
continue
4141
if src is None:
4242
msg = f"could not find any config file in {config_file}"
@@ -53,7 +53,7 @@ def _locate_source() -> Source | None:
5353
candidate: Path = base / src_type.FILENAME
5454
try:
5555
return src_type(candidate)
56-
except ValueError:
56+
except ValueError: # noqa: PERF203
5757
pass
5858
return None
5959

@@ -64,7 +64,7 @@ def _load_exact_source(config_file: Path) -> Source:
6464
for src_type in (exact_match,) if exact_match is not None else SOURCE_TYPES: # pragma: no branch
6565
try:
6666
return src_type(config_file)
67-
except ValueError:
67+
except ValueError: # noqa: PERF203
6868
pass
6969
msg = f"could not recognize config file {config_file}"
7070
raise HandledError(msg)

src/tox/provision.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def _get_missing(requires: list[Requirement]) -> list[tuple[Requirement, str | N
132132
package_name = canonicalize_name(package.name)
133133
try:
134134
dist = distribution(package_name)
135-
except PackageNotFoundError:
135+
except PackageNotFoundError: # noqa: PERF203
136136
missing.append((package, None))
137137
else:
138138
if not package.specifier.contains(dist.version, prereleases=True):

src/tox/session/cmd/depends.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _handle(at: int, env: str) -> None:
3838
packager_list: list[str] = []
3939
try:
4040
for pkg_env in run_env.package_envs:
41-
packager_list.append(pkg_env.name)
41+
packager_list.append(pkg_env.name) # noqa: PERF401
4242
except Exception as exception: # noqa: BLE001
4343
packager_list.append(f"... ({exception})")
4444
names = " | ".join(packager_list)

src/tox/session/cmd/legacy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def _handle_legacy_only_flags(option: Parsed, envs: EnvSelector) -> None: # noq
139139
for at, entry in enumerate(as_root_args):
140140
try:
141141
req = Requirement(entry)
142-
except InvalidRequirement:
142+
except InvalidRequirement: # noqa: PERF203
143143
continue
144144
if req.name in to_force:
145145
as_root_args[at] = str(to_force[req.name])

src/tox/session/cmd/run/common.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,8 @@ def execute(state: State, max_workers: int | None, has_spinner: bool, live: bool
263263
thread._stop() # type: ignore[attr-defined] # pragma: no cover # noqa: SLF001
264264
thread.join()
265265
finally:
266-
ordered_results: list[ToxEnvRunResult] = []
267266
name_to_run = {r.name: r for r in results}
268-
for env in to_run_list:
269-
ordered_results.append(name_to_run[env])
267+
ordered_results: list[ToxEnvRunResult] = [name_to_run[env] for env in to_run_list]
270268
# write the journal
271269
write_journal(getattr(state.conf.options, "result_json", None), state._journal) # noqa: SLF001
272270
# report the outcome

src/tox/session/cmd/run/single.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def run_command_set(
112112
outcomes.append(current_outcome)
113113
try:
114114
current_outcome.assert_success()
115-
except SystemExit as exception:
115+
except SystemExit as exception: # noqa: PERF203
116116
if cmd.ignore_exit_code:
117117
logging.warning("command failed but is marked ignore outcome so handling it as success")
118118
continue

src/tox/session/cmd/show_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def print_conf(is_colored: bool, conf: ConfigSet, keys: Iterable[str]) -> None:
101101
try:
102102
value = conf[key]
103103
as_str, multi_line = stringify(value)
104-
except Exception as exception: # because e.g. the interpreter cannot be found # noqa: BLE001
104+
except Exception as exception: # because e.g. the interpreter cannot be found # noqa: BLE001, PERF203
105105
as_str, multi_line = _colored(is_colored, Fore.LIGHTRED_EX, f"# Exception: {exception!r}"), False
106106
if multi_line and "\n" not in as_str:
107107
multi_line = False

src/tox/tox_env/python/pip/req/file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def _merge_option_line( # noqa: C901, PLR0912, PLR0915
320320
base_opt.features_enabled = []
321321
for feature in opt.features_enabled:
322322
if feature not in base_opt.features_enabled:
323-
base_opt.features_enabled.append(feature)
323+
base_opt.features_enabled.append(feature) # noqa: PERF401
324324
base_opt.features_enabled.sort()
325325
if opt.index_url:
326326
if getattr(base_opt, "index_url", []):

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ def _normalize_raw(raw: str) -> str:
6666
# a line ending in an unescaped \ is treated as a line continuation and the newline following it is effectively
6767
# ignored
6868
raw = "".join(raw.replace("\r", "").split("\\\n"))
69-
lines: list[str] = []
70-
for line in raw.splitlines():
71-
# for tox<4 supporting requirement/constraint files via -rreq.txt/-creq.txt
72-
lines.append(PythonDeps._normalize_line(line))
69+
# for tox<4 supporting requirement/constraint files via -rreq.txt/-creq.txt
70+
lines: list[str] = [PythonDeps._normalize_line(line) for line in raw.splitlines()]
7371
adjusted = "\n".join(lines)
7472
return f"{adjusted}\n" if raw.endswith("\\\n") else adjusted # preserve trailing newline if input has it
7573

src/tox/util/spinner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ class _CursorInfo(ctypes.Structure):
2525
def _file_support_encoding(chars: Sequence[str], file: IO[str]) -> bool:
2626
encoding = getattr(file, "encoding", None)
2727
if encoding is not None: # pragma: no branch # this should be always set, unless someone passes in something bad
28-
for char in chars:
29-
try:
28+
try:
29+
for char in chars:
3030
char.encode(encoding)
31-
except UnicodeEncodeError:
32-
break
31+
except UnicodeEncodeError:
32+
pass
3333
else:
3434
return True
3535
return False

tests/plugin/test_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def _cannot_extend_config(config_set: ConfigSet) -> None:
241241
try:
242242
_conf(config_set) # type: ignore[no-untyped-call] # call to not typed function
243243
raise NotImplementedError # noqa: TRY301
244-
except RuntimeError as exc:
244+
except RuntimeError as exc: # noqa: PERF203
245245
assert str(exc) == "config set has been marked final and cannot be extended" # noqa: PT017
246246

247247
@impl

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ commands =
8484
description = do a release, required posarg of the version number
8585
skip_install = true
8686
deps =
87-
gitpython>=3.1.31
87+
gitpython>=3.1.32
8888
packaging>=23.1
8989
towncrier>=23.6
9090
commands =

0 commit comments

Comments
 (0)