Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions stdlib/_frozen_importlib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ from _typeshed.importlib import LoaderProtocol
from collections.abc import Mapping, Sequence
from types import ModuleType
from typing import Any, ClassVar
from typing_extensions import deprecated

# Signature of `builtins.__import__` should be kept identical to `importlib.__import__`
def __import__(
Expand Down Expand Up @@ -49,6 +50,7 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader)
# MetaPathFinder
if sys.version_info < (3, 12):
@classmethod
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `find_spec()` instead.")
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...

@classmethod
Expand All @@ -67,6 +69,7 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader)
# Loader
if sys.version_info < (3, 12):
@staticmethod
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Now it's done automatically.")
def module_repr(module: types.ModuleType) -> str: ...
if sys.version_info >= (3, 10):
@staticmethod
Expand All @@ -83,6 +86,7 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
# MetaPathFinder
if sys.version_info < (3, 12):
@classmethod
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `find_spec()` instead.")
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...

@classmethod
Expand All @@ -101,6 +105,7 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
# Loader
if sys.version_info < (3, 12):
@staticmethod
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Now it's done automatically.")
def module_repr(m: types.ModuleType) -> str: ...
if sys.version_info >= (3, 10):
@staticmethod
Expand Down
8 changes: 5 additions & 3 deletions stdlib/_frozen_importlib_external.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def spec_from_file_location(
class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
if sys.version_info < (3, 12):
@classmethod
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `find_spec()` instead.")
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...

@classmethod
Expand Down Expand Up @@ -70,6 +71,7 @@ class PathFinder(importlib.abc.MetaPathFinder):
) -> ModuleSpec | None: ...
if sys.version_info < (3, 12):
@classmethod
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `find_spec()` instead.")
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...

SOURCE_SUFFIXES: list[str]
Expand Down Expand Up @@ -158,7 +160,7 @@ if sys.version_info >= (3, 11):
def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ...
if sys.version_info < (3, 12):
@staticmethod
@deprecated("module_repr() is deprecated, and has been removed in Python 3.12")
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Now it's done automatically.")
def module_repr(module: types.ModuleType) -> str: ...

_NamespaceLoader = NamespaceLoader
Expand All @@ -176,12 +178,12 @@ else:
def load_module(self, fullname: str) -> types.ModuleType: ...
if sys.version_info >= (3, 10):
@staticmethod
@deprecated("module_repr() is deprecated, and has been removed in Python 3.12")
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Now it's done automatically.")
def module_repr(module: types.ModuleType) -> str: ...
def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ...
else:
@classmethod
@deprecated("module_repr() is deprecated, and has been removed in Python 3.12")
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Now it's done automatically.")
def module_repr(cls, module: types.ModuleType) -> str: ...

if sys.version_info >= (3, 13):
Expand Down
3 changes: 2 additions & 1 deletion stdlib/_ssl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from ssl import (
SSLZeroReturnError as SSLZeroReturnError,
)
from typing import Any, ClassVar, Final, Literal, TypedDict, final, overload, type_check_only
from typing_extensions import NotRequired, Self, TypeAlias
from typing_extensions import NotRequired, Self, TypeAlias, deprecated

_PasswordType: TypeAlias = Callable[[], str | bytes | bytearray] | str | bytes | bytearray
_PCTRTT: TypeAlias = tuple[tuple[str, str], ...]
Expand Down Expand Up @@ -51,6 +51,7 @@ def RAND_add(string: str | ReadableBuffer, entropy: float, /) -> None: ...
def RAND_bytes(n: int, /) -> bytes: ...

if sys.version_info < (3, 12):
@deprecated("Deprecated since Python 3.6; removed in Python 3.12. Use `ssl.RAND_bytes()` instead.")
def RAND_pseudo_bytes(n: int, /) -> tuple[bytes, bool]: ...

if sys.version_info < (3, 10):
Expand Down
3 changes: 2 additions & 1 deletion stdlib/_tkinter.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from collections.abc import Callable
from typing import Any, ClassVar, Final, final
from typing_extensions import TypeAlias
from typing_extensions import TypeAlias, deprecated

