diff --git a/stdlib/_csv.pyi b/stdlib/_csv.pyi index c3f1dd58c..7e9b9e4e7 100644 --- a/stdlib/_csv.pyi +++ b/stdlib/_csv.pyi @@ -1,9 +1,9 @@ from _typeshed import SupportsWrite from collections.abc import Iterable, Iterator from typing import Any -from typing_extensions import Literal, TypeAlias +from typing_extensions import Final, Literal, TypeAlias -__version__: str +__version__: Final[str] QUOTE_ALL: Literal[1] QUOTE_MINIMAL: Literal[0] diff --git a/stdlib/_decimal.pyi b/stdlib/_decimal.pyi index 3f997e7d9..b8208fe18 100644 --- a/stdlib/_decimal.pyi +++ b/stdlib/_decimal.pyi @@ -3,14 +3,14 @@ import sys from collections.abc import Container, Sequence from types import TracebackType from typing import Any, ClassVar, NamedTuple, overload -from typing_extensions import Literal, Self, TypeAlias +from typing_extensions import Final, Literal, Self, TypeAlias _Decimal: TypeAlias = Decimal | int _DecimalNew: TypeAlias = Decimal | float | str | tuple[int, Sequence[int], int] _ComparableNum: TypeAlias = Decimal | float | numbers.Rational -__version__: str -__libmpdec_version__: str +__version__: Final[str] +__libmpdec_version__: Final[str] class DecimalTuple(NamedTuple): sign: int diff --git a/stdlib/_heapq.pyi b/stdlib/_heapq.pyi index 90dc28deb..8d6c3e881 100644 --- a/stdlib/_heapq.pyi +++ b/stdlib/_heapq.pyi @@ -1,8 +1,9 @@ from typing import Any, TypeVar +from typing_extensions import Final _T = TypeVar("_T") -__about__: str +__about__: Final[str] def heapify(__heap: list[Any]) -> None: ... def heappop(__heap: list[_T]) -> _T: ... diff --git a/stdlib/cgitb.pyi b/stdlib/cgitb.pyi index 04bcbfb0d..4c315bf6c 100644 --- a/stdlib/cgitb.pyi +++ b/stdlib/cgitb.pyi @@ -2,8 +2,9 @@ from _typeshed import OptExcInfo, StrOrBytesPath from collections.abc import Callable from types import FrameType, TracebackType from typing import IO, Any +from typing_extensions import Final -__UNDEF__: object # undocumented sentinel +__UNDEF__: Final[object] # undocumented sentinel def reset() -> str: ... # undocumented def small(text: str) -> str: ... # undocumented diff --git a/stdlib/heapq.pyi b/stdlib/heapq.pyi index 9d7815507..61418b370 100644 --- a/stdlib/heapq.pyi +++ b/stdlib/heapq.pyi @@ -2,12 +2,13 @@ from _heapq import * from _typeshed import SupportsRichComparison from collections.abc import Callable, Iterable from typing import Any, TypeVar +from typing_extensions import Final __all__ = ["heappush", "heappop", "heapify", "heapreplace", "merge", "nlargest", "nsmallest", "heappushpop"] _S = TypeVar("_S") -__about__: str +__about__: Final[str] def merge( *iterables: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = None, reverse: bool = False diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index 9bcd8659f..c6893d50c 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -6,16 +6,16 @@ from collections.abc import Callable, Container, Mapping, MutableMapping from reprlib import Repr from types import MethodType, ModuleType, TracebackType from typing import IO, Any, AnyStr, NoReturn, TypeVar -from typing_extensions import TypeGuard +from typing_extensions import Final, TypeGuard __all__ = ["help"] _T = TypeVar("_T") -__author__: str -__date__: str -__version__: str -__credits__: str +__author__: Final[str] +__date__: Final[str] +__version__: Final[str] +__credits__: Final[str] def pathdirs() -> list[str]: ... def getdoc(object: object) -> str: ... diff --git a/stdlib/sys.pyi b/stdlib/sys.pyi index 725f66794..e12881599 100644 --- a/stdlib/sys.pyi +++ b/stdlib/sys.pyi @@ -7,7 +7,7 @@ from importlib.machinery import ModuleSpec from io import TextIOWrapper from types import FrameType, ModuleType, TracebackType from typing import Any, NoReturn, Protocol, TextIO, TypeVar, overload -from typing_extensions import Literal, TypeAlias, final +from typing_extensions import Final, Literal, TypeAlias, final _T = TypeVar("_T") @@ -62,9 +62,10 @@ stdout: TextIO stderr: TextIO if sys.version_info >= (3, 10): stdlib_module_names: frozenset[str] -__stdin__: TextIOWrapper -__stdout__: TextIOWrapper -__stderr__: TextIOWrapper + +__stdin__: Final[TextIOWrapper] # Contains the original value of stdin +__stdout__: Final[TextIOWrapper] # Contains the original value of stdout +__stderr__: Final[TextIOWrapper] # Contains the original value of stderr tracebacklimit: int version: str api_version: int @@ -277,11 +278,10 @@ if sys.platform == "win32": def intern(__string: str) -> str: ... def is_finalizing() -> bool: ... - -__breakpointhook__: Any # contains the original value of breakpointhook - def breakpointhook(*args: Any, **kwargs: Any) -> Any: ... +__breakpointhook__ = breakpointhook # Contains the original value of breakpointhook + if sys.platform != "win32": def setdlopenflags(__flags: int) -> None: ... diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 3b1989edc..12ce2d2c7 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -3,7 +3,7 @@ from collections.abc import Awaitable, Callable, Coroutine, Iterable, Mapping, S from contextlib import _GeneratorContextManager from types import TracebackType from typing import Any, Generic, TypeVar, overload -from typing_extensions import Literal, Self, TypeAlias +from typing_extensions import Final, Literal, Self, TypeAlias _T = TypeVar("_T") _TT = TypeVar("_TT", bound=type[Any]) @@ -47,7 +47,7 @@ else: "seal", ) -__version__: str +__version__: Final[str] FILTER_DIR: Any