mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Python 3.11 removals in stdlib (#6374)
Co-authored-by: Akuli <akuviljanen17@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -103,6 +103,7 @@ decimal: 2.7-
|
||||
difflib: 2.7-
|
||||
dis: 2.7-
|
||||
distutils: 2.7-
|
||||
distutils.command.bdist_msi: 2.7-3.10
|
||||
doctest: 2.7-
|
||||
dummy_threading: 2.7-
|
||||
email: 2.7-
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import sys
|
||||
from typing import Any
|
||||
from typing_extensions import Literal, final
|
||||
|
||||
@@ -68,7 +69,8 @@ class TkappType:
|
||||
quit: Any
|
||||
record: Any
|
||||
setvar: Any
|
||||
split: Any
|
||||
if sys.version_info < (3, 11):
|
||||
split: Any
|
||||
splitlist: Any
|
||||
unsetvar: Any
|
||||
wantobjects: Any
|
||||
|
||||
@@ -2,7 +2,7 @@ import sys
|
||||
from typing import Type
|
||||
|
||||
from .base_events import BaseEventLoop as BaseEventLoop
|
||||
from .coroutines import coroutine as coroutine, iscoroutine as iscoroutine, iscoroutinefunction as iscoroutinefunction
|
||||
from .coroutines import iscoroutine as iscoroutine, iscoroutinefunction as iscoroutinefunction
|
||||
from .events import (
|
||||
AbstractEventLoop as AbstractEventLoop,
|
||||
AbstractEventLoopPolicy as AbstractEventLoopPolicy,
|
||||
@@ -71,6 +71,8 @@ from .transports import (
|
||||
WriteTransport as WriteTransport,
|
||||
)
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
from .coroutines import coroutine as coroutine
|
||||
if sys.version_info >= (3, 7):
|
||||
from .events import get_running_loop as get_running_loop
|
||||
if sys.version_info >= (3, 8):
|
||||
|
||||
@@ -285,20 +285,35 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
async def connect_accepted_socket(
|
||||
self, protocol_factory: _ProtocolFactory, sock: socket, *, ssl: _SSLContext = ...
|
||||
) -> _TransProtPair: ...
|
||||
async def create_datagram_endpoint(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
local_addr: tuple[str, int] | None = ...,
|
||||
remote_addr: tuple[str, int] | None = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
reuse_address: bool | None = ...,
|
||||
reuse_port: bool | None = ...,
|
||||
allow_broadcast: bool | None = ...,
|
||||
sock: socket | None = ...,
|
||||
) -> _TransProtPair: ...
|
||||
if sys.version_info < (3, 11):
|
||||
async def create_datagram_endpoint(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
local_addr: tuple[str, int] | None = ...,
|
||||
remote_addr: tuple[str, int] | None = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
reuse_address: bool | None = ...,
|
||||
reuse_port: bool | None = ...,
|
||||
allow_broadcast: bool | None = ...,
|
||||
sock: socket | None = ...,
|
||||
) -> _TransProtPair: ...
|
||||
else:
|
||||
async def create_datagram_endpoint(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
local_addr: tuple[str, int] | None = ...,
|
||||
remote_addr: tuple[str, int] | None = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
proto: int = ...,
|
||||
flags: int = ...,
|
||||
reuse_port: bool | None = ...,
|
||||
allow_broadcast: bool | None = ...,
|
||||
sock: socket | None = ...,
|
||||
) -> _TransProtPair: ...
|
||||
# Pipes and subprocesses.
|
||||
async def connect_read_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ...
|
||||
async def connect_write_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ...
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import sys
|
||||
import types
|
||||
from collections.abc import Callable, Coroutine
|
||||
from typing import Any, TypeVar
|
||||
from collections.abc import Coroutine
|
||||
from typing import Any
|
||||
from typing_extensions import TypeGuard
|
||||
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
if sys.version_info < (3, 11):
|
||||
from collections.abc import Callable
|
||||
from typing import TypeVar
|
||||
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
def coroutine(func: _F) -> _F: ...
|
||||
|
||||
def coroutine(func: _F) -> _F: ...
|
||||
def iscoroutinefunction(func: object) -> bool: ...
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
|
||||
@@ -12,10 +12,13 @@ def a2b_base64(__data: str | bytes) -> bytes: ...
|
||||
def b2a_base64(__data: bytes, *, newline: bool = ...) -> bytes: ...
|
||||
def a2b_qp(data: str | bytes, header: bool = ...) -> bytes: ...
|
||||
def b2a_qp(data: bytes, quotetabs: bool = ..., istext: bool = ..., header: bool = ...) -> bytes: ...
|
||||
def a2b_hqx(__data: str | bytes) -> bytes: ...
|
||||
def rledecode_hqx(__data: bytes) -> bytes: ...
|
||||
def rlecode_hqx(__data: bytes) -> bytes: ...
|
||||
def b2a_hqx(__data: bytes) -> bytes: ...
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
def a2b_hqx(__data: str | bytes) -> bytes: ...
|
||||
def rledecode_hqx(__data: bytes) -> bytes: ...
|
||||
def rlecode_hqx(__data: bytes) -> bytes: ...
|
||||
def b2a_hqx(__data: bytes) -> bytes: ...
|
||||
|
||||
def crc_hqx(__data: bytes, __crc: int) -> int: ...
|
||||
def crc32(__data: bytes, __crc: int = ...) -> int: ...
|
||||
def b2a_hex(__data: bytes) -> bytes: ...
|
||||
|
||||
@@ -137,7 +137,9 @@ class RawConfigParser(_parser):
|
||||
def optionxform(self, optionstr: str) -> str: ...
|
||||
|
||||
class ConfigParser(RawConfigParser): ...
|
||||
class SafeConfigParser(ConfigParser): ...
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
class SafeConfigParser(ConfigParser): ...
|
||||
|
||||
class SectionProxy(MutableMapping[str, str]):
|
||||
def __init__(self, parser: RawConfigParser, name: str) -> None: ...
|
||||
|
||||
@@ -85,7 +85,8 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]):
|
||||
def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ...
|
||||
def __iter__(self) -> Iterator[AnyStr]: ...
|
||||
def __next__(self) -> AnyStr: ...
|
||||
def __getitem__(self, i: int) -> AnyStr: ...
|
||||
if sys.version_info < (3, 11):
|
||||
def __getitem__(self, i: int) -> AnyStr: ...
|
||||
def nextfile(self) -> None: ...
|
||||
def readline(self) -> AnyStr: ...
|
||||
def filename(self) -> str: ...
|
||||
|
||||
@@ -16,8 +16,9 @@ class NullTranslations:
|
||||
def npgettext(self, context: str, msgid1: str, msgid2: str, n: int) -> str: ...
|
||||
def info(self) -> Any: ...
|
||||
def charset(self) -> Any: ...
|
||||
def output_charset(self) -> Any: ...
|
||||
def set_output_charset(self, charset: str) -> None: ...
|
||||
if sys.version_info < (3, 11):
|
||||
def output_charset(self) -> Any: ...
|
||||
def set_output_charset(self, charset: str) -> None: ...
|
||||
def install(self, names: Container[str] | None = ...) -> None: ...
|
||||
|
||||
class GNUTranslations(NullTranslations):
|
||||
@@ -30,47 +31,71 @@ def find(domain: str, localedir: StrPath | None = ..., languages: Iterable[str]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@overload
|
||||
def translation(
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: None = ...,
|
||||
fallback: bool = ...,
|
||||
codeset: str | None = ...,
|
||||
) -> NullTranslations: ...
|
||||
@overload
|
||||
def translation(
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: Type[_T] = ...,
|
||||
fallback: Literal[False] = ...,
|
||||
codeset: str | None = ...,
|
||||
) -> _T: ...
|
||||
@overload
|
||||
def translation(
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: Type[Any] = ...,
|
||||
fallback: Literal[True] = ...,
|
||||
codeset: str | None = ...,
|
||||
) -> Any: ...
|
||||
def install(
|
||||
domain: str, localedir: StrPath | None = ..., codeset: str | None = ..., names: Container[str] | None = ...
|
||||
) -> None: ...
|
||||
if sys.version_info < (3, 11):
|
||||
@overload
|
||||
def translation(
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: None = ...,
|
||||
fallback: bool = ...,
|
||||
codeset: str | None = ...,
|
||||
) -> NullTranslations: ...
|
||||
@overload
|
||||
def translation(
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: Type[_T] = ...,
|
||||
fallback: Literal[False] = ...,
|
||||
codeset: str | None = ...,
|
||||
) -> _T: ...
|
||||
@overload
|
||||
def translation(
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: Type[Any] = ...,
|
||||
fallback: Literal[True] = ...,
|
||||
codeset: str | None = ...,
|
||||
) -> Any: ...
|
||||
def install(
|
||||
domain: str, localedir: StrPath | None = ..., codeset: str | None = ..., names: Container[str] | None = ...
|
||||
) -> None: ...
|
||||
|
||||
else:
|
||||
@overload
|
||||
def translation(
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: None = ...,
|
||||
fallback: bool = ...,
|
||||
) -> NullTranslations: ...
|
||||
@overload
|
||||
def translation(
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: Type[_T] = ...,
|
||||
fallback: Literal[False] = ...,
|
||||
) -> _T: ...
|
||||
@overload
|
||||
def translation(
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: Type[Any] = ...,
|
||||
fallback: Literal[True] = ...,
|
||||
) -> Any: ...
|
||||
def install(domain: str, localedir: StrPath | None = ..., names: Container[str] | None = ...) -> None: ...
|
||||
|
||||
def textdomain(domain: str | None = ...) -> str: ...
|
||||
def bindtextdomain(domain: str, localedir: StrPath | None = ...) -> str: ...
|
||||
def bind_textdomain_codeset(domain: str, codeset: str | None = ...) -> str: ...
|
||||
def dgettext(domain: str, message: str) -> str: ...
|
||||
def ldgettext(domain: str, message: str) -> str: ...
|
||||
def dngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ...
|
||||
def ldngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ...
|
||||
def gettext(message: str) -> str: ...
|
||||
def lgettext(message: str) -> str: ...
|
||||
def ngettext(msgid1: str, msgid2: str, n: int) -> str: ...
|
||||
def lngettext(msgid1: str, msgid2: str, n: int) -> str: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
def pgettext(context: str, message: str) -> str: ...
|
||||
@@ -78,4 +103,11 @@ if sys.version_info >= (3, 8):
|
||||
def npgettext(context: str, msgid1: str, msgid2: str, n: int) -> str: ...
|
||||
def dnpgettext(domain: str, context: str, msgid1: str, msgid2: str, n: int) -> str: ...
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
def lgettext(message: str) -> str: ...
|
||||
def ldgettext(domain: str, message: str) -> str: ...
|
||||
def lngettext(msgid1: str, msgid2: str, n: int) -> str: ...
|
||||
def ldngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ...
|
||||
def bind_textdomain_codeset(domain: str, codeset: str | None = ...) -> str: ...
|
||||
|
||||
Catalog = translation
|
||||
|
||||
@@ -247,19 +247,20 @@ class BoundArguments:
|
||||
def getclasstree(classes: list[type], unique: bool = ...) -> list[Any]: ...
|
||||
def walktree(classes: list[type], children: dict[Type[Any], list[type]], parent: Type[Any] | None) -> list[Any]: ...
|
||||
|
||||
class ArgSpec(NamedTuple):
|
||||
args: list[str]
|
||||
varargs: str | None
|
||||
keywords: str | None
|
||||
defaults: Tuple[Any, ...]
|
||||
|
||||
class Arguments(NamedTuple):
|
||||
args: list[str]
|
||||
varargs: str | None
|
||||
varkw: str | None
|
||||
|
||||
def getargs(co: CodeType) -> Arguments: ...
|
||||
def getargspec(func: object) -> ArgSpec: ...
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
class ArgSpec(NamedTuple):
|
||||
args: list[str]
|
||||
varargs: str | None
|
||||
keywords: str | None
|
||||
defaults: Tuple[Any, ...]
|
||||
def getargspec(func: object) -> ArgSpec: ...
|
||||
|
||||
class FullArgSpec(NamedTuple):
|
||||
args: list[str]
|
||||
@@ -281,21 +282,24 @@ class ArgInfo(NamedTuple):
|
||||
def getargvalues(frame: FrameType) -> ArgInfo: ...
|
||||
def formatannotation(annotation: object, base_module: str | None = ...) -> str: ...
|
||||
def formatannotationrelativeto(object: object) -> Callable[[object], str]: ...
|
||||
def formatargspec(
|
||||
args: list[str],
|
||||
varargs: str | None = ...,
|
||||
varkw: str | None = ...,
|
||||
defaults: Tuple[Any, ...] | None = ...,
|
||||
kwonlyargs: Sequence[str] | None = ...,
|
||||
kwonlydefaults: dict[str, Any] | None = ...,
|
||||
annotations: dict[str, Any] = ...,
|
||||
formatarg: Callable[[str], str] = ...,
|
||||
formatvarargs: Callable[[str], str] = ...,
|
||||
formatvarkw: Callable[[str], str] = ...,
|
||||
formatvalue: Callable[[Any], str] = ...,
|
||||
formatreturns: Callable[[Any], str] = ...,
|
||||
formatannotation: Callable[[Any], str] = ...,
|
||||
) -> str: ...
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
def formatargspec(
|
||||
args: list[str],
|
||||
varargs: str | None = ...,
|
||||
varkw: str | None = ...,
|
||||
defaults: Tuple[Any, ...] | None = ...,
|
||||
kwonlyargs: Sequence[str] | None = ...,
|
||||
kwonlydefaults: dict[str, Any] | None = ...,
|
||||
annotations: dict[str, Any] = ...,
|
||||
formatarg: Callable[[str], str] = ...,
|
||||
formatvarargs: Callable[[str], str] = ...,
|
||||
formatvarkw: Callable[[str], str] = ...,
|
||||
formatvalue: Callable[[Any], str] = ...,
|
||||
formatreturns: Callable[[Any], str] = ...,
|
||||
formatannotation: Callable[[Any], str] = ...,
|
||||
) -> str: ...
|
||||
|
||||
def formatargvalues(
|
||||
args: list[str],
|
||||
varargs: str | None,
|
||||
|
||||
@@ -688,7 +688,8 @@ class Tk(Misc, Wm):
|
||||
quit: Any
|
||||
record: Any
|
||||
setvar: Any
|
||||
split: Any
|
||||
if sys.version_info < (3, 11):
|
||||
split: Any
|
||||
splitlist: Any
|
||||
unsetvar: Any
|
||||
wantobjects: Any
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import sys
|
||||
from typing import IO, Any, Callable
|
||||
|
||||
from .types import WSGIEnvironment
|
||||
@@ -7,7 +8,8 @@ class FileWrapper:
|
||||
blksize: int
|
||||
close: Callable[[], None] # only exists if filelike.close exists
|
||||
def __init__(self, filelike: IO[bytes], blksize: int = ...) -> None: ...
|
||||
def __getitem__(self, key: Any) -> bytes: ...
|
||||
if sys.version_info < (3, 11):
|
||||
def __getitem__(self, key: Any) -> bytes: ...
|
||||
def __iter__(self) -> FileWrapper: ...
|
||||
def __next__(self) -> bytes: ...
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import sys
|
||||
from typing import IO, Any, Sequence, Tuple, Union
|
||||
from typing_extensions import Literal
|
||||
from xml.dom.minidom import Document, DOMImplementation, Element, Text
|
||||
@@ -66,7 +67,8 @@ class DOMEventStream:
|
||||
bufsize: int
|
||||
def __init__(self, stream: IO[bytes], parser: XMLReader, bufsize: int) -> None: ...
|
||||
pulldom: Any
|
||||
def __getitem__(self, pos): ...
|
||||
if sys.version_info < (3, 11):
|
||||
def __getitem__(self, pos): ...
|
||||
def __next__(self): ...
|
||||
def __iter__(self): ...
|
||||
def getEvent(self) -> _Event: ...
|
||||
|
||||
Reference in New Issue
Block a user