mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-07 05:54:02 +08:00
[stdlib] Deprecate old functions (#14553)
* [stdlib] Deprecate many functions * Fix typo * Imporove message for asyncio/trsock * Apply suggestions from code review Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> * Add Python before version * [pre-commit.ci] auto fixes from pre-commit.com hooks * Wrap comment lines * fix the rest --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -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__(
|
||||
@@ -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
|
||||
@@ -67,6 +69,10 @@ 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. "
|
||||
"The module spec is now used by the import machinery to generate a module repr."
|
||||
)
|
||||
def module_repr(module: types.ModuleType) -> str: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@staticmethod
|
||||
@@ -83,6 +89,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
|
||||
@@ -101,6 +108,10 @@ 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. "
|
||||
"The module spec is now used by the import machinery to generate a module repr."
|
||||
)
|
||||
def module_repr(m: types.ModuleType) -> str: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@staticmethod
|
||||
|
||||
@@ -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
|
||||
@@ -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]
|
||||
@@ -158,7 +160,10 @@ 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. "
|
||||
"The module spec is now used by the import machinery to generate a module repr."
|
||||
)
|
||||
def module_repr(module: types.ModuleType) -> str: ...
|
||||
|
||||
_NamespaceLoader = NamespaceLoader
|
||||
@@ -176,12 +181,18 @@ 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. "
|
||||
"The module spec is now used by the import machinery to generate a module repr."
|
||||
)
|
||||
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. "
|
||||
"The module spec is now used by the import machinery to generate a module repr."
|
||||
)
|
||||
def module_repr(cls, module: types.ModuleType) -> str: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
|
||||
+2
-1
@@ -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], ...]
|
||||
@@ -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):
|
||||
|
||||
+2
-1
@@ -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
|
||||
@@ -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, /): ...
|
||||
|
||||
+4
-2
@@ -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: ...
|
||||
|
||||
@@ -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):
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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("Removed in Python 3.11")
|
||||
def accept(self) -> tuple[socket.socket, _RetAddress]: ...
|
||||
@deprecated("Removed in Python 3.11")
|
||||
def connect(self, address: _Address) -> None: ...
|
||||
@deprecated("Removed in Python 3.11")
|
||||
def connect_ex(self, address: _Address) -> int: ...
|
||||
@deprecated("Removed in Python 3.11")
|
||||
def bind(self, address: _Address) -> None: ...
|
||||
if sys.platform == "win32":
|
||||
@deprecated("Removed in Python 3.11")
|
||||
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> None: ...
|
||||
else:
|
||||
@deprecated("Removed in Python 3.11")
|
||||
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> NoReturn: ...
|
||||
|
||||
@deprecated("Removed in Python 3.11")
|
||||
def listen(self, backlog: int = ..., /) -> None: ...
|
||||
@deprecated("Removed in Python 3.11")
|
||||
def makefile(self) -> BinaryIO: ...
|
||||
@deprecated("Rmoved in Python 3.11")
|
||||
def sendfile(self, file: BinaryIO, offset: int = ..., count: int | None = ...) -> int: ...
|
||||
@deprecated("Removed in Python 3.11")
|
||||
def close(self) -> None: ...
|
||||
@deprecated("Removed in Python 3.11")
|
||||
def detach(self) -> int: ...
|
||||
if sys.platform == "linux":
|
||||
@deprecated("Removed in Python 3.11")
|
||||
def sendmsg_afalg(
|
||||
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
|
||||
) -> int: ...
|
||||
else:
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def sendmsg_afalg(
|
||||
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
|
||||
) -> NoReturn: ...
|
||||
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def sendmsg(
|
||||
self, buffers: Iterable[ReadableBuffer], ancdata: Iterable[_CMSG] = ..., flags: int = ..., address: _Address = ..., /
|
||||
) -> int: ...
|
||||
@overload
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def sendto(self, data: ReadableBuffer, address: _Address) -> int: ...
|
||||
@overload
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def sendto(self, data: ReadableBuffer, flags: int, address: _Address) -> int: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def send(self, data: ReadableBuffer, flags: int = ...) -> int: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def sendall(self, data: ReadableBuffer, flags: int = ...) -> None: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def set_inheritable(self, inheritable: bool) -> None: ...
|
||||
if sys.platform == "win32":
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def share(self, process_id: int) -> bytes: ...
|
||||
else:
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def share(self, process_id: int) -> NoReturn: ...
|
||||
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def recv_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> int: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> tuple[int, _RetAddress]: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def recvmsg_into(
|
||||
self, buffers: Iterable[_WriteBuffer], ancbufsize: int = ..., flags: int = ..., /
|
||||
) -> tuple[int, list[_CMSG], int, Any]: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def recvmsg(self, bufsize: int, ancbufsize: int = ..., flags: int = ..., /) -> tuple[bytes, list[_CMSG], int, Any]: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def recvfrom(self, bufsize: int, flags: int = ...) -> tuple[bytes, _RetAddress]: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def __enter__(self) -> socket.socket: ...
|
||||
@deprecated("Removed in Python 3.11.")
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
+5
-1
@@ -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.
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
+2
-1
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -2,6 +2,7 @@ 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"]
|
||||
|
||||
@@ -9,6 +10,7 @@ __all__ = ["__import__", "import_module", "invalidate_caches", "reload"]
|
||||
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: ...
|
||||
|
||||
@@ -2,11 +2,16 @@ 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. "
|
||||
"The module spec is now used by the import machinery to generate a module repr."
|
||||
)
|
||||
def module_repr(self, module: types.ModuleType) -> str: ...
|
||||
|
||||
def create_module(self, spec: ModuleSpec) -> types.ModuleType | None: ...
|
||||
|
||||
@@ -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.")
|
||||
@@ -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: ...
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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")
|
||||
@@ -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: ...
|
||||
|
||||
@@ -12,13 +12,25 @@ from importlib._bootstrap_external import (
|
||||
spec_from_file_location as spec_from_file_location,
|
||||
)
|
||||
from importlib.abc import Loader
|
||||
from typing_extensions import ParamSpec
|
||||
from typing_extensions import ParamSpec, deprecated
|
||||
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
if sys.version_info < (3, 12):
|
||||
@deprecated(
|
||||
"Deprecated since Python 3.4; removed in Python 3.12. "
|
||||
"`__name__`, `__package__` and `__loader__` are now set automatically."
|
||||
)
|
||||
def module_for_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ...
|
||||
@deprecated(
|
||||
"Deprecated since Python 3.4; removed in Python 3.12. "
|
||||
"`__name__`, `__package__` and `__loader__` are now set automatically."
|
||||
)
|
||||
def set_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ...
|
||||
@deprecated(
|
||||
"Deprecated since Python 3.4; removed in Python 3.12. "
|
||||
"`__name__`, `__package__` and `__loader__` are now set automatically."
|
||||
)
|
||||
def set_package(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ...
|
||||
|
||||
def resolve_name(name: str, package: str | None) -> str: ...
|
||||
|
||||
+6
-1
@@ -26,7 +26,7 @@ from types import (
|
||||
WrapperDescriptorType,
|
||||
)
|
||||
from typing import Any, ClassVar, Final, Literal, NamedTuple, Protocol, TypeVar, overload, type_check_only
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias, TypeGuard, TypeIs
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias, TypeGuard, TypeIs, deprecated
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
from annotationlib import Format
|
||||
@@ -476,12 +476,14 @@ class Arguments(NamedTuple):
|
||||
def getargs(co: CodeType) -> Arguments: ...
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
@deprecated("Deprecated since Python 3.0; removed in Python 3.11.")
|
||||
class ArgSpec(NamedTuple):
|
||||
args: list[str]
|
||||
varargs: str | None
|
||||
keywords: str | None
|
||||
defaults: tuple[Any, ...]
|
||||
|
||||
@deprecated("Deprecated since Python 3.0; removed in Python 3.11. Use `inspect.signature()` instead.")
|
||||
def getargspec(func: object) -> ArgSpec: ...
|
||||
|
||||
class FullArgSpec(NamedTuple):
|
||||
@@ -512,6 +514,9 @@ else:
|
||||
def formatannotationrelativeto(object: object) -> Callable[[object], str]: ...
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
@deprecated(
|
||||
"Deprecated since Python 3.5; removed in Python 3.11. Use `inspect.signature()` and the `Signature` class instead."
|
||||
)
|
||||
def formatargspec(
|
||||
args: list[str],
|
||||
varargs: str | None = None,
|
||||
|
||||
+7
-1
@@ -18,6 +18,7 @@ from builtins import str as _str
|
||||
from collections.abc import Callable, Iterable
|
||||
from decimal import Decimal
|
||||
from typing import Any
|
||||
from typing_extensions import deprecated
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from _locale import getencoding as getencoding
|
||||
@@ -137,9 +138,14 @@ def getpreferredencoding(do_setlocale: bool = True) -> _str: ...
|
||||
def normalize(localename: _str) -> _str: ...
|
||||
|
||||
if sys.version_info < (3, 13):
|
||||
def resetlocale(category: int = ...) -> None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
@deprecated("Deprecated since Python 3.11; removed in Python 3.13. Use `locale.setlocale(locale.LC_ALL, '')` instead.")
|
||||
def resetlocale(category: int = ...) -> None: ...
|
||||
else:
|
||||
def resetlocale(category: int = ...) -> None: ...
|
||||
|
||||
if sys.version_info < (3, 12):
|
||||
@deprecated("Deprecated since Python 3.7; removed in Python 3.12. Use `locale.format_string()` instead.")
|
||||
def format(
|
||||
percent: _str, value: float | Decimal, grouping: bool = False, monetary: bool = False, *additional: Any
|
||||
) -> _str: ...
|
||||
|
||||
@@ -301,7 +301,7 @@ class Path(PurePath):
|
||||
def write_text(self, data: str, encoding: str | None = None, errors: str | None = None) -> int: ...
|
||||
if sys.version_info < (3, 12):
|
||||
if sys.version_info >= (3, 10):
|
||||
@deprecated("Deprecated as of Python 3.10 and removed in Python 3.12. Use hardlink_to() instead.")
|
||||
@deprecated("Deprecated since Python 3.10; removed in Python 3.12. Use `hardlink_to()` instead.")
|
||||
def link_to(self, target: StrOrBytesPath) -> None: ...
|
||||
else:
|
||||
def link_to(self, target: StrOrBytesPath) -> None: ...
|
||||
|
||||
+10
-4
@@ -30,17 +30,23 @@ class ModuleInfo(NamedTuple):
|
||||
def extend_path(path: _PathT, name: str) -> _PathT: ...
|
||||
|
||||
if sys.version_info < (3, 12):
|
||||
@deprecated("Deprecated since Python 3.3; removed in Python 3.12. Use the `importlib` module instead.")
|
||||
class ImpImporter:
|
||||
def __init__(self, path: StrOrBytesPath | None = None) -> None: ...
|
||||
|
||||
@deprecated("Deprecated since Python 3.3; removed in Python 3.12. Use the `importlib` module instead.")
|
||||
class ImpLoader:
|
||||
def __init__(self, fullname: str, file: IO[str], filename: StrOrBytesPath, etc: tuple[str, str, int]) -> None: ...
|
||||
|
||||
if sys.version_info < (3, 14):
|
||||
@deprecated("Use importlib.util.find_spec() instead. Will be removed in Python 3.14.")
|
||||
def find_loader(fullname: str) -> LoaderProtocol | None: ...
|
||||
@deprecated("Use importlib.util.find_spec() instead. Will be removed in Python 3.14.")
|
||||
def get_loader(module_or_name: str) -> LoaderProtocol | None: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
@deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `importlib.util.find_spec()` instead.")
|
||||
def find_loader(fullname: str) -> LoaderProtocol | None: ...
|
||||
@deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `importlib.util.find_spec()` instead.")
|
||||
def get_loader(module_or_name: str) -> LoaderProtocol | None: ...
|
||||
else:
|
||||
def find_loader(fullname: str) -> LoaderProtocol | None: ...
|
||||
def get_loader(module_or_name: str) -> LoaderProtocol | None: ...
|
||||
|
||||
def get_importer(path_item: StrOrBytesPath) -> PathEntryFinderProtocol | None: ...
|
||||
def iter_importers(fullname: str = "") -> Iterator[MetaPathFinderProtocol | PathEntryFinderProtocol]: ...
|
||||
|
||||
+8
-4
@@ -15,10 +15,14 @@ if sys.platform != "win32":
|
||||
def openpty() -> tuple[int, int]: ...
|
||||
|
||||
if sys.version_info < (3, 14):
|
||||
@deprecated("Deprecated in 3.12, to be removed in 3.14; use openpty() instead")
|
||||
def master_open() -> tuple[int, str]: ...
|
||||
@deprecated("Deprecated in 3.12, to be removed in 3.14; use openpty() instead")
|
||||
def slave_open(tty_name: str) -> int: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
@deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `openpty()` instead.")
|
||||
def master_open() -> tuple[int, str]: ...
|
||||
@deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `openpty()` instead.")
|
||||
def slave_open(tty_name: str) -> int: ...
|
||||
else:
|
||||
def master_open() -> tuple[int, str]: ...
|
||||
def slave_open(tty_name: str) -> int: ...
|
||||
|
||||
def fork() -> tuple[int, int]: ...
|
||||
def spawn(argv: str | Iterable[str], master_read: _Reader = ..., stdin_read: _Reader = ...) -> int: ...
|
||||
|
||||
+6
-2
@@ -6,7 +6,7 @@ from _typeshed import MaybeNone, ReadableBuffer
|
||||
from collections.abc import Callable, Iterator, Mapping
|
||||
from types import GenericAlias
|
||||
from typing import Any, AnyStr, Final, Generic, Literal, TypeVar, final, overload
|
||||
from typing_extensions import TypeAlias
|
||||
from typing_extensions import TypeAlias, deprecated
|
||||
|
||||
__all__ = [
|
||||
"match",
|
||||
@@ -307,4 +307,8 @@ def escape(pattern: AnyStr) -> AnyStr: ...
|
||||
def purge() -> None: ...
|
||||
|
||||
if sys.version_info < (3, 13):
|
||||
def template(pattern: AnyStr | Pattern[AnyStr], flags: _FlagsType = 0) -> Pattern[AnyStr]: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
@deprecated("Deprecated since Python 3.11; removed in Python 3.13. Use `re.compile()` instead.")
|
||||
def template(pattern: AnyStr | Pattern[AnyStr], flags: _FlagsType = 0) -> Pattern[AnyStr]: ... # undocumented
|
||||
else:
|
||||
def template(pattern: AnyStr | Pattern[AnyStr], flags: _FlagsType = 0) -> Pattern[AnyStr]: ... # undocumented
|
||||
|
||||
+2
-1
@@ -4,7 +4,7 @@ import socket
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
from typing_extensions import TypeAlias, deprecated
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = ["SMTPChannel", "SMTPServer", "DebuggingServer", "PureProxy"]
|
||||
@@ -87,5 +87,6 @@ class PureProxy(SMTPServer):
|
||||
def process_message(self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str) -> str | None: ... # type: ignore[override]
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
@deprecated("Deprecated since Python 3.9; removed in Python 3.11.")
|
||||
class MailmanProxy(PureProxy):
|
||||
def process_message(self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str) -> str | None: ... # type: ignore[override]
|
||||
|
||||
@@ -1029,6 +1029,7 @@ class Tk(Misc, Wm):
|
||||
def loadtk(self) -> None: ...
|
||||
def record(self, script, /): ...
|
||||
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, /): ...
|
||||
|
||||
+3
-1
@@ -4,7 +4,7 @@ from collections.abc import Callable, Generator, Sequence
|
||||
from contextlib import contextmanager
|
||||
from tkinter import Canvas, Frame, Misc, PhotoImage, Scrollbar
|
||||
from typing import Any, ClassVar, Literal, TypedDict, overload, type_check_only
|
||||
from typing_extensions import Self, TypeAlias
|
||||
from typing_extensions import Self, TypeAlias, deprecated
|
||||
|
||||
__all__ = [
|
||||
"ScrolledCanvas",
|
||||
@@ -426,6 +426,7 @@ class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods
|
||||
def get_shapepoly(self) -> _PolygonCoords | None: ...
|
||||
|
||||
if sys.version_info < (3, 13):
|
||||
@deprecated("Deprecated since Python 3.1; removed in Python 3.13. Use `tiltangle()` instead.")
|
||||
def settiltangle(self, angle: float) -> None: ...
|
||||
|
||||
@overload
|
||||
@@ -707,6 +708,7 @@ def shapetransform(
|
||||
def get_shapepoly() -> _PolygonCoords | None: ...
|
||||
|
||||
if sys.version_info < (3, 13):
|
||||
@deprecated("Deprecated since Python 3.1; removed in Python 3.13. Use `tiltangle()` instead.")
|
||||
def settiltangle(angle: float) -> None: ...
|
||||
|
||||
@overload
|
||||
|
||||
@@ -325,7 +325,7 @@ def urlretrieve(
|
||||
def urlcleanup() -> None: ...
|
||||
|
||||
if sys.version_info < (3, 14):
|
||||
@deprecated("Deprecated since Python 3.3; Removed in 3.14; Use newer urlopen functions and methods.")
|
||||
@deprecated("Deprecated since Python 3.3; removed in Python 3.14. Use newer `urlopen` functions and methods.")
|
||||
class URLopener:
|
||||
version: ClassVar[str]
|
||||
def __init__(self, proxies: dict[str, str] | None = None, **x509: str) -> None: ...
|
||||
@@ -356,7 +356,7 @@ if sys.version_info < (3, 14):
|
||||
def open_unknown_proxy(self, proxy: str, fullurl: str, data: ReadableBuffer | None = None) -> None: ... # undocumented
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
@deprecated("Deprecated since Python 3.3; Removed in 3.14; Use newer urlopen functions and methods.")
|
||||
@deprecated("Deprecated since Python 3.3; removed in Python 3.14. Use newer `urlopen` functions and methods.")
|
||||
class FancyURLopener(URLopener):
|
||||
def prompt_user_passwd(self, host: str, realm: str) -> tuple[str, str]: ...
|
||||
def get_user_passwd(self, host: str, realm: str, clear_cache: int = 0) -> tuple[str, str]: ... # undocumented
|
||||
|
||||
+12
-4
@@ -27,8 +27,14 @@ class zipimporter(_LoaderBasics):
|
||||
def __init__(self, path: StrOrBytesPath) -> None: ...
|
||||
|
||||
if sys.version_info < (3, 12):
|
||||
def find_loader(self, fullname: str, path: str | None = None) -> tuple[zipimporter | None, list[str]]: ... # undocumented
|
||||
def find_module(self, fullname: str, path: str | None = None) -> zipimporter | None: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@deprecated("Deprecated since Python 3.10; removed in Python 3.12. Use `find_spec()` instead.")
|
||||
def find_loader(self, fullname: str, path: str | None = None) -> tuple[zipimporter | None, list[str]]: ...
|
||||
@deprecated("Deprecated since Python 3.10; removed in Python 3.12. Use `find_spec()` instead.")
|
||||
def find_module(self, fullname: str, path: str | None = None) -> zipimporter | None: ...
|
||||
else:
|
||||
def find_loader(self, fullname: str, path: str | None = None) -> tuple[zipimporter | None, list[str]]: ...
|
||||
def find_module(self, fullname: str, path: str | None = None) -> zipimporter | None: ...
|
||||
|
||||
def get_code(self, fullname: str) -> CodeType: ...
|
||||
def get_data(self, pathname: str) -> bytes: ...
|
||||
@@ -42,10 +48,12 @@ class zipimporter(_LoaderBasics):
|
||||
|
||||
def get_source(self, fullname: str) -> str | None: ...
|
||||
def is_package(self, fullname: str) -> bool: ...
|
||||
@deprecated("Deprecated since 3.10; use exec_module() instead")
|
||||
def load_module(self, fullname: str) -> ModuleType: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@deprecated("Deprecated since Python 3.10; removed in Python 3.15. Use `exec_module()` instead.")
|
||||
def load_module(self, fullname: str) -> ModuleType: ...
|
||||
def exec_module(self, module: ModuleType) -> None: ...
|
||||
def create_module(self, spec: ModuleSpec) -> None: ...
|
||||
def find_spec(self, fullname: str, target: ModuleType | None = None) -> ModuleSpec | None: ...
|
||||
def invalidate_caches(self) -> None: ...
|
||||
else:
|
||||
def load_module(self, fullname: str) -> ModuleType: ...
|
||||
|
||||
Reference in New Issue
Block a user