mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-28 14:46:55 +08:00
Type and mark as final module-level dunders not meant to be overwritten in stdlib/ (#9709)
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user