Skip to content

Commit d7ce800

Browse files
[pre-commit.ci] pre-commit autoupdate (#3051)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bernát Gábor <[email protected]>
1 parent af66165 commit d7ce800

File tree

20 files changed

+43
-43
lines changed

20 files changed

+43
-43
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ repos:
1414
- id: tox-ini-fmt
1515
args: ["-p", "fix"]
1616
- repo: https://github.com/tox-dev/pyproject-fmt
17-
rev: "0.12.0"
17+
rev: "0.12.1"
1818
hooks:
1919
- id: pyproject-fmt
20-
additional_dependencies: ["tox>=4.6.1"]
20+
additional_dependencies: ["tox>=4.6.3"]
2121
- repo: https://github.com/pre-commit/mirrors-prettier
2222
rev: "v3.0.0-alpha.9-for-vscode"
2323
hooks:
@@ -29,7 +29,7 @@ repos:
2929
- id: blacken-docs
3030
additional_dependencies: [black==23.3]
3131
- repo: https://github.com/astral-sh/ruff-pre-commit
32-
rev: "v0.0.272"
32+
rev: "v0.0.275"
3333
hooks:
3434
- id: ruff
3535
args: [--fix, --exit-non-zero-on-fix]

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ and `devpi <https://www.devpi.net>`_).
2222
:target: https://pypistats.org/packages/tox
2323
:alt: PyPI - Downloads
2424
.. image:: https://img.shields.io/pypi/l/tox?style=flat-square
25-
:target: https://opensource.org/licenses/MIT
25+
:target: https://opensource.org/license/mit/
2626
:alt: PyPI - License
2727
.. image:: https://img.shields.io/github/issues/tox-dev/tox?style=flat-square
2828
:target: https://github.com/tox-dev/tox/issues

docs/tox_conf.py

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

3-
from typing import TYPE_CHECKING, cast
3+
from typing import TYPE_CHECKING, Any, ClassVar, cast
44

55
from docutils.nodes import Element, Node, Text, container, fully_normalize_name, literal, paragraph, reference, strong
66
from docutils.parsers.rst.directives import flag, unchanged, unchanged_required
@@ -11,6 +11,8 @@
1111
from sphinx.util.logging import getLogger
1212

1313
if TYPE_CHECKING:
14+
from typing import Final
15+
1416
from docutils.parsers.rst.states import RSTState, RSTStateMachine
1517

