Skip to content

Commit 27db835

Browse files
authored
chore: use Final type annotation on every top-level constant (#1010)
1 parent bc3106a commit 27db835

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

cibuildwheel/architecture.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from enum import Enum
55
from typing import Set
66

7-
from .typing import Literal, PlatformName, assert_never
7+
from .typing import Final, Literal, PlatformName, assert_never
88

9-
PRETTY_NAMES = {"linux": "Linux", "macos": "macOS", "windows": "Windows"}
9+
PRETTY_NAMES: Final = {"linux": "Linux", "macos": "macOS", "windows": "Windows"}
1010

1111

1212
@functools.total_ordering

cibuildwheel/logger.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
import time
66
from typing import IO, AnyStr, Optional, Union
77

8+
from cibuildwheel.typing import Final
89
from cibuildwheel.util import CIProvider, detect_ci_provider
910

10-
DEFAULT_FOLD_PATTERN = ("{name}", "")
11-
FOLD_PATTERNS = {
11+
DEFAULT_FOLD_PATTERN: Final = ("{name}", "")
12+
FOLD_PATTERNS: Final = {
1213
"azure": ("##[group]{name}", "##[endgroup]"),
1314
"travis": ("travis_fold:start:{identifier}\n{name}", "travis_fold:end:{identifier}"),
1415
"github": ("::group::{name}", "::endgroup::{name}"),
1516
}
1617

17-
PLATFORM_IDENTIFIER_DESCRIPTIONS = {
18+
PLATFORM_IDENTIFIER_DESCRIPTIONS: Final = {
1819
"manylinux_x86_64": "manylinux x86_64",
1920
"manylinux_i686": "manylinux i686",
2021
"manylinux_aarch64": "manylinux aarch64",

cibuildwheel/util.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@
3939
from packaging.version import Version
4040
from platformdirs import user_cache_path
4141

42-
from cibuildwheel.typing import Literal, PathOrStr, PlatformName
42+
from cibuildwheel.typing import Final, Literal, PathOrStr, PlatformName
4343

44-
resources_dir = Path(__file__).parent / "resources"
44+
resources_dir: Final = Path(__file__).parent / "resources"
4545

46-
install_certifi_script = resources_dir / "install_certifi.py"
46+
install_certifi_script: Final = resources_dir / "install_certifi.py"
4747

48-
BuildFrontend = Literal["pip", "build"]
48+
BuildFrontend: Final = Literal["pip", "build"]
4949

50-
MANYLINUX_ARCHS = (
50+
MANYLINUX_ARCHS: Final = (
5151
"x86_64",
5252
"i686",
5353
"pypy_x86_64",
@@ -58,18 +58,18 @@
5858
"pypy_i686",
5959
)
6060

61-
MUSLLINUX_ARCHS = (
61+
MUSLLINUX_ARCHS: Final = (
6262
"x86_64",
6363
"i686",
6464
"aarch64",
6565
"ppc64le",
6666
"s390x",
6767
)
6868

69-
DEFAULT_CIBW_CACHE_PATH = user_cache_path(appname="cibuildwheel", appauthor="pypa")
70-
CIBW_CACHE_PATH = Path(os.environ.get("CIBW_CACHE_PATH", DEFAULT_CIBW_CACHE_PATH)).resolve()
69+
DEFAULT_CIBW_CACHE_PATH: Final = user_cache_path(appname="cibuildwheel", appauthor="pypa")
70+
CIBW_CACHE_PATH: Final = Path(os.environ.get("CIBW_CACHE_PATH", DEFAULT_CIBW_CACHE_PATH)).resolve()
7171

72-
IS_WIN = sys.platform.startswith("win")
72+
IS_WIN: Final = sys.platform.startswith("win")
7373

7474

7575
@overload

0 commit comments

Comments
 (0)