# _tkinter is meant to be only used internally by tkinter, but some tkinter
# functions e.g. return _tkinter.Tcl_Obj objects. Tcl_Obj represents a Tcl
Expand Down Expand Up @@ -84,6 +84,7 @@ class TkappType:
def record(self, script, /): ...
def setvar(self, *ags, **kwargs): ...
if sys.version_info < (3, 11):
@deprecated("Deprecated since Python 3.9; removed in Python 3.11. Use `splitlist()` instead.")
def split(self, arg, /): ...

def splitlist(self, arg, /): ...
Expand Down
6 changes: 4 additions & 2 deletions stdlib/ast.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1097,15 +1097,17 @@ class Constant(expr):
kind: str | None
if sys.version_info < (3, 14):
# Aliases for value, for backwards compatibility
@deprecated("Will be removed in Python 3.14; use value instead")
@property
@deprecated("Will be removed in Python 3.14. Use value instead.")
def n(self) -> _ConstantValue: ...
@n.setter
@deprecated("Will be removed in Python 3.14. Use value instead.")
def n(self, value: _ConstantValue) -> None: ...
@deprecated("Will be removed in Python 3.14; use value instead")
@property
@deprecated("Will be removed in Python 3.14. Use value instead.")
def s(self) -> _ConstantValue: ...
@s.setter
@deprecated("Will be removed in Python 3.14. Use value instead.")
def s(self, value: _ConstantValue) -> None: ...

