Skip to content

Commit ddb7ded

Browse files
committed
Fix
Signed-off-by: Bernát Gábor <[email protected]>
1 parent 4113349 commit ddb7ded

File tree

9 files changed

+32
-19
lines changed

9 files changed

+32
-19
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
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:

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: 4 additions & 4 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"',
@@ -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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@
55
import os
66
from configparser import ConfigParser
77
from pathlib import Path
8-
from typing import Any
8+
from typing import TYPE_CHECKING, Any, ClassVar
99

1010
from platformdirs import user_config_dir
1111

1212
from tox.config.loader.api import ConfigLoadArgs
1313
from tox.config.loader.ini import IniLoader
1414
from tox.config.source.ini_section import CORE
1515

16+
if TYPE_CHECKING:
17+
from typing import Final
18+
1619
DEFAULT_CONFIG_FILE = Path(user_config_dir("tox")) / "config.ini"
1720

1821

1922
class IniConfig:
2023
TOX_CONFIG_FILE_ENV_VAR = "TOX_USER_CONFIG_FILE"
21-
STATE = {None: "failed to parse", True: "active", False: "missing"}
24+
STATE: Final[ClassVar[dict[bool | None], str]] = {None: "failed to parse", True: "active", False: "missing"}
2225

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

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/report.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
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, TYPE_CHECKING, ClassVar, Iterator, Tuple
1212

1313
from colorama import Fore, Style, init
1414

15+
if TYPE_CHECKING:
16+
from typing import Final
17+
1518
LEVELS = {
1619
0: logging.CRITICAL,
1720
1: logging.ERROR,
@@ -29,7 +32,7 @@
2932
class _LogThreadLocal(local):
3033
"""A thread local variable that inherits values from its parent."""
3134

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

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

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

Lines changed: 2 additions & 1 deletion
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)

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, Final
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_: Final[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: Final[ClassVar[list[str]]] = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
52+
ASCII_FRAMES: Final[ClassVar[list[str]]] = ["|", "-", "+", "x", "*"]
5253
UNICODE_OUTCOME = Outcome(ok="✔", fail="✖", skip="⚠")
5354
ASCII_OUTCOME = Outcome(ok="+", fail="!", skip="?")
5455

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)