Skip to content

Commit

Permalink
Final for distutils constants (python#12454)
Browse files Browse the repository at this point in the history
Co-authored-by: Avasam <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Sep 8, 2024
1 parent 453df4b commit 257b2fa
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 35 deletions.
4 changes: 2 additions & 2 deletions stdlib/distutils/command/check.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, ClassVar, Literal
from typing import Any, ClassVar, Final, Literal
from typing_extensions import TypeAlias

from ..cmd import Command
Expand All @@ -22,7 +22,7 @@ class SilentReporter(_Reporter):
) -> None: ...
def system_message(self, level, message, *children, **kwargs): ...

HAS_DOCUTILS: bool
HAS_DOCUTILS: Final[bool]

class check(Command):
description: str
Expand Down
4 changes: 2 additions & 2 deletions stdlib/distutils/command/config.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from _typeshed import StrOrBytesPath
from collections.abc import Sequence
from re import Pattern
from typing import Any, ClassVar, Literal
from typing import Any, ClassVar, Final, Literal

from ..ccompiler import CCompiler
from ..cmd import Command

LANG_EXT: dict[str, str]
LANG_EXT: Final[dict[str, str]]

class config(Command):
description: str
Expand Down
7 changes: 4 additions & 3 deletions stdlib/distutils/command/install.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import sys
from collections.abc import Callable
from typing import Any, ClassVar, Final
from typing import Any, ClassVar, Final, Literal

from ..cmd import Command

HAS_USER_SITE: bool
SCHEME_KEYS: tuple[str, ...]
HAS_USER_SITE: Final[bool]

SCHEME_KEYS: Final[tuple[Literal["purelib"], Literal["platlib"], Literal["headers"], Literal["scripts"], Literal["data"]]]
INSTALL_SCHEMES: Final[dict[str, dict[str, str]]]

if sys.version_info < (3, 10):
Expand Down
4 changes: 2 additions & 2 deletions stdlib/distutils/command/install_lib.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Any, ClassVar
from typing import Any, ClassVar, Final

from ..cmd import Command

PYTHON_SOURCE_EXTENSION: str
PYTHON_SOURCE_EXTENSION: Final = ".py"

class install_lib(Command):
description: str
Expand Down
4 changes: 2 additions & 2 deletions stdlib/distutils/core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ from collections.abc import Mapping
from distutils.cmd import Command as Command
from distutils.dist import Distribution as Distribution
from distutils.extension import Extension as Extension
from typing import Any, Literal
from typing import Any, Final, Literal

USAGE: str
USAGE: Final[str]

def gen_usage(script_name: StrOrBytesPath) -> str: ...

Expand Down
10 changes: 5 additions & 5 deletions stdlib/distutils/cygwinccompiler.pyi
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
from distutils.unixccompiler import UnixCCompiler
from distutils.version import LooseVersion
from re import Pattern
from typing import Literal
from typing import Final, Literal

def get_msvcr() -> list[str] | None: ...

class CygwinCCompiler(UnixCCompiler): ...
class Mingw32CCompiler(CygwinCCompiler): ...

CONFIG_H_OK: str
CONFIG_H_NOTOK: str
CONFIG_H_UNCERTAIN: str
CONFIG_H_OK: Final = "ok"
CONFIG_H_NOTOK: Final = "not ok"
CONFIG_H_UNCERTAIN: Final = "uncertain"

def check_config_h() -> tuple[Literal["ok", "not ok", "uncertain"], str]: ...

RE_VERSION: Pattern[bytes]
RE_VERSION: Final[Pattern[bytes]]

def get_versions() -> tuple[LooseVersion | None, ...]: ...
def is_cygwingcc() -> bool: ...
12 changes: 6 additions & 6 deletions stdlib/distutils/fancy_getopt.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from collections.abc import Iterable, Mapping
from re import Pattern
from typing import Any, overload
from typing import Any, Final, overload
from typing_extensions import TypeAlias

_Option: TypeAlias = tuple[str, str | None, str]
_GR: TypeAlias = tuple[list[str], OptionDummy]

longopt_pat: str
longopt_re: Pattern[str]
neg_alias_re: Pattern[str]
longopt_xlate: dict[int, int]
longopt_pat: Final = r"[a-zA-Z](?:[a-zA-Z0-9-]*)"
longopt_re: Final[Pattern[str]]
neg_alias_re: Final[Pattern[str]]
longopt_xlate: Final[dict[int, int]]

class FancyGetopt:
def __init__(self, option_table: list[_Option] | None = None) -> None: ...
Expand All @@ -25,7 +25,7 @@ def fancy_getopt(
options: list[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: list[str] | None
) -> list[str] | _GR: ...

WS_TRANS: dict[int, str]
WS_TRANS: Final[dict[int, str]]

def wrap_text(text: str, width: int) -> list[str]: ...
def translate_longopt(opt: str) -> str: ...
Expand Down
12 changes: 6 additions & 6 deletions stdlib/distutils/log.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Any
from typing import Any, Final

DEBUG: int
INFO: int
WARN: int
ERROR: int
FATAL: int
DEBUG: Final = 1
INFO: Final = 2
WARN: Final = 3
ERROR: Final = 4
FATAL: Final = 5

class Log:
def __init__(self, threshold: int = 3) -> None: ...
Expand Down
14 changes: 7 additions & 7 deletions stdlib/distutils/sysconfig.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import sys
from collections.abc import Mapping
from distutils.ccompiler import CCompiler
from typing import Literal, overload
from typing import Final, Literal, overload
from typing_extensions import deprecated

PREFIX: str
EXEC_PREFIX: str
BASE_PREFIX: str
BASE_EXEC_PREFIX: str
project_base: str
python_build: bool
PREFIX: Final[str]
EXEC_PREFIX: Final[str]
BASE_PREFIX: Final[str]
BASE_EXEC_PREFIX: Final[str]
project_base: Final[str]
python_build: Final[bool]

def expand_makefile_vars(s: str, vars: Mapping[str, str]) -> str: ...
@overload
Expand Down

0 comments on commit 257b2fa

Please sign in to comment.