def __init__(self, value: _ConstantValue, kind: str | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion stdlib/asyncio/coroutines.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from collections.abc import Awaitable, Callable, Coroutine
from typing import Any, TypeVar, overload
from typing_extensions import ParamSpec, TypeGuard, TypeIs
from typing_extensions import ParamSpec, TypeGuard, TypeIs, deprecated

# Keep asyncio.__all__ updated with any changes to __all__ here
if sys.version_info >= (3, 11):
Expand All @@ -14,6 +14,7 @@ _FunctionT = TypeVar("_FunctionT", bound=Callable[..., Any])
_P = ParamSpec("_P")

if sys.version_info < (3, 11):
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `async def` instead.")
def coroutine(func: _FunctionT) -> _FunctionT: ...

@overload
Expand Down
31 changes: 30 additions & 1 deletion stdlib/asyncio/trsock.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from builtins import type as Type # alias to avoid name clashes with property n
from collections.abc import Iterable
from types import TracebackType
from typing import Any, BinaryIO, NoReturn, overload
from typing_extensions import TypeAlias
from typing_extensions import TypeAlias, deprecated

# These are based in socket, maybe move them out into _typeshed.pyi or such
_Address: TypeAlias = socket._Address
Expand Down Expand Up @@ -42,53 +42,82 @@ class TransportSocket:
def setblocking(self, flag: bool) -> None: ...
if sys.version_info < (3, 11):
def _na(self, what: str) -> None: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def accept(self) -> tuple[socket.socket, _RetAddress]: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def connect(self, address: _Address) -> None: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def connect_ex(self, address: _Address) -> int: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def bind(self, address: _Address) -> None: ...
if sys.platform == "win32":
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> None: ...
else:
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> NoReturn: ...

@deprecated("Initially it was deprecated; removed in Python 3.11.")
def listen(self, backlog: int = ..., /) -> None: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def makefile(self) -> BinaryIO: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def sendfile(self, file: BinaryIO, offset: int = ..., count: int | None = ...) -> int: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def close(self) -> None: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def detach(self) -> int: ...
if sys.platform == "linux":
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def sendmsg_afalg(
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
) -> int: ...
else:
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def sendmsg_afalg(
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
) -> NoReturn: ...

@deprecated("Initially it was deprecated; removed in Python 3.11.")
def sendmsg(
self, buffers: Iterable[ReadableBuffer], ancdata: Iterable[_CMSG] = ..., flags: int = ..., address: _Address = ..., /
) -> int: ...
@overload
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def sendto(self, data: ReadableBuffer, address: _Address) -> int: ...
@overload
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def sendto(self, data: ReadableBuffer, flags: int, address: _Address) -> int: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def send(self, data: ReadableBuffer, flags: int = ...) -> int: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def sendall(self, data: ReadableBuffer, flags: int = ...) -> None: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def set_inheritable(self, inheritable: bool) -> None: ...
if sys.platform == "win32":
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def share(self, process_id: int) -> bytes: ...
else:
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def share(self, process_id: int) -> NoReturn: ...

@deprecated("Initially it was deprecated; removed in Python 3.11.")
def recv_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> int: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> tuple[int, _RetAddress]: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def recvmsg_into(
self, buffers: Iterable[_WriteBuffer], ancbufsize: int = ..., flags: int = ..., /
) -> tuple[int, list[_CMSG], int, Any]: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def recvmsg(self, bufsize: int, ancbufsize: int = ..., flags: int = ..., /) -> tuple[bytes, list[_CMSG], int, Any]: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def recvfrom(self, bufsize: int, flags: int = ...) -> tuple[bytes, _RetAddress]: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def __enter__(self) -> socket.socket: ...
@deprecated("Initially it was deprecated; removed in Python 3.11.")
def __exit__(
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
6 changes: 5 additions & 1 deletion stdlib/binascii.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from _typeshed import ReadableBuffer
from typing_extensions import TypeAlias
from typing_extensions import TypeAlias, deprecated

# Many functions in binascii accept buffer objects
# or ASCII-only strings.
Expand All @@ -20,9 +20,13 @@ def a2b_qp(data: _AsciiBuffer, header: bool = False) -> bytes: ...
def b2a_qp(data: ReadableBuffer, quotetabs: bool = False, istext: bool = True, header: bool = False) -> bytes: ...

if sys.version_info < (3, 11):
@deprecated("Deprecated since Python 3.9; removed in Python 3.11.")
def a2b_hqx(data: _AsciiBuffer, /) -> bytes: ...
@deprecated("Deprecated since Python 3.9; removed in Python 3.11.")
def rledecode_hqx(data: ReadableBuffer, /) -> bytes: ...
@deprecated("Deprecated since Python 3.9; removed in Python 3.11.")
def rlecode_hqx(data: ReadableBuffer, /) -> bytes: ...
@deprecated("Deprecated since Python 3.9; removed in Python 3.11.")
def b2a_hqx(data: ReadableBuffer, /) -> bytes: ...

def crc_hqx(data: ReadableBuffer, crc: int, /) -> int: ...
Expand Down
3 changes: 3 additions & 0 deletions stdlib/configparser.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ class BasicInterpolation(Interpolation): ...
class ExtendedInterpolation(Interpolation): ...

if sys.version_info < (3, 13):
@deprecated(
"Deprecated since Python 3.2; removed in Python 3.13. Use `BasicInterpolation` or `ExtendedInterpolation` instead."
)
class LegacyInterpolation(Interpolation):
def before_get(self, parser: _Parser, section: _SectionName, option: str, value: str, vars: _Section) -> str: ...

Expand Down
4 changes: 4 additions & 0 deletions stdlib/gettext.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ class NullTranslations:
def info(self) -> dict[str, str]: ...
def charset(self) -> str | None: ...
if sys.version_info < (3, 11):
@deprecated("Deprecated since Python 3.8; removed in Python 3.11.")
def output_charset(self) -> str | None: ...
@deprecated("Deprecated since Python 3.8; removed in Python 3.11.")
def set_output_charset(self, charset: str) -> None: ...
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `gettext()` instead.")
def lgettext(self, message: str) -> str: ...
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `ngettext()` instead.")
def lngettext(self, msgid1: str, msgid2: str, n: int) -> str: ...

def install(self, names: Container[str] | None = None) -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion stdlib/gzip.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import zlib
from _typeshed import ReadableBuffer, SizedBuffer, StrOrBytesPath, WriteableBuffer
from io import FileIO, TextIOWrapper
from typing import Final, Literal, Protocol, overload, type_check_only
from typing_extensions import TypeAlias
from typing_extensions import TypeAlias, deprecated

if sys.version_info >= (3, 14):
from compression._common._streams import BaseStream, DecompressReader
Expand Down Expand Up @@ -143,6 +143,7 @@ class GzipFile(BaseStream):
) -> None: ...
if sys.version_info < (3, 12):
@property
@deprecated("Deprecated since Python 2.6; removed in Python 3.12. Use `name` attribute instead.")
def filename(self) -> str: ...

@property
Expand Down
2 changes: 2 additions & 0 deletions stdlib/importlib/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import sys
from importlib._bootstrap import __import__ as __import__
from importlib.abc import Loader
from types import ModuleType
from typing_extensions import deprecated

__all__ = ["__import__", "import_module", "invalidate_caches", "reload"]

# `importlib.import_module` return type should be kept the same as `builtins.__import__`
def import_module(name: str, package: str | None = None) -> ModuleType: ...

if sys.version_info < (3, 12):
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `importlib.util.find_spec()` instead.")
def find_loader(name: str, path: str | None = None) -> Loader | None: ...

def invalidate_caches() -> None: ...
Expand Down
2 changes: 2 additions & 0 deletions stdlib/importlib/_abc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import sys
import types
from abc import ABCMeta
from importlib.machinery import ModuleSpec
from typing_extensions import deprecated

if sys.version_info >= (3, 10):
class Loader(metaclass=ABCMeta):
def load_module(self, fullname: str) -> types.ModuleType: ...
if sys.version_info < (3, 12):
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Now it's done automatically.")
def module_repr(self, module: types.ModuleType) -> str: ...

def create_module(self, spec: ModuleSpec) -> types.ModuleType | None: ...
Expand Down
4 changes: 4 additions & 0 deletions stdlib/importlib/abc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ else:
def exec_module(self, module: types.ModuleType) -> None: ...

if sys.version_info < (3, 12):
@deprecated("Deprecated since Python 3.3; removed in Python 3.12. Use `MetaPathFinder` or `PathEntryFinder` instead.")
class Finder(metaclass=ABCMeta): ...

@deprecated("Deprecated as of Python 3.7: Use importlib.resources.abc.TraversableResources instead.")
Expand Down Expand Up @@ -71,6 +72,7 @@ if sys.version_info >= (3, 10):
# Please keep in sync with _typeshed.importlib.MetaPathFinderProtocol
class MetaPathFinder(metaclass=ABCMeta):
if sys.version_info < (3, 12):
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `MetaPathFinder.find_spec()` instead.")
def find_module(self, fullname: str, path: Sequence[str] | None) -> Loader | None: ...

def invalidate_caches(self) -> None: ...
Expand All @@ -81,7 +83,9 @@ if sys.version_info >= (3, 10):

class PathEntryFinder(metaclass=ABCMeta):
if sys.version_info < (3, 12):
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `PathEntryFinder.find_spec()` instead.")
def find_module(self, fullname: str) -> Loader | None: ...
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `find_spec()` instead.")
def find_loader(self, fullname: str) -> tuple[Loader | None, Sequence[str]]: ...

def invalidate_caches(self) -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion stdlib/importlib/metadata/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ from os import PathLike
from pathlib import Path
from re import Pattern
from typing import Any, ClassVar, Generic, NamedTuple, TypeVar, overload
from typing_extensions import Self, TypeAlias
from typing_extensions import Self, TypeAlias, deprecated

_T = TypeVar("_T")
_KT = TypeVar("_KT")
Expand Down Expand Up @@ -148,6 +148,7 @@ if sys.version_info >= (3, 10) and sys.version_info < (3, 12):
def keys(self) -> dict_keys[_KT, _VT]: ...
def values(self) -> dict_values[_KT, _VT]: ...

@deprecated("Deprecated since Python 3.10; removed in Python 3.12. Use `select` instead.")
class SelectableGroups(Deprecated[str, EntryPoints], dict[str, EntryPoints]): # use as dict is deprecated since 3.10
@classmethod
def load(cls, eps: Iterable[EntryPoint]) -> Self: ...
Expand Down
Loading
Loading