mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-30 16:14:24 +08:00
Use Final for undocumented constants (#12450)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from collections.abc import Iterable, Sequence
|
||||
from typing import TypeVar
|
||||
from typing import Final, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_K = TypeVar("_K")
|
||||
@@ -7,15 +7,15 @@ _V = TypeVar("_V")
|
||||
|
||||
__all__ = ["compiler_fixup", "customize_config_vars", "customize_compiler", "get_platform_osx"]
|
||||
|
||||
_UNIVERSAL_CONFIG_VARS: tuple[str, ...] # undocumented
|
||||
_COMPILER_CONFIG_VARS: tuple[str, ...] # undocumented
|
||||
_INITPRE: str # undocumented
|
||||
_UNIVERSAL_CONFIG_VARS: Final[tuple[str, ...]] # undocumented
|
||||
_COMPILER_CONFIG_VARS: Final[tuple[str, ...]] # undocumented
|
||||
_INITPRE: Final[str] # undocumented
|
||||
|
||||
def _find_executable(executable: str, path: str | None = None) -> str | None: ... # undocumented
|
||||
def _read_output(commandstring: str, capture_stderr: bool = False) -> str | None: ... # undocumented
|
||||
def _find_build_tool(toolname: str) -> str: ... # undocumented
|
||||
|
||||
_SYSTEM_VERSION: str | None # undocumented
|
||||
_SYSTEM_VERSION: Final[str | None] # undocumented
|
||||
|
||||
def _get_system_version() -> str: ... # undocumented
|
||||
def _remove_original_values(_config_vars: dict[str, str]) -> None: ... # undocumented
|
||||
|
||||
@@ -51,7 +51,7 @@ _SUPPRESS_T = NewType("_SUPPRESS_T", str)
|
||||
SUPPRESS: _SUPPRESS_T | str # not using Literal because argparse sometimes compares SUPPRESS with is
|
||||
# the | str is there so that foo = argparse.SUPPRESS; foo = "test" checks out in mypy
|
||||
ZERO_OR_MORE: Final = "*"
|
||||
_UNRECOGNIZED_ARGS_ATTR: str # undocumented
|
||||
_UNRECOGNIZED_ARGS_ATTR: Final[str] # undocumented
|
||||
|
||||
class ArgumentError(Exception):
|
||||
argument_name: str | None
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from collections.abc import Callable, Iterator
|
||||
from email.message import Message
|
||||
from typing import overload
|
||||
from typing import Final, overload
|
||||
|
||||
__all__ = ["Charset", "add_alias", "add_charset", "add_codec"]
|
||||
|
||||
QP: int # undocumented
|
||||
BASE64: int # undocumented
|
||||
SHORTEST: int # undocumented
|
||||
QP: Final[int] # undocumented
|
||||
BASE64: Final[int] # undocumented
|
||||
SHORTEST: Final[int] # undocumented
|
||||
|
||||
class Charset:
|
||||
input_charset: str
|
||||
|
||||
@@ -3,7 +3,7 @@ import sys
|
||||
import zlib
|
||||
from _typeshed import ReadableBuffer, SizedBuffer, StrOrBytesPath
|
||||
from io import FileIO
|
||||
from typing import Literal, Protocol, TextIO, overload
|
||||
from typing import Final, Literal, Protocol, TextIO, overload
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
__all__ = ["BadGzipFile", "GzipFile", "open", "compress", "decompress"]
|
||||
@@ -12,14 +12,14 @@ _ReadBinaryMode: TypeAlias = Literal["r", "rb"]
|
||||
_WriteBinaryMode: TypeAlias = Literal["a", "ab", "w", "wb", "x", "xb"]
|
||||
_OpenTextMode: TypeAlias = Literal["rt", "at", "wt", "xt"]
|
||||
|
||||
READ: object # undocumented
|
||||
WRITE: object # undocumented
|
||||
READ: Final[object] # undocumented
|
||||
WRITE: Final[object] # undocumented
|
||||
|
||||
FTEXT: int # actually Literal[1] # undocumented
|
||||
FHCRC: int # actually Literal[2] # undocumented
|
||||
FEXTRA: int # actually Literal[4] # undocumented
|
||||
FNAME: int # actually Literal[8] # undocumented
|
||||
FCOMMENT: int # actually Literal[16] # undocumented
|
||||
FTEXT: Final[int] # actually Literal[1] # undocumented
|
||||
FHCRC: Final[int] # actually Literal[2] # undocumented
|
||||
FEXTRA: Final[int] # actually Literal[4] # undocumented
|
||||
FNAME: Final[int] # actually Literal[8] # undocumented
|
||||
FCOMMENT: Final[int] # actually Literal[16] # undocumented
|
||||
|
||||
class _ReadableFileobj(Protocol):
|
||||
def read(self, n: int, /) -> bytes: ...
|
||||
|
||||
@@ -4,14 +4,14 @@ from collections.abc import Callable, Hashable, Iterable, Sequence
|
||||
from configparser import RawConfigParser
|
||||
from re import Pattern
|
||||
from threading import Thread
|
||||
from typing import IO, Any, Literal, SupportsIndex, TypedDict, overload
|
||||
from typing import IO, Any, Final, Literal, SupportsIndex, TypedDict, overload
|
||||
from typing_extensions import Required, TypeAlias
|
||||
|
||||
from . import Filter, Filterer, Formatter, Handler, Logger, _FilterType, _FormatStyle, _Level
|
||||
|
||||
DEFAULT_LOGGING_CONFIG_PORT: int
|
||||
RESET_ERROR: int # undocumented
|
||||
IDENTIFIER: Pattern[str] # undocumented
|
||||
RESET_ERROR: Final[int] # undocumented
|
||||
IDENTIFIER: Final[Pattern[str]] # undocumented
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
class _RootLoggerConfiguration(TypedDict, total=False):
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import sys
|
||||
from collections.abc import Container, Iterable, Iterator, Sequence
|
||||
from types import CodeType
|
||||
from typing import IO, Any
|
||||
from typing import IO, Any, Final
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
LOAD_CONST: int # undocumented
|
||||
IMPORT_NAME: int # undocumented
|
||||
STORE_NAME: int # undocumented
|
||||
STORE_GLOBAL: int # undocumented
|
||||
STORE_OPS: tuple[int, int] # undocumented
|
||||
EXTENDED_ARG: int # undocumented
|
||||
LOAD_CONST: Final[int] # undocumented
|
||||
IMPORT_NAME: Final[int] # undocumented
|
||||
STORE_NAME: Final[int] # undocumented
|
||||
STORE_GLOBAL: Final[int] # undocumented
|
||||
STORE_OPS: Final[tuple[int, int]] # undocumented
|
||||
EXTENDED_ARG: Final[int] # undocumented
|
||||
|
||||
packagePathMap: dict[str, list[str]] # undocumented
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from _typeshed import ReadableBuffer, SupportsRead
|
||||
from collections.abc import Callable
|
||||
from pyexpat import errors as errors, model as model
|
||||
from typing import Any, final
|
||||
from typing import Any, Final, final
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
EXPAT_VERSION: str # undocumented
|
||||
EXPAT_VERSION: Final[str] # undocumented
|
||||
version_info: tuple[int, int, int] # undocumented
|
||||
native_encoding: str # undocumented
|
||||
features: list[tuple[str, int]] # undocumented
|
||||
@@ -15,7 +15,6 @@ class ExpatError(Exception):
|
||||
offset: int
|
||||
|
||||
error = ExpatError
|
||||
|
||||
XML_PARAM_ENTITY_PARSING_NEVER: int
|
||||
XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE: int
|
||||
XML_PARAM_ENTITY_PARSING_ALWAYS: int
|
||||
|
||||
@@ -2,7 +2,7 @@ import sys
|
||||
from _typeshed import ReadableBuffer, StrOrBytesPath
|
||||
from collections.abc import Callable, Collection, Iterable, Mapping, Sequence
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, AnyStr, Generic, Literal, TypeVar, overload
|
||||
from typing import IO, Any, AnyStr, Final, Generic, Literal, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -74,8 +74,8 @@ _T = TypeVar("_T")
|
||||
|
||||
# These two are private but documented
|
||||
if sys.version_info >= (3, 11):
|
||||
_USE_VFORK: bool
|
||||
_USE_POSIX_SPAWN: bool
|
||||
_USE_VFORK: Final[bool]
|
||||
_USE_POSIX_SPAWN: Final[bool]
|
||||
|
||||
class CompletedProcess(Generic[_T]):
|
||||
# morally: _CMD
|
||||
@@ -1810,9 +1810,9 @@ else:
|
||||
text: bool | None = None,
|
||||
) -> Any: ... # morally: -> str | bytes
|
||||
|
||||
PIPE: int
|
||||
STDOUT: int
|
||||
DEVNULL: int
|
||||
PIPE: Final[int]
|
||||
STDOUT: Final[int]
|
||||
DEVNULL: Final[int]
|
||||
|
||||
class SubprocessError(Exception): ...
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
import termios
|
||||
from typing import IO
|
||||
from typing import IO, Final
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
if sys.platform != "win32":
|
||||
@@ -15,13 +15,13 @@ if sys.platform != "win32":
|
||||
_FD: TypeAlias = int | IO[str]
|
||||
|
||||
# XXX: Undocumented integer constants
|
||||
IFLAG: int
|
||||
OFLAG: int
|
||||
CFLAG: int
|
||||
LFLAG: int
|
||||
ISPEED: int
|
||||
OSPEED: int
|
||||
CC: int
|
||||
IFLAG: Final[int]
|
||||
OFLAG: Final[int]
|
||||
CFLAG: Final[int]
|
||||
LFLAG: Final[int]
|
||||
ISPEED: Final[int]
|
||||
OSPEED: Final[int]
|
||||
CC: Final[int]
|
||||
def setraw(fd: _FD, when: int = 2) -> _ModeSetterReturn: ...
|
||||
def setcbreak(fd: _FD, when: int = 2) -> _ModeSetterReturn: ...
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from collections.abc import Callable, Iterable, Mapping
|
||||
from datetime import datetime
|
||||
from io import BytesIO
|
||||
from types import TracebackType
|
||||
from typing import Any, Literal, Protocol, overload
|
||||
from typing import Any, Final, Literal, Protocol, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
class _SupportsTimeTuple(Protocol):
|
||||
@@ -34,22 +34,22 @@ _HostType: TypeAlias = tuple[str, dict[str, str]] | str
|
||||
|
||||
def escape(s: str) -> str: ... # undocumented
|
||||
|
||||
MAXINT: int # undocumented
|
||||
MININT: int # undocumented
|
||||
MAXINT: Final[int] # undocumented
|
||||
MININT: Final[int] # undocumented
|
||||
|
||||
PARSE_ERROR: int # undocumented
|
||||
SERVER_ERROR: int # undocumented
|
||||
APPLICATION_ERROR: int # undocumented
|
||||
SYSTEM_ERROR: int # undocumented
|
||||
TRANSPORT_ERROR: int # undocumented
|
||||
PARSE_ERROR: Final[int] # undocumented
|
||||
SERVER_ERROR: Final[int] # undocumented
|
||||
APPLICATION_ERROR: Final[int] # undocumented
|
||||
SYSTEM_ERROR: Final[int] # undocumented
|
||||
TRANSPORT_ERROR: Final[int] # undocumented
|
||||
|
||||
NOT_WELLFORMED_ERROR: int # undocumented
|
||||
UNSUPPORTED_ENCODING: int # undocumented
|
||||
INVALID_ENCODING_CHAR: int # undocumented
|
||||
INVALID_XMLRPC: int # undocumented
|
||||
METHOD_NOT_FOUND: int # undocumented
|
||||
INVALID_METHOD_PARAMS: int # undocumented
|
||||
INTERNAL_ERROR: int # undocumented
|
||||
NOT_WELLFORMED_ERROR: Final[int] # undocumented
|
||||
UNSUPPORTED_ENCODING: Final[int] # undocumented
|
||||
INVALID_ENCODING_CHAR: Final[int] # undocumented
|
||||
INVALID_XMLRPC: Final[int] # undocumented
|
||||
METHOD_NOT_FOUND: Final[int] # undocumented
|
||||
INVALID_METHOD_PARAMS: Final[int] # undocumented
|
||||
INTERNAL_ERROR: Final[int] # undocumented
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
@@ -98,7 +98,7 @@ class Binary:
|
||||
|
||||
def _binary(data: ReadableBuffer) -> Binary: ... # undocumented
|
||||
|
||||
WRAPPERS: tuple[type[DateTime], type[Binary]] # undocumented
|
||||
WRAPPERS: Final[tuple[type[DateTime], type[Binary]]] # undocumented
|
||||
|
||||
class ExpatParser: # undocumented
|
||||
def __init__(self, target: Unmarshaller) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user