1618
LOGGER = getLogger(__name__)
@@ -19,7 +21,7 @@
1921
class ToxConfig(SphinxDirective):
2022
name = "conf"
2123
has_content = True
22-
option_spec = {
24+
option_spec: Final[ClassVar[dict[str, Any]]] = {
2325
"keys": unchanged_required,
2426
"version_added": unchanged,
2527
"version_changed": unchanged,

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ dependencies = [
5252
"chardet>=5.1",
5353
"colorama>=0.4.6",
5454
"filelock>=3.12.2",
55-
'importlib-metadata>=6.6; python_version < "3.8"',
55+
'importlib-metadata>=6.7; python_version < "3.8"',
5656
"packaging>=23.1",
57-
"platformdirs>=3.5.3",
58-
"pluggy>=1",
57+
"platformdirs>=3.8",
58+
"pluggy>=1.2",
5959
"pyproject-api>=1.5.2",
6060
'tomli>=2.0.1; python_version < "3.11"',
6161
'typing-extensions>=4.6.3; python_version < "3.8"',
@@ -65,7 +65,7 @@ optional-dependencies.docs = [
6565
"furo>=2023.5.20",
6666
"sphinx>=7.0.1",
6767
"sphinx-argparse-cli>=1.11.1",
68-
"sphinx-autodoc-typehints!=1.23.4,>=1.23.2",
68+
"sphinx-autodoc-typehints!=1.23.4,>=1.23.3",
6969
"sphinx-copybutton>=0.5.2",
7070
"sphinx-inline-tabs>=2023.4.21",
7171
"sphinxcontrib-towncrier>=0.2.1a0",
@@ -82,7 +82,7 @@ optional-dependencies.testing = [
8282
"hatch-vcs>=0.3",
8383
"hatchling>=1.17.1",
8484
"psutil>=5.9.5",
85-
"pytest>=7.3.2",
85+
"pytest>=7.4",
8686
"pytest-cov>=4.1",
8787
"pytest-mock>=3.11.1",
8888
"pytest-xdist>=3.3.1",

src/tox/config/cli/ini.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66
from configparser import ConfigParser
77
from pathlib import Path
8-
from typing import Any
8+
from typing import Any, ClassVar
99

1010
from platformdirs import user_config_dir
1111

@@ -18,7 +18,7 @@
1818

1919
class IniConfig:
2020
TOX_CONFIG_FILE_ENV_VAR = "TOX_USER_CONFIG_FILE"
21-
STATE = {None: "failed to parse", True: "active", False: "missing"}
21+
STATE: ClassVar[dict[bool | None, str]] = {None: "failed to parse", True: "active", False: "missing"}
2222

2323
def __init__(self) -> None:
2424
config_file = os.environ.get(self.TOX_CONFIG_FILE_ENV_VAR, None)

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ def replace_reference( # noqa: PLR0912, C901
259259
exception = exc
260260
else:
261261
as_str, _ = stringify(value)
262-
as_str = as_str.replace("#", r"\#") # escape comment characters as these will be stripped
263-
return as_str
262+
return as_str.replace("#", r"\#") # escape comment characters as these will be stripped
264263
except Exception as exc: # noqa: BLE001
265264
exception = exc
266265
if exception is not None:

src/tox/config/loader/section.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __repr__(self) -> str:
5252

5353
def __eq__(self, other: Any) -> bool:
5454
return isinstance(other, self.__class__) and (self._prefix, self._name) == (
55-
other._prefix, # noqa: SLF001
55+
other._prefix,
5656
other.name,
5757
)
5858

src/tox/config/loader/str_convert.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
import sys
66
from itertools import chain
77
from pathlib import Path
8-
from typing import Any, Iterator
8+
from typing import TYPE_CHECKING, Any, Iterator
99

1010
from tox.config.loader.convert import Convert
1111
from tox.config.types import Command, EnvList
1212

13+
if TYPE_CHECKING:
14+
from typing import Final
15+
1316

1417
class StrConvert(Convert[str]):
1518
"""A class converting string values to tox types."""
@@ -111,8 +114,8 @@ def to_env_list(value: str) -> EnvList:
111114
elements = list(chain.from_iterable(extend_factors(expr) for expr in value.split("\n")))
112115
return EnvList(elements)
113116

114-
TRUTHFUL_VALUES = {"true", "1", "yes", "on"}
115-
FALSE_VALUES = {"false", "0", "no", "off", ""}
117+
TRUTHFUL_VALUES: Final[set[str]] = {"true", "1", "yes", "on"}
118+
FALSE_VALUES: Final[set[str]] = {"false", "0", "no", "off", ""}
116119
VALID_BOOL = sorted(TRUTHFUL_VALUES | FALSE_VALUES)
117120

118121
@staticmethod

src/tox/config/of_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __init__( # noqa: PLR0913
7171
of_type: type[T],
7272
default: Callable[[Config, str | None], T] | T,
7373
post_process: Callable[[T], T] | None = None,
74-
factory: Factory[T] = None,
74+
factory: Factory[T] | None = None,
7575
) -> None:
7676
super().__init__(keys, desc)
7777
self.of_type = of_type

src/tox/config/sets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def add_config( # noqa: PLR0913
4747
default: Callable[[Config, str | None], V] | V,
4848
desc: str,
4949
post_process: Callable[[V], V] | None = None,
50-
factory: Factory[Any] = None,
50+
factory: Factory[Any] | None = None,
5151
) -> ConfigDynamicDefinition[V]:
5252
"""
5353
Add configuration value.

src/tox/plugin/inline.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def _load_plugin(path: Path) -> ModuleType:
2727
try:
2828
if module_name in sys.modules:
2929
del sys.modules[module_name] # pragma: no cover
30-
module = importlib.import_module(module_name)
31-
return module
30+
return importlib.import_module(module_name)
3231
finally:
3332
del sys.path[0]

src/tox/report.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from io import BytesIO, TextIOWrapper
99
from pathlib import Path
1010
from threading import Thread, current_thread, enumerate, local
11-
from typing import IO, Iterator, Tuple
11+
from typing import IO, ClassVar, Iterator, Tuple
1212

1313
from colorama import Fore, Style, init
1414

@@ -29,7 +29,7 @@
2929
class _LogThreadLocal(local):
3030
"""A thread local variable that inherits values from its parent."""
3131

32-
_ident_to_data: dict[int | None, str] = {}
32+
_ident_to_data: ClassVar[dict[int | None, str]] = {}
3333

3434
def __init__(self, out_err: OutErr) -> None:
3535
self.name = self._ident_to_data.get(getattr(current_thread(), "parent_ident", None), "ROOT")

src/tox/run.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ def main(args: Sequence[str]) -> int:
4242
if result is not False:
4343
return result
4444
handler = state._options.cmd_handlers[state.conf.options.command] # noqa: SLF001
45-
result = handler(state)
46-
return result
45+
return handler(state)
4746

4847

4948
def setup_state(args: Sequence[str]) -> State:

src/tox/session/env_select.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __repr__(self) -> str:
4747
return f"{self.__class__.__name__}({'' if self.is_default_list else repr(str(self))})"
4848

4949
def __eq__(self, other: Any) -> bool:
50-
return type(self) == type(other) and self._names == other._names # noqa: SLF001
50+
return type(self) == type(other) and self._names == other._names
5151

5252
def __ne__(self, other: Any) -> bool:
5353
return not (self == other)

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@ def _get_file_content(self, url: str) -> str:
246246
scheme = get_url_scheme(url)
247247
if scheme in ["http", "https"]:
248248
with urlopen(url) as response: # noqa: S310
249-
text = self._read_decode(response)
250-
return text
249+
return self._read_decode(response)
251250
elif scheme == "file":
252251
url = url_to_path(url)
253252
try:
@@ -275,8 +274,7 @@ def _pre_process(self, content: str) -> ReqFileLines:
275274
lines_enum: ReqFileLines = enumerate(content.splitlines(), start=1)
276275
lines_enum = self._join_lines(lines_enum)
277276
lines_enum = self._ignore_comments(lines_enum)
278-
lines_enum = self._expand_env_variables(lines_enum)
279-
return lines_enum
277+
return self._expand_env_variables(lines_enum)
280278

281279
def _parse_line(self, line: str) -> tuple[str, Namespace]:
282280
args_str, options_str = self._break_args_options(line)

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ def url_to_path(url: str) -> str:
2727
else:
2828
msg = f"non-local file URIs are not supported on this platform: {url!r}"
2929
raise ValueError(msg)
30-
path = url2pathname(netloc + path)
31-
return path
30+
return url2pathname(netloc + path)
3231

3332

3433
def handle_binary_option(value: str, target: set[str], other: set[str]) -> None:

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
if TYPE_CHECKING:
99
from argparse import ArgumentParser, Namespace
1010
from pathlib import Path
11+
from typing import Final
1112

1213

1314
class PythonDeps(RequirementsFile):
1415
# these options are valid in requirements.txt, but not via pip cli and
1516
# thus cannot be used in the testenv `deps` list
16-
_illegal_options = ["hash"]
17+
_illegal_options: Final[list[str]] = ["hash"]
1718

1819
def __init__(self, raw: str, root: Path) -> None:
1920
super().__init__(root / "tox.ini", constraint=False)
@@ -70,8 +71,7 @@ def _normalize_raw(raw: str) -> str:
7071
# for tox<4 supporting requirement/constraint files via -rreq.txt/-creq.txt
7172
lines.append(PythonDeps._normalize_line(line))
7273
adjusted = "\n".join(lines)
73-
raw = f"{adjusted}\n" if raw.endswith("\\\n") else adjusted # preserve trailing newline if input has it
74-
return raw
74+
return f"{adjusted}\n" if raw.endswith("\\\n") else adjusted # preserve trailing newline if input has it
7575

7676
@staticmethod
7777
def _normalize_line(line: str) -> str:

src/tox/util/spinner.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313

1414
if TYPE_CHECKING:
1515
from types import TracebackType
16+
from typing import Any, ClassVar
1617

1718
if sys.platform == "win32": # pragma: win32 cover
1819
import ctypes
1920

2021
class _CursorInfo(ctypes.Structure):
21-
_fields_ = [("size", ctypes.c_int), ("visible", ctypes.c_byte)]
22+
_fields_: ClassVar[list[tuple[str, Any]]] = [("size", ctypes.c_int), ("visible", ctypes.c_byte)]
2223

2324

2425
def _file_support_encoding(chars: Sequence[str], file: IO[str]) -> bool:
@@ -47,8 +48,8 @@ class Outcome(NamedTuple):
4748
class Spinner:
4849
CLEAR_LINE = "\033[K"
4950
max_width = 120
50-
UNICODE_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
51-
ASCII_FRAMES = ["|", "-", "+", "x", "*"]
51+
UNICODE_FRAMES: ClassVar[list[str]] = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
52+
ASCII_FRAMES: ClassVar[list[str]] = ["|", "-", "+", "x", "*"]
5253
UNICODE_OUTCOME = Outcome(ok="✔", fail="✖", skip="⚠")
5354
ASCII_OUTCOME = Outcome(ok="+", fail="!", skip="?")
5455

tests/util/test_ci.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"TEAMCITY_VERSION": None, # TeamCity
2323
"TRAVIS": "true", # Travis CI
2424
}.items(),
25-
ids=lambda v: v[0], # type: ignore[no-any-return]
25+
ids=lambda v: v[0],
2626
)
2727
def test_is_ci(env_var: tuple[str, str | None], monkeypatch: pytest.MonkeyPatch) -> None:
2828
for var in _ENV_VARS:
@@ -41,7 +41,7 @@ def test_is_ci(env_var: tuple[str, str | None], monkeypatch: pytest.MonkeyPatch)
4141
"GITHUB_ACTIONS": "", # GitHub Actions
4242
"TRAVIS": "", # Travis CI
4343
}.items(),
44-
ids=lambda v: v[0], # type: ignore[no-any-return]
44+
ids=lambda v: v[0],
4545
)
4646
def test_is_ci_bad_set(env_var: tuple[str, str], monkeypatch: pytest.MonkeyPatch) -> None:
4747
for var in _ENV_VARS:

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ commands =
5252
[testenv:type]
5353
description = run type check on code base
5454
deps =
55-
mypy==1.3
55+
mypy==1.4.1
5656
types-cachetools>=5.3.0.5
5757
types-chardet>=5.0.4.6
5858
commands =

0 commit comments

Comments
 (0)