Remove Python 3.7 branches (#11238)

This commit is contained in:
Sebastian Rittau
2024-01-05 11:39:39 +01:00
committed by GitHub
parent 4e62577002
commit 23604858a6
122 changed files with 1952 additions and 3800 deletions
+6 -9
View File
@@ -17,13 +17,11 @@ import re
import subprocess
import sys
import urllib.parse
from importlib.metadata import distribution
import aiohttp
import termcolor
if sys.version_info >= (3, 8):
from importlib.metadata import distribution
PYRIGHT_CONFIG = "pyrightconfig.stricter.json"
@@ -204,12 +202,11 @@ def main() -> None:
#
# The importlib.metadata module is used for projects whose name is different
# from the runtime Python package name (example: PyYAML/yaml)
if sys.version_info >= (3, 8):
dist = distribution(project).read_text("top_level.txt")
if dist is not None:
packages = [name for name in dist.split() if not name.startswith("_")]
if len(packages) == 1:
package = packages[0]
dist = distribution(project).read_text("top_level.txt")
if dist is not None:
packages = [name for name in dist.split() if not name.startswith("_")]
if len(packages) == 1:
package = packages[0]
print(f'Using detected package "{package}" for project "{project}"', file=sys.stderr)
print("Suggestion: Try again with --package argument if that's not what you wanted", file=sys.stderr)
+22 -44
View File
@@ -4,9 +4,8 @@ from typing import Any, ClassVar
from typing_extensions import Literal
PyCF_ONLY_AST: Literal[1024]
if sys.version_info >= (3, 8):
PyCF_TYPE_COMMENTS: Literal[4096]
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]
PyCF_TYPE_COMMENTS: Literal[4096]
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]
_Identifier: typing_extensions.TypeAlias = str
@@ -19,33 +18,29 @@ class AST:
# TODO: Not all nodes have all of the following attributes
lineno: int
col_offset: int
if sys.version_info >= (3, 8):
end_lineno: int | None
end_col_offset: int | None
type_comment: str | None
end_lineno: int | None
end_col_offset: int | None
type_comment: str | None
class mod(AST): ...
class type_ignore(AST): ...
if sys.version_info >= (3, 8):
class type_ignore(AST): ...
class TypeIgnore(type_ignore):
if sys.version_info >= (3, 10):
__match_args__ = ("lineno", "tag")
tag: str
class TypeIgnore(type_ignore):
if sys.version_info >= (3, 10):
__match_args__ = ("lineno", "tag")
tag: str
class FunctionType(mod):
if sys.version_info >= (3, 10):
__match_args__ = ("argtypes", "returns")
argtypes: list[expr]
returns: expr
class FunctionType(mod):
if sys.version_info >= (3, 10):
__match_args__ = ("argtypes", "returns")
argtypes: list[expr]
returns: expr
class Module(mod):
if sys.version_info >= (3, 10):
__match_args__ = ("body", "type_ignores")
body: list[stmt]
if sys.version_info >= (3, 8):
type_ignores: list[TypeIgnore]
type_ignores: list[TypeIgnore]
class Interactive(mod):
if sys.version_info >= (3, 10):
@@ -340,21 +335,6 @@ class JoinedStr(expr):
__match_args__ = ("values",)
values: list[expr]
if sys.version_info < (3, 8):
class Num(expr): # Deprecated in 3.8; use Constant
n: int | float | complex
class Str(expr): # Deprecated in 3.8; use Constant
s: str
class Bytes(expr): # Deprecated in 3.8; use Constant
s: bytes
class NameConstant(expr): # Deprecated in 3.8; use Constant
value: Any
class Ellipsis(expr): ... # Deprecated in 3.8; use Constant
class Constant(expr):
if sys.version_info >= (3, 10):
__match_args__ = ("value", "kind")
@@ -364,12 +344,11 @@ class Constant(expr):
s: Any
n: int | float | complex
if sys.version_info >= (3, 8):
class NamedExpr(expr):
if sys.version_info >= (3, 10):
__match_args__ = ("target", "value")
target: Name
value: expr
class NamedExpr(expr):
if sys.version_info >= (3, 10):
__match_args__ = ("target", "value")
target: Name
value: expr
class Attribute(expr):
if sys.version_info >= (3, 10):
@@ -498,8 +477,7 @@ class ExceptHandler(excepthandler):
class arguments(AST):
if sys.version_info >= (3, 10):
__match_args__ = ("posonlyargs", "args", "vararg", "kwonlyargs", "kw_defaults", "kwarg", "defaults")
if sys.version_info >= (3, 8):
posonlyargs: list[arg]
posonlyargs: list[arg]
args: list[arg]
vararg: arg | None
kwonlyargs: list[arg]
-5
View File
@@ -99,11 +99,6 @@ else:
def unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
def unicode_escape_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
if sys.version_info < (3, 8):
def unicode_internal_decode(__obj: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
def unicode_internal_encode(__obj: str | ReadableBuffer, __errors: str | None = None) -> tuple[bytes, int]: ...
def utf_16_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
def utf_16_be_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
def utf_16_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
+7 -7
View File
@@ -548,10 +548,10 @@ if sys.platform != "win32":
def vline(self, ch: _ChType, n: int) -> None: ...
@overload
def vline(self, y: int, x: int, ch: _ChType, n: int) -> None: ...
if sys.version_info >= (3, 8):
class _ncurses_version(NamedTuple):
major: int
minor: int
patch: int
ncurses_version: _ncurses_version
window = _CursesWindow # undocumented
class _ncurses_version(NamedTuple):
major: int
minor: int
patch: int
ncurses_version: _ncurses_version
window = _CursesWindow # undocumented
+7 -12
View File
@@ -1,4 +1,5 @@
import sys
from _thread import _excepthook, _ExceptHookArgs
from _typeshed import ProfileFunction, TraceFunction
from collections.abc import Callable, Iterable, Mapping
from types import TracebackType
@@ -28,11 +29,10 @@ __all__ = [
"settrace",
"local",
"stack_size",
"ExceptHookArgs",
"excepthook",
]
if sys.version_info >= (3, 8):
__all__ += ["ExceptHookArgs", "excepthook"]
def active_count() -> int: ...
def current_thread() -> Thread: ...
def currentThread() -> Thread: ...
@@ -72,10 +72,8 @@ class Thread:
def join(self, timeout: float | None = None) -> None: ...
def getName(self) -> str: ...
def setName(self, name: str) -> None: ...
if sys.version_info >= (3, 8):
@property
def native_id(self) -> int | None: ... # only available on some platforms
@property
def native_id(self) -> int | None: ... # only available on some platforms
def is_alive(self) -> bool: ...
if sys.version_info < (3, 9):
def isAlive(self) -> bool: ...
@@ -138,11 +136,8 @@ class Event:
def clear(self) -> None: ...
def wait(self, timeout: float | None = None) -> bool: ...
if sys.version_info >= (3, 8):
from _thread import _excepthook, _ExceptHookArgs
excepthook = _excepthook
ExceptHookArgs = _ExceptHookArgs
excepthook = _excepthook
ExceptHookArgs = _ExceptHookArgs
class Timer(Thread):
def __init__(
+1 -8
View File
@@ -1,4 +1,3 @@
import sys
from collections.abc import Iterable, Sequence
from typing import TypeVar
@@ -13,13 +12,7 @@ _COMPILER_CONFIG_VARS: tuple[str, ...] # undocumented
_INITPRE: str # undocumented
def _find_executable(executable: str, path: str | None = None) -> str | None: ... # undocumented
if sys.version_info >= (3, 8):
def _read_output(commandstring: str, capture_stderr: bool = False) -> str | None: ... # undocumented
else:
def _read_output(commandstring: str) -> str | None: ... # undocumented
def _read_output(commandstring: str, capture_stderr: bool = False) -> str | None: ... # undocumented
def _find_build_tool(toolname: str) -> str: ... # undocumented
_SYSTEM_VERSION: str | None # undocumented
+50 -60
View File
@@ -1,16 +1,9 @@
import sys
from _typeshed import ReadableBuffer, WriteableBuffer
from collections.abc import Iterable
from typing import Any, SupportsInt, overload
from typing import Any, SupportsIndex, overload
from typing_extensions import TypeAlias
if sys.version_info >= (3, 8):
from typing import SupportsIndex
_FD: TypeAlias = SupportsIndex
else:
_FD: TypeAlias = SupportsInt
_CMSG: TypeAlias = tuple[int, int, bytes]
_CMSGArg: TypeAlias = tuple[int, int, ReadableBuffer]
@@ -144,34 +137,33 @@ IPPROTO_IP: int
IPPROTO_RAW: int
IPPROTO_TCP: int
IPPROTO_UDP: int
if sys.version_info >= (3, 8) or sys.platform != "win32":
IPPROTO_AH: int
IPPROTO_DSTOPTS: int
IPPROTO_EGP: int
IPPROTO_ESP: int
IPPROTO_FRAGMENT: int
IPPROTO_GGP: int
IPPROTO_HOPOPTS: int
IPPROTO_ICMPV6: int
IPPROTO_IDP: int
IPPROTO_IGMP: int
IPPROTO_IPV4: int
IPPROTO_IPV6: int
IPPROTO_MAX: int
IPPROTO_ND: int
IPPROTO_NONE: int
IPPROTO_PIM: int
IPPROTO_PUP: int
IPPROTO_ROUTING: int
IPPROTO_SCTP: int
if sys.platform != "darwin":
IPPROTO_CBT: int
IPPROTO_ICLFXBM: int
IPPROTO_IGP: int
IPPROTO_L2TP: int
IPPROTO_PGM: int
IPPROTO_RDP: int
IPPROTO_ST: int
IPPROTO_AH: int
IPPROTO_DSTOPTS: int
IPPROTO_EGP: int
IPPROTO_ESP: int
IPPROTO_FRAGMENT: int
IPPROTO_GGP: int
IPPROTO_HOPOPTS: int
IPPROTO_ICMPV6: int
IPPROTO_IDP: int
IPPROTO_IGMP: int
IPPROTO_IPV4: int
IPPROTO_IPV6: int
IPPROTO_MAX: int
IPPROTO_ND: int
IPPROTO_NONE: int
IPPROTO_PIM: int
IPPROTO_PUP: int
IPPROTO_ROUTING: int
IPPROTO_SCTP: int
if sys.platform != "darwin":
IPPROTO_CBT: int
IPPROTO_ICLFXBM: int
IPPROTO_IGP: int
IPPROTO_L2TP: int
IPPROTO_PGM: int
IPPROTO_RDP: int
IPPROTO_ST: int
if sys.platform != "win32":
IPPROTO_EON: int
IPPROTO_GRE: int
@@ -363,20 +355,18 @@ if sys.platform == "linux":
CAN_BCM_RX_STATUS: int
CAN_BCM_RX_TIMEOUT: int
CAN_BCM_RX_CHANGED: int
if sys.version_info >= (3, 8):
CAN_BCM_SETTIMER: int
CAN_BCM_STARTTIMER: int
CAN_BCM_TX_COUNTEVT: int
CAN_BCM_TX_ANNOUNCE: int
CAN_BCM_TX_CP_CAN_ID: int
CAN_BCM_RX_FILTER_ID: int
CAN_BCM_RX_CHECK_DLC: int
CAN_BCM_RX_NO_AUTOTIMER: int
CAN_BCM_RX_ANNOUNCE_RESUME: int
CAN_BCM_TX_RESET_MULTI_IDX: int
CAN_BCM_RX_RTR_FRAME: int
CAN_BCM_CAN_FD_FRAME: int
CAN_BCM_SETTIMER: int
CAN_BCM_STARTTIMER: int
CAN_BCM_TX_COUNTEVT: int
CAN_BCM_TX_ANNOUNCE: int
CAN_BCM_TX_CP_CAN_ID: int
CAN_BCM_RX_FILTER_ID: int
CAN_BCM_RX_CHECK_DLC: int
CAN_BCM_RX_NO_AUTOTIMER: int
CAN_BCM_RX_ANNOUNCE_RESUME: int
CAN_BCM_TX_RESET_MULTI_IDX: int
CAN_BCM_RX_RTR_FRAME: int
CAN_BCM_CAN_FD_FRAME: int
if sys.platform == "linux":
# Availability: Linux >= 3.6
@@ -545,7 +535,7 @@ if sys.platform != "win32" and sys.platform != "darwin":
HCI_TIME_STAMP: int # not in FreeBSD, NetBSD, or DragonFlyBSD
HCI_DATA_DIR: int # not in FreeBSD, NetBSD, or DragonFlyBSD
if sys.platform == "linux" and sys.version_info >= (3, 8):
if sys.platform == "linux":
AF_QIPCRTR: int # Availability: Linux >= 4.7
if sys.version_info >= (3, 11) and sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
@@ -700,9 +690,11 @@ class socket:
@property
def timeout(self) -> float | None: ...
if sys.platform == "win32":
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | bytes | None = ...) -> None: ...
def __init__(
self, family: int = ..., type: int = ..., proto: int = ..., fileno: SupportsIndex | bytes | None = ...
) -> None: ...
else:
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | None = ...) -> None: ...
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: SupportsIndex | None = ...) -> None: ...
def bind(self, __address: _Address) -> None: ...
def close(self) -> None: ...
@@ -766,8 +758,8 @@ SocketType = socket
# ===== Functions =====
def close(__fd: _FD) -> None: ...
def dup(__fd: _FD) -> int: ...
def close(__fd: SupportsIndex) -> None: ...
def dup(__fd: SupportsIndex) -> int: ...
# the 5th tuple item is an address
def getaddrinfo(
@@ -803,10 +795,8 @@ if sys.platform != "win32":
def CMSG_SPACE(__length: int) -> int: ...
def socketpair(__family: int = ..., __type: int = ..., __proto: int = ...) -> tuple[socket, socket]: ...
# Windows added these in 3.8, but didn't have them before
if sys.platform != "win32" or sys.version_info >= (3, 8):
def if_nameindex() -> list[tuple[int, str]]: ...
def if_nametoindex(__name: str) -> int: ...
def if_indextoname(__index: int) -> str: ...
def if_nameindex() -> list[tuple[int, str]]: ...
def if_nametoindex(__name: str) -> int: ...
def if_indextoname(__index: int) -> str: ...
CAPI: object
+1 -1
View File
@@ -78,7 +78,7 @@ def S_ISSOCK(mode: int) -> bool: ...
def S_ISWHT(mode: int) -> bool: ...
def filemode(mode: int) -> str: ...
if sys.platform == "win32" and sys.version_info >= (3, 8):
if sys.platform == "win32":
IO_REPARSE_TAG_SYMLINK: int
IO_REPARSE_TAG_MOUNT_POINT: int
IO_REPARSE_TAG_APPEXECLINK: int
+15 -15
View File
@@ -28,21 +28,21 @@ def stack_size(size: int = ...) -> int: ...
TIMEOUT_MAX: float
if sys.version_info >= (3, 8):
def get_native_id() -> int: ... # only available on some platforms
@final
class _ExceptHookArgs(structseq[Any], tuple[type[BaseException], BaseException | None, TracebackType | None, Thread | None]):
if sys.version_info >= (3, 10):
__match_args__: Final = ("exc_type", "exc_value", "exc_traceback", "thread")
@property
def exc_type(self) -> type[BaseException]: ...
@property
def exc_value(self) -> BaseException | None: ...
@property
def exc_traceback(self) -> TracebackType | None: ...
@property
def thread(self) -> Thread | None: ...
_excepthook: Callable[[_ExceptHookArgs], Any]
def get_native_id() -> int: ... # only available on some platforms
@final
class _ExceptHookArgs(structseq[Any], tuple[type[BaseException], BaseException | None, TracebackType | None, Thread | None]):
if sys.version_info >= (3, 10):
__match_args__: Final = ("exc_type", "exc_value", "exc_traceback", "thread")
@property
def exc_type(self) -> type[BaseException]: ...
@property
def exc_value(self) -> BaseException | None: ...
@property
def exc_traceback(self) -> TracebackType | None: ...
@property
def thread(self) -> Thread | None: ...
_excepthook: Callable[[_ExceptHookArgs], Any]
if sys.version_info >= (3, 12):
def daemon_threads_allowed() -> bool: ...
+10 -24
View File
@@ -107,29 +107,15 @@ TK_VERSION: str
class TkttType:
def deletetimerhandler(self): ...
if sys.version_info >= (3, 8):
def create(
__screenName: str | None = None,
__baseName: str = "",
__className: str = "Tk",
__interactive: bool = False,
__wantobjects: bool = False,
__wantTk: bool = True,
__sync: bool = False,
__use: str | None = None,
): ...
else:
def create(
__screenName: str | None = None,
__baseName: str | None = None,
__className: str = "Tk",
__interactive: bool = False,
__wantobjects: bool = False,
__wantTk: bool = True,
__sync: bool = False,
__use: str | None = None,
): ...
def create(
__screenName: str | None = None,
__baseName: str = "",
__className: str = "Tk",
__interactive: bool = False,
__wantobjects: bool = False,
__wantTk: bool = True,
__sync: bool = False,
__use: str | None = None,
): ...
def getbusywaitinterval(): ...
def setbusywaitinterval(__new_val): ...
+33 -39
View File
@@ -36,12 +36,11 @@ if sys.platform == "win32":
FILE_GENERIC_READ: Literal[1179785]
FILE_GENERIC_WRITE: Literal[1179926]
if sys.version_info >= (3, 8):
FILE_MAP_ALL_ACCESS: Literal[983071]
FILE_MAP_COPY: Literal[1]
FILE_MAP_EXECUTE: Literal[32]
FILE_MAP_READ: Literal[4]
FILE_MAP_WRITE: Literal[2]
FILE_MAP_ALL_ACCESS: Literal[983071]
FILE_MAP_COPY: Literal[1]
FILE_MAP_EXECUTE: Literal[32]
FILE_MAP_READ: Literal[4]
FILE_MAP_WRITE: Literal[2]
FILE_TYPE_CHAR: Literal[2]
FILE_TYPE_DISK: Literal[1]
@@ -53,23 +52,21 @@ if sys.platform == "win32":
GENERIC_WRITE: Literal[0x40000000]
HIGH_PRIORITY_CLASS: Literal[0x80]
INFINITE: Literal[0xFFFFFFFF]
if sys.version_info >= (3, 8):
# Ignore the Flake8 error -- flake8-pyi assumes
# most numbers this long will be implementation details,
# but here we can see that it's a power of 2
INVALID_HANDLE_VALUE: Literal[0xFFFFFFFFFFFFFFFF] # noqa: Y054
# Ignore the Flake8 error -- flake8-pyi assumes
# most numbers this long will be implementation details,
# but here we can see that it's a power of 2
INVALID_HANDLE_VALUE: Literal[0xFFFFFFFFFFFFFFFF] # noqa: Y054
IDLE_PRIORITY_CLASS: Literal[0x40]
NORMAL_PRIORITY_CLASS: Literal[0x20]
REALTIME_PRIORITY_CLASS: Literal[0x100]
NMPWAIT_WAIT_FOREVER: Literal[0xFFFFFFFF]
if sys.version_info >= (3, 8):
MEM_COMMIT: Literal[0x1000]
MEM_FREE: Literal[0x10000]
MEM_IMAGE: Literal[0x1000000]
MEM_MAPPED: Literal[0x40000]
MEM_PRIVATE: Literal[0x20000]
MEM_RESERVE: Literal[0x2000]
MEM_COMMIT: Literal[0x1000]
MEM_FREE: Literal[0x10000]
MEM_IMAGE: Literal[0x1000000]
MEM_MAPPED: Literal[0x40000]
MEM_PRIVATE: Literal[0x20000]
MEM_RESERVE: Literal[0x2000]
NULL: Literal[0]
OPEN_EXISTING: Literal[3]
@@ -81,29 +78,27 @@ if sys.platform == "win32":
PIPE_UNLIMITED_INSTANCES: Literal[255]
PIPE_WAIT: Literal[0]
if sys.version_info >= (3, 8):
PAGE_EXECUTE: Literal[0x10]
PAGE_EXECUTE_READ: Literal[0x20]
PAGE_EXECUTE_READWRITE: Literal[0x40]
PAGE_EXECUTE_WRITECOPY: Literal[0x80]
PAGE_GUARD: Literal[0x100]
PAGE_NOACCESS: Literal[0x1]
PAGE_NOCACHE: Literal[0x200]
PAGE_READONLY: Literal[0x2]
PAGE_READWRITE: Literal[0x4]
PAGE_WRITECOMBINE: Literal[0x400]
PAGE_WRITECOPY: Literal[0x8]
PAGE_EXECUTE: Literal[0x10]
PAGE_EXECUTE_READ: Literal[0x20]
PAGE_EXECUTE_READWRITE: Literal[0x40]
PAGE_EXECUTE_WRITECOPY: Literal[0x80]
PAGE_GUARD: Literal[0x100]
PAGE_NOACCESS: Literal[0x1]
PAGE_NOCACHE: Literal[0x200]
PAGE_READONLY: Literal[0x2]
PAGE_READWRITE: Literal[0x4]
PAGE_WRITECOMBINE: Literal[0x400]
PAGE_WRITECOPY: Literal[0x8]
PROCESS_ALL_ACCESS: Literal[0x1FFFFF]
PROCESS_DUP_HANDLE: Literal[0x40]
if sys.version_info >= (3, 8):
SEC_COMMIT: Literal[0x8000000]
SEC_IMAGE: Literal[0x1000000]
SEC_LARGE_PAGES: Literal[0x80000000]
SEC_NOCACHE: Literal[0x10000000]
SEC_RESERVE: Literal[0x4000000]
SEC_WRITECOMBINE: Literal[0x40000000]
SEC_COMMIT: Literal[0x8000000]
SEC_IMAGE: Literal[0x1000000]
SEC_LARGE_PAGES: Literal[0x80000000]
SEC_NOCACHE: Literal[0x10000000]
SEC_RESERVE: Literal[0x4000000]
SEC_WRITECOMBINE: Literal[0x40000000]
STARTF_USESHOWWINDOW: Literal[0x1]
STARTF_USESTDHANDLES: Literal[0x100]
@@ -114,8 +109,7 @@ if sys.platform == "win32":
STILL_ACTIVE: Literal[259]
SW_HIDE: Literal[0]
if sys.version_info >= (3, 8):
SYNCHRONIZE: Literal[0x100000]
SYNCHRONIZE: Literal[0x100000]
WAIT_ABANDONED_0: Literal[128]
WAIT_OBJECT_0: Literal[0]
WAIT_TIMEOUT: Literal[258]
+1 -2
View File
@@ -446,8 +446,7 @@ class _StoreFalseAction(_StoreConstAction):
class _AppendAction(Action): ...
# undocumented
if sys.version_info >= (3, 8):
class _ExtendAction(_AppendAction): ...
class _ExtendAction(_AppendAction): ...
# undocumented
class _AppendConstAction(Action):
+95 -123
View File
@@ -6,29 +6,31 @@ from collections.abc import Iterator
from typing import Any, TypeVar as _TypeVar, overload
from typing_extensions import Literal, deprecated
if sys.version_info >= (3, 8):
class _ABC(type):
if sys.version_info >= (3, 9):
def __init__(cls, *args: Unused) -> None: ...
class _ABC(type):
if sys.version_info >= (3, 9):
def __init__(cls, *args: Unused) -> None: ...
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class Num(Constant, metaclass=_ABC):
value: int | float | complex
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class Str(Constant, metaclass=_ABC):
value: str
# Aliases for value, for backwards compatibility
s: str
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class Bytes(Constant, metaclass=_ABC):
value: bytes
# Aliases for value, for backwards compatibility
s: bytes
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class NameConstant(Constant, metaclass=_ABC): ...
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class Num(Constant, metaclass=_ABC):
value: int | float | complex
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class Ellipsis(Constant, metaclass=_ABC): ...
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class Str(Constant, metaclass=_ABC):
value: str
# Aliases for value, for backwards compatibility
s: str
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class Bytes(Constant, metaclass=_ABC):
value: bytes
# Aliases for value, for backwards compatibility
s: bytes
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class NameConstant(Constant, metaclass=_ABC): ...
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
class Ellipsis(Constant, metaclass=_ABC): ...
if sys.version_info >= (3, 9):
class slice(AST): ...
@@ -90,10 +92,8 @@ class NodeVisitor:
def visit_FormattedValue(self, node: FormattedValue) -> Any: ...
def visit_JoinedStr(self, node: JoinedStr) -> Any: ...
def visit_Constant(self, node: Constant) -> Any: ...
if sys.version_info >= (3, 8):
def visit_NamedExpr(self, node: NamedExpr) -> Any: ...
def visit_TypeIgnore(self, node: TypeIgnore) -> Any: ...
def visit_NamedExpr(self, node: NamedExpr) -> Any: ...
def visit_TypeIgnore(self, node: TypeIgnore) -> Any: ...
def visit_Attribute(self, node: Attribute) -> Any: ...
def visit_Subscript(self, node: Subscript) -> Any: ...
def visit_Starred(self, node: Starred) -> Any: ...
@@ -181,100 +181,75 @@ class NodeTransformer(NodeVisitor):
_T = _TypeVar("_T", bound=AST)
if sys.version_info >= (3, 8):
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
mode: Literal["exec"] = "exec",
*,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Module: ...
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any],
mode: Literal["eval"],
*,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Expression: ...
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any],
mode: Literal["func_type"],
*,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> FunctionType: ...
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any],
mode: Literal["single"],
*,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Interactive: ...
@overload
def parse(
source: str | ReadableBuffer,
*,
mode: Literal["eval"],
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Expression: ...
@overload
def parse(
source: str | ReadableBuffer,
*,
mode: Literal["func_type"],
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> FunctionType: ...
@overload
def parse(
source: str | ReadableBuffer,
*,
mode: Literal["single"],
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Interactive: ...
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
mode: str = "exec",
*,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> AST: ...
else:
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
mode: Literal["exec"] = "exec",
) -> Module: ...
@overload
def parse(
source: str | ReadableBuffer, filename: str | ReadableBuffer | os.PathLike[Any], mode: Literal["eval"]
) -> Expression: ...
@overload
def parse(
source: str | ReadableBuffer, filename: str | ReadableBuffer | os.PathLike[Any], mode: Literal["single"]
) -> Interactive: ...
@overload
def parse(source: str | ReadableBuffer, *, mode: Literal["eval"]) -> Expression: ...
@overload
def parse(source: str | ReadableBuffer, *, mode: Literal["single"]) -> Interactive: ...
@overload
def parse(
source: str | ReadableBuffer, filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>", mode: str = "exec"
) -> AST: ...
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
mode: Literal["exec"] = "exec",
*,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Module: ...
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any],
mode: Literal["eval"],
*,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Expression: ...
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any],
mode: Literal["func_type"],
*,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> FunctionType: ...
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any],
mode: Literal["single"],
*,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Interactive: ...
@overload
def parse(
source: str | ReadableBuffer,
*,
mode: Literal["eval"],
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Expression: ...
@overload
def parse(
source: str | ReadableBuffer,
*,
mode: Literal["func_type"],
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> FunctionType: ...
@overload
def parse(
source: str | ReadableBuffer,
*,
mode: Literal["single"],
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Interactive: ...
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
mode: str = "exec",
*,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> AST: ...
if sys.version_info >= (3, 9):
def unparse(ast_obj: AST) -> str: ...
@@ -295,10 +270,7 @@ def increment_lineno(node: _T, n: int = 1) -> _T: ...
def iter_child_nodes(node: AST) -> Iterator[AST]: ...
def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ...
def literal_eval(node_or_string: str | AST) -> Any: ...
if sys.version_info >= (3, 8):
def get_source_segment(source: str, node: AST, *, padded: bool = False) -> str | None: ...
def get_source_segment(source: str, node: AST, *, padded: bool = False) -> str | None: ...
def walk(node: AST) -> Iterator[AST]: ...
if sys.version_info >= (3, 9):
+1 -3
View File
@@ -7,6 +7,7 @@ from typing_extensions import TypeAlias
from .base_events import *
from .coroutines import *
from .events import *
from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *
@@ -17,9 +18,6 @@ from .subprocess import *
from .tasks import *
from .transports import *
if sys.version_info >= (3, 8):
from .exceptions import *
if sys.version_info >= (3, 9):
from .threads import *
+7 -47
View File
@@ -53,13 +53,8 @@ class Server(AbstractServer):
def is_serving(self) -> bool: ...
async def start_serving(self) -> None: ...
async def serve_forever(self) -> None: ...
if sys.version_info >= (3, 8):
@property
def sockets(self) -> tuple[socket, ...]: ...
else:
@property
def sockets(self) -> list[socket]: ...
@property
def sockets(self) -> tuple[socket, ...]: ...
def close(self) -> None: ...
async def wait_closed(self) -> None: ...
@@ -87,10 +82,8 @@ class BaseEventLoop(AbstractEventLoop):
# Tasks methods
if sys.version_info >= (3, 11):
def create_task(self, coro: _CoroutineLike[_T], *, name: object = None, context: Context | None = None) -> Task[_T]: ...
elif sys.version_info >= (3, 8):
def create_task(self, coro: _CoroutineLike[_T], *, name: object = None) -> Task[_T]: ...
else:
def create_task(self, coro: _CoroutineLike[_T]) -> Task[_T]: ...
def create_task(self, coro: _CoroutineLike[_T], *, name: object = None) -> Task[_T]: ...
def set_task_factory(self, factory: _TaskFactory | None) -> None: ...
def get_task_factory(self) -> _TaskFactory | None: ...
@@ -192,43 +185,6 @@ class BaseEventLoop(AbstractEventLoop):
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
elif sys.version_info >= (3, 8):
@overload
async def create_connection(
self,
protocol_factory: Callable[[], _ProtocolT],
host: str = ...,
port: int = ...,
*,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: None = None,
local_addr: tuple[str, int] | None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
@overload
async def create_connection(
self,
protocol_factory: Callable[[], _ProtocolT],
host: None = None,
port: None = None,
*,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: socket,
local_addr: None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
else:
@overload
async def create_connection(
@@ -245,6 +201,8 @@ class BaseEventLoop(AbstractEventLoop):
local_addr: tuple[str, int] | None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
@overload
async def create_connection(
@@ -261,6 +219,8 @@ class BaseEventLoop(AbstractEventLoop):
local_addr: None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
if sys.version_info >= (3, 11):
@overload
-2
View File
@@ -23,6 +23,4 @@ def iscoroutinefunction(func: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable
def iscoroutinefunction(func: Callable[_P, object]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, Any]]]: ...
@overload
def iscoroutinefunction(func: object) -> TypeGuard[Callable[..., Coroutine[Any, Any, Any]]]: ...
# Can actually be a generator-style coroutine on Python 3.7
def iscoroutine(obj: object) -> TypeGuard[Coroutine[Any, Any, Any]]: ...
+22 -85
View File
@@ -16,44 +16,23 @@ from .tasks import Task
from .transports import BaseTransport, DatagramTransport, ReadTransport, SubprocessTransport, Transport, WriteTransport
from .unix_events import AbstractChildWatcher
if sys.version_info >= (3, 8):
__all__ = (
"AbstractEventLoopPolicy",
"AbstractEventLoop",
"AbstractServer",
"Handle",
"TimerHandle",
"get_event_loop_policy",
"set_event_loop_policy",
"get_event_loop",
"set_event_loop",
"new_event_loop",
"get_child_watcher",
"set_child_watcher",
"_set_running_loop",
"get_running_loop",
"_get_running_loop",
)
else:
__all__ = (
"AbstractEventLoopPolicy",
"AbstractEventLoop",
"AbstractServer",
"Handle",
"TimerHandle",
"SendfileNotAvailableError",
"get_event_loop_policy",
"set_event_loop_policy",
"get_event_loop",
"set_event_loop",
"new_event_loop",
"get_child_watcher",
"set_child_watcher",
"_set_running_loop",
"get_running_loop",
"_get_running_loop",
)
__all__ = (
"AbstractEventLoopPolicy",
"AbstractEventLoop",
"AbstractServer",
"Handle",
"TimerHandle",
"get_event_loop_policy",
"set_event_loop_policy",
"get_event_loop",
"set_event_loop",
"new_event_loop",
"get_child_watcher",
"set_child_watcher",
"_set_running_loop",
"get_running_loop",
"_get_running_loop",
)
_T = TypeVar("_T")
_Ts = TypeVarTuple("_Ts")
@@ -162,12 +141,9 @@ class AbstractEventLoop:
def create_task(
self, coro: _CoroutineLike[_T], *, name: str | None = None, context: Context | None = None
) -> Task[_T]: ...
elif sys.version_info >= (3, 8):
@abstractmethod
def create_task(self, coro: _CoroutineLike[_T], *, name: str | None = None) -> Task[_T]: ...
else:
@abstractmethod
def create_task(self, coro: _CoroutineLike[_T]) -> Task[_T]: ...
def create_task(self, coro: _CoroutineLike[_T], *, name: str | None = None) -> Task[_T]: ...
@abstractmethod
def set_task_factory(self, factory: _TaskFactory | None) -> None: ...
@@ -242,45 +218,6 @@ class AbstractEventLoop:
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
elif sys.version_info >= (3, 8):
@overload
@abstractmethod
async def create_connection(
self,
protocol_factory: Callable[[], _ProtocolT],
host: str = ...,
port: int = ...,
*,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: None = None,
local_addr: tuple[str, int] | None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
@overload
@abstractmethod
async def create_connection(
self,
protocol_factory: Callable[[], _ProtocolT],
host: None = None,
port: None = None,
*,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: socket,
local_addr: None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
else:
@overload
@abstractmethod
@@ -298,6 +235,8 @@ class AbstractEventLoop:
local_addr: tuple[str, int] | None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
@overload
@abstractmethod
@@ -315,6 +254,8 @@ class AbstractEventLoop:
local_addr: None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
if sys.version_info >= (3, 11):
@overload
@@ -554,7 +495,6 @@ class AbstractEventLoop:
def add_writer(self, fd: FileDescriptorLike, callback: Callable[[Unpack[_Ts]], Any], *args: Unpack[_Ts]) -> None: ...
@abstractmethod
def remove_writer(self, fd: FileDescriptorLike) -> bool: ...
# Completion based I/O methods returning Futures prior to 3.7
@abstractmethod
async def sock_recv(self, sock: socket, nbytes: int) -> bytes: ...
@abstractmethod
@@ -632,6 +572,3 @@ else:
def _set_running_loop(__loop: AbstractEventLoop | None) -> None: ...
def _get_running_loop() -> AbstractEventLoop: ...
def get_running_loop() -> AbstractEventLoop: ...
if sys.version_info < (3, 8):
class SendfileNotAvailableError(RuntimeError): ...
+3 -12
View File
@@ -1,25 +1,16 @@
import sys
from collections.abc import Awaitable, Callable, Generator, Iterable
from concurrent.futures._base import Error, Future as _ConcurrentFuture
from concurrent.futures._base import Future as _ConcurrentFuture
from contextvars import Context
from typing import Any, TypeVar
from typing_extensions import Literal, Self, TypeGuard
from .events import AbstractEventLoop
if sys.version_info < (3, 8):
from concurrent.futures import CancelledError as CancelledError, TimeoutError as TimeoutError
class InvalidStateError(Error): ...
from contextvars import Context
if sys.version_info >= (3, 9):
from types import GenericAlias
if sys.version_info >= (3, 8):
__all__ = ("Future", "wrap_future", "isfuture")
else:
__all__ = ("CancelledError", "TimeoutError", "InvalidStateError", "Future", "wrap_future", "isfuture")
__all__ = ("Future", "wrap_future", "isfuture")
_T = TypeVar("_T")
+1 -4
View File
@@ -28,8 +28,5 @@ if sys.version_info >= (3, 12):
main: Coroutine[Any, Any, _T], *, debug: bool | None = ..., loop_factory: Callable[[], AbstractEventLoop] | None = ...
) -> _T: ...
elif sys.version_info >= (3, 8):
def run(main: Coroutine[Any, Any, _T], *, debug: bool | None = None) -> _T: ...
else:
def run(main: Coroutine[Any, Any, _T], *, debug: bool = False) -> _T: ...
def run(main: Coroutine[Any, Any, _T], *, debug: bool | None = None) -> _T: ...
+10 -44
View File
@@ -9,54 +9,20 @@ from . import events, protocols, transports
from .base_events import Server
if sys.platform == "win32":
if sys.version_info >= (3, 8):
__all__ = ("StreamReader", "StreamWriter", "StreamReaderProtocol", "open_connection", "start_server")
else:
__all__ = (
"StreamReader",
"StreamWriter",
"StreamReaderProtocol",
"open_connection",
"start_server",
"IncompleteReadError",
"LimitOverrunError",
)
__all__ = ("StreamReader", "StreamWriter", "StreamReaderProtocol", "open_connection", "start_server")
else:
if sys.version_info >= (3, 8):
__all__ = (
"StreamReader",
"StreamWriter",
"StreamReaderProtocol",
"open_connection",
"start_server",
"open_unix_connection",
"start_unix_server",
)
else:
__all__ = (
"StreamReader",
"StreamWriter",
"StreamReaderProtocol",
"open_connection",
"start_server",
"IncompleteReadError",
"LimitOverrunError",
"open_unix_connection",
"start_unix_server",
)
__all__ = (
"StreamReader",
"StreamWriter",
"StreamReaderProtocol",
"open_connection",
"start_server",
"open_unix_connection",
"start_unix_server",
)
_ClientConnectedCallback: TypeAlias = Callable[[StreamReader, StreamWriter], Awaitable[None] | None]
if sys.version_info < (3, 8):
class IncompleteReadError(EOFError):
expected: int | None
partial: bytes
def __init__(self, partial: bytes, expected: int | None) -> None: ...
class LimitOverrunError(Exception):
consumed: int
def __init__(self, message: str, consumed: int) -> None: ...
if sys.version_info >= (3, 10):
async def open_connection(
host: str | None = None,
+7 -12
View File
@@ -4,15 +4,10 @@ from _typeshed import StrOrBytesPath
from asyncio import events, protocols, streams, transports
from collections.abc import Callable, Collection
from typing import IO, Any
from typing_extensions import Literal, TypeAlias
from typing_extensions import Literal
__all__ = ("create_subprocess_exec", "create_subprocess_shell")
if sys.version_info >= (3, 8):
_ExecArg: TypeAlias = StrOrBytesPath
else:
_ExecArg: TypeAlias = str | bytes
PIPE: int
STDOUT: int
DEVNULL: int
@@ -74,8 +69,8 @@ if sys.version_info >= (3, 11):
pipesize: int = -1,
) -> Process: ...
async def create_subprocess_exec(
program: _ExecArg,
*args: _ExecArg,
program: StrOrBytesPath,
*args: StrOrBytesPath,
stdin: int | IO[Any] | None = None,
stdout: int | IO[Any] | None = None,
stderr: int | IO[Any] | None = None,
@@ -139,8 +134,8 @@ elif sys.version_info >= (3, 10):
pipesize: int = -1,
) -> Process: ...
async def create_subprocess_exec(
program: _ExecArg,
*args: _ExecArg,
program: StrOrBytesPath,
*args: StrOrBytesPath,
stdin: int | IO[Any] | None = None,
stdout: int | IO[Any] | None = None,
stderr: int | IO[Any] | None = None,
@@ -203,8 +198,8 @@ else: # >= 3.9
umask: int = -1,
) -> Process: ...
async def create_subprocess_exec(
program: _ExecArg,
*args: _ExecArg,
program: StrOrBytesPath,
*args: StrOrBytesPath,
stdin: int | IO[Any] | None = None,
stdout: int | IO[Any] | None = None,
stderr: int | IO[Any] | None = None,
+6 -11
View File
@@ -402,16 +402,14 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportGe
name: str | None = ...,
context: Context | None = None,
) -> None: ...
elif sys.version_info >= (3, 8):
else:
def __init__(
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop = ..., name: str | None = ...
) -> None: ...
else:
def __init__(self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop = ...) -> None: ...
if sys.version_info >= (3, 8):
def get_coro(self) -> _TaskCompatibleCoro[_T_co]: ...
def get_name(self) -> str: ...
def set_name(self, __value: object) -> None: ...
def get_coro(self) -> _TaskCompatibleCoro[_T_co]: ...
def get_name(self) -> str: ...
def set_name(self, __value: object) -> None: ...
if sys.version_info >= (3, 12):
def get_context(self) -> Context: ...
@@ -433,11 +431,8 @@ def all_tasks(loop: AbstractEventLoop | None = None) -> set[Task[Any]]: ...
if sys.version_info >= (3, 11):
def create_task(coro: _CoroutineLike[_T], *, name: str | None = None, context: Context | None = None) -> Task[_T]: ...
elif sys.version_info >= (3, 8):
def create_task(coro: _CoroutineLike[_T], *, name: str | None = None) -> Task[_T]: ...
else:
def create_task(coro: _CoroutineLike[_T]) -> Task[_T]: ...
def create_task(coro: _CoroutineLike[_T], *, name: str | None = None) -> Task[_T]: ...
def current_task(loop: AbstractEventLoop | None = None) -> Task[Any] | None: ...
def _enter_task(loop: AbstractEventLoop, task: Task[Any]) -> None: ...
+18 -25
View File
@@ -29,9 +29,8 @@ if sys.version_info >= (3, 12):
def __exit__(
self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None
) -> None: ...
if sys.version_info >= (3, 8):
@abstractmethod
def is_active(self) -> bool: ...
@abstractmethod
def is_active(self) -> bool: ...
else:
class AbstractChildWatcher:
@@ -49,9 +48,8 @@ else:
def __exit__(
self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None
) -> None: ...
if sys.version_info >= (3, 8):
@abstractmethod
def is_active(self) -> bool: ...
@abstractmethod
def is_active(self) -> bool: ...
if sys.platform != "win32":
if sys.version_info >= (3, 9):
@@ -65,7 +63,7 @@ if sys.platform != "win32":
"ThreadedChildWatcher",
"DefaultEventLoopPolicy",
)
elif sys.version_info >= (3, 8):
else:
__all__ = (
"SelectorEventLoop",
"AbstractChildWatcher",
@@ -75,16 +73,12 @@ if sys.platform != "win32":
"ThreadedChildWatcher",
"DefaultEventLoopPolicy",
)
else:
__all__ = ("SelectorEventLoop", "AbstractChildWatcher", "SafeChildWatcher", "FastChildWatcher", "DefaultEventLoopPolicy")
# Doesn't actually have ABCMeta metaclass at runtime, but mypy complains if we don't have it in the stub.
# See discussion in #7412
class BaseChildWatcher(AbstractChildWatcher, metaclass=ABCMeta):
def close(self) -> None: ...
if sys.version_info >= (3, 8):
def is_active(self) -> bool: ...
def is_active(self) -> bool: ...
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
if sys.version_info >= (3, 12):
@@ -141,7 +135,7 @@ if sys.platform != "win32":
def add_child_handler(self, pid: int, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> None: ...
def remove_child_handler(self, pid: int) -> bool: ...
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
elif sys.version_info >= (3, 8):
else:
class MultiLoopChildWatcher(AbstractChildWatcher):
def is_active(self) -> bool: ...
def close(self) -> None: ...
@@ -153,18 +147,17 @@ if sys.platform != "win32":
def remove_child_handler(self, pid: int) -> bool: ...
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
if sys.version_info >= (3, 8):
class ThreadedChildWatcher(AbstractChildWatcher):
def is_active(self) -> Literal[True]: ...
def close(self) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
) -> None: ...
def __del__(self) -> None: ...
def add_child_handler(self, pid: int, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> None: ...
def remove_child_handler(self, pid: int) -> bool: ...
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
class ThreadedChildWatcher(AbstractChildWatcher):
def is_active(self) -> Literal[True]: ...
def close(self) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
) -> None: ...
def __del__(self) -> None: ...
def add_child_handler(self, pid: int, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> None: ...
def remove_child_handler(self, pid: int) -> bool: ...
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
if sys.version_info >= (3, 9):
class PidfdChildWatcher(AbstractChildWatcher):
+2 -10
View File
@@ -27,16 +27,8 @@ if sys.version_info < (3, 11):
def crc_hqx(__data: ReadableBuffer, __crc: int) -> int: ...
def crc32(__data: ReadableBuffer, __crc: int = 0) -> int: ...
if sys.version_info >= (3, 8):
# sep must be str or bytes, not bytearray or any other buffer
def b2a_hex(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes: ...
def hexlify(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes: ...
else:
def b2a_hex(__data: ReadableBuffer) -> bytes: ...
def hexlify(__data: ReadableBuffer) -> bytes: ...
def b2a_hex(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes: ...
def hexlify(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes: ...
def a2b_hex(__hexstr: _AsciiBuffer) -> bytes: ...
def unhexlify(__hexstr: _AsciiBuffer) -> bytes: ...
+107 -235
View File
@@ -116,10 +116,7 @@ class object:
# return type of pickle methods is rather hard to express in the current type system
# see #6661 and https://docs.python.org/3/library/pickle.html#object.__reduce__
def __reduce__(self) -> str | tuple[Any, ...]: ...
if sys.version_info >= (3, 8):
def __reduce_ex__(self, __protocol: SupportsIndex) -> str | tuple[Any, ...]: ...
else:
def __reduce_ex__(self, __protocol: int) -> str | tuple[Any, ...]: ...
def __reduce_ex__(self, __protocol: SupportsIndex) -> str | tuple[Any, ...]: ...
if sys.version_info >= (3, 11):
def __getstate__(self) -> object: ...
@@ -227,9 +224,7 @@ class int:
def __new__(cls, __x: ConvertibleToInt = ...) -> Self: ...
@overload
def __new__(cls, __x: str | bytes | bytearray, base: SupportsIndex) -> Self: ...
if sys.version_info >= (3, 8):
def as_integer_ratio(self) -> tuple[int, Literal[1]]: ...
def as_integer_ratio(self) -> tuple[int, Literal[1]]: ...
@property
def real(self) -> int: ...
@property
@@ -393,22 +388,15 @@ class float:
def __bool__(self) -> bool: ...
class complex:
if sys.version_info >= (3, 8):
# Python doesn't currently accept SupportsComplex for the second argument
@overload
def __new__(
cls,
real: complex | SupportsComplex | SupportsFloat | SupportsIndex = ...,
imag: complex | SupportsFloat | SupportsIndex = ...,
) -> Self: ...
@overload
def __new__(cls, real: str | SupportsComplex | SupportsFloat | SupportsIndex | complex) -> Self: ...
else:
@overload
def __new__(cls, real: complex | SupportsComplex | SupportsFloat = ..., imag: complex | SupportsFloat = ...) -> Self: ...
@overload
def __new__(cls, real: str | SupportsComplex | SupportsFloat | complex) -> Self: ...
# Python doesn't currently accept SupportsComplex for the second argument
@overload
def __new__(
cls,
real: complex | SupportsComplex | SupportsFloat | SupportsIndex = ...,
imag: complex | SupportsFloat | SupportsIndex = ...,
) -> Self: ...
@overload
def __new__(cls, real: str | SupportsComplex | SupportsFloat | SupportsIndex | complex) -> Self: ...
@property
def real(self) -> float: ...
@property
@@ -462,17 +450,10 @@ class str(Sequence[str]):
def endswith(
self, __suffix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
if sys.version_info >= (3, 8):
@overload
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
@overload
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
else:
@overload
def expandtabs(self: LiteralString, tabsize: int = 8) -> LiteralString: ...
@overload
def expandtabs(self, tabsize: int = 8) -> str: ... # type: ignore[misc]
@overload
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
@overload
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
def find(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
@overload
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
@@ -639,19 +620,11 @@ class bytes(Sequence[int]):
__start: SupportsIndex | None = ...,
__end: SupportsIndex | None = ...,
) -> bool: ...
if sys.version_info >= (3, 8):
def expandtabs(self, tabsize: SupportsIndex = 8) -> bytes: ...
else:
def expandtabs(self, tabsize: int = ...) -> bytes: ...
def expandtabs(self, tabsize: SupportsIndex = 8) -> bytes: ...
def find(
self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> int: ...
if sys.version_info >= (3, 8):
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
else:
def hex(self) -> str: ...
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
def index(
self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> int: ...
@@ -747,20 +720,12 @@ class bytearray(MutableSequence[int]):
__start: SupportsIndex | None = ...,
__end: SupportsIndex | None = ...,
) -> bool: ...
if sys.version_info >= (3, 8):
def expandtabs(self, tabsize: SupportsIndex = 8) -> bytearray: ...
else:
def expandtabs(self, tabsize: int = ...) -> bytearray: ...
def expandtabs(self, tabsize: SupportsIndex = 8) -> bytearray: ...
def extend(self, __iterable_of_ints: Iterable[SupportsIndex]) -> None: ...
def find(
self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> int: ...
if sys.version_info >= (3, 8):
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
else:
def hex(self) -> str: ...
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
def index(
self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> int: ...
@@ -891,21 +856,13 @@ class memoryview(Sequence[int]):
def __setitem__(self, __key: SupportsIndex, __value: SupportsIndex) -> None: ...
if sys.version_info >= (3, 10):
def tobytes(self, order: Literal["C", "F", "A"] | None = "C") -> bytes: ...
elif sys.version_info >= (3, 8):
def tobytes(self, order: Literal["C", "F", "A"] | None = None) -> bytes: ...
else:
def tobytes(self) -> bytes: ...
def tobytes(self, order: Literal["C", "F", "A"] | None = None) -> bytes: ...
def tolist(self) -> list[int]: ...
if sys.version_info >= (3, 8):
def toreadonly(self) -> memoryview: ...
def toreadonly(self) -> memoryview: ...
def release(self) -> None: ...
if sys.version_info >= (3, 8):
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
else:
def hex(self) -> str: ...
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
def __buffer__(self, __flags: int) -> memoryview: ...
def __release_buffer__(self, __buffer: memoryview) -> None: ...
@@ -1119,8 +1076,7 @@ class dict(MutableMapping[_KT, _VT]):
def __delitem__(self, __key: _KT) -> None: ...
def __iter__(self) -> Iterator[_KT]: ...
def __eq__(self, __value: object) -> bool: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[_KT]: ...
def __reversed__(self) -> Iterator[_KT]: ...
__hash__: ClassVar[None] # type: ignore[assignment]
if sys.version_info >= (3, 9):
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
@@ -1297,89 +1253,49 @@ if sys.version_info >= (3, 10):
# compile() returns a CodeType, unless the flags argument includes PyCF_ONLY_AST (=1024),
# in which case it returns ast.AST. We have overloads for flag 0 (the default) and for
# explicitly passing PyCF_ONLY_AST. We fall back to Any for other values of flags.
if sys.version_info >= (3, 8):
@overload
def compile(
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
flags: Literal[0],
dont_inherit: bool = False,
optimize: int = -1,
*,
_feature_version: int = -1,
) -> CodeType: ...
@overload
def compile(
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
*,
dont_inherit: bool = False,
optimize: int = -1,
_feature_version: int = -1,
) -> CodeType: ...
@overload
def compile(
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
flags: Literal[1024],
dont_inherit: bool = False,
optimize: int = -1,
*,
_feature_version: int = -1,
) -> _ast.AST: ...
@overload
def compile(
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
flags: int,
dont_inherit: bool = False,
optimize: int = -1,
*,
_feature_version: int = -1,
) -> Any: ...
else:
@overload
def compile(
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
flags: Literal[0],
dont_inherit: bool = False,
optimize: int = -1,
) -> CodeType: ...
@overload
def compile(
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
*,
dont_inherit: bool = False,
optimize: int = -1,
) -> CodeType: ...
@overload
def compile(
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
flags: Literal[1024],
dont_inherit: bool = False,
optimize: int = -1,
) -> _ast.AST: ...
@overload
def compile(
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
flags: int,
dont_inherit: bool = False,
optimize: int = -1,
) -> Any: ...
@overload
def compile(
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
flags: Literal[0],
dont_inherit: bool = False,
optimize: int = -1,
*,
_feature_version: int = -1,
) -> CodeType: ...
@overload
def compile(
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
*,
dont_inherit: bool = False,
optimize: int = -1,
_feature_version: int = -1,
) -> CodeType: ...
@overload
def compile(
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
flags: Literal[1024],
dont_inherit: bool = False,
optimize: int = -1,
*,
_feature_version: int = -1,
) -> _ast.AST: ...
@overload
def compile(
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
filename: str | ReadableBuffer | _PathLike[Any],
mode: str,
flags: int,
dont_inherit: bool = False,
optimize: int = -1,
*,
_feature_version: int = -1,
) -> Any: ...
def copyright() -> None: ...
def credits() -> None: ...
def delattr(__obj: object, __name: str) -> None: ...
@@ -1673,77 +1589,45 @@ _SupportsSomeKindOfPow = ( # noqa: Y026 # TODO: Use TypeAlias once mypy bugs a
_SupportsPow2[Any, Any] | _SupportsPow3NoneOnly[Any, Any] | _SupportsPow3[Any, Any, Any]
)
if sys.version_info >= (3, 8):
# TODO: `pow(int, int, Literal[0])` fails at runtime,
# but adding a `NoReturn` overload isn't a good solution for expressing that (see #8566).
@overload
def pow(base: int, exp: int, mod: int) -> int: ...
@overload
def pow(base: int, exp: Literal[0], mod: None = None) -> Literal[1]: ...
@overload
def pow(base: int, exp: _PositiveInteger, mod: None = None) -> int: ...
@overload
def pow(base: int, exp: _NegativeInteger, mod: None = None) -> float: ...
# int base & positive-int exp -> int; int base & negative-int exp -> float
# return type must be Any as `int | float` causes too many false-positive errors
@overload
def pow(base: int, exp: int, mod: None = None) -> Any: ...
@overload
def pow(base: _PositiveInteger, exp: float, mod: None = None) -> float: ...
@overload
def pow(base: _NegativeInteger, exp: float, mod: None = None) -> complex: ...
@overload
def pow(base: float, exp: int, mod: None = None) -> float: ...
# float base & float exp could return float or complex
# return type must be Any (same as complex base, complex exp),
# as `float | complex` causes too many false-positive errors
@overload
def pow(base: float, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> Any: ...
@overload
def pow(base: complex, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> complex: ...
@overload
def pow(base: _SupportsPow2[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ...
@overload
def pow(base: _SupportsPow3NoneOnly[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ...
@overload
def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ...
@overload
def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = None) -> Any: ...
@overload
def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex: ...
# TODO: `pow(int, int, Literal[0])` fails at runtime,
# but adding a `NoReturn` overload isn't a good solution for expressing that (see #8566).
@overload
def pow(base: int, exp: int, mod: int) -> int: ...
@overload
def pow(base: int, exp: Literal[0], mod: None = None) -> Literal[1]: ...
@overload
def pow(base: int, exp: _PositiveInteger, mod: None = None) -> int: ...
@overload
def pow(base: int, exp: _NegativeInteger, mod: None = None) -> float: ...
else:
@overload
def pow(__x: int, __y: int, __z: int) -> int: ...
@overload
def pow(__x: int, __y: Literal[0], __z: None = None) -> Literal[1]: ...
@overload
def pow(__x: int, __y: _PositiveInteger, __z: None = None) -> int: ...
@overload
def pow(__x: int, __y: _NegativeInteger, __z: None = None) -> float: ...
@overload
def pow(__x: int, __y: int, __z: None = None) -> Any: ...
@overload
def pow(__x: _PositiveInteger, __y: float, __z: None = None) -> float: ...
@overload
def pow(__x: _NegativeInteger, __y: float, __z: None = None) -> complex: ...
@overload
def pow(__x: float, __y: int, __z: None = None) -> float: ...
@overload
def pow(__x: float, __y: complex | _SupportsSomeKindOfPow, __z: None = None) -> Any: ...
@overload
def pow(__x: complex, __y: complex | _SupportsSomeKindOfPow, __z: None = None) -> complex: ...
@overload
def pow(__x: _SupportsPow2[_E, _T_co], __y: _E, __z: None = None) -> _T_co: ...
@overload
def pow(__x: _SupportsPow3NoneOnly[_E, _T_co], __y: _E, __z: None = None) -> _T_co: ...
@overload
def pow(__x: _SupportsPow3[_E, _M, _T_co], __y: _E, __z: _M) -> _T_co: ...
@overload
def pow(__x: _SupportsSomeKindOfPow, __y: float, __z: None = None) -> Any: ...
@overload
def pow(__x: _SupportsSomeKindOfPow, __y: complex, __z: None = None) -> complex: ...
# int base & positive-int exp -> int; int base & negative-int exp -> float
# return type must be Any as `int | float` causes too many false-positive errors
@overload
def pow(base: int, exp: int, mod: None = None) -> Any: ...
@overload
def pow(base: _PositiveInteger, exp: float, mod: None = None) -> float: ...
@overload
def pow(base: _NegativeInteger, exp: float, mod: None = None) -> complex: ...
@overload
def pow(base: float, exp: int, mod: None = None) -> float: ...
# float base & float exp could return float or complex
# return type must be Any (same as complex base, complex exp),
# as `float | complex` causes too many false-positive errors
@overload
def pow(base: float, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> Any: ...
@overload
def pow(base: complex, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> complex: ...
@overload
def pow(base: _SupportsPow2[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ...
@overload
def pow(base: _SupportsPow3NoneOnly[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ...
@overload
def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ...
@overload
def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = None) -> Any: ...
@overload
def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex: ...
def quit(code: sys._ExitCode = None) -> NoReturn: ...
class reversed(Iterator[_T]):
@@ -1793,24 +1677,12 @@ _SupportsSumNoDefaultT = TypeVar("_SupportsSumNoDefaultT", bound=_SupportsSumWit
# However, we can't express that in the stub for `sum()`
# without creating many false-positive errors (see #7578).
# Instead, we special-case the most common examples of this: bool and literal integers.
if sys.version_info >= (3, 8):
@overload
def sum(__iterable: Iterable[bool | _LiteralInteger], start: int = 0) -> int: ... # type: ignore[overload-overlap]
else:
@overload
def sum(__iterable: Iterable[bool | _LiteralInteger], __start: int = 0) -> int: ... # type: ignore[overload-overlap]
@overload
def sum(__iterable: Iterable[bool | _LiteralInteger], start: int = 0) -> int: ... # type: ignore[overload-overlap]
@overload
def sum(__iterable: Iterable[_SupportsSumNoDefaultT]) -> _SupportsSumNoDefaultT | Literal[0]: ...
if sys.version_info >= (3, 8):
@overload
def sum(__iterable: Iterable[_AddableT1], start: _AddableT2) -> _AddableT1 | _AddableT2: ...
else:
@overload
def sum(__iterable: Iterable[_AddableT1], __start: _AddableT2) -> _AddableT1 | _AddableT2: ...
@overload
def sum(__iterable: Iterable[_AddableT1], start: _AddableT2) -> _AddableT1 | _AddableT2: ...
# The argument to `vars()` has to have a `__dict__` attribute, so the second overload can't be annotated with `object`
# (A "SupportsDunderDict" protocol doesn't work)
+2 -4
View File
@@ -1,4 +1,3 @@
import sys
from _typeshed import StrOrBytesPath, Unused
from collections.abc import Callable
from types import CodeType
@@ -30,8 +29,7 @@ class Profile:
def run(self, cmd: str) -> Self: ...
def runctx(self, cmd: str, globals: dict[str, Any], locals: dict[str, Any]) -> Self: ...
def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ...
if sys.version_info >= (3, 8):
def __enter__(self) -> Self: ...
def __exit__(self, *exc_info: Unused) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, *exc_info: Unused) -> None: ...
def label(code: str | CodeType) -> _Label: ... # undocumented
-12
View File
@@ -1,4 +1,3 @@
import sys
from _typeshed import SupportsGetItem, SupportsItemAccess, Unused
from builtins import list as _list, type as _type
from collections.abc import Iterable, Iterator, Mapping
@@ -22,9 +21,6 @@ __all__ = [
"print_environ_usage",
]
if sys.version_info < (3, 8):
__all__ += ["parse_qs", "parse_qsl", "escape"]
def parse(
fp: IO[Any] | None = None,
environ: SupportsItemAccess[str, str] = ...,
@@ -32,11 +28,6 @@ def parse(
strict_parsing: bool = ...,
separator: str = "&",
) -> dict[str, list[str]]: ...
if sys.version_info < (3, 8):
def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> dict[str, list[str]]: ...
def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> list[tuple[str, str]]: ...
def parse_multipart(
fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = "utf-8", errors: str = "replace", separator: str = "&"
) -> dict[str, list[Any]]: ...
@@ -52,9 +43,6 @@ def print_form(form: dict[str, Any]) -> None: ...
def print_directory() -> None: ...
def print_environ_usage() -> None: ...
if sys.version_info < (3, 8):
def escape(s: str, quote: bool | None = None) -> str: ...
class MiniFieldStorage:
# The first five "Any" attributes here are always None, but mypy doesn't support that
filename: Any
+2 -9
View File
@@ -1,10 +1,6 @@
import sys
from typing import SupportsComplex, SupportsFloat
from typing import SupportsComplex, SupportsFloat, SupportsIndex
from typing_extensions import TypeAlias
if sys.version_info >= (3, 8):
from typing import SupportsIndex
e: float
pi: float
inf: float
@@ -13,10 +9,7 @@ nan: float
nanj: complex
tau: float
if sys.version_info >= (3, 8):
_C: TypeAlias = SupportsFloat | SupportsComplex | SupportsIndex | complex
else:
_C: TypeAlias = SupportsFloat | SupportsComplex | complex
_C: TypeAlias = SupportsFloat | SupportsComplex | SupportsIndex | complex
def acos(__z: _C) -> complex: ...
def acosh(__z: _C) -> complex: ...
+3 -12
View File
@@ -1,4 +1,3 @@
import sys
import types
from _codecs import *
from _typeshed import ReadableBuffer
@@ -129,17 +128,9 @@ def getincrementalencoder(encoding: str) -> _IncrementalEncoder: ...
def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ...
def getreader(encoding: str) -> _StreamReader: ...
def getwriter(encoding: str) -> _StreamWriter: ...
if sys.version_info >= (3, 8):
def open(
filename: str, mode: str = "r", encoding: str | None = None, errors: str = "strict", buffering: int = -1
) -> StreamReaderWriter: ...
else:
def open(
filename: str, mode: str = "r", encoding: str | None = None, errors: str = "strict", buffering: int = 1
) -> StreamReaderWriter: ...
def open(
filename: str, mode: str = "r", encoding: str | None = None, errors: str = "strict", buffering: int = -1
) -> StreamReaderWriter: ...
def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = None, errors: str = "strict") -> StreamRecoder: ...
def iterencode(iterator: Iterable[str], encoding: str, errors: str = "strict") -> Generator[bytes, None, None]: ...
def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = "strict") -> Generator[str, None, None]: ...
+2 -10
View File
@@ -169,20 +169,12 @@ class UserString(Sequence[UserString]):
def __mul__(self, n: int) -> Self: ...
def __rmul__(self, n: int) -> Self: ...
def __mod__(self, args: Any) -> Self: ...
if sys.version_info >= (3, 8):
def __rmod__(self, template: object) -> Self: ...
else:
def __rmod__(self, format: Any) -> Self: ...
def __rmod__(self, template: object) -> Self: ...
def capitalize(self) -> Self: ...
def casefold(self) -> Self: ...
def center(self, width: int, *args: Any) -> Self: ...
def count(self, sub: str | UserString, start: int = 0, end: int = sys.maxsize) -> int: ...
if sys.version_info >= (3, 8):
def encode(self: UserString, encoding: str | None = "utf-8", errors: str | None = "strict") -> bytes: ...
else:
def encode(self, encoding: str | None = None, errors: str | None = None) -> Self: ...
def encode(self: UserString, encoding: str | None = "utf-8", errors: str | None = "strict") -> bytes: ...
def endswith(self, suffix: str | tuple[str, ...], start: int | None = 0, end: int | None = sys.maxsize) -> bool: ...
def expandtabs(self, tabsize: int = 8) -> Self: ...
def find(self, sub: str | UserString, start: int = 0, end: int = sys.maxsize) -> int: ...
+1 -5
View File
@@ -1,5 +1,3 @@
import sys
from ._base import (
ALL_COMPLETED as ALL_COMPLETED,
FIRST_COMPLETED as FIRST_COMPLETED,
@@ -8,6 +6,7 @@ from ._base import (
CancelledError as CancelledError,
Executor as Executor,
Future as Future,
InvalidStateError as InvalidStateError,
TimeoutError as TimeoutError,
as_completed as as_completed,
wait as wait,
@@ -15,9 +14,6 @@ from ._base import (
from .process import ProcessPoolExecutor as ProcessPoolExecutor
from .thread import ThreadPoolExecutor as ThreadPoolExecutor
if sys.version_info >= (3, 8):
from ._base import InvalidStateError as InvalidStateError
__all__ = (
"FIRST_COMPLETED",
"FIRST_EXCEPTION",
+1 -3
View File
@@ -30,9 +30,7 @@ if sys.version_info >= (3, 11):
else:
class TimeoutError(Error): ...
if sys.version_info >= (3, 8):
class InvalidStateError(Error): ...
class InvalidStateError(Error): ...
class BrokenExecutor(RuntimeError): ...
_T = TypeVar("_T")
+4 -12
View File
@@ -24,16 +24,12 @@ from _csv import (
if sys.version_info >= (3, 12):
from _csv import QUOTE_NOTNULL as QUOTE_NOTNULL, QUOTE_STRINGS as QUOTE_STRINGS
from _typeshed import SupportsWrite
from collections.abc import Collection, Iterable, Iterator, Mapping, Sequence
from typing import Any, Generic, TypeVar, overload
from typing_extensions import Literal, Self
if sys.version_info >= (3, 8):
from builtins import dict as _DictReadMapping
else:
from collections import OrderedDict as _DictReadMapping
if sys.version_info >= (3, 12):
from types import GenericAlias
@@ -69,7 +65,7 @@ class excel(Dialect): ...
class excel_tab(excel): ...
class unix_dialect(Dialect): ...
class DictReader(Iterator[_DictReadMapping[_T | Any, str | Any]], Generic[_T]):
class DictReader(Iterator[dict[_T | Any, str | Any]], Generic[_T]):
fieldnames: Sequence[_T] | None
restkey: _T | None
restval: str | Any | None
@@ -113,7 +109,7 @@ class DictReader(Iterator[_DictReadMapping[_T | Any, str | Any]], Generic[_T]):
strict: bool = False,
) -> None: ...
def __iter__(self) -> Self: ...
def __next__(self) -> _DictReadMapping[_T | Any, str | Any]: ...
def __next__(self) -> dict[_T | Any, str | Any]: ...
if sys.version_info >= (3, 12):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
@@ -139,11 +135,7 @@ class DictWriter(Generic[_T]):
quoting: _QuotingType = 0,
strict: bool = False,
) -> None: ...
if sys.version_info >= (3, 8):
def writeheader(self) -> Any: ...
else:
def writeheader(self) -> None: ...
def writeheader(self) -> Any: ...
def writerow(self, rowdict: Mapping[_T, Any]) -> Any: ...
def writerows(self, rowdicts: Iterable[Mapping[_T, Any]]) -> None: ...
if sys.version_info >= (3, 12):
+9 -20
View File
@@ -47,26 +47,15 @@ class CDLL:
_name: str
_handle: int
_FuncPtr: type[_FuncPointer]
if sys.version_info >= (3, 8):
def __init__(
self,
name: str | None,
mode: int = ...,
handle: int | None = None,
use_errno: bool = False,
use_last_error: bool = False,
winmode: int | None = None,
) -> None: ...
else:
def __init__(
self,
name: str | None,
mode: int = ...,
handle: int | None = None,
use_errno: bool = False,
use_last_error: bool = False,
) -> None: ...
def __init__(
self,
name: str | None,
mode: int = ...,
handle: int | None = None,
use_errno: bool = False,
use_last_error: bool = False,
winmode: int | None = None,
) -> None: ...
def __getattr__(self, name: str) -> _NamedFuncPointer: ...
def __getitem__(self, name_or_ordinal: str) -> _NamedFuncPointer: ...
+4 -13
View File
@@ -54,19 +54,10 @@ def asdict(obj: DataclassInstance, *, dict_factory: Callable[[list[tuple[str, An
def astuple(obj: DataclassInstance) -> tuple[Any, ...]: ...
@overload
def astuple(obj: DataclassInstance, *, tuple_factory: Callable[[list[Any]], _T]) -> _T: ...
if sys.version_info >= (3, 8):
# cls argument is now positional-only
@overload
def dataclass(__cls: None) -> Callable[[type[_T]], type[_T]]: ...
@overload
def dataclass(__cls: type[_T]) -> type[_T]: ...
else:
@overload
def dataclass(_cls: None) -> Callable[[type[_T]], type[_T]]: ...
@overload
def dataclass(_cls: type[_T]) -> type[_T]: ...
@overload
def dataclass(__cls: None) -> Callable[[type[_T]], type[_T]]: ...
@overload
def dataclass(__cls: type[_T]) -> type[_T]: ...
if sys.version_info >= (3, 11):
@overload
+17 -53
View File
@@ -60,10 +60,8 @@ class date:
def fromordinal(cls, __n: int) -> Self: ...
@classmethod
def fromisoformat(cls, __date_string: str) -> Self: ...
if sys.version_info >= (3, 8):
@classmethod
def fromisocalendar(cls, year: int, week: int, day: int) -> Self: ...
@classmethod
def fromisocalendar(cls, year: int, week: int, day: int) -> Self: ...
@property
def year(self) -> int: ...
@property
@@ -89,26 +87,14 @@ class date:
def __ge__(self, __value: date) -> bool: ...
def __gt__(self, __value: date) -> bool: ...
def __eq__(self, __value: object) -> bool: ...
if sys.version_info >= (3, 8):
def __add__(self, __value: timedelta) -> Self: ...
def __radd__(self, __value: timedelta) -> Self: ...
@overload
def __sub__(self, __value: timedelta) -> Self: ...
@overload
def __sub__(self, __value: datetime) -> NoReturn: ...
@overload
def __sub__(self: _D, __value: _D) -> timedelta: ...
else:
# Prior to Python 3.8, arithmetic operations always returned `date`, even in subclasses
def __add__(self, __value: timedelta) -> date: ...
def __radd__(self, __value: timedelta) -> date: ...
@overload
def __sub__(self, __value: timedelta) -> date: ...
@overload
def __sub__(self, __value: datetime) -> NoReturn: ...
@overload
def __sub__(self, __value: date) -> timedelta: ...
def __add__(self, __value: timedelta) -> Self: ...
def __radd__(self, __value: timedelta) -> Self: ...
@overload
def __sub__(self, __value: timedelta) -> Self: ...
@overload
def __sub__(self, __value: datetime) -> NoReturn: ...
@overload
def __sub__(self: _D, __value: _D) -> timedelta: ...
def __hash__(self) -> int: ...
def weekday(self) -> int: ...
def isoweekday(self) -> int: ...
@@ -266,17 +252,8 @@ class datetime(date):
@classmethod
def utcfromtimestamp(cls, __t: float) -> Self: ...
if sys.version_info >= (3, 8):
@classmethod
def now(cls, tz: _TzInfo | None = None) -> Self: ...
else:
@overload
@classmethod
def now(cls, tz: None = None) -> Self: ...
@overload
@classmethod
def now(cls, tz: _TzInfo) -> datetime: ...
@classmethod
def now(cls, tz: _TzInfo | None = None) -> Self: ...
@classmethod
def utcnow(cls) -> Self: ...
@classmethod
@@ -299,11 +276,7 @@ class datetime(date):
*,
fold: int = ...,
) -> Self: ...
if sys.version_info >= (3, 8):
def astimezone(self, tz: _TzInfo | None = ...) -> Self: ...
else:
def astimezone(self, tz: _TzInfo | None = ...) -> datetime: ...
def astimezone(self, tz: _TzInfo | None = ...) -> Self: ...
def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
@classmethod
def strptime(cls, __date_string: str, __format: str) -> Self: ...
@@ -316,16 +289,7 @@ class datetime(date):
def __gt__(self, __value: datetime) -> bool: ... # type: ignore[override]
def __eq__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 8):
@overload # type: ignore[override]
def __sub__(self, __value: timedelta) -> Self: ...
@overload
def __sub__(self: _D, __value: _D) -> timedelta: ...
else:
# Prior to Python 3.8, arithmetic operations always returned `datetime`, even in subclasses
def __add__(self, __value: timedelta) -> datetime: ...
def __radd__(self, __value: timedelta) -> datetime: ...
@overload # type: ignore[override]
def __sub__(self, __value: datetime) -> timedelta: ...
@overload
def __sub__(self, __value: timedelta) -> datetime: ...
@overload # type: ignore[override]
def __sub__(self, __value: timedelta) -> Self: ...
@overload
def __sub__(self: _D, __value: _D) -> timedelta: ...
+1 -4
View File
@@ -1,12 +1,9 @@
import sys
from _typeshed import StrPath, Unused
from collections.abc import Callable, Container, Iterable, Mapping
from typing import Any
from typing_extensions import Literal
if sys.version_info >= (3, 8):
def get_host_platform() -> str: ...
def get_host_platform() -> str: ...
def get_platform() -> str: ...
def convert_path(pathname: str) -> str: ...
def change_root(new_root: str, pathname: str) -> str: ...
+14 -20
View File
@@ -1,4 +1,3 @@
import sys
from collections.abc import Iterable, Iterator
from email.errors import HeaderParseError, MessageDefect
from email.policy import Policy
@@ -195,10 +194,9 @@ class DotAtomText(TokenList):
token_type: str
as_ew_allowed: bool
if sys.version_info >= (3, 8):
class NoFoldLiteral(TokenList):
token_type: str
as_ew_allowed: bool
class NoFoldLiteral(TokenList):
token_type: str
as_ew_allowed: bool
class AddrSpec(TokenList):
token_type: str
@@ -296,17 +294,16 @@ class HeaderLabel(TokenList):
token_type: str
as_ew_allowed: bool
if sys.version_info >= (3, 8):
class MsgID(TokenList):
token_type: str
as_ew_allowed: bool
def fold(self, policy: Policy) -> str: ...
class MsgID(TokenList):
token_type: str
as_ew_allowed: bool
def fold(self, policy: Policy) -> str: ...
class MessageID(MsgID):
token_type: str
class MessageID(MsgID):
token_type: str
class InvalidMessageID(MessageID):
token_type: str
class InvalidMessageID(MessageID):
token_type: str
class Header(TokenList):
token_type: str
@@ -375,12 +372,9 @@ def get_group_list(value: str) -> tuple[GroupList, str]: ...
def get_group(value: str) -> tuple[Group, str]: ...
def get_address(value: str) -> tuple[Address, str]: ...
def get_address_list(value: str) -> tuple[AddressList, str]: ...
if sys.version_info >= (3, 8):
def get_no_fold_literal(value: str) -> tuple[NoFoldLiteral, str]: ...
def get_msg_id(value: str) -> tuple[MsgID, str]: ...
def parse_message_id(value: str) -> MessageID: ...
def get_no_fold_literal(value: str) -> tuple[NoFoldLiteral, str]: ...
def get_msg_id(value: str) -> tuple[MsgID, str]: ...
def parse_message_id(value: str) -> MessageID: ...
def parse_mime_version(value: str) -> MIMEVersion: ...
def get_invalid_parameter(value: str) -> tuple[InvalidParameter, str]: ...
def get_ttext(value: str) -> tuple[ValueTerminal, str]: ...
+7 -10
View File
@@ -1,4 +1,3 @@
import sys
import types
from collections.abc import Iterable, Mapping
from datetime import datetime as _datetime
@@ -7,6 +6,7 @@ from email._header_value_parser import (
ContentDisposition,
ContentTransferEncoding,
ContentType,
MessageID,
MIMEVersion,
TokenList,
UnstructuredTokenList,
@@ -130,15 +130,12 @@ class ContentTransferEncodingHeader:
@staticmethod
def value_parser(value: str) -> ContentTransferEncoding: ...
if sys.version_info >= (3, 8):
from email._header_value_parser import MessageID
class MessageIDHeader:
max_count: ClassVar[Literal[1]]
@classmethod
def parse(cls, value: str, kwds: dict[str, Any]) -> None: ...
@staticmethod
def value_parser(value: str) -> MessageID: ...
class MessageIDHeader:
max_count: ClassVar[Literal[1]]
@classmethod
def parse(cls, value: str, kwds: dict[str, Any]) -> None: ...
@staticmethod
def value_parser(value: str) -> MessageID: ...
class _HeaderParser(Protocol):
max_count: ClassVar[Literal[1] | None]
+6 -7
View File
@@ -37,13 +37,12 @@ if sys.platform != "win32":
F_NOTIFY: int
F_EXLCK: int
F_GETLK64: int
if sys.version_info >= (3, 8):
F_ADD_SEALS: int
F_GET_SEALS: int
F_SEAL_GROW: int
F_SEAL_SEAL: int
F_SEAL_SHRINK: int
F_SEAL_WRITE: int
F_ADD_SEALS: int
F_GET_SEALS: int
F_SEAL_GROW: int
F_SEAL_SEAL: int
F_SEAL_SHRINK: int
F_SEAL_WRITE: int
if sys.version_info >= (3, 9):
F_OFD_GETLK: int
F_OFD_SETLK: int
+2 -109
View File
@@ -68,7 +68,7 @@ if sys.version_info >= (3, 10):
errors: str | None = None,
) -> FileInput[Any]: ...
elif sys.version_info >= (3, 8):
else:
# bufsize is dropped and mode and openhook become keyword-only
@overload
def input(
@@ -98,57 +98,6 @@ elif sys.version_info >= (3, 8):
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
) -> FileInput[Any]: ...
else:
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
bufsize: int = 0,
mode: _TextMode = "r",
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = None,
) -> FileInput[str]: ...
# Because mode isn't keyword-only here yet, we need two overloads each for
# the bytes case and the fallback case.
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
bufsize: int = 0,
*,
mode: Literal["rb"],
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = None,
) -> FileInput[bytes]: ...
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None,
inplace: bool,
backup: str,
bufsize: int,
mode: Literal["rb"],
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = None,
) -> FileInput[bytes]: ...
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
bufsize: int = 0,
*,
mode: str,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
) -> FileInput[Any]: ...
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None,
inplace: bool,
backup: str,
bufsize: int,
mode: str,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
) -> FileInput[Any]: ...
def close() -> None: ...
def nextfile() -> None: ...
def filename() -> str: ...
@@ -198,7 +147,7 @@ class FileInput(Iterator[AnyStr]):
errors: str | None = None,
) -> None: ...
elif sys.version_info >= (3, 8):
else:
# bufsize is dropped and mode and openhook become keyword-only
@overload
def __init__(
@@ -231,62 +180,6 @@ class FileInput(Iterator[AnyStr]):
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
) -> None: ...
else:
@overload
def __init__(
self: FileInput[str],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
bufsize: int = 0,
mode: _TextMode = "r",
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = None,
) -> None: ...
# Because mode isn't keyword-only here yet, we need two overloads each for
# the bytes case and the fallback case.
@overload
def __init__(
self: FileInput[bytes],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
bufsize: int = 0,
*,
mode: Literal["rb"],
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = None,
) -> None: ...
@overload
def __init__(
self: FileInput[bytes],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None,
inplace: bool,
backup: str,
bufsize: int,
mode: Literal["rb"],
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = None,
) -> None: ...
@overload
def __init__(
self: FileInput[Any],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
bufsize: int = 0,
*,
mode: str,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
) -> None: ...
@overload
def __init__(
self: FileInput[Any],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None,
inplace: bool,
backup: str,
bufsize: int,
mode: str,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
) -> None: ...
def __del__(self) -> None: ...
def close(self) -> None: ...
def __enter__(self) -> Self: ...
+9 -21
View File
@@ -30,8 +30,7 @@ class Fraction(Rational):
@classmethod
def from_decimal(cls, dec: Decimal) -> Self: ...
def limit_denominator(self, max_denominator: int = 1000000) -> Fraction: ...
if sys.version_info >= (3, 8):
def as_integer_ratio(self) -> tuple[int, int]: ...
def as_integer_ratio(self) -> tuple[int, int]: ...
if sys.version_info >= (3, 12):
def is_integer(self) -> bool: ...
@@ -103,25 +102,14 @@ class Fraction(Rational):
def __rmod__(b, a: int | Fraction) -> Fraction: ...
@overload
def __rmod__(b, a: float) -> float: ...
if sys.version_info >= (3, 8):
@overload
def __divmod__(a, b: int | Fraction) -> tuple[int, Fraction]: ...
@overload
def __divmod__(a, b: float) -> tuple[float, Fraction]: ...
@overload
def __rdivmod__(a, b: int | Fraction) -> tuple[int, Fraction]: ...
@overload
def __rdivmod__(a, b: float) -> tuple[float, Fraction]: ...
else:
@overload
def __divmod__(self, other: int | Fraction) -> tuple[int, Fraction]: ...
@overload
def __divmod__(self, other: float) -> tuple[float, Fraction]: ...
@overload
def __rdivmod__(self, other: int | Fraction) -> tuple[int, Fraction]: ...
@overload
def __rdivmod__(self, other: float) -> tuple[float, Fraction]: ...
@overload
def __divmod__(a, b: int | Fraction) -> tuple[int, Fraction]: ...
@overload
def __divmod__(a, b: float) -> tuple[float, Fraction]: ...
@overload
def __rdivmod__(a, b: int | Fraction) -> tuple[int, Fraction]: ...
@overload
def __rdivmod__(a, b: float) -> tuple[float, Fraction]: ...
@overload
def __pow__(a, b: int) -> Fraction: ...
@overload
+33 -43
View File
@@ -20,11 +20,10 @@ __all__ = [
"partial",
"partialmethod",
"singledispatch",
"cached_property",
"singledispatchmethod",
]
if sys.version_info >= (3, 8):
__all__ += ["cached_property", "singledispatchmethod"]
if sys.version_info >= (3, 9):
__all__ += ["cache"]
@@ -63,14 +62,10 @@ class _lru_cache_wrapper(Generic[_T]):
def __copy__(self) -> _lru_cache_wrapper[_T]: ...
def __deepcopy__(self, __memo: Any) -> _lru_cache_wrapper[_T]: ...
if sys.version_info >= (3, 8):
@overload
def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
@overload
def lru_cache(maxsize: Callable[..., _T], typed: bool = False) -> _lru_cache_wrapper[_T]: ...
else:
def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
@overload
def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
@overload
def lru_cache(maxsize: Callable[..., _T], typed: bool = False) -> _lru_cache_wrapper[_T]: ...
if sys.version_info >= (3, 12):
WRAPPER_ASSIGNMENTS: tuple[
@@ -149,11 +144,7 @@ class partialmethod(Generic[_T]):
def __init__(self, __func: Callable[..., _T], *args: Any, **keywords: Any) -> None: ...
@overload
def __init__(self, __func: _Descriptor, *args: Any, **keywords: Any) -> None: ...
if sys.version_info >= (3, 8):
def __get__(self, obj: Any, cls: type[Any] | None = None) -> Callable[..., _T]: ...
else:
def __get__(self, obj: Any, cls: type[Any] | None) -> Callable[..., _T]: ...
def __get__(self, obj: Any, cls: type[Any] | None = None) -> Callable[..., _T]: ...
@property
def __isabstractmethod__(self) -> bool: ...
if sys.version_info >= (3, 9):
@@ -178,34 +169,33 @@ class _SingleDispatchCallable(Generic[_T]):
def singledispatch(func: Callable[..., _T]) -> _SingleDispatchCallable[_T]: ...
if sys.version_info >= (3, 8):
class singledispatchmethod(Generic[_T]):
dispatcher: _SingleDispatchCallable[_T]
func: Callable[..., _T]
def __init__(self, func: Callable[..., _T]) -> None: ...
@property
def __isabstractmethod__(self) -> bool: ...
@overload
def register(self, cls: type[Any], method: None = None) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
@overload
def register(self, cls: Callable[..., _T], method: None = None) -> Callable[..., _T]: ...
@overload
def register(self, cls: type[Any], method: Callable[..., _T]) -> Callable[..., _T]: ...
def __get__(self, obj: _S, cls: type[_S] | None = None) -> Callable[..., _T]: ...
class singledispatchmethod(Generic[_T]):
dispatcher: _SingleDispatchCallable[_T]
func: Callable[..., _T]
def __init__(self, func: Callable[..., _T]) -> None: ...
@property
def __isabstractmethod__(self) -> bool: ...
@overload
def register(self, cls: type[Any], method: None = None) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
@overload
def register(self, cls: Callable[..., _T], method: None = None) -> Callable[..., _T]: ...
@overload
def register(self, cls: type[Any], method: Callable[..., _T]) -> Callable[..., _T]: ...
def __get__(self, obj: _S, cls: type[_S] | None = None) -> Callable[..., _T]: ...
class cached_property(Generic[_T]):
func: Callable[[Any], _T]
attrname: str | None
def __init__(self, func: Callable[[Any], _T]) -> None: ...
@overload
def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ...
@overload
def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ...
def __set_name__(self, owner: type[Any], name: str) -> None: ...
# __set__ is not defined at runtime, but @cached_property is designed to be settable
def __set__(self, instance: object, value: _T) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
class cached_property(Generic[_T]):
func: Callable[[Any], _T]
attrname: str | None
def __init__(self, func: Callable[[Any], _T]) -> None: ...
@overload
def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ...
@overload
def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ...
def __set_name__(self, owner: type[Any], name: str) -> None: ...
# __set__ is not defined at runtime, but @cached_property is designed to be settable
def __set__(self, instance: object, value: _T) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
if sys.version_info >= (3, 9):
def cache(__user_function: Callable[..., _T]) -> _lru_cache_wrapper[_T]: ...
+1 -7
View File
@@ -19,13 +19,7 @@ def disable() -> None: ...
def enable() -> None: ...
def get_count() -> tuple[int, int, int]: ...
def get_debug() -> int: ...
if sys.version_info >= (3, 8):
def get_objects(generation: int | None = None) -> list[Any]: ...
else:
def get_objects() -> list[Any]: ...
def get_objects(generation: int | None = None) -> list[Any]: ...
def freeze() -> None: ...
def unfreeze() -> None: ...
def get_freeze_count() -> int: ...
+10 -13
View File
@@ -18,14 +18,15 @@ __all__ = [
"dngettext",
"gettext",
"ngettext",
"dnpgettext",
"dpgettext",
"npgettext",
"pgettext",
]
if sys.version_info < (3, 11):
__all__ += ["bind_textdomain_codeset", "ldgettext", "ldngettext", "lgettext", "lngettext"]
if sys.version_info >= (3, 8):
__all__ += ["dnpgettext", "dpgettext", "npgettext", "pgettext"]
class _TranslationsReader(Protocol):
def read(self) -> bytes: ...
# optional:
@@ -37,10 +38,8 @@ class NullTranslations:
def add_fallback(self, fallback: NullTranslations) -> None: ...
def gettext(self, message: str) -> str: ...
def ngettext(self, msgid1: str, msgid2: str, n: int) -> str: ...
if sys.version_info >= (3, 8):
def pgettext(self, context: str, message: str) -> str: ...
def npgettext(self, context: str, msgid1: str, msgid2: str, n: int) -> str: ...
def pgettext(self, context: str, message: str) -> str: ...
def npgettext(self, context: str, msgid1: str, msgid2: str, n: int) -> str: ...
def info(self) -> dict[str, str]: ...
def charset(self) -> str | None: ...
if sys.version_info < (3, 11):
@@ -156,12 +155,10 @@ def dgettext(domain: str, message: str) -> str: ...
def dngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ...
def gettext(message: str) -> str: ...
def ngettext(msgid1: str, msgid2: str, n: int) -> str: ...
if sys.version_info >= (3, 8):
def pgettext(context: str, message: str) -> str: ...
def dpgettext(domain: str, context: str, message: str) -> str: ...
def npgettext(context: str, msgid1: str, msgid2: str, n: int) -> str: ...
def dnpgettext(domain: str, context: str, msgid1: str, msgid2: str, n: int) -> str: ...
def pgettext(context: str, message: str) -> str: ...
def dpgettext(domain: str, context: str, message: str) -> str: ...
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: ...
+3 -12
View File
@@ -6,10 +6,7 @@ from io import FileIO
from typing import Protocol, TextIO, overload
from typing_extensions import Literal, TypeAlias
if sys.version_info >= (3, 8):
__all__ = ["BadGzipFile", "GzipFile", "open", "compress", "decompress"]
else:
__all__ = ["GzipFile", "open", "compress", "decompress"]
__all__ = ["BadGzipFile", "GzipFile", "open", "compress", "decompress"]
_ReadBinaryMode: TypeAlias = Literal["r", "rb"]
_WriteBinaryMode: TypeAlias = Literal["a", "ab", "w", "wb", "x", "xb"]
@@ -85,8 +82,7 @@ class _PaddedFile:
def seek(self, off: int) -> int: ...
def seekable(self) -> bool: ...
if sys.version_info >= (3, 8):
class BadGzipFile(OSError): ...
class BadGzipFile(OSError): ...
class GzipFile(_compression.BaseStream):
myfileobj: FileIO | None
@@ -160,10 +156,5 @@ class GzipFile(_compression.BaseStream):
class _GzipReader(_compression.DecompressReader):
def __init__(self, fp: _ReadableFileobj) -> None: ...
if sys.version_info >= (3, 8):
def compress(data: SizedBuffer, compresslevel: int = 9, *, mtime: float | None = None) -> bytes: ...
else:
def compress(data: SizedBuffer, compresslevel: int = 9) -> bytes: ...
def compress(data: SizedBuffer, compresslevel: int = 9, *, mtime: float | None = None) -> bytes: ...
def decompress(data: ReadableBuffer) -> bytes: ...
+1 -10
View File
@@ -70,7 +70,7 @@ if sys.version_info >= (3, 9):
def sha384(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
def sha512(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
elif sys.version_info >= (3, 8):
else:
def new(name: str, data: ReadableBuffer = b"") -> _Hash: ...
def md5(string: ReadableBuffer = b"") -> _Hash: ...
def sha1(string: ReadableBuffer = b"") -> _Hash: ...
@@ -79,15 +79,6 @@ elif sys.version_info >= (3, 8):
def sha384(string: ReadableBuffer = b"") -> _Hash: ...
def sha512(string: ReadableBuffer = b"") -> _Hash: ...
else:
def new(name: str, data: ReadableBuffer = b"") -> _Hash: ...
def md5(__string: ReadableBuffer = ...) -> _Hash: ...
def sha1(__string: ReadableBuffer = ...) -> _Hash: ...
def sha224(__string: ReadableBuffer = ...) -> _Hash: ...
def sha256(__string: ReadableBuffer = ...) -> _Hash: ...
def sha384(__string: ReadableBuffer = ...) -> _Hash: ...
def sha512(__string: ReadableBuffer = ...) -> _Hash: ...
algorithms_guaranteed: AbstractSet[str]
algorithms_available: AbstractSet[str]
+7 -18
View File
@@ -1,4 +1,3 @@
import sys
from _typeshed import ReadableBuffer, SizedBuffer
from collections.abc import Callable
from types import ModuleType
@@ -14,29 +13,19 @@ trans_36: bytes
digest_size: None
if sys.version_info >= (3, 8):
# In reality digestmod has a default value, but the function always throws an error
# if the argument is not given, so we pretend it is a required argument.
@overload
def new(key: bytes | bytearray, msg: ReadableBuffer | None, digestmod: _DigestMod) -> HMAC: ...
@overload
def new(key: bytes | bytearray, *, digestmod: _DigestMod) -> HMAC: ...
else:
def new(key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod | None = None) -> HMAC: ...
# In reality digestmod has a default value, but the function always throws an error
# if the argument is not given, so we pretend it is a required argument.
@overload
def new(key: bytes | bytearray, msg: ReadableBuffer | None, digestmod: _DigestMod) -> HMAC: ...
@overload
def new(key: bytes | bytearray, *, digestmod: _DigestMod) -> HMAC: ...
class HMAC:
digest_size: int
block_size: int
@property
def name(self) -> str: ...
if sys.version_info >= (3, 8):
def __init__(self, key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod = "") -> None: ...
else:
def __init__(
self, key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod | None = None
) -> None: ...
def __init__(self, key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod = "") -> None: ...
def update(self, msg: ReadableBuffer) -> None: ...
def digest(self) -> bytes: ...
def hexdigest(self) -> str: ...
+1 -2
View File
@@ -73,8 +73,7 @@ class HTTPStatus(IntEnum):
NOT_EXTENDED: int
NETWORK_AUTHENTICATION_REQUIRED: int
MISDIRECTED_REQUEST: int
if sys.version_info >= (3, 8):
UNAVAILABLE_FOR_LEGAL_REASONS: int
UNAVAILABLE_FOR_LEGAL_REASONS: int
if sys.version_info >= (3, 9):
EARLY_HINTS: Literal[103]
IM_A_TEAPOT: Literal[418]
+17 -41
View File
@@ -44,13 +44,7 @@ class CookieJar(Iterable[Cookie]):
class FileCookieJar(CookieJar):
filename: str
delayload: bool
if sys.version_info >= (3, 8):
def __init__(
self, filename: StrPath | None = None, delayload: bool = False, policy: CookiePolicy | None = None
) -> None: ...
else:
def __init__(self, filename: str | None = None, delayload: bool = False, policy: CookiePolicy | None = None) -> None: ...
def __init__(self, filename: StrPath | None = None, delayload: bool = False, policy: CookiePolicy | None = None) -> None: ...
def save(self, filename: str | None = None, ignore_discard: bool = False, ignore_expires: bool = False) -> None: ...
def load(self, filename: str | None = None, ignore_discard: bool = False, ignore_expires: bool = False) -> None: ...
def revert(self, filename: str | None = None, ignore_discard: bool = False, ignore_expires: bool = False) -> None: ...
@@ -84,40 +78,22 @@ class DefaultCookiePolicy(CookiePolicy):
DomainRFC2965Match: ClassVar[int]
DomainLiberal: ClassVar[int]
DomainStrict: ClassVar[int]
if sys.version_info >= (3, 8):
def __init__(
self,
blocked_domains: Sequence[str] | None = None,
allowed_domains: Sequence[str] | None = None,
netscape: bool = True,
rfc2965: bool = False,
rfc2109_as_netscape: bool | None = None,
hide_cookie2: bool = False,
strict_domain: bool = False,
strict_rfc2965_unverifiable: bool = True,
strict_ns_unverifiable: bool = False,
strict_ns_domain: int = 0,
strict_ns_set_initial_dollar: bool = False,
strict_ns_set_path: bool = False,
secure_protocols: Sequence[str] = ("https", "wss"),
) -> None: ...
else:
def __init__(
self,
blocked_domains: Sequence[str] | None = None,
allowed_domains: Sequence[str] | None = None,
netscape: bool = True,
rfc2965: bool = False,
rfc2109_as_netscape: bool | None = None,
hide_cookie2: bool = False,
strict_domain: bool = False,
strict_rfc2965_unverifiable: bool = True,
strict_ns_unverifiable: bool = False,
strict_ns_domain: int = 0,
strict_ns_set_initial_dollar: bool = False,
strict_ns_set_path: bool = False,
) -> None: ...
def __init__(
self,
blocked_domains: Sequence[str] | None = None,
allowed_domains: Sequence[str] | None = None,
netscape: bool = True,
rfc2965: bool = False,
rfc2109_as_netscape: bool | None = None,
hide_cookie2: bool = False,
strict_domain: bool = False,
strict_rfc2965_unverifiable: bool = True,
strict_ns_unverifiable: bool = False,
strict_ns_domain: int = 0,
strict_ns_set_initial_dollar: bool = False,
strict_ns_set_path: bool = False,
secure_protocols: Sequence[str] = ("https", "wss"),
) -> None: ...
def blocked_domains(self) -> tuple[str, ...]: ...
def set_blocked_domains(self, blocked_domains: Sequence[str]) -> None: ...
def is_blocked(self, domain: str) -> bool: ...
+2 -4
View File
@@ -3,12 +3,10 @@ import sys
import types
from _typeshed import ReadableBuffer
from collections.abc import Callable, Iterable, MutableSequence, Sequence
from importlib.metadata import DistributionFinder, PathDistribution
from typing import Any
from typing_extensions import Literal, deprecated
if sys.version_info >= (3, 8):
from importlib.metadata import DistributionFinder, PathDistribution
class ModuleSpec:
def __init__(
self,
@@ -117,7 +115,7 @@ class PathFinder:
if sys.version_info >= (3, 10):
@staticmethod
def find_distributions(context: DistributionFinder.Context = ...) -> Iterable[PathDistribution]: ...
elif sys.version_info >= (3, 8):
else:
@classmethod
def find_distributions(cls, context: DistributionFinder.Context = ...) -> Iterable[PathDistribution]: ...
+22 -51
View File
@@ -200,57 +200,29 @@ def isfunction(object: object) -> TypeGuard[FunctionType]: ...
if sys.version_info >= (3, 12):
def markcoroutinefunction(func: _F) -> _F: ...
if sys.version_info >= (3, 8):
@overload
def isgeneratorfunction(obj: Callable[..., Generator[Any, Any, Any]]) -> bool: ...
@overload
def isgeneratorfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, GeneratorType[Any, Any, Any]]]: ...
@overload
def isgeneratorfunction(obj: object) -> TypeGuard[Callable[..., GeneratorType[Any, Any, Any]]]: ...
@overload
def iscoroutinefunction(obj: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ...
@overload
def iscoroutinefunction(obj: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, _T]]]: ...
@overload
def iscoroutinefunction(obj: Callable[_P, object]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, Any]]]: ...
@overload
def iscoroutinefunction(obj: object) -> TypeGuard[Callable[..., CoroutineType[Any, Any, Any]]]: ...
else:
@overload
def isgeneratorfunction(object: Callable[..., Generator[Any, Any, Any]]) -> bool: ...
@overload
def isgeneratorfunction(object: Callable[_P, Any]) -> TypeGuard[Callable[_P, GeneratorType[Any, Any, Any]]]: ...
@overload
def isgeneratorfunction(object: object) -> TypeGuard[Callable[..., GeneratorType[Any, Any, Any]]]: ...
@overload
def iscoroutinefunction(object: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ...
@overload
def iscoroutinefunction(object: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, _T]]]: ...
@overload
def iscoroutinefunction(object: Callable[_P, Any]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, Any]]]: ...
@overload
def iscoroutinefunction(object: object) -> TypeGuard[Callable[..., CoroutineType[Any, Any, Any]]]: ...
@overload
def isgeneratorfunction(obj: Callable[..., Generator[Any, Any, Any]]) -> bool: ...
@overload
def isgeneratorfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, GeneratorType[Any, Any, Any]]]: ...
@overload
def isgeneratorfunction(obj: object) -> TypeGuard[Callable[..., GeneratorType[Any, Any, Any]]]: ...
@overload
def iscoroutinefunction(obj: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ...
@overload
def iscoroutinefunction(obj: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, _T]]]: ...
@overload
def iscoroutinefunction(obj: Callable[_P, object]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, Any]]]: ...
@overload
def iscoroutinefunction(obj: object) -> TypeGuard[Callable[..., CoroutineType[Any, Any, Any]]]: ...
def isgenerator(object: object) -> TypeGuard[GeneratorType[Any, Any, Any]]: ...
def iscoroutine(object: object) -> TypeGuard[CoroutineType[Any, Any, Any]]: ...
def isawaitable(object: object) -> TypeGuard[Awaitable[Any]]: ...
if sys.version_info >= (3, 8):
@overload
def isasyncgenfunction(obj: Callable[..., AsyncGenerator[Any, Any]]) -> bool: ...
@overload
def isasyncgenfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, AsyncGeneratorType[Any, Any]]]: ...
@overload
def isasyncgenfunction(obj: object) -> TypeGuard[Callable[..., AsyncGeneratorType[Any, Any]]]: ...
else:
@overload
def isasyncgenfunction(object: Callable[..., AsyncGenerator[Any, Any]]) -> bool: ...
@overload
def isasyncgenfunction(object: Callable[_P, Any]) -> TypeGuard[Callable[_P, AsyncGeneratorType[Any, Any]]]: ...
@overload
def isasyncgenfunction(object: object) -> TypeGuard[Callable[..., AsyncGeneratorType[Any, Any]]]: ...
@overload
def isasyncgenfunction(obj: Callable[..., AsyncGenerator[Any, Any]]) -> bool: ...
@overload
def isasyncgenfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, AsyncGeneratorType[Any, Any]]]: ...
@overload
def isasyncgenfunction(obj: object) -> TypeGuard[Callable[..., AsyncGeneratorType[Any, Any]]]: ...
class _SupportsSet(Protocol[_T_cont, _V_cont]):
def __set__(self, __instance: _T_cont, __value: _V_cont) -> None: ...
@@ -381,9 +353,8 @@ class _ParameterKind(enum.IntEnum):
KEYWORD_ONLY: int
VAR_KEYWORD: int
if sys.version_info >= (3, 8):
@property
def description(self) -> str: ...
@property
def description(self) -> str: ...
if sys.version_info >= (3, 12):
AGEN_CREATED: Literal["AGEN_CREATED"]
+2 -5
View File
@@ -12,6 +12,7 @@ from typing_extensions import Literal, Self
__all__ = [
"BlockingIOError",
"open",
"open_code",
"IOBase",
"RawIOBase",
"FileIO",
@@ -30,9 +31,6 @@ __all__ = [
"SEEK_END",
]
if sys.version_info >= (3, 8):
__all__ += ["open_code"]
if sys.version_info >= (3, 11):
__all__ += ["DEFAULT_BUFFER_SIZE", "IncrementalNewlineDecoder", "text_encoding"]
@@ -46,8 +44,7 @@ SEEK_END: Literal[2]
open = builtins.open
if sys.version_info >= (3, 8):
def open_code(path: str) -> IO[bytes]: ...
def open_code(path: str) -> IO[bytes]: ...
BlockingIOError = builtins.BlockingIOError
+4 -8
View File
@@ -49,14 +49,10 @@ class repeat(Iterator[_T]):
def __length_hint__(self) -> int: ...
class accumulate(Iterator[_T]):
if sys.version_info >= (3, 8):
@overload
def __init__(self, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> None: ...
@overload
def __init__(self, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = ...) -> None: ...
else:
def __init__(self, iterable: Iterable[_T], func: Callable[[_T, _T], _T] | None = ...) -> None: ...
@overload
def __init__(self, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> None: ...
@overload
def __init__(self, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = ...) -> None: ...
def __iter__(self) -> Self: ...
def __next__(self) -> _T: ...
+1 -4
View File
@@ -1,5 +1,3 @@
import sys
from .pgen2.grammar import Grammar
class Symbols:
@@ -112,6 +110,5 @@ class pattern_symbols(Symbols):
python_grammar: Grammar
python_grammar_no_print_statement: Grammar
if sys.version_info >= (3, 8):
python_grammar_no_print_and_exec_statement: Grammar
python_grammar_no_print_and_exec_statement: Grammar
pattern_grammar: Grammar
+235 -469
View File
@@ -128,173 +128,94 @@ class Logger(Filterer):
def getChild(self, suffix: str) -> Self: ... # see python/typing#980
if sys.version_info >= (3, 12):
def getChildren(self) -> set[Logger]: ...
if sys.version_info >= (3, 8):
def debug(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def info(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def warning(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def warn(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def error(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def exception(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = True,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def critical(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def log(
self,
level: int,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def _log(
self,
level: int,
msg: object,
args: _ArgsType,
exc_info: _ExcInfoType | None = None,
extra: Mapping[str, object] | None = None,
stack_info: bool = False,
stacklevel: int = 1,
) -> None: ... # undocumented
else:
def debug(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def info(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def warning(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def warn(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def error(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def critical(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def log(
self,
level: int,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def exception(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = True,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def _log(
self,
level: int,
msg: object,
args: _ArgsType,
exc_info: _ExcInfoType | None = None,
extra: Mapping[str, object] | None = None,
stack_info: bool = False,
) -> None: ... # undocumented
def debug(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def info(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def warning(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def warn(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def error(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def exception(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = True,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def critical(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def log(
self,
level: int,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def _log(
self,
level: int,
msg: object,
args: _ArgsType,
exc_info: _ExcInfoType | None = None,
extra: Mapping[str, object] | None = None,
stack_info: bool = False,
stacklevel: int = 1,
) -> None: ... # undocumented
fatal = critical
def addHandler(self, hdlr: Handler) -> None: ...
def removeHandler(self, hdlr: Handler) -> None: ...
if sys.version_info >= (3, 8):
def findCaller(self, stack_info: bool = False, stacklevel: int = 1) -> tuple[str, int, str, str | None]: ...
else:
def findCaller(self, stack_info: bool = False) -> tuple[str, int, str, str | None]: ...
def findCaller(self, stack_info: bool = False, stacklevel: int = 1) -> tuple[str, int, str, str | None]: ...
def handle(self, record: LogRecord) -> None: ...
def makeRecord(
self,
@@ -366,12 +287,10 @@ class Formatter:
*,
defaults: Mapping[str, Any] | None = None,
) -> None: ...
elif sys.version_info >= (3, 8):
else:
def __init__(
self, fmt: str | None = None, datefmt: str | None = None, style: _FormatStyle = "%", validate: bool = True
) -> None: ...
else:
def __init__(self, fmt: str | None = None, datefmt: str | None = None, style: _FormatStyle = "%") -> None: ...
def format(self, record: LogRecord) -> str: ...
def formatTime(self, record: LogRecord, datefmt: str | None = None) -> str: ...
@@ -451,163 +370,87 @@ class LoggerAdapter(Generic[_L]):
def __init__(self, logger: _L, extra: Mapping[str, object]) -> None: ...
def process(self, msg: Any, kwargs: MutableMapping[str, Any]) -> tuple[Any, MutableMapping[str, Any]]: ...
if sys.version_info >= (3, 8):
def debug(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def info(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def warning(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def warn(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def error(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def exception(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = True,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def critical(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def log(
self,
level: int,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
else:
def debug(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def info(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def warning(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def warn(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def error(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def exception(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = True,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def critical(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def log(
self,
level: int,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def debug(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def info(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def warning(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def warn(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def error(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def exception(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = True,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def critical(
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def log(
self,
level: int,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
**kwargs: object,
) -> None: ...
def isEnabledFor(self, level: int) -> bool: ...
def getEffectiveLevel(self) -> int: ...
def setLevel(self, level: _Level) -> None: ...
@@ -629,132 +472,71 @@ class LoggerAdapter(Generic[_L]):
def getLogger(name: str | None = None) -> Logger: ...
def getLoggerClass() -> type[Logger]: ...
def getLogRecordFactory() -> Callable[..., LogRecord]: ...
if sys.version_info >= (3, 8):
def debug(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def info(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def warning(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def warn(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def error(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def critical(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def exception(
msg: object,
*args: object,
exc_info: _ExcInfoType = True,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def log(
level: int,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
else:
def debug(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def info(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def warning(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def warn(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def error(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def critical(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def exception(
msg: object,
*args: object,
exc_info: _ExcInfoType = True,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def log(
level: int,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
extra: Mapping[str, object] | None = None,
) -> None: ...
def debug(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def info(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def warning(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def warn(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def error(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def critical(
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def exception(
msg: object,
*args: object,
exc_info: _ExcInfoType = True,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
def log(
level: int,
msg: object,
*args: object,
exc_info: _ExcInfoType = None,
stack_info: bool = False,
stacklevel: int = 1,
extra: Mapping[str, object] | None = None,
) -> None: ...
fatal = critical
@@ -783,20 +565,6 @@ if sys.version_info >= (3, 9):
errors: str | None = ...,
) -> None: ...
elif sys.version_info >= (3, 8):
def basicConfig(
*,
filename: StrPath | None = ...,
filemode: str = ...,
format: str = ...,
datefmt: str | None = ...,
style: _FormatStyle = ...,
level: _Level | None = ...,
stream: SupportsWrite[str] | None = ...,
handlers: Iterable[Handler] | None = ...,
force: bool = ...,
) -> None: ...
else:
def basicConfig(
*,
@@ -808,6 +576,7 @@ else:
level: _Level | None = ...,
stream: SupportsWrite[str] | None = ...,
handlers: Iterable[Handler] | None = ...,
force: bool = ...,
) -> None: ...
def shutdown(handlerList: Sequence[Any] = ...) -> None: ... # handlerList is undocumented
@@ -863,8 +632,7 @@ class PercentStyle: # undocumented
default_format: str
asctime_format: str
asctime_search: str
if sys.version_info >= (3, 8):
validation_pattern: Pattern[str]
validation_pattern: Pattern[str]
_fmt: str
if sys.version_info >= (3, 10):
def __init__(self, fmt: str, *, defaults: Mapping[str, Any] | None = None) -> None: ...
@@ -872,9 +640,7 @@ class PercentStyle: # undocumented
def __init__(self, fmt: str) -> None: ...
def usesTime(self) -> bool: ...
if sys.version_info >= (3, 8):
def validate(self) -> None: ...
def validate(self) -> None: ...
def format(self, record: Any) -> str: ...
class StrFormatStyle(PercentStyle): # undocumented
+3 -10
View File
@@ -28,16 +28,9 @@ else:
class _LoggerConfiguration(_RootLoggerConfiguration, TypedDict, total=False):
propagate: bool
if sys.version_info >= (3, 8):
_FormatterConfigurationTypedDict = TypedDict(
"_FormatterConfigurationTypedDict", {"class": str, "format": str, "datefmt": str, "style": _FormatStyle}, total=False
)
else:
_FormatterConfigurationTypedDict = TypedDict(
"_FormatterConfigurationTypedDict",
{"class": str, "format": str, "datefmt": str, "style": _FormatStyle, "validate": bool},
total=False,
)
_FormatterConfigurationTypedDict = TypedDict(
"_FormatterConfigurationTypedDict", {"class": str, "format": str, "datefmt": str, "style": _FormatStyle}, total=False
)
class _FilterConfigurationTypedDict(TypedDict):
name: str
+11 -37
View File
@@ -6,10 +6,7 @@ from typing_extensions import SupportsIndex, TypeAlias
_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
if sys.version_info >= (3, 8):
_SupportsFloatOrIndex: TypeAlias = SupportsFloat | SupportsIndex
else:
_SupportsFloatOrIndex: TypeAlias = SupportsFloat
_SupportsFloatOrIndex: TypeAlias = SupportsFloat | SupportsIndex
e: float
pi: float
@@ -35,18 +32,12 @@ class _SupportsCeil(Protocol[_T_co]):
def ceil(__x: _SupportsCeil[_T]) -> _T: ...
@overload
def ceil(__x: _SupportsFloatOrIndex) -> int: ...
if sys.version_info >= (3, 8):
def comb(__n: SupportsIndex, __k: SupportsIndex) -> int: ...
def comb(__n: SupportsIndex, __k: SupportsIndex) -> int: ...
def copysign(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ...
def cos(__x: _SupportsFloatOrIndex) -> float: ...
def cosh(__x: _SupportsFloatOrIndex) -> float: ...
def degrees(__x: _SupportsFloatOrIndex) -> float: ...
if sys.version_info >= (3, 8):
def dist(__p: Iterable[_SupportsFloatOrIndex], __q: Iterable[_SupportsFloatOrIndex]) -> float: ...
def dist(__p: Iterable[_SupportsFloatOrIndex], __q: Iterable[_SupportsFloatOrIndex]) -> float: ...
def erf(__x: _SupportsFloatOrIndex) -> float: ...
def erfc(__x: _SupportsFloatOrIndex) -> float: ...
def exp(__x: _SupportsFloatOrIndex) -> float: ...
@@ -56,12 +47,7 @@ if sys.version_info >= (3, 11):
def expm1(__x: _SupportsFloatOrIndex) -> float: ...
def fabs(__x: _SupportsFloatOrIndex) -> float: ...
if sys.version_info >= (3, 8):
def factorial(__x: SupportsIndex) -> int: ...
else:
def factorial(__x: int) -> int: ...
def factorial(__x: SupportsIndex) -> int: ...
class _SupportsFloor(Protocol[_T_co]):
def __floor__(self) -> _T_co: ...
@@ -81,12 +67,7 @@ if sys.version_info >= (3, 9):
else:
def gcd(__x: SupportsIndex, __y: SupportsIndex) -> int: ...
if sys.version_info >= (3, 8):
def hypot(*coordinates: _SupportsFloatOrIndex) -> float: ...
else:
def hypot(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ...
def hypot(*coordinates: _SupportsFloatOrIndex) -> float: ...
def isclose(
a: _SupportsFloatOrIndex,
b: _SupportsFloatOrIndex,
@@ -97,9 +78,7 @@ def isclose(
def isinf(__x: _SupportsFloatOrIndex) -> bool: ...
def isfinite(__x: _SupportsFloatOrIndex) -> bool: ...
def isnan(__x: _SupportsFloatOrIndex) -> bool: ...
if sys.version_info >= (3, 8):
def isqrt(__n: SupportsIndex) -> int: ...
def isqrt(__n: SupportsIndex) -> int: ...
if sys.version_info >= (3, 9):
def lcm(*integers: SupportsIndex) -> int: ...
@@ -118,17 +97,12 @@ if sys.version_info >= (3, 12):
elif sys.version_info >= (3, 9):
def nextafter(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ...
if sys.version_info >= (3, 8):
def perm(__n: SupportsIndex, __k: SupportsIndex | None = None) -> int: ...
def perm(__n: SupportsIndex, __k: SupportsIndex | None = None) -> int: ...
def pow(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ...
if sys.version_info >= (3, 8):
@overload
def prod(__iterable: Iterable[SupportsIndex], *, start: SupportsIndex = 1) -> int: ... # type: ignore[overload-overlap]
@overload
def prod(__iterable: Iterable[_SupportsFloatOrIndex], *, start: _SupportsFloatOrIndex = 1) -> float: ...
@overload
def prod(__iterable: Iterable[SupportsIndex], *, start: SupportsIndex = 1) -> int: ... # type: ignore[overload-overlap]
@overload
def prod(__iterable: Iterable[_SupportsFloatOrIndex], *, start: _SupportsFloatOrIndex = 1) -> float: ...
def radians(__x: _SupportsFloatOrIndex) -> float: ...
def remainder(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ...
def sin(__x: _SupportsFloatOrIndex) -> float: ...
+2 -12
View File
@@ -1,4 +1,3 @@
import sys
from _typeshed import StrPath
from collections.abc import Sequence
from typing import IO
@@ -19,12 +18,7 @@ __all__ = [
"common_types",
]
if sys.version_info >= (3, 8):
def guess_type(url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ...
else:
def guess_type(url: str, strict: bool = True) -> tuple[str | None, str | None]: ...
def guess_type(url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ...
def guess_all_extensions(type: str, strict: bool = True) -> list[str]: ...
def guess_extension(type: str, strict: bool = True) -> str | None: ...
def init(files: Sequence[str] | None = None) -> None: ...
@@ -45,11 +39,7 @@ class MimeTypes:
types_map_inv: tuple[dict[str, str], dict[str, str]]
def __init__(self, filenames: tuple[str, ...] = (), strict: bool = True) -> None: ...
def guess_extension(self, type: str, strict: bool = True) -> str | None: ...
if sys.version_info >= (3, 8):
def guess_type(self, url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ...
else:
def guess_type(self, url: str, strict: bool = True) -> tuple[str | None, str | None]: ...
def guess_type(self, url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ...
def guess_all_extensions(self, type: str, strict: bool = True) -> list[str]: ...
def read(self, filename: str, strict: bool = True) -> None: ...
def readfp(self, fp: IO[str], strict: bool = True) -> None: ...
+24 -28
View File
@@ -39,11 +39,7 @@ class mmap(Iterable[int], Sized):
) -> None: ...
def close(self) -> None: ...
if sys.version_info >= (3, 8):
def flush(self, offset: int = ..., size: int = ...) -> None: ...
else:
def flush(self, offset: int = ..., size: int = ...) -> int: ...
def flush(self, offset: int = ..., size: int = ...) -> None: ...
def move(self, dest: int, src: int, count: int) -> None: ...
def read_byte(self) -> int: ...
def readline(self) -> bytes: ...
@@ -54,7 +50,7 @@ class mmap(Iterable[int], Sized):
def write_byte(self, byte: int) -> None: ...
def __len__(self) -> int: ...
closed: bool
if sys.version_info >= (3, 8) and sys.platform != "win32":
if sys.platform != "win32":
def madvise(self, option: int, start: int = ..., length: int = ...) -> None: ...
def find(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ...
@@ -81,7 +77,7 @@ class mmap(Iterable[int], Sized):
def __buffer__(self, __flags: int) -> memoryview: ...
def __release_buffer__(self, __buffer: memoryview) -> None: ...
if sys.version_info >= (3, 8) and sys.platform != "win32":
if sys.platform != "win32":
MADV_NORMAL: int
MADV_RANDOM: int
MADV_SEQUENTIAL: int
@@ -89,28 +85,28 @@ if sys.version_info >= (3, 8) and sys.platform != "win32":
MADV_DONTNEED: int
MADV_FREE: int
if sys.platform == "linux":
MADV_REMOVE: int
MADV_DONTFORK: int
MADV_DOFORK: int
MADV_HWPOISON: int
MADV_MERGEABLE: int
MADV_UNMERGEABLE: int
# Seems like this constant is not defined in glibc.
# See https://github.com/python/typeshed/pull/5360 for details
# MADV_SOFT_OFFLINE: int
MADV_HUGEPAGE: int
MADV_NOHUGEPAGE: int
MADV_DONTDUMP: int
MADV_DODUMP: int
if sys.platform == "linux":
MADV_REMOVE: int
MADV_DONTFORK: int
MADV_DOFORK: int
MADV_HWPOISON: int
MADV_MERGEABLE: int
MADV_UNMERGEABLE: int
# Seems like this constant is not defined in glibc.
# See https://github.com/python/typeshed/pull/5360 for details
# MADV_SOFT_OFFLINE: int
MADV_HUGEPAGE: int
MADV_NOHUGEPAGE: int
MADV_DONTDUMP: int
MADV_DODUMP: int
# This Values are defined for FreeBSD but type checkers do not support conditions for these
if sys.platform != "linux" and sys.platform != "darwin":
MADV_NOSYNC: int
MADV_AUTOSYNC: int
MADV_NOCORE: int
MADV_CORE: int
MADV_PROTECT: int
# This Values are defined for FreeBSD but type checkers do not support conditions for these
if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32":
MADV_NOSYNC: int
MADV_AUTOSYNC: int
MADV_NOCORE: int
MADV_CORE: int
MADV_PROTECT: int
if sys.version_info >= (3, 10) and sys.platform == "darwin":
MADV_FREE_REUSABLE: int
+7 -17
View File
@@ -31,23 +31,13 @@ class ModuleFinder:
excludes: Container[str] # undocumented
replace_paths: Sequence[tuple[str, str]] # undocumented
if sys.version_info >= (3, 8):
def __init__(
self,
path: list[str] | None = None,
debug: int = 0,
excludes: Container[str] | None = None,
replace_paths: Sequence[tuple[str, str]] | None = None,
) -> None: ...
else:
def __init__(
self,
path: list[str] | None = None,
debug: int = 0,
excludes: Container[str] = [],
replace_paths: Sequence[tuple[str, str]] = [],
) -> None: ...
def __init__(
self,
path: list[str] | None = None,
debug: int = 0,
excludes: Container[str] | None = None,
replace_paths: Sequence[tuple[str, str]] | None = None,
) -> None: ...
def msg(self, level: int, str: str, *args: Any) -> None: ... # undocumented
def msgin(self, *args: Any) -> None: ... # undocumented
def msgout(self, *args: Any) -> None: ... # undocumented
+6 -8
View File
@@ -1,4 +1,3 @@
import sys
from multiprocessing import context, reduction as reducer
from multiprocessing.context import (
AuthenticationError as AuthenticationError,
@@ -7,7 +6,11 @@ from multiprocessing.context import (
ProcessError as ProcessError,
TimeoutError as TimeoutError,
)
from multiprocessing.process import active_children as active_children, current_process as current_process
from multiprocessing.process import (
active_children as active_children,
current_process as current_process,
parent_process as parent_process,
)
# These are technically functions that return instances of these Queue classes.
# The stub here doesn't reflect reality exactly --
@@ -19,9 +22,6 @@ from multiprocessing.process import active_children as active_children, current_
from multiprocessing.queues import JoinableQueue as JoinableQueue, Queue as Queue, SimpleQueue as SimpleQueue
from multiprocessing.spawn import freeze_support as freeze_support
if sys.version_info >= (3, 8):
from multiprocessing.process import parent_process as parent_process
__all__ = [
"Array",
"AuthenticationError",
@@ -55,15 +55,13 @@ __all__ = [
"get_logger",
"get_start_method",
"log_to_stderr",
"parent_process",
"reducer",
"set_executable",
"set_forkserver_preload",
"set_start_method",
]
if sys.version_info >= (3, 8):
__all__ += ["parent_process"]
# These functions (really bound methods)
# are all autogenerated at runtime here: https://github.com/python/cpython/blob/600c65c094b0b48704d8ec2416930648052ba715/Lib/multiprocessing/__init__.py#L23
RawValue = context._default_context.RawValue
+3 -10
View File
@@ -16,10 +16,7 @@ if sys.platform != "win32":
else:
from multiprocessing.connection import PipeConnection
if sys.version_info >= (3, 8):
__all__ = ()
else:
__all__: list[str] = []
__all__ = ()
_LockLike: TypeAlias = synchronize.Lock | synchronize.RLock
_CT = TypeVar("_CT", bound=_CData)
@@ -39,10 +36,8 @@ class BaseContext:
# multiprocessing.*, so the signatures should be identical (modulo self).
@staticmethod
def current_process() -> BaseProcess: ...
if sys.version_info >= (3, 8):
@staticmethod
def parent_process() -> BaseProcess | None: ...
@staticmethod
def parent_process() -> BaseProcess | None: ...
@staticmethod
def active_children() -> list[BaseProcess]: ...
def cpu_count(self) -> int: ...
@@ -151,8 +146,6 @@ class DefaultContext(BaseContext):
def __init__(self, context: BaseContext) -> None: ...
def get_start_method(self, allow_none: bool = False) -> str: ...
def get_all_start_methods(self) -> list[str]: ...
if sys.version_info < (3, 8):
__all__: ClassVar[list[str]]
_default_context: DefaultContext
+8 -15
View File
@@ -9,14 +9,9 @@ from typing_extensions import Self, SupportsIndex, TypeAlias
from .connection import Connection
from .context import BaseContext
from .shared_memory import _SLT, ShareableList as _ShareableList, SharedMemory as _SharedMemory
if sys.version_info >= (3, 8):
from .shared_memory import _SLT, ShareableList as _ShareableList, SharedMemory as _SharedMemory
__all__ = ["BaseManager", "SyncManager", "BaseProxy", "Token", "SharedMemoryManager"]
else:
__all__ = ["BaseManager", "SyncManager", "BaseProxy", "Token"]
__all__ = ["BaseManager", "SyncManager", "BaseProxy", "Token", "SharedMemoryManager"]
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -208,12 +203,10 @@ class SyncManager(BaseManager):
def list(self) -> ListProxy[Any]: ...
class RemoteError(Exception): ...
class SharedMemoryServer(Server): ...
if sys.version_info >= (3, 8):
class SharedMemoryServer(Server): ...
class SharedMemoryManager(BaseManager):
def get_server(self) -> SharedMemoryServer: ...
def SharedMemory(self, size: int) -> _SharedMemory: ...
def ShareableList(self, sequence: Iterable[_SLT] | None) -> _ShareableList[_SLT]: ...
def __del__(self) -> None: ...
class SharedMemoryManager(BaseManager):
def get_server(self) -> SharedMemoryServer: ...
def SharedMemory(self, size: int) -> _SharedMemory: ...
def ShareableList(self, sequence: Iterable[_SLT] | None) -> _ShareableList[_SLT]: ...
def __del__(self) -> None: ...
+16 -44
View File
@@ -13,18 +13,9 @@ _S = TypeVar("_S")
_T = TypeVar("_T")
class ApplyResult(Generic[_T]):
if sys.version_info >= (3, 8):
def __init__(
self, pool: Pool, callback: Callable[[_T], object] | None, error_callback: Callable[[BaseException], object] | None
) -> None: ...
else:
def __init__(
self,
cache: dict[int, ApplyResult[Any]],
callback: Callable[[_T], object] | None,
error_callback: Callable[[BaseException], object] | None,
) -> None: ...
def __init__(
self, pool: Pool, callback: Callable[[_T], object] | None, error_callback: Callable[[BaseException], object] | None
) -> None: ...
def get(self, timeout: float | None = None) -> _T: ...
def wait(self, timeout: float | None = None) -> None: ...
def ready(self) -> bool: ...
@@ -36,31 +27,17 @@ class ApplyResult(Generic[_T]):
AsyncResult = ApplyResult
class MapResult(ApplyResult[list[_T]]):
if sys.version_info >= (3, 8):
def __init__(
self,
pool: Pool,
chunksize: int,
length: int,
callback: Callable[[list[_T]], object] | None,
error_callback: Callable[[BaseException], object] | None,
) -> None: ...
else:
def __init__(
self,
cache: dict[int, ApplyResult[Any]],
chunksize: int,
length: int,
callback: Callable[[list[_T]], object] | None,
error_callback: Callable[[BaseException], object] | None,
) -> None: ...
def __init__(
self,
pool: Pool,
chunksize: int,
length: int,
callback: Callable[[list[_T]], object] | None,
error_callback: Callable[[BaseException], object] | None,
) -> None: ...
class IMapIterator(Iterator[_T]):
if sys.version_info >= (3, 8):
def __init__(self, pool: Pool) -> None: ...
else:
def __init__(self, cache: dict[int, IMapIterator[Any]]) -> None: ...
def __init__(self, pool: Pool) -> None: ...
def __iter__(self) -> Self: ...
def next(self, timeout: float | None = None) -> _T: ...
def __next__(self, timeout: float | None = None) -> _T: ...
@@ -120,12 +97,7 @@ class ThreadPool(Pool):
) -> None: ...
# undocumented
if sys.version_info >= (3, 8):
INIT: Literal["INIT"]
RUN: Literal["RUN"]
CLOSE: Literal["CLOSE"]
TERMINATE: Literal["TERMINATE"]
else:
RUN: Literal[0]
CLOSE: Literal[1]
TERMINATE: Literal[2]
INIT: Literal["INIT"]
RUN: Literal["RUN"]
CLOSE: Literal["CLOSE"]
TERMINATE: Literal["TERMINATE"]
+2 -8
View File
@@ -1,11 +1,7 @@
import sys
from collections.abc import Callable, Iterable, Mapping
from typing import Any
if sys.version_info >= (3, 8):
__all__ = ["BaseProcess", "current_process", "active_children", "parent_process"]
else:
__all__ = ["BaseProcess", "current_process", "active_children"]
__all__ = ["BaseProcess", "current_process", "active_children", "parent_process"]
class BaseProcess:
name: str
@@ -40,6 +36,4 @@ class BaseProcess:
def current_process() -> BaseProcess: ...
def active_children() -> list[BaseProcess]: ...
if sys.version_info >= (3, 8):
def parent_process() -> BaseProcess | None: ...
def parent_process() -> BaseProcess | None: ...
+3 -7
View File
@@ -32,13 +32,9 @@ register = ForkingPickler.register
def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = None) -> None: ...
if sys.platform == "win32":
if sys.version_info >= (3, 8):
def duplicate(
handle: int, target_process: int | None = None, inheritable: bool = False, *, source_process: int | None = None
) -> int: ...
else:
def duplicate(handle: int, target_process: int | None = None, inheritable: bool = False) -> int: ...
def duplicate(
handle: int, target_process: int | None = None, inheritable: bool = False, *, source_process: int | None = None
) -> int: ...
def steal_handle(source_pid: int, handle: int) -> int: ...
def send_handle(conn: connection.PipeConnection, handle: int, destination_pid: int) -> None: ...
def recv_handle(conn: connection.PipeConnection) -> int: ...
+1 -5
View File
@@ -56,8 +56,4 @@ opmap: dict[str, int]
HAVE_ARGUMENT: Literal[90]
EXTENDED_ARG: Literal[144]
if sys.version_info >= (3, 8):
def stack_effect(__opcode: int, __oparg: int | None = None, *, jump: bool | None = None) -> int: ...
else:
def stack_effect(__opcode: int, __oparg: int | None = None) -> int: ...
def stack_effect(__opcode: int, __oparg: int | None = None, *, jump: bool | None = None) -> int: ...
+60 -64
View File
@@ -361,9 +361,8 @@ class stat_result(structseq[float], tuple[int, int, int, int, int, int, int, flo
if sys.platform == "win32":
@property
def st_file_attributes(self) -> int: ...
if sys.version_info >= (3, 8):
@property
def st_reparse_tag(self) -> int: ...
@property
def st_reparse_tag(self) -> int: ...
if sys.version_info >= (3, 12):
@property
def st_birthtime(self) -> float: ... # time of file creation in seconds
@@ -975,36 +974,35 @@ else:
def WEXITSTATUS(status: int) -> int: ...
def WSTOPSIG(status: int) -> int: ...
def WTERMSIG(status: int) -> int: ...
if sys.version_info >= (3, 8):
def posix_spawn(
__path: StrOrBytesPath,
__argv: _ExecVArgs,
__env: _ExecEnv,
*,
file_actions: Sequence[tuple[Any, ...]] | None = ...,
setpgroup: int | None = ...,
resetids: bool = ...,
setsid: bool = ...,
setsigmask: Iterable[int] = ...,
setsigdef: Iterable[int] = ...,
scheduler: tuple[Any, sched_param] | None = ...,
) -> int: ...
def posix_spawnp(
__path: StrOrBytesPath,
__argv: _ExecVArgs,
__env: _ExecEnv,
*,
file_actions: Sequence[tuple[Any, ...]] | None = ...,
setpgroup: int | None = ...,
resetids: bool = ...,
setsid: bool = ...,
setsigmask: Iterable[int] = ...,
setsigdef: Iterable[int] = ...,
scheduler: tuple[Any, sched_param] | None = ...,
) -> int: ...
POSIX_SPAWN_OPEN: int
POSIX_SPAWN_CLOSE: int
POSIX_SPAWN_DUP2: int
def posix_spawn(
__path: StrOrBytesPath,
__argv: _ExecVArgs,
__env: _ExecEnv,
*,
file_actions: Sequence[tuple[Any, ...]] | None = ...,
setpgroup: int | None = ...,
resetids: bool = ...,
setsid: bool = ...,
setsigmask: Iterable[int] = ...,
setsigdef: Iterable[int] = ...,
scheduler: tuple[Any, sched_param] | None = ...,
) -> int: ...
def posix_spawnp(
__path: StrOrBytesPath,
__argv: _ExecVArgs,
__env: _ExecEnv,
*,
file_actions: Sequence[tuple[Any, ...]] | None = ...,
setpgroup: int | None = ...,
resetids: bool = ...,
setsid: bool = ...,
setsigmask: Iterable[int] = ...,
setsigdef: Iterable[int] = ...,
scheduler: tuple[Any, sched_param] | None = ...,
) -> int: ...
POSIX_SPAWN_OPEN: int
POSIX_SPAWN_CLOSE: int
POSIX_SPAWN_DUP2: int
if sys.platform != "win32":
@final
@@ -1048,38 +1046,36 @@ if sys.platform != "win32":
after_in_child: Callable[..., Any] | None = ...,
) -> None: ...
if sys.version_info >= (3, 8):
if sys.platform == "win32":
class _AddedDllDirectory:
path: str | None
def __init__(self, path: str | None, cookie: _T, remove_dll_directory: Callable[[_T], object]) -> None: ...
def close(self) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args: Unused) -> None: ...
if sys.platform == "win32":
class _AddedDllDirectory:
path: str | None
def __init__(self, path: str | None, cookie: _T, remove_dll_directory: Callable[[_T], object]) -> None: ...
def close(self) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args: Unused) -> None: ...
def add_dll_directory(path: str) -> _AddedDllDirectory: ...
if sys.platform == "linux":
MFD_CLOEXEC: int
MFD_ALLOW_SEALING: int
MFD_HUGETLB: int
MFD_HUGE_SHIFT: int
MFD_HUGE_MASK: int
MFD_HUGE_64KB: int
MFD_HUGE_512KB: int
MFD_HUGE_1MB: int
MFD_HUGE_2MB: int
MFD_HUGE_8MB: int
MFD_HUGE_16MB: int
MFD_HUGE_32MB: int
MFD_HUGE_256MB: int
MFD_HUGE_512MB: int
MFD_HUGE_1GB: int
MFD_HUGE_2GB: int
MFD_HUGE_16GB: int
def memfd_create(name: str, flags: int = ...) -> int: ...
def copy_file_range(
src: int, dst: int, count: int, offset_src: int | None = ..., offset_dst: int | None = ...
) -> int: ...
def add_dll_directory(path: str) -> _AddedDllDirectory: ...
if sys.platform == "linux":
MFD_CLOEXEC: int
MFD_ALLOW_SEALING: int
MFD_HUGETLB: int
MFD_HUGE_SHIFT: int
MFD_HUGE_MASK: int
MFD_HUGE_64KB: int
MFD_HUGE_512KB: int
MFD_HUGE_1MB: int
MFD_HUGE_2MB: int
MFD_HUGE_8MB: int
MFD_HUGE_16MB: int
MFD_HUGE_32MB: int
MFD_HUGE_256MB: int
MFD_HUGE_512MB: int
MFD_HUGE_1GB: int
MFD_HUGE_2GB: int
MFD_HUGE_16GB: int
def memfd_create(name: str, flags: int = ...) -> int: ...
def copy_file_range(src: int, dst: int, count: int, offset_src: int | None = ..., offset_dst: int | None = ...) -> int: ...
if sys.version_info >= (3, 9):
def waitstatus_to_exitcode(status: int) -> int: ...
+4 -12
View File
@@ -196,13 +196,9 @@ class Path(PurePath):
if sys.version_info >= (3, 9):
def readlink(self) -> Self: ...
if sys.version_info >= (3, 8):
def rename(self, target: str | PurePath) -> Self: ...
def replace(self, target: str | PurePath) -> Self: ...
else:
def rename(self, target: str | PurePath) -> None: ...
def replace(self, target: str | PurePath) -> None: ...
def rename(self, target: str | PurePath) -> Self: ...
def replace(self, target: str | PurePath) -> Self: ...
def resolve(self, strict: bool = False) -> Self: ...
def rmdir(self) -> None: ...
def symlink_to(self, target: StrOrBytesPath, target_is_directory: bool = False) -> None: ...
@@ -210,11 +206,7 @@ class Path(PurePath):
def hardlink_to(self, target: StrOrBytesPath) -> None: ...
def touch(self, mode: int = 0o666, exist_ok: bool = True) -> None: ...
if sys.version_info >= (3, 8):
def unlink(self, missing_ok: bool = False) -> None: ...
else:
def unlink(self) -> None: ...
def unlink(self, missing_ok: bool = False) -> None: ...
@classmethod
def home(cls) -> Self: ...
def absolute(self) -> Self: ...
@@ -229,7 +221,7 @@ class Path(PurePath):
) -> int: ...
else:
def write_text(self, data: str, encoding: str | None = None, errors: str | None = None) -> int: ...
if sys.version_info >= (3, 8) and sys.version_info < (3, 12):
if sys.version_info < (3, 12):
def link_to(self, target: StrOrBytesPath) -> None: ...
if sys.version_info >= (3, 12):
def walk(
+62 -78
View File
@@ -1,10 +1,10 @@
import sys
from _typeshed import ReadableBuffer, SupportsWrite
from collections.abc import Callable, Iterable, Iterator, Mapping
from typing import Any, ClassVar, Protocol, SupportsBytes
from typing_extensions import SupportsIndex, TypeAlias, final
__all__ = [
"PickleBuffer",
"PickleError",
"PicklingError",
"UnpicklingError",
@@ -30,6 +30,7 @@ __all__ = [
"BINUNICODE",
"BINUNICODE8",
"BUILD",
"BYTEARRAY8",
"DEFAULT_PROTOCOL",
"DICT",
"DUP",
@@ -61,6 +62,7 @@ __all__ = [
"NEWOBJ",
"NEWOBJ_EX",
"NEWTRUE",
"NEXT_BUFFER",
"NONE",
"OBJ",
"PERSID",
@@ -68,6 +70,7 @@ __all__ = [
"POP_MARK",
"PROTO",
"PUT",
"READONLY_BUFFER",
"REDUCE",
"SETITEM",
"SETITEMS",
@@ -85,9 +88,6 @@ __all__ = [
"UNICODE",
]
if sys.version_info >= (3, 8):
__all__ += ["BYTEARRAY8", "NEXT_BUFFER", "PickleBuffer", "READONLY_BUFFER"]
HIGHEST_PROTOCOL: int
DEFAULT_PROTOCOL: int
@@ -97,48 +97,43 @@ class _ReadableFileobj(Protocol):
def read(self, __n: int) -> bytes: ...
def readline(self) -> bytes: ...
if sys.version_info >= (3, 8):
@final
class PickleBuffer:
def __init__(self, buffer: ReadableBuffer) -> None: ...
def raw(self) -> memoryview: ...
def release(self) -> None: ...
def __buffer__(self, __flags: int) -> memoryview: ...
def __release_buffer__(self, __buffer: memoryview) -> None: ...
_BufferCallback: TypeAlias = Callable[[PickleBuffer], Any] | None
def dump(
obj: Any,
file: SupportsWrite[bytes],
protocol: int | None = None,
*,
fix_imports: bool = True,
buffer_callback: _BufferCallback = None,
) -> None: ...
def dumps(
obj: Any, protocol: int | None = None, *, fix_imports: bool = True, buffer_callback: _BufferCallback = None
) -> bytes: ...
def load(
file: _ReadableFileobj,
*,
fix_imports: bool = True,
encoding: str = "ASCII",
errors: str = "strict",
buffers: Iterable[Any] | None = (),
) -> Any: ...
def loads(
__data: ReadableBuffer,
*,
fix_imports: bool = True,
encoding: str = "ASCII",
errors: str = "strict",
buffers: Iterable[Any] | None = (),
) -> Any: ...
@final
class PickleBuffer:
def __init__(self, buffer: ReadableBuffer) -> None: ...
def raw(self) -> memoryview: ...
def release(self) -> None: ...
def __buffer__(self, __flags: int) -> memoryview: ...
def __release_buffer__(self, __buffer: memoryview) -> None: ...
else:
def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = None, *, fix_imports: bool = True) -> None: ...
def dumps(obj: Any, protocol: int | None = None, *, fix_imports: bool = True) -> bytes: ...
def load(file: _ReadableFileobj, *, fix_imports: bool = True, encoding: str = "ASCII", errors: str = "strict") -> Any: ...
def loads(data: ReadableBuffer, *, fix_imports: bool = True, encoding: str = "ASCII", errors: str = "strict") -> Any: ...
_BufferCallback: TypeAlias = Callable[[PickleBuffer], Any] | None
def dump(
obj: Any,
file: SupportsWrite[bytes],
protocol: int | None = None,
*,
fix_imports: bool = True,
buffer_callback: _BufferCallback = None,
) -> None: ...
def dumps(
obj: Any, protocol: int | None = None, *, fix_imports: bool = True, buffer_callback: _BufferCallback = None
) -> bytes: ...
def load(
file: _ReadableFileobj,
*,
fix_imports: bool = True,
encoding: str = "ASCII",
errors: str = "strict",
buffers: Iterable[Any] | None = (),
) -> Any: ...
def loads(
__data: ReadableBuffer,
*,
fix_imports: bool = True,
encoding: str = "ASCII",
errors: str = "strict",
buffers: Iterable[Any] | None = (),
) -> Any: ...
class PickleError(Exception): ...
class PicklingError(PickleError): ...
@@ -158,19 +153,15 @@ class Pickler:
bin: bool # undocumented
dispatch: ClassVar[dict[type, Callable[[Unpickler, Any], None]]] # undocumented, _Pickler only
if sys.version_info >= (3, 8):
def __init__(
self,
file: SupportsWrite[bytes],
protocol: int | None = ...,
*,
fix_imports: bool = ...,
buffer_callback: _BufferCallback = ...,
) -> None: ...
def reducer_override(self, obj: Any) -> Any: ...
else:
def __init__(self, file: SupportsWrite[bytes], protocol: int | None = ..., *, fix_imports: bool = ...) -> None: ...
def __init__(
self,
file: SupportsWrite[bytes],
protocol: int | None = ...,
*,
fix_imports: bool = ...,
buffer_callback: _BufferCallback = ...,
) -> None: ...
def reducer_override(self, obj: Any) -> Any: ...
def dump(self, __obj: Any) -> None: ...
def clear_memo(self) -> None: ...
def persistent_id(self, obj: Any) -> Any: ...
@@ -178,21 +169,15 @@ class Pickler:
class Unpickler:
dispatch: ClassVar[dict[int, Callable[[Unpickler], None]]] # undocumented, _Unpickler only
if sys.version_info >= (3, 8):
def __init__(
self,
file: _ReadableFileobj,
*,
fix_imports: bool = ...,
encoding: str = ...,
errors: str = ...,
buffers: Iterable[Any] | None = ...,
) -> None: ...
else:
def __init__(
self, file: _ReadableFileobj, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...
) -> None: ...
def __init__(
self,
file: _ReadableFileobj,
*,
fix_imports: bool = ...,
encoding: str = ...,
errors: str = ...,
buffers: Iterable[Any] | None = ...,
) -> None: ...
def load(self) -> Any: ...
def find_class(self, __module_name: str, __global_name: str) -> Any: ...
def persistent_load(self, pid: Any) -> Any: ...
@@ -272,11 +257,10 @@ STACK_GLOBAL: bytes
MEMOIZE: bytes
FRAME: bytes
if sys.version_info >= (3, 8):
# Protocol 5
BYTEARRAY8: bytes
NEXT_BUFFER: bytes
READONLY_BUFFER: bytes
# protocol 5
BYTEARRAY8: bytes
NEXT_BUFFER: bytes
READONLY_BUFFER: bytes
def encode_long(x: int) -> bytes: ... # undocumented
def decode_long(data: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer) -> int: ... # undocumented
+3 -30
View File
@@ -1,37 +1,10 @@
import sys
if sys.version_info < (3, 8):
import os
DEV_NULL = os.devnull
from typing import NamedTuple
if sys.version_info >= (3, 8):
def libc_ver(executable: str | None = None, lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ...
else:
def libc_ver(
executable: str = sys.executable, lib: str = "", version: str = "", chunksize: int = 16384
) -> tuple[str, str]: ...
if sys.version_info < (3, 8):
def linux_distribution(
distname: str = "",
version: str = "",
id: str = "",
supported_dists: tuple[str, ...] = ...,
full_distribution_name: bool = ...,
) -> tuple[str, str, str]: ...
def dist(
distname: str = "", version: str = "", id: str = "", supported_dists: tuple[str, ...] = ...
) -> tuple[str, str, str]: ...
def libc_ver(executable: str | None = None, lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ...
def win32_ver(release: str = "", version: str = "", csd: str = "", ptype: str = "") -> tuple[str, str, str, str]: ...
if sys.version_info >= (3, 8):
def win32_edition() -> str: ...
def win32_is_iot() -> bool: ...
def win32_edition() -> str: ...
def win32_is_iot() -> bool: ...
def mac_ver(
release: str = "", versioninfo: tuple[str, str, str] = ("", "", ""), machine: str = ""
) -> tuple[str, tuple[str, str, str], str]: ...
+10 -41
View File
@@ -6,39 +6,9 @@ from enum import Enum
from typing import IO, Any
from typing_extensions import Self
if sys.version_info >= (3, 9):
__all__ = ["InvalidFileException", "FMT_XML", "FMT_BINARY", "load", "dump", "loads", "dumps", "UID"]
elif sys.version_info >= (3, 8):
__all__ = [
"readPlist",
"writePlist",
"readPlistFromBytes",
"writePlistToBytes",
"Data",
"InvalidFileException",
"FMT_XML",
"FMT_BINARY",
"load",
"dump",
"loads",
"dumps",
"UID",
]
else:
__all__ = [
"readPlist",
"writePlist",
"readPlistFromBytes",
"writePlistToBytes",
"Data",
"InvalidFileException",
"FMT_XML",
"FMT_BINARY",
"load",
"dump",
"loads",
"dumps",
]
__all__ = ["InvalidFileException", "FMT_XML", "FMT_BINARY", "load", "dump", "loads", "dumps", "UID"]
if sys.version_info < (3, 9):
__all__ += ["readPlist", "writePlist", "readPlistFromBytes", "writePlistToBytes", "Data"]
class PlistFormat(Enum):
FMT_XML: int
@@ -96,14 +66,13 @@ if sys.version_info < (3, 9):
data: bytes
def __init__(self, data: bytes) -> None: ...
if sys.version_info >= (3, 8):
class UID:
data: int
def __init__(self, data: int) -> None: ...
def __index__(self) -> int: ...
def __reduce__(self) -> tuple[type[Self], tuple[int]]: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
class UID:
data: int
def __init__(self, data: int) -> None: ...
def __index__(self) -> int: ...
def __reduce__(self) -> tuple[type[Self], tuple[int]]: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
class InvalidFileException(ValueError):
def __init__(self, message: str = "Invalid file") -> None: ...
+90 -95
View File
@@ -51,6 +51,9 @@ if sys.platform != "win32":
P_ALL as P_ALL,
P_PGID as P_PGID,
P_PID as P_PID,
POSIX_SPAWN_CLOSE as POSIX_SPAWN_CLOSE,
POSIX_SPAWN_DUP2 as POSIX_SPAWN_DUP2,
POSIX_SPAWN_OPEN as POSIX_SPAWN_OPEN,
PRIO_PGRP as PRIO_PGRP,
PRIO_PROCESS as PRIO_PROCESS,
PRIO_USER as PRIO_USER,
@@ -161,12 +164,17 @@ if sys.platform != "win32":
pathconf as pathconf,
pathconf_names as pathconf_names,
pipe as pipe,
posix_spawn as posix_spawn,
posix_spawnp as posix_spawnp,
pread as pread,
preadv as preadv,
putenv as putenv,
pwrite as pwrite,
pwritev as pwritev,
read as read,
readlink as readlink,
readv as readv,
register_at_fork as register_at_fork,
remove as remove,
rename as rename,
replace as replace,
@@ -222,48 +230,28 @@ if sys.platform != "win32":
writev as writev,
)
if sys.platform != "darwin":
from os import EX_NOTFOUND as EX_NOTFOUND
if sys.version_info >= (3, 9):
from os import CLD_KILLED as CLD_KILLED, CLD_STOPPED as CLD_STOPPED, waitstatus_to_exitcode as waitstatus_to_exitcode
if sys.platform == "linux":
from os import (
GRND_NONBLOCK as GRND_NONBLOCK,
GRND_RANDOM as GRND_RANDOM,
RTLD_DEEPBIND as RTLD_DEEPBIND,
XATTR_CREATE as XATTR_CREATE,
XATTR_REPLACE as XATTR_REPLACE,
XATTR_SIZE_MAX as XATTR_SIZE_MAX,
getrandom as getrandom,
getxattr as getxattr,
listxattr as listxattr,
removexattr as removexattr,
setxattr as setxattr,
)
if sys.version_info >= (3, 11):
from os import login_tty as login_tty
if sys.version_info >= (3, 10):
from os import (
EFD_CLOEXEC as EFD_CLOEXEC,
EFD_NONBLOCK as EFD_NONBLOCK,
EFD_SEMAPHORE as EFD_SEMAPHORE,
SPLICE_F_MORE as SPLICE_F_MORE,
SPLICE_F_MOVE as SPLICE_F_MOVE,
SPLICE_F_NONBLOCK as SPLICE_F_NONBLOCK,
eventfd as eventfd,
eventfd_read as eventfd_read,
eventfd_write as eventfd_write,
splice as splice,
)
else:
if sys.platform != "linux":
from os import chflags as chflags, lchflags as lchflags, lchmod as lchmod
if sys.platform != "darwin":
from os import (
EX_NOTFOUND as EX_NOTFOUND,
POSIX_FADV_DONTNEED as POSIX_FADV_DONTNEED,
POSIX_FADV_NOREUSE as POSIX_FADV_NOREUSE,
POSIX_FADV_NORMAL as POSIX_FADV_NORMAL,
POSIX_FADV_RANDOM as POSIX_FADV_RANDOM,
POSIX_FADV_SEQUENTIAL as POSIX_FADV_SEQUENTIAL,
POSIX_FADV_WILLNEED as POSIX_FADV_WILLNEED,
RWF_DSYNC as RWF_DSYNC,
RWF_HIPRI as RWF_HIPRI,
RWF_NOWAIT as RWF_NOWAIT,
RWF_SYNC as RWF_SYNC,
fdatasync as fdatasync,
getresgid as getresgid,
getresuid as getresuid,
@@ -286,78 +274,85 @@ if sys.platform != "win32":
if sys.version_info >= (3, 10):
from os import RWF_APPEND as RWF_APPEND
if sys.version_info >= (3, 11):
from os import login_tty as login_tty
if sys.platform == "linux":
from os import (
GRND_NONBLOCK as GRND_NONBLOCK,
GRND_RANDOM as GRND_RANDOM,
MFD_ALLOW_SEALING as MFD_ALLOW_SEALING,
MFD_CLOEXEC as MFD_CLOEXEC,
MFD_HUGE_1GB as MFD_HUGE_1GB,
MFD_HUGE_1MB as MFD_HUGE_1MB,
MFD_HUGE_2GB as MFD_HUGE_2GB,
MFD_HUGE_2MB as MFD_HUGE_2MB,
MFD_HUGE_8MB as MFD_HUGE_8MB,
MFD_HUGE_16GB as MFD_HUGE_16GB,
MFD_HUGE_16MB as MFD_HUGE_16MB,
MFD_HUGE_32MB as MFD_HUGE_32MB,
MFD_HUGE_64KB as MFD_HUGE_64KB,
MFD_HUGE_256MB as MFD_HUGE_256MB,
MFD_HUGE_512KB as MFD_HUGE_512KB,
MFD_HUGE_512MB as MFD_HUGE_512MB,
MFD_HUGE_MASK as MFD_HUGE_MASK,
MFD_HUGE_SHIFT as MFD_HUGE_SHIFT,
MFD_HUGETLB as MFD_HUGETLB,
RTLD_DEEPBIND as RTLD_DEEPBIND,
XATTR_CREATE as XATTR_CREATE,
XATTR_REPLACE as XATTR_REPLACE,
XATTR_SIZE_MAX as XATTR_SIZE_MAX,
copy_file_range as copy_file_range,
getrandom as getrandom,
getxattr as getxattr,
listxattr as listxattr,
memfd_create as memfd_create,
removexattr as removexattr,
setxattr as setxattr,
)
if sys.version_info >= (3, 9):
from os import CLD_KILLED as CLD_KILLED, CLD_STOPPED as CLD_STOPPED, waitstatus_to_exitcode as waitstatus_to_exitcode
if sys.platform == "linux":
if sys.version_info >= (3, 9):
from os import P_PIDFD as P_PIDFD, pidfd_open as pidfd_open
if sys.version_info >= (3, 8):
from os import (
POSIX_SPAWN_CLOSE as POSIX_SPAWN_CLOSE,
POSIX_SPAWN_DUP2 as POSIX_SPAWN_DUP2,
POSIX_SPAWN_OPEN as POSIX_SPAWN_OPEN,
posix_spawn as posix_spawn,
posix_spawnp as posix_spawnp,
)
if sys.platform == "linux":
if sys.version_info >= (3, 10):
from os import (
MFD_ALLOW_SEALING as MFD_ALLOW_SEALING,
MFD_CLOEXEC as MFD_CLOEXEC,
MFD_HUGE_1GB as MFD_HUGE_1GB,
MFD_HUGE_1MB as MFD_HUGE_1MB,
MFD_HUGE_2GB as MFD_HUGE_2GB,
MFD_HUGE_2MB as MFD_HUGE_2MB,
MFD_HUGE_8MB as MFD_HUGE_8MB,
MFD_HUGE_16GB as MFD_HUGE_16GB,
MFD_HUGE_16MB as MFD_HUGE_16MB,
MFD_HUGE_32MB as MFD_HUGE_32MB,
MFD_HUGE_64KB as MFD_HUGE_64KB,
MFD_HUGE_256MB as MFD_HUGE_256MB,
MFD_HUGE_512KB as MFD_HUGE_512KB,
MFD_HUGE_512MB as MFD_HUGE_512MB,
MFD_HUGE_MASK as MFD_HUGE_MASK,
MFD_HUGE_SHIFT as MFD_HUGE_SHIFT,
MFD_HUGETLB as MFD_HUGETLB,
copy_file_range as copy_file_range,
memfd_create as memfd_create,
EFD_CLOEXEC as EFD_CLOEXEC,
EFD_NONBLOCK as EFD_NONBLOCK,
EFD_SEMAPHORE as EFD_SEMAPHORE,
SPLICE_F_MORE as SPLICE_F_MORE,
SPLICE_F_MOVE as SPLICE_F_MOVE,
SPLICE_F_NONBLOCK as SPLICE_F_NONBLOCK,
eventfd as eventfd,
eventfd_read as eventfd_read,
eventfd_write as eventfd_write,
splice as splice,
)
from os import preadv as preadv, pwritev as pwritev, register_at_fork as register_at_fork
if sys.platform != "darwin":
from os import RWF_DSYNC as RWF_DSYNC, RWF_HIPRI as RWF_HIPRI, RWF_NOWAIT as RWF_NOWAIT, RWF_SYNC as RWF_SYNC
if sys.version_info >= (3, 12):
from os import (
CLONE_FILES as CLONE_FILES,
CLONE_FS as CLONE_FS,
CLONE_NEWCGROUP as CLONE_NEWCGROUP,
CLONE_NEWIPC as CLONE_NEWIPC,
CLONE_NEWNET as CLONE_NEWNET,
CLONE_NEWNS as CLONE_NEWNS,
CLONE_NEWPID as CLONE_NEWPID,
CLONE_NEWTIME as CLONE_NEWTIME,
CLONE_NEWUSER as CLONE_NEWUSER,
CLONE_NEWUTS as CLONE_NEWUTS,
CLONE_SIGHAND as CLONE_SIGHAND,
CLONE_SYSVSEM as CLONE_SYSVSEM,
CLONE_THREAD as CLONE_THREAD,
CLONE_VM as CLONE_VM,
setns as setns,
unshare as unshare,
)
if sys.version_info >= (3, 12) and sys.platform == "linux":
from os import (
CLONE_FILES as CLONE_FILES,
CLONE_FS as CLONE_FS,
CLONE_NEWCGROUP as CLONE_NEWCGROUP,
CLONE_NEWIPC as CLONE_NEWIPC,
CLONE_NEWNET as CLONE_NEWNET,
CLONE_NEWNS as CLONE_NEWNS,
CLONE_NEWPID as CLONE_NEWPID,
CLONE_NEWTIME as CLONE_NEWTIME,
CLONE_NEWUSER as CLONE_NEWUSER,
CLONE_NEWUTS as CLONE_NEWUTS,
CLONE_SIGHAND as CLONE_SIGHAND,
CLONE_SYSVSEM as CLONE_SYSVSEM,
CLONE_THREAD as CLONE_THREAD,
CLONE_VM as CLONE_VM,
setns as setns,
unshare as unshare,
)
if sys.version_info >= (3, 12) and sys.platform == "darwin":
from os import (
PRIO_DARWIN_BG as PRIO_DARWIN_BG,
PRIO_DARWIN_NONUI as PRIO_DARWIN_NONUI,
PRIO_DARWIN_PROCESS as PRIO_DARWIN_PROCESS,
PRIO_DARWIN_THREAD as PRIO_DARWIN_THREAD,
)
if sys.platform == "darwin":
if sys.version_info >= (3, 12):
from os import (
PRIO_DARWIN_BG as PRIO_DARWIN_BG,
PRIO_DARWIN_NONUI as PRIO_DARWIN_NONUI,
PRIO_DARWIN_PROCESS as PRIO_DARWIN_PROCESS,
PRIO_DARWIN_THREAD as PRIO_DARWIN_THREAD,
)
# Not same as os.environ or os.environb
# Because of this variable, we can't do "from posix import *" in os/__init__.pyi
+5 -32
View File
@@ -1,10 +1,7 @@
import sys
from typing import IO
if sys.version_info >= (3, 8):
__all__ = ["pprint", "pformat", "isreadable", "isrecursive", "saferepr", "PrettyPrinter", "pp"]
else:
__all__ = ["pprint", "pformat", "isreadable", "isrecursive", "saferepr", "PrettyPrinter"]
__all__ = ["pprint", "pformat", "isreadable", "isrecursive", "saferepr", "PrettyPrinter", "pp"]
if sys.version_info >= (3, 10):
def pformat(
@@ -18,7 +15,7 @@ if sys.version_info >= (3, 10):
underscore_numbers: bool = False,
) -> str: ...
elif sys.version_info >= (3, 8):
else:
def pformat(
object: object,
indent: int = 1,
@@ -29,9 +26,6 @@ elif sys.version_info >= (3, 8):
sort_dicts: bool = True,
) -> str: ...
else:
def pformat(object: object, indent: int = 1, width: int = 80, depth: int | None = None, *, compact: bool = False) -> str: ...
if sys.version_info >= (3, 10):
def pp(
object: object,
@@ -45,7 +39,7 @@ if sys.version_info >= (3, 10):
underscore_numbers: bool = ...,
) -> None: ...
elif sys.version_info >= (3, 8):
else:
def pp(
object: object,
stream: IO[str] | None = ...,
@@ -70,18 +64,6 @@ if sys.version_info >= (3, 10):
underscore_numbers: bool = False,
) -> None: ...
elif sys.version_info >= (3, 8):
def pprint(
object: object,
stream: IO[str] | None = None,
indent: int = 1,
width: int = 80,
depth: int | None = None,
*,
compact: bool = False,
sort_dicts: bool = True,
) -> None: ...
else:
def pprint(
object: object,
@@ -91,6 +73,7 @@ else:
depth: int | None = None,
*,
compact: bool = False,
sort_dicts: bool = True,
) -> None: ...
def isreadable(object: object) -> bool: ...
@@ -110,7 +93,7 @@ class PrettyPrinter:
sort_dicts: bool = True,
underscore_numbers: bool = False,
) -> None: ...
elif sys.version_info >= (3, 8):
else:
def __init__(
self,
indent: int = 1,
@@ -121,16 +104,6 @@ class PrettyPrinter:
compact: bool = False,
sort_dicts: bool = True,
) -> None: ...
else:
def __init__(
self,
indent: int = 1,
width: int = 80,
depth: int | None = None,
stream: IO[str] | None = None,
*,
compact: bool = False,
) -> None: ...
def pformat(self, object: object) -> str: ...
def pprint(self, object: object) -> None: ...
+9 -21
View File
@@ -17,27 +17,15 @@ class PycInvalidationMode(enum.Enum):
UNCHECKED_HASH: int
def _get_default_invalidation_mode() -> PycInvalidationMode: ...
if sys.version_info >= (3, 8):
def compile(
file: AnyStr,
cfile: AnyStr | None = None,
dfile: AnyStr | None = None,
doraise: bool = False,
optimize: int = -1,
invalidation_mode: PycInvalidationMode | None = None,
quiet: int = 0,
) -> AnyStr | None: ...
else:
def compile(
file: AnyStr,
cfile: AnyStr | None = None,
dfile: AnyStr | None = None,
doraise: bool = False,
optimize: int = -1,
invalidation_mode: PycInvalidationMode | None = None,
) -> AnyStr | None: ...
def compile(
file: AnyStr,
cfile: AnyStr | None = None,
dfile: AnyStr | None = None,
doraise: bool = False,
optimize: int = -1,
invalidation_mode: PycInvalidationMode | None = None,
quiet: int = 0,
) -> AnyStr | None: ...
if sys.version_info >= (3, 10):
def main() -> None: ...
+2 -9
View File
@@ -1,18 +1,11 @@
import sys
from collections.abc import Iterable
from typing import TextIO
from typing_extensions import Self
if sys.version_info >= (3, 8):
__all__ = ["shlex", "split", "quote", "join"]
else:
__all__ = ["shlex", "split", "quote"]
__all__ = ["shlex", "split", "quote", "join"]
def split(s: str, comments: bool = False, posix: bool = True) -> list[str]: ...
if sys.version_info >= (3, 8):
def join(split_command: Iterable[str]) -> str: ...
def join(split_command: Iterable[str]) -> str: ...
def quote(s: str) -> str: ...
class shlex(Iterable[str]):
+17 -46
View File
@@ -48,12 +48,7 @@ class ExecError(OSError): ...
class ReadError(OSError): ...
class RegistryError(Exception): ...
if sys.version_info >= (3, 8):
def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = 0) -> None: ...
else:
def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = 16384) -> None: ...
def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = 0) -> None: ...
def copyfile(src: StrOrBytesPath, dst: _StrOrBytesPathT, *, follow_symlinks: bool = True) -> _StrOrBytesPathT: ...
def copymode(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: ...
def copystat(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: ...
@@ -66,27 +61,15 @@ def copy2(src: StrPath, dst: StrPath, *, follow_symlinks: bool = True) -> _PathR
@overload
def copy2(src: BytesPath, dst: BytesPath, *, follow_symlinks: bool = True) -> _PathReturn: ...
def ignore_patterns(*patterns: StrPath) -> Callable[[Any, list[str]], set[str]]: ...
if sys.version_info >= (3, 8):
def copytree(
src: StrPath,
dst: StrPath,
symlinks: bool = False,
ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = None,
copy_function: Callable[[str, str], object] = ...,
ignore_dangling_symlinks: bool = False,
dirs_exist_ok: bool = False,
) -> _PathReturn: ...
else:
def copytree(
src: StrPath,
dst: StrPath,
symlinks: bool = False,
ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = None,
copy_function: Callable[[str, str], object] = ...,
ignore_dangling_symlinks: bool = False,
) -> _PathReturn: ...
def copytree(
src: StrPath,
dst: StrPath,
symlinks: bool = False,
ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = None,
copy_function: Callable[[str, str], object] = ...,
ignore_dangling_symlinks: bool = False,
dirs_exist_ok: bool = False,
) -> _PathReturn: ...
_OnErrorCallback: TypeAlias = Callable[[Callable[..., Any], str, Any], object]
_OnExcCallback: TypeAlias = Callable[[Callable[..., Any], str, Exception], object]
@@ -161,16 +144,10 @@ def chown(path: FileDescriptorOrPath, user: None = None, *, group: str | int) ->
def chown(path: FileDescriptorOrPath, user: None, group: str | int) -> None: ...
@overload
def chown(path: FileDescriptorOrPath, user: str | int, group: str | int) -> None: ...
if sys.version_info >= (3, 8):
@overload
def which(cmd: _StrPathT, mode: int = 1, path: StrPath | None = None) -> str | _StrPathT | None: ...
@overload
def which(cmd: bytes, mode: int = 1, path: StrPath | None = None) -> bytes | None: ...
else:
def which(cmd: _StrPathT, mode: int = 1, path: StrPath | None = None) -> str | _StrPathT | None: ...
@overload
def which(cmd: _StrPathT, mode: int = 1, path: StrPath | None = None) -> str | _StrPathT | None: ...
@overload
def which(cmd: bytes, mode: int = 1, path: StrPath | None = None) -> bytes | None: ...
def make_archive(
base_name: str,
format: str,
@@ -192,15 +169,9 @@ def register_archive_format(
name: str, function: Callable[[str, str], object], extra_args: None = None, description: str = ""
) -> None: ...
def unregister_archive_format(name: str) -> None: ...
if sys.version_info >= (3, 8):
def unpack_archive(
filename: StrPath, extract_dir: StrPath | None = None, format: str | None = None, *, filter: _TarfileFilter | None = None
) -> None: ...
else:
def unpack_archive(filename: StrPath, extract_dir: StrPath | None = None, format: str | None = None) -> None: ...
def unpack_archive(
filename: StrPath, extract_dir: StrPath | None = None, format: str | None = None, *, filter: _TarfileFilter | None = None
) -> None: ...
@overload
def register_unpack_format(
name: str,
+3 -5
View File
@@ -179,11 +179,9 @@ else:
def sigtimedwait(sigset: Iterable[int], timeout: float) -> struct_siginfo | None: ...
def sigwaitinfo(sigset: Iterable[int]) -> struct_siginfo: ...
if sys.version_info >= (3, 8):
def strsignal(__signalnum: _SIGNUM) -> str | None: ...
def valid_signals() -> set[Signals]: ...
def raise_signal(__signalnum: _SIGNUM) -> None: ...
def strsignal(__signalnum: _SIGNUM) -> str | None: ...
def valid_signals() -> set[Signals]: ...
def raise_signal(__signalnum: _SIGNUM) -> None: ...
def set_wakeup_fd(fd: int, *, warn_on_full_buffer: bool = ...) -> int: ...
if sys.version_info >= (3, 9):
+60 -79
View File
@@ -4,7 +4,6 @@
import _socket
import sys
from _socket import (
_FD,
CAPI as CAPI,
EAI_AGAIN as EAI_AGAIN,
EAI_BADFLAGS as EAI_BADFLAGS,
@@ -34,9 +33,28 @@ from _socket import (
IP_TTL as IP_TTL,
IPPORT_RESERVED as IPPORT_RESERVED,
IPPORT_USERRESERVED as IPPORT_USERRESERVED,
IPPROTO_AH as IPPROTO_AH,
IPPROTO_DSTOPTS as IPPROTO_DSTOPTS,
IPPROTO_EGP as IPPROTO_EGP,
IPPROTO_ESP as IPPROTO_ESP,
IPPROTO_FRAGMENT as IPPROTO_FRAGMENT,
IPPROTO_GGP as IPPROTO_GGP,
IPPROTO_HOPOPTS as IPPROTO_HOPOPTS,
IPPROTO_ICMP as IPPROTO_ICMP,
IPPROTO_ICMPV6 as IPPROTO_ICMPV6,
IPPROTO_IDP as IPPROTO_IDP,
IPPROTO_IGMP as IPPROTO_IGMP,
IPPROTO_IP as IPPROTO_IP,
IPPROTO_IPV4 as IPPROTO_IPV4,
IPPROTO_IPV6 as IPPROTO_IPV6,
IPPROTO_MAX as IPPROTO_MAX,
IPPROTO_ND as IPPROTO_ND,
IPPROTO_NONE as IPPROTO_NONE,
IPPROTO_PIM as IPPROTO_PIM,
IPPROTO_PUP as IPPROTO_PUP,
IPPROTO_RAW as IPPROTO_RAW,
IPPROTO_ROUTING as IPPROTO_ROUTING,
IPPROTO_SCTP as IPPROTO_SCTP,
IPPROTO_TCP as IPPROTO_TCP,
IPPROTO_UDP as IPPROTO_UDP,
IPV6_CHECKSUM as IPV6_CHECKSUM,
@@ -106,6 +124,9 @@ from _socket import (
herror as herror,
htonl as htonl,
htons as htons,
if_indextoname as if_indextoname,
if_nameindex as if_nameindex,
if_nametoindex as if_nametoindex,
inet_aton as inet_aton,
inet_ntoa as inet_ntoa,
inet_ntop as inet_ntop,
@@ -119,7 +140,7 @@ from _typeshed import ReadableBuffer, Unused, WriteableBuffer
from collections.abc import Iterable
from enum import IntEnum, IntFlag
from io import BufferedReader, BufferedRWPair, BufferedWriter, IOBase, RawIOBase, TextIOWrapper
from typing import Any, Protocol, overload
from typing import Any, Protocol, SupportsIndex, overload
from typing_extensions import Literal, Self
if sys.platform == "win32":
@@ -148,46 +169,22 @@ if sys.platform == "darwin":
from _socket import PF_SYSTEM as PF_SYSTEM, SYSPROTO_CONTROL as SYSPROTO_CONTROL
if sys.platform != "darwin":
from _socket import TCP_KEEPIDLE as TCP_KEEPIDLE
from _socket import (
IPPROTO_CBT as IPPROTO_CBT,
IPPROTO_ICLFXBM as IPPROTO_ICLFXBM,
IPPROTO_IGP as IPPROTO_IGP,
IPPROTO_L2TP as IPPROTO_L2TP,
IPPROTO_PGM as IPPROTO_PGM,
IPPROTO_RDP as IPPROTO_RDP,
IPPROTO_ST as IPPROTO_ST,
TCP_KEEPIDLE as TCP_KEEPIDLE,
)
if sys.version_info >= (3, 10):
from _socket import IP_RECVTOS as IP_RECVTOS
elif sys.platform != "win32" and sys.platform != "darwin":
from _socket import IP_RECVTOS as IP_RECVTOS
if sys.platform != "win32" or sys.version_info >= (3, 8):
from _socket import (
IPPROTO_AH as IPPROTO_AH,
IPPROTO_DSTOPTS as IPPROTO_DSTOPTS,
IPPROTO_EGP as IPPROTO_EGP,
IPPROTO_ESP as IPPROTO_ESP,
IPPROTO_FRAGMENT as IPPROTO_FRAGMENT,
IPPROTO_GGP as IPPROTO_GGP,
IPPROTO_HOPOPTS as IPPROTO_HOPOPTS,
IPPROTO_ICMPV6 as IPPROTO_ICMPV6,
IPPROTO_IDP as IPPROTO_IDP,
IPPROTO_IGMP as IPPROTO_IGMP,
IPPROTO_IPV4 as IPPROTO_IPV4,
IPPROTO_IPV6 as IPPROTO_IPV6,
IPPROTO_MAX as IPPROTO_MAX,
IPPROTO_ND as IPPROTO_ND,
IPPROTO_NONE as IPPROTO_NONE,
IPPROTO_PIM as IPPROTO_PIM,
IPPROTO_PUP as IPPROTO_PUP,
IPPROTO_ROUTING as IPPROTO_ROUTING,
IPPROTO_SCTP as IPPROTO_SCTP,
)
if sys.platform != "darwin":
from _socket import (
IPPROTO_CBT as IPPROTO_CBT,
IPPROTO_ICLFXBM as IPPROTO_ICLFXBM,
IPPROTO_IGP as IPPROTO_IGP,
IPPROTO_L2TP as IPPROTO_L2TP,
IPPROTO_PGM as IPPROTO_PGM,
IPPROTO_RDP as IPPROTO_RDP,
IPPROTO_ST as IPPROTO_ST,
)
if sys.platform != "win32" and sys.platform != "darwin":
from _socket import (
IP_BIND_ADDRESS_NO_PORT as IP_BIND_ADDRESS_NO_PORT,
@@ -223,6 +220,7 @@ if sys.platform != "win32" and sys.platform != "darwin":
TCP_USER_TIMEOUT as TCP_USER_TIMEOUT,
TCP_WINDOW_CLAMP as TCP_WINDOW_CLAMP,
)
if sys.platform != "win32":
from _socket import (
CMSG_LEN as CMSG_LEN,
@@ -252,6 +250,7 @@ if sys.platform != "win32":
SCM_CREDS as SCM_CREDS,
SCM_RIGHTS as SCM_RIGHTS,
SO_REUSEPORT as SO_REUSEPORT,
TCP_NOTSENT_LOWAT as TCP_NOTSENT_LOWAT,
sethostname as sethostname,
)
@@ -269,9 +268,6 @@ if sys.platform != "win32":
IPV6_USE_MIN_MTU as IPV6_USE_MIN_MTU,
)
if sys.platform != "win32" or sys.version_info >= (3, 8):
from _socket import if_indextoname as if_indextoname, if_nameindex as if_nameindex, if_nametoindex as if_nametoindex
if sys.platform != "darwin":
if sys.platform != "win32" or sys.version_info >= (3, 9):
from _socket import BDADDR_ANY as BDADDR_ANY, BDADDR_LOCAL as BDADDR_LOCAL, BTPROTO_RFCOMM as BTPROTO_RFCOMM
@@ -295,15 +291,27 @@ if sys.platform == "linux":
ALG_SET_OP as ALG_SET_OP,
ALG_SET_PUBKEY as ALG_SET_PUBKEY,
CAN_BCM as CAN_BCM,
CAN_BCM_CAN_FD_FRAME as CAN_BCM_CAN_FD_FRAME,
CAN_BCM_RX_ANNOUNCE_RESUME as CAN_BCM_RX_ANNOUNCE_RESUME,
CAN_BCM_RX_CHANGED as CAN_BCM_RX_CHANGED,
CAN_BCM_RX_CHECK_DLC as CAN_BCM_RX_CHECK_DLC,
CAN_BCM_RX_DELETE as CAN_BCM_RX_DELETE,
CAN_BCM_RX_FILTER_ID as CAN_BCM_RX_FILTER_ID,
CAN_BCM_RX_NO_AUTOTIMER as CAN_BCM_RX_NO_AUTOTIMER,
CAN_BCM_RX_READ as CAN_BCM_RX_READ,
CAN_BCM_RX_RTR_FRAME as CAN_BCM_RX_RTR_FRAME,
CAN_BCM_RX_SETUP as CAN_BCM_RX_SETUP,
CAN_BCM_RX_STATUS as CAN_BCM_RX_STATUS,
CAN_BCM_RX_TIMEOUT as CAN_BCM_RX_TIMEOUT,
CAN_BCM_SETTIMER as CAN_BCM_SETTIMER,
CAN_BCM_STARTTIMER as CAN_BCM_STARTTIMER,
CAN_BCM_TX_ANNOUNCE as CAN_BCM_TX_ANNOUNCE,
CAN_BCM_TX_COUNTEVT as CAN_BCM_TX_COUNTEVT,
CAN_BCM_TX_CP_CAN_ID as CAN_BCM_TX_CP_CAN_ID,
CAN_BCM_TX_DELETE as CAN_BCM_TX_DELETE,
CAN_BCM_TX_EXPIRED as CAN_BCM_TX_EXPIRED,
CAN_BCM_TX_READ as CAN_BCM_TX_READ,
CAN_BCM_TX_RESET_MULTI_IDX as CAN_BCM_TX_RESET_MULTI_IDX,
CAN_BCM_TX_SEND as CAN_BCM_TX_SEND,
CAN_BCM_TX_SETUP as CAN_BCM_TX_SETUP,
CAN_BCM_TX_STATUS as CAN_BCM_TX_STATUS,
@@ -311,6 +319,7 @@ if sys.platform == "linux":
CAN_EFF_MASK as CAN_EFF_MASK,
CAN_ERR_FLAG as CAN_ERR_FLAG,
CAN_ERR_MASK as CAN_ERR_MASK,
CAN_ISOTP as CAN_ISOTP,
CAN_RAW as CAN_RAW,
CAN_RAW_ERR_FILTER as CAN_RAW_ERR_FILTER,
CAN_RAW_FD_FRAMES as CAN_RAW_FD_FRAMES,
@@ -319,6 +328,7 @@ if sys.platform == "linux":
CAN_RAW_RECV_OWN_MSGS as CAN_RAW_RECV_OWN_MSGS,
CAN_RTR_FLAG as CAN_RTR_FLAG,
CAN_SFF_MASK as CAN_SFF_MASK,
IOCTL_VM_SOCKETS_GET_LOCAL_CID as IOCTL_VM_SOCKETS_GET_LOCAL_CID,
NETLINK_ARPD as NETLINK_ARPD,
NETLINK_CRYPTO as NETLINK_CRYPTO,
NETLINK_DNRTMSG as NETLINK_DNRTMSG,
@@ -361,6 +371,9 @@ if sys.platform == "linux":
RDS_RDMA_SILENT as RDS_RDMA_SILENT,
RDS_RDMA_USE_ONCE as RDS_RDMA_USE_ONCE,
RDS_RECVERR as RDS_RECVERR,
SO_VM_SOCKETS_BUFFER_MAX_SIZE as SO_VM_SOCKETS_BUFFER_MAX_SIZE,
SO_VM_SOCKETS_BUFFER_MIN_SIZE as SO_VM_SOCKETS_BUFFER_MIN_SIZE,
SO_VM_SOCKETS_BUFFER_SIZE as SO_VM_SOCKETS_BUFFER_SIZE,
SOL_ALG as SOL_ALG,
SOL_CAN_BASE as SOL_CAN_BASE,
SOL_CAN_RAW as SOL_CAN_RAW,
@@ -389,36 +402,12 @@ if sys.platform == "linux":
TIPC_WAIT_FOREVER as TIPC_WAIT_FOREVER,
TIPC_WITHDRAWN as TIPC_WITHDRAWN,
TIPC_ZONE_SCOPE as TIPC_ZONE_SCOPE,
)
if sys.platform == "linux":
from _socket import (
CAN_ISOTP as CAN_ISOTP,
IOCTL_VM_SOCKETS_GET_LOCAL_CID as IOCTL_VM_SOCKETS_GET_LOCAL_CID,
SO_VM_SOCKETS_BUFFER_MAX_SIZE as SO_VM_SOCKETS_BUFFER_MAX_SIZE,
SO_VM_SOCKETS_BUFFER_MIN_SIZE as SO_VM_SOCKETS_BUFFER_MIN_SIZE,
SO_VM_SOCKETS_BUFFER_SIZE as SO_VM_SOCKETS_BUFFER_SIZE,
VM_SOCKETS_INVALID_VERSION as VM_SOCKETS_INVALID_VERSION,
VMADDR_CID_ANY as VMADDR_CID_ANY,
VMADDR_CID_HOST as VMADDR_CID_HOST,
VMADDR_PORT_ANY as VMADDR_PORT_ANY,
)
if sys.platform != "win32":
from _socket import TCP_NOTSENT_LOWAT as TCP_NOTSENT_LOWAT
if sys.platform == "linux" and sys.version_info >= (3, 8):
from _socket import (
CAN_BCM_CAN_FD_FRAME as CAN_BCM_CAN_FD_FRAME,
CAN_BCM_RX_ANNOUNCE_RESUME as CAN_BCM_RX_ANNOUNCE_RESUME,
CAN_BCM_RX_CHECK_DLC as CAN_BCM_RX_CHECK_DLC,
CAN_BCM_RX_FILTER_ID as CAN_BCM_RX_FILTER_ID,
CAN_BCM_RX_NO_AUTOTIMER as CAN_BCM_RX_NO_AUTOTIMER,
CAN_BCM_RX_RTR_FRAME as CAN_BCM_RX_RTR_FRAME,
CAN_BCM_SETTIMER as CAN_BCM_SETTIMER,
CAN_BCM_STARTTIMER as CAN_BCM_STARTTIMER,
CAN_BCM_TX_ANNOUNCE as CAN_BCM_TX_ANNOUNCE,
CAN_BCM_TX_COUNTEVT as CAN_BCM_TX_COUNTEVT,
CAN_BCM_TX_CP_CAN_ID as CAN_BCM_TX_CP_CAN_ID,
CAN_BCM_TX_RESET_MULTI_IDX as CAN_BCM_TX_RESET_MULTI_IDX,
)
if sys.platform == "linux" and sys.version_info >= (3, 9):
from _socket import (
CAN_J1939 as CAN_J1939,
@@ -529,8 +518,7 @@ class AddressFamily(IntEnum):
AF_ALG: int
AF_NETLINK: int
AF_VSOCK: int
if sys.version_info >= (3, 8):
AF_QIPCRTR: int
AF_QIPCRTR: int
if sys.platform != "win32" or sys.version_info >= (3, 9):
AF_LINK: int
if sys.platform != "darwin":
@@ -580,8 +568,7 @@ if sys.platform == "linux":
AF_ALG = AddressFamily.AF_ALG
AF_NETLINK = AddressFamily.AF_NETLINK
AF_VSOCK = AddressFamily.AF_VSOCK
if sys.version_info >= (3, 8):
AF_QIPCRTR = AddressFamily.AF_QIPCRTR
AF_QIPCRTR = AddressFamily.AF_QIPCRTR
if sys.platform != "win32" or sys.version_info >= (3, 9):
AF_LINK = AddressFamily.AF_LINK
@@ -782,7 +769,7 @@ class socket(_socket.socket):
def get_inheritable(self) -> bool: ...
def set_inheritable(self, inheritable: bool) -> None: ...
def fromfd(fd: _FD, family: AddressFamily | int, type: SocketKind | int, proto: int = 0) -> socket: ...
def fromfd(fd: SupportsIndex, family: AddressFamily | int, type: SocketKind | int, proto: int = 0) -> socket: ...
if sys.platform != "win32":
if sys.version_info >= (3, 9):
@@ -827,16 +814,10 @@ else:
address: tuple[str | None, int], timeout: float | None = ..., source_address: _Address | None = None # noqa: F811
) -> socket: ...
if sys.version_info >= (3, 8):
def has_dualstack_ipv6() -> bool: ...
def create_server(
address: _Address,
*,
family: int = ...,
backlog: int | None = None,
reuse_port: bool = False,
dualstack_ipv6: bool = False,
) -> socket: ...
def has_dualstack_ipv6() -> bool: ...
def create_server(
address: _Address, *, family: int = ..., backlog: int | None = None, reuse_port: bool = False, dualstack_ipv6: bool = False
) -> socket: ...
# the 5th tuple item is an address
def getaddrinfo(
+6 -23
View File
@@ -1,6 +1,6 @@
import sqlite3
import sys
from _typeshed import Incomplete, ReadableBuffer, StrOrBytesPath, SupportsLenAndGetItem, Unused
from _typeshed import ReadableBuffer, StrOrBytesPath, SupportsLenAndGetItem, Unused
from collections.abc import Callable, Generator, Iterable, Iterator, Mapping
from datetime import date, datetime, time
from types import TracebackType
@@ -245,12 +245,6 @@ else:
def register_adapter(__type: type[_T], __caster: _Adapter[_T]) -> None: ...
def register_converter(__name: str, __converter: _Converter) -> None: ...
if sys.version_info < (3, 8):
class Cache:
def __init__(self, *args: Incomplete, **kwargs: Unused) -> None: ...
def display(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
def get(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
class _AggregateProtocol(Protocol):
def step(self, __value: int) -> object: ...
def finalize(self) -> int: ...
@@ -341,13 +335,9 @@ class Connection:
) -> None: ...
def create_collation(self, __name: str, __callback: Callable[[str, str], int | SupportsIndex] | None) -> None: ...
if sys.version_info >= (3, 8):
def create_function(
self, name: str, narg: int, func: Callable[..., _SqliteData] | None, *, deterministic: bool = False
) -> None: ...
else:
def create_function(self, name: str, num_params: int, func: Callable[..., _SqliteData] | None) -> None: ...
def create_function(
self, name: str, narg: int, func: Callable[..., _SqliteData] | None, *, deterministic: bool = False
) -> None: ...
@overload
def cursor(self, factory: None = None) -> Cursor: ...
@overload
@@ -458,15 +448,8 @@ class Row:
def __lt__(self, __value: object) -> bool: ...
def __ne__(self, __value: object) -> bool: ...
if sys.version_info >= (3, 8):
@final
class _Statement: ...
else:
@final
class Statement:
def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
_Statement: TypeAlias = Statement
@final
class _Statement: ...
class Warning(Exception): ...
+13 -37
View File
@@ -25,7 +25,14 @@ if sys.version_info >= (3, 11):
if sys.version_info < (3, 11):
class Verbose(Exception): ...
class _State:
_OpSubpatternType: TypeAlias = tuple[int | None, int, int, SubPattern]
_OpGroupRefExistsType: TypeAlias = tuple[int, SubPattern, SubPattern]
_OpInType: TypeAlias = list[tuple[_NIC, int]]
_OpBranchType: TypeAlias = tuple[None, list[SubPattern]]
_AvType: TypeAlias = _OpInType | _OpBranchType | Iterable[SubPattern] | _OpGroupRefExistsType | _OpSubpatternType
_CodeType: TypeAlias = tuple[_NIC, _AvType]
class State:
flags: int
groupdict: dict[str, int]
groupwidths: list[int | None]
@@ -37,29 +44,12 @@ class _State:
def checkgroup(self, gid: int) -> bool: ...
def checklookbehindgroup(self, gid: int, source: Tokenizer) -> None: ...
if sys.version_info >= (3, 8):
State: TypeAlias = _State
else:
Pattern: TypeAlias = _State
_OpSubpatternType: TypeAlias = tuple[int | None, int, int, SubPattern]
_OpGroupRefExistsType: TypeAlias = tuple[int, SubPattern, SubPattern]
_OpInType: TypeAlias = list[tuple[_NIC, int]]
_OpBranchType: TypeAlias = tuple[None, list[SubPattern]]
_AvType: TypeAlias = _OpInType | _OpBranchType | Iterable[SubPattern] | _OpGroupRefExistsType | _OpSubpatternType
_CodeType: TypeAlias = tuple[_NIC, _AvType]
class SubPattern:
data: list[_CodeType]
width: int | None
state: State
if sys.version_info >= (3, 8):
state: State
def __init__(self, state: State, data: list[_CodeType] | None = None) -> None: ...
else:
pattern: Pattern
def __init__(self, pattern: Pattern, data: list[_CodeType] | None = None) -> None: ...
def __init__(self, state: State, data: list[_CodeType] | None = None) -> None: ...
def dump(self, level: int = 0) -> None: ...
def __len__(self) -> int: ...
def __delitem__(self, index: int | slice) -> None: ...
@@ -79,11 +69,7 @@ class Tokenizer:
def match(self, char: str) -> bool: ...
def get(self) -> str | None: ...
def getwhile(self, n: int, charset: Iterable[str]) -> str: ...
if sys.version_info >= (3, 8):
def getuntil(self, terminator: str, name: str) -> str: ...
else:
def getuntil(self, terminator: str) -> str: ...
def getuntil(self, terminator: str, name: str) -> str: ...
@property
def pos(self) -> int: ...
def tell(self) -> int: ...
@@ -106,23 +92,13 @@ if sys.version_info >= (3, 12):
@overload
def parse_template(source: bytes, pattern: _Pattern[Any]) -> _TemplateByteType: ...
elif sys.version_info >= (3, 8):
else:
@overload
def parse_template(source: str, state: _Pattern[Any]) -> _TemplateType: ...
@overload
def parse_template(source: bytes, state: _Pattern[Any]) -> _TemplateByteType: ...
else:
@overload
def parse_template(source: str, pattern: _Pattern[Any]) -> _TemplateType: ...
@overload
def parse_template(source: bytes, pattern: _Pattern[Any]) -> _TemplateByteType: ...
if sys.version_info >= (3, 8):
def parse(str: str, flags: int = 0, state: State | None = None) -> SubPattern: ...
else:
def parse(str: str, flags: int = 0, pattern: Pattern | None = None) -> SubPattern: ...
def parse(str: str, flags: int = 0, state: State | None = None) -> SubPattern: ...
if sys.version_info < (3, 12):
def expand_template(template: _TemplateType, match: Match[Any]) -> str: ...
+8 -17
View File
@@ -199,14 +199,11 @@ class Options(enum.IntFlag):
OP_NO_COMPRESSION: int
OP_NO_TICKET: int
OP_NO_RENEGOTIATION: int
if sys.version_info >= (3, 8):
OP_ENABLE_MIDDLEBOX_COMPAT: int
OP_ENABLE_MIDDLEBOX_COMPAT: int
if sys.version_info >= (3, 12):
OP_LEGACY_SERVER_CONNECT: int
OP_ENABLE_KTLS: int
if sys.version_info >= (3, 11):
OP_IGNORE_UNEXPECTED_EOF: int
elif sys.version_info >= (3, 8) and sys.platform == "linux":
if sys.version_info >= (3, 11) or sys.platform == "linux":
OP_IGNORE_UNEXPECTED_EOF: int
OP_ALL: Options
@@ -222,14 +219,11 @@ OP_SINGLE_ECDH_USE: Options
OP_NO_COMPRESSION: Options
OP_NO_TICKET: Options
OP_NO_RENEGOTIATION: Options
if sys.version_info >= (3, 8):
OP_ENABLE_MIDDLEBOX_COMPAT: Options
OP_ENABLE_MIDDLEBOX_COMPAT: Options
if sys.version_info >= (3, 12):
OP_LEGACY_SERVER_CONNECT: Options
OP_ENABLE_KTLS: Options
if sys.version_info >= (3, 11):
OP_IGNORE_UNEXPECTED_EOF: Options
elif sys.version_info >= (3, 8) and sys.platform == "linux":
if sys.version_info >= (3, 11) or sys.platform == "linux":
OP_IGNORE_UNEXPECTED_EOF: Options
HAS_NEVER_CHECK_COMMON_NAME: bool
@@ -365,8 +359,7 @@ class SSLSocket(socket.socket):
def unwrap(self) -> socket.socket: ...
def version(self) -> str | None: ...
def pending(self) -> int: ...
if sys.version_info >= (3, 8):
def verify_client_post_handshake(self) -> None: ...
def verify_client_post_handshake(self) -> None: ...
# These methods always raise `NotImplementedError`:
def recvmsg(self, *args: Never, **kwargs: Never) -> Never: ... # type: ignore[override]
def recvmsg_into(self, *args: Never, **kwargs: Never) -> Never: ... # type: ignore[override]
@@ -397,9 +390,8 @@ class SSLContext:
# so making these ClassVars wouldn't be appropriate
sslobject_class: type[SSLObject]
sslsocket_class: type[SSLSocket]
if sys.version_info >= (3, 8):
keylog_filename: str
post_handshake_auth: bool
keylog_filename: str
post_handshake_auth: bool
if sys.version_info >= (3, 10):
security_level: int
if sys.version_info >= (3, 10):
@@ -481,8 +473,7 @@ class SSLObject:
def unwrap(self) -> None: ...
def version(self) -> str | None: ...
def get_channel_binding(self, cb_type: str = "tls-unique") -> bytes | None: ...
if sys.version_info >= (3, 8):
def verify_client_post_handshake(self) -> None: ...
def verify_client_post_handshake(self) -> None: ...
@final
class MemoryBIO:
+46 -53
View File
@@ -8,6 +8,10 @@ from typing_extensions import Literal, Self, TypeAlias
__all__ = [
"StatisticsError",
"fmean",
"geometric_mean",
"mean",
"harmonic_mean",
"pstdev",
"pvariance",
"stdev",
@@ -16,14 +20,12 @@ __all__ = [
"median_low",
"median_high",
"median_grouped",
"mean",
"mode",
"harmonic_mean",
"multimode",
"NormalDist",
"quantiles",
]
if sys.version_info >= (3, 8):
__all__ += ["geometric_mean", "multimode", "NormalDist", "fmean", "quantiles"]
if sys.version_info >= (3, 10):
__all__ += ["covariance", "correlation", "linear_regression"]
@@ -39,12 +41,10 @@ class StatisticsError(ValueError): ...
if sys.version_info >= (3, 11):
def fmean(data: Iterable[SupportsFloat], weights: Iterable[SupportsFloat] | None = None) -> float: ...
elif sys.version_info >= (3, 8):
else:
def fmean(data: Iterable[SupportsFloat]) -> float: ...
if sys.version_info >= (3, 8):
def geometric_mean(data: Iterable[SupportsFloat]) -> float: ...
def geometric_mean(data: Iterable[SupportsFloat]) -> float: ...
def mean(data: Iterable[_NumberT]) -> _NumberT: ...
if sys.version_info >= (3, 10):
@@ -64,56 +64,49 @@ else:
def median_grouped(data: Iterable[_NumberT], interval: _NumberT | float = 1) -> _NumberT | float: ...
def mode(data: Iterable[_HashableT]) -> _HashableT: ...
if sys.version_info >= (3, 8):
def multimode(data: Iterable[_HashableT]) -> list[_HashableT]: ...
def multimode(data: Iterable[_HashableT]) -> list[_HashableT]: ...
def pstdev(data: Iterable[_NumberT], mu: _NumberT | None = None) -> _NumberT: ...
def pvariance(data: Iterable[_NumberT], mu: _NumberT | None = None) -> _NumberT: ...
if sys.version_info >= (3, 8):
def quantiles(
data: Iterable[_NumberT], *, n: int = 4, method: Literal["inclusive", "exclusive"] = "exclusive"
) -> list[_NumberT]: ...
def quantiles(
data: Iterable[_NumberT], *, n: int = 4, method: Literal["inclusive", "exclusive"] = "exclusive"
) -> list[_NumberT]: ...
def stdev(data: Iterable[_NumberT], xbar: _NumberT | None = None) -> _NumberT: ...
def variance(data: Iterable[_NumberT], xbar: _NumberT | None = None) -> _NumberT: ...
if sys.version_info >= (3, 8):
class NormalDist:
def __init__(self, mu: float = 0.0, sigma: float = 1.0) -> None: ...
@property
def mean(self) -> float: ...
@property
def median(self) -> float: ...
@property
def mode(self) -> float: ...
@property
def stdev(self) -> float: ...
@property
def variance(self) -> float: ...
@classmethod
def from_samples(cls, data: Iterable[SupportsFloat]) -> Self: ...
def samples(self, n: int, *, seed: Any | None = None) -> list[float]: ...
def pdf(self, x: float) -> float: ...
def cdf(self, x: float) -> float: ...
def inv_cdf(self, p: float) -> float: ...
def overlap(self, other: NormalDist) -> float: ...
def quantiles(self, n: int = 4) -> list[float]: ...
if sys.version_info >= (3, 9):
def zscore(self, x: float) -> float: ...
class NormalDist:
def __init__(self, mu: float = 0.0, sigma: float = 1.0) -> None: ...
@property
def mean(self) -> float: ...
@property
def median(self) -> float: ...
@property
def mode(self) -> float: ...
@property
def stdev(self) -> float: ...
@property
def variance(self) -> float: ...
@classmethod
def from_samples(cls, data: Iterable[SupportsFloat]) -> Self: ...
def samples(self, n: int, *, seed: Any | None = None) -> list[float]: ...
def pdf(self, x: float) -> float: ...
def cdf(self, x: float) -> float: ...
def inv_cdf(self, p: float) -> float: ...
def overlap(self, other: NormalDist) -> float: ...
def quantiles(self, n: int = 4) -> list[float]: ...
if sys.version_info >= (3, 9):
def zscore(self, x: float) -> float: ...
def __eq__(self, x2: object) -> bool: ...
def __add__(self, x2: float | NormalDist) -> NormalDist: ...
def __sub__(self, x2: float | NormalDist) -> NormalDist: ...
def __mul__(self, x2: float) -> NormalDist: ...
def __truediv__(self, x2: float) -> NormalDist: ...
def __pos__(self) -> NormalDist: ...
def __neg__(self) -> NormalDist: ...
__radd__ = __add__
def __rsub__(self, x2: float | NormalDist) -> NormalDist: ...
__rmul__ = __mul__
def __hash__(self) -> int: ...
def __eq__(self, x2: object) -> bool: ...
def __add__(self, x2: float | NormalDist) -> NormalDist: ...
def __sub__(self, x2: float | NormalDist) -> NormalDist: ...
def __mul__(self, x2: float) -> NormalDist: ...
def __truediv__(self, x2: float) -> NormalDist: ...
def __pos__(self) -> NormalDist: ...
def __neg__(self) -> NormalDist: ...
__radd__ = __add__
def __rsub__(self, x2: float | NormalDist) -> NormalDist: ...
__rmul__ = __mul__
def __hash__(self) -> int: ...
if sys.version_info >= (3, 12):
def correlation(
+3 -13
View File
@@ -64,12 +64,7 @@ if sys.platform == "win32":
# reveal_type(e.cmd) # Any, but morally is _CMD
_FILE: TypeAlias = None | int | IO[Any]
_InputString: TypeAlias = ReadableBuffer | str
if sys.version_info >= (3, 8):
_CMD: TypeAlias = StrOrBytesPath | Sequence[StrOrBytesPath]
else:
# Python 3.7 doesn't support _CMD being a single PathLike.
# See: https://bugs.python.org/issue31961
_CMD: TypeAlias = str | bytes | Sequence[StrOrBytesPath]
_CMD: TypeAlias = StrOrBytesPath | Sequence[StrOrBytesPath]
if sys.platform == "win32":
_ENV: TypeAlias = Mapping[str, str]
else:
@@ -80,8 +75,7 @@ _T = TypeVar("_T")
# These two are private but documented
if sys.version_info >= (3, 11):
_USE_VFORK: bool
if sys.version_info >= (3, 8):
_USE_POSIX_SPAWN: bool
_USE_POSIX_SPAWN: bool
class CompletedProcess(Generic[_T]):
# morally: _CMD
@@ -2577,11 +2571,7 @@ else:
def getstatusoutput(cmd: str | bytes) -> tuple[int, str]: ...
def getoutput(cmd: str | bytes) -> str: ...
if sys.version_info >= (3, 8):
def list2cmdline(seq: Iterable[StrOrBytesPath]) -> str: ... # undocumented
else:
def list2cmdline(seq: Iterable[str]) -> str: ... # undocumented
def list2cmdline(seq: Iterable[StrOrBytesPath]) -> str: ... # undocumented
if sys.platform == "win32":
class STARTUPINFO:
+5 -9
View File
@@ -1,5 +1,3 @@
import sys
single_input: int
file_input: int
eval_input: int
@@ -87,11 +85,9 @@ encoding_decl: int
yield_expr: int
yield_arg: int
sync_comp_for: int
if sys.version_info >= (3, 8):
func_body_suite: int
func_type: int
func_type_input: int
namedexpr_test: int
typelist: int
func_body_suite: int
func_type: int
func_type_input: int
namedexpr_test: int
typelist: int
sym_name: dict[int, str]
+5 -10
View File
@@ -29,21 +29,16 @@ class Function(SymbolTable):
def get_locals(self) -> tuple[str, ...]: ...
def get_globals(self) -> tuple[str, ...]: ...
def get_frees(self) -> tuple[str, ...]: ...
if sys.version_info >= (3, 8):
def get_nonlocals(self) -> tuple[str, ...]: ...
def get_nonlocals(self) -> tuple[str, ...]: ...
class Class(SymbolTable):
def get_methods(self) -> tuple[str, ...]: ...
class Symbol:
if sys.version_info >= (3, 8):
def __init__(
self, name: str, flags: int, namespaces: Sequence[SymbolTable] | None = None, *, module_scope: bool = False
) -> None: ...
def is_nonlocal(self) -> bool: ...
else:
def __init__(self, name: str, flags: int, namespaces: Sequence[SymbolTable] | None = None) -> None: ...
def __init__(
self, name: str, flags: int, namespaces: Sequence[SymbolTable] | None = None, *, module_scope: bool = False
) -> None: ...
def is_nonlocal(self) -> bool: ...
def get_name(self) -> str: ...
def is_referenced(self) -> bool: ...
def is_parameter(self) -> bool: ...
+16 -21
View File
@@ -1,7 +1,7 @@
import sys
from _typeshed import OptExcInfo, ProfileFunction, TraceFunction, structseq
from builtins import object as _object
from collections.abc import AsyncGenerator, Callable, Coroutine, Sequence
from collections.abc import AsyncGenerator, Callable, Sequence
from importlib.abc import PathEntryFinder
from importlib.machinery import ModuleSpec
from io import TextIOWrapper
@@ -55,8 +55,7 @@ platform: str
if sys.version_info >= (3, 9):
platlibdir: str
prefix: str
if sys.version_info >= (3, 8):
pycache_prefix: str | None
pycache_prefix: str | None
ps1: object
ps2: object
@@ -322,18 +321,19 @@ if sys.version_info < (3, 9):
# An 11-tuple or None
def callstats() -> tuple[int, int, int, int, int, int, int, int, int, int, int] | None: ...
if sys.version_info >= (3, 8):
# Doesn't exist at runtime, but exported in the stubs so pytest etc. can annotate their code more easily.
class UnraisableHookArgs(Protocol):
exc_type: type[BaseException]
exc_value: BaseException | None
exc_traceback: TracebackType | None
err_msg: str | None
object: _object
unraisablehook: Callable[[UnraisableHookArgs], Any]
def __unraisablehook__(__unraisable: UnraisableHookArgs) -> Any: ...
def addaudithook(hook: Callable[[str, tuple[Any, ...]], Any]) -> None: ...
def audit(__event: str, *args: Any) -> None: ...
# Doesn't exist at runtime, but exported in the stubs so pytest etc. can annotate their code more easily.
class UnraisableHookArgs(Protocol):
exc_type: type[BaseException]
exc_value: BaseException | None
exc_traceback: TracebackType | None
err_msg: str | None
object: _object
unraisablehook: Callable[[UnraisableHookArgs], Any]
def __unraisablehook__(__unraisable: UnraisableHookArgs) -> Any: ...
def addaudithook(hook: Callable[[str, tuple[Any, ...]], Any]) -> None: ...
def audit(__event: str, *args: Any) -> None: ...
_AsyncgenHook: TypeAlias = Callable[[AsyncGenerator[Any, Any]], None] | None
@@ -353,12 +353,7 @@ if sys.platform == "win32":
def get_coroutine_origin_tracking_depth() -> int: ...
def set_coroutine_origin_tracking_depth(depth: int) -> None: ...
if sys.version_info < (3, 8):
_CoroWrapper: TypeAlias = Callable[[Coroutine[Any, Any, Any]], Any]
def set_coroutine_wrapper(__wrapper: _CoroWrapper) -> None: ...
def get_coroutine_wrapper() -> _CoroWrapper: ...
# The following two functions were added in 3.11.0, 3.10.7, 3.9.14, 3.8.14, & 3.7.14,
# The following two functions were added in 3.11.0, 3.10.7, 3.9.14, and 3.8.14,
# as part of the response to CVE-2020-10735
def set_int_max_str_digits(maxdigits: int) -> None: ...
def get_int_max_str_digits() -> int: ...
+48 -67
View File
@@ -291,32 +291,23 @@ class TarFile:
def getnames(self) -> _list[str]: ...
def list(self, verbose: bool = True, *, members: _list[TarInfo] | None = None) -> None: ...
def next(self) -> TarInfo | None: ...
if sys.version_info >= (3, 8):
def extractall(
self,
path: StrOrBytesPath = ".",
members: Iterable[TarInfo] | None = None,
*,
numeric_owner: bool = False,
filter: _TarfileFilter | None = ...,
) -> None: ...
def extract(
self,
member: str | TarInfo,
path: StrOrBytesPath = "",
set_attrs: bool = True,
*,
numeric_owner: bool = False,
filter: _TarfileFilter | None = ...,
) -> None: ...
else:
def extractall(
self, path: StrOrBytesPath = ".", members: Iterable[TarInfo] | None = None, *, numeric_owner: bool = False
) -> None: ...
def extract(
self, member: str | TarInfo, path: StrOrBytesPath = "", set_attrs: bool = True, *, numeric_owner: bool = False
) -> None: ...
def extractall(
self,
path: StrOrBytesPath = ".",
members: Iterable[TarInfo] | None = None,
*,
numeric_owner: bool = False,
filter: _TarfileFilter | None = ...,
) -> None: ...
def extract(
self,
member: str | TarInfo,
path: StrOrBytesPath = "",
set_attrs: bool = True,
*,
numeric_owner: bool = False,
filter: _TarfileFilter | None = ...,
) -> None: ...
def _extract_member(
self, tarinfo: TarInfo, targetpath: str, set_attrs: bool = True, numeric_owner: bool = False
) -> None: ... # undocumented
@@ -350,9 +341,6 @@ if sys.version_info >= (3, 9):
else:
def is_tarfile(name: StrOrBytesPath) -> bool: ...
if sys.version_info < (3, 8):
def filemode(mode: int) -> str: ... # undocumented
class TarError(Exception): ...
class ReadError(TarError): ...
class CompressionError(TarError): ...
@@ -360,30 +348,29 @@ class StreamError(TarError): ...
class ExtractError(TarError): ...
class HeaderError(TarError): ...
if sys.version_info >= (3, 8):
class FilterError(TarError):
# This attribute is only set directly on the subclasses, but the documentation guarantees
# that it is always present on FilterError.
tarinfo: TarInfo
class FilterError(TarError):
# This attribute is only set directly on the subclasses, but the documentation guarantees
# that it is always present on FilterError.
tarinfo: TarInfo
class AbsolutePathError(FilterError):
def __init__(self, tarinfo: TarInfo) -> None: ...
class AbsolutePathError(FilterError):
def __init__(self, tarinfo: TarInfo) -> None: ...
class OutsideDestinationError(FilterError):
def __init__(self, tarinfo: TarInfo, path: str) -> None: ...
class OutsideDestinationError(FilterError):
def __init__(self, tarinfo: TarInfo, path: str) -> None: ...
class SpecialFileError(FilterError):
def __init__(self, tarinfo: TarInfo) -> None: ...
class SpecialFileError(FilterError):
def __init__(self, tarinfo: TarInfo) -> None: ...
class AbsoluteLinkError(FilterError):
def __init__(self, tarinfo: TarInfo) -> None: ...
class AbsoluteLinkError(FilterError):
def __init__(self, tarinfo: TarInfo) -> None: ...
class LinkOutsideDestinationError(FilterError):
def __init__(self, tarinfo: TarInfo, path: str) -> None: ...
class LinkOutsideDestinationError(FilterError):
def __init__(self, tarinfo: TarInfo, path: str) -> None: ...
def fully_trusted_filter(member: TarInfo, dest_path: str) -> TarInfo: ...
def tar_filter(member: TarInfo, dest_path: str) -> TarInfo: ...
def data_filter(member: TarInfo, dest_path: str) -> TarInfo: ...
def fully_trusted_filter(member: TarInfo, dest_path: str) -> TarInfo: ...
def tar_filter(member: TarInfo, dest_path: str) -> TarInfo: ...
def data_filter(member: TarInfo, dest_path: str) -> TarInfo: ...
class TarInfo:
name: str
@@ -414,27 +401,21 @@ class TarInfo:
def linkpath(self) -> str: ...
@linkpath.setter
def linkpath(self, linkname: str) -> None: ...
if sys.version_info >= (3, 8):
def replace(
self,
*,
name: str = ...,
mtime: int = ...,
mode: int = ...,
linkname: str = ...,
uid: int = ...,
gid: int = ...,
uname: str = ...,
gname: str = ...,
deep: bool = True,
) -> Self: ...
def replace(
self,
*,
name: str = ...,
mtime: int = ...,
mode: int = ...,
linkname: str = ...,
uid: int = ...,
gid: int = ...,
uname: str = ...,
gname: str = ...,
deep: bool = True,
) -> Self: ...
def get_info(self) -> Mapping[str, str | int | bytes | Mapping[str, str]]: ...
if sys.version_info >= (3, 8):
def tobuf(self, format: int | None = 2, encoding: str | None = "utf-8", errors: str = "surrogateescape") -> bytes: ...
else:
def tobuf(self, format: int | None = 1, encoding: str | None = "utf-8", errors: str = "surrogateescape") -> bytes: ...
def tobuf(self, format: int | None = 2, encoding: str | None = "utf-8", errors: str = "surrogateescape") -> bytes: ...
def create_ustar_header(
self, info: Mapping[str, str | int | bytes | Mapping[str, str]], encoding: str, errors: str
) -> bytes: ...
+161 -333
View File
@@ -85,47 +85,6 @@ if sys.version_info >= (3, 12):
delete_on_close: bool = True,
) -> _TemporaryFileWrapper[Any]: ...
elif sys.version_info >= (3, 8):
@overload
def NamedTemporaryFile(
mode: OpenTextMode,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
delete: bool = True,
*,
errors: str | None = None,
) -> _TemporaryFileWrapper[str]: ...
@overload
def NamedTemporaryFile(
mode: OpenBinaryMode = "w+b",
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
delete: bool = True,
*,
errors: str | None = None,
) -> _TemporaryFileWrapper[bytes]: ...
@overload
def NamedTemporaryFile(
mode: str = "w+b",
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
delete: bool = True,
*,
errors: str | None = None,
) -> _TemporaryFileWrapper[Any]: ...
else:
@overload
def NamedTemporaryFile(
@@ -137,6 +96,8 @@ else:
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
delete: bool = True,
*,
errors: str | None = None,
) -> _TemporaryFileWrapper[str]: ...
@overload
def NamedTemporaryFile(
@@ -148,6 +109,8 @@ else:
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
delete: bool = True,
*,
errors: str | None = None,
) -> _TemporaryFileWrapper[bytes]: ...
@overload
def NamedTemporaryFile(
@@ -159,167 +122,97 @@ else:
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
delete: bool = True,
*,
errors: str | None = None,
) -> _TemporaryFileWrapper[Any]: ...
if sys.platform == "win32":
TemporaryFile = NamedTemporaryFile
else:
# See the comments for builtins.open() for an explanation of the overloads.
if sys.version_info >= (3, 8):
@overload
def TemporaryFile(
mode: OpenTextMode,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = None,
) -> io.TextIOWrapper: ...
@overload
def TemporaryFile(
mode: OpenBinaryMode,
buffering: Literal[0],
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = None,
) -> io.FileIO: ...
@overload
def TemporaryFile(
*,
buffering: Literal[0],
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
errors: str | None = None,
) -> io.FileIO: ...
@overload
def TemporaryFile(
mode: OpenBinaryModeWriting,
buffering: Literal[-1, 1] = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = None,
) -> io.BufferedWriter: ...
@overload
def TemporaryFile(
mode: OpenBinaryModeReading,
buffering: Literal[-1, 1] = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = None,
) -> io.BufferedReader: ...
@overload
def TemporaryFile(
mode: OpenBinaryModeUpdating = "w+b",
buffering: Literal[-1, 1] = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = None,
) -> io.BufferedRandom: ...
@overload
def TemporaryFile(
mode: str = "w+b",
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = None,
) -> IO[Any]: ...
else:
@overload
def TemporaryFile(
mode: OpenTextMode,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
) -> io.TextIOWrapper: ...
@overload
def TemporaryFile(
mode: OpenBinaryMode,
buffering: Literal[0],
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
) -> io.FileIO: ...
@overload
def TemporaryFile(
*,
buffering: Literal[0],
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
) -> io.FileIO: ...
@overload
def TemporaryFile(
mode: OpenBinaryModeUpdating = "w+b",
buffering: Literal[-1, 1] = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
) -> io.BufferedRandom: ...
@overload
def TemporaryFile(
mode: OpenBinaryModeWriting,
buffering: Literal[-1, 1] = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
) -> io.BufferedWriter: ...
@overload
def TemporaryFile(
mode: OpenBinaryModeReading,
buffering: Literal[-1, 1] = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
) -> io.BufferedReader: ...
@overload
def TemporaryFile(
mode: str = "w+b",
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
) -> IO[Any]: ...
@overload
def TemporaryFile(
mode: OpenTextMode,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = None,
) -> io.TextIOWrapper: ...
@overload
def TemporaryFile(
mode: OpenBinaryMode,
buffering: Literal[0],
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = None,
) -> io.FileIO: ...
@overload
def TemporaryFile(
*,
buffering: Literal[0],
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
errors: str | None = None,
) -> io.FileIO: ...
@overload
def TemporaryFile(
mode: OpenBinaryModeWriting,
buffering: Literal[-1, 1] = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = None,
) -> io.BufferedWriter: ...
@overload
def TemporaryFile(
mode: OpenBinaryModeReading,
buffering: Literal[-1, 1] = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = None,
) -> io.BufferedReader: ...
@overload
def TemporaryFile(
mode: OpenBinaryModeUpdating = "w+b",
buffering: Literal[-1, 1] = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = None,
) -> io.BufferedRandom: ...
@overload
def TemporaryFile(
mode: str = "w+b",
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = None,
) -> IO[Any]: ...
class _TemporaryFileWrapper(IO[AnyStr]):
file: IO[AnyStr] # io.TextIOWrapper, io.BufferedReader or io.BufferedWriter
@@ -386,143 +279,78 @@ class SpooledTemporaryFile(IO[AnyStr], _SpooledTemporaryFileBase):
@property
def newlines(self) -> str | tuple[str, ...] | None: ... # undocumented
# bytes needs to go first, as default mode is to open as bytes
if sys.version_info >= (3, 8):
@overload
def __init__(
self: SpooledTemporaryFile[bytes],
max_size: int = 0,
mode: OpenBinaryMode = "w+b",
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
*,
errors: str | None = None,
) -> None: ...
@overload
def __init__(
self: SpooledTemporaryFile[str],
max_size: int,
mode: OpenTextMode,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
*,
errors: str | None = None,
) -> None: ...
@overload
def __init__(
self: SpooledTemporaryFile[str],
max_size: int = 0,
*,
mode: OpenTextMode,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
errors: str | None = None,
) -> None: ...
@overload
def __init__(
self,
max_size: int,
mode: str,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
*,
errors: str | None = None,
) -> None: ...
@overload
def __init__(
self,
max_size: int = 0,
*,
mode: str,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
errors: str | None = None,
) -> None: ...
@property
def errors(self) -> str | None: ...
else:
@overload
def __init__(
self: SpooledTemporaryFile[bytes],
max_size: int = 0,
mode: OpenBinaryMode = "w+b",
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
) -> None: ...
@overload
def __init__(
self: SpooledTemporaryFile[str],
max_size: int,
mode: OpenTextMode,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
) -> None: ...
@overload
def __init__(
self: SpooledTemporaryFile[str],
max_size: int = 0,
*,
mode: OpenTextMode,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
) -> None: ...
@overload
def __init__(
self,
max_size: int,
mode: str,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
) -> None: ...
@overload
def __init__(
self,
max_size: int = 0,
*,
mode: str,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
) -> None: ...
@overload
def __init__(
self: SpooledTemporaryFile[bytes],
max_size: int = 0,
mode: OpenBinaryMode = "w+b",
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
*,
errors: str | None = None,
) -> None: ...
@overload
def __init__(
self: SpooledTemporaryFile[str],
max_size: int,
mode: OpenTextMode,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
*,
errors: str | None = None,
) -> None: ...
@overload
def __init__(
self: SpooledTemporaryFile[str],
max_size: int = 0,
*,
mode: OpenTextMode,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
errors: str | None = None,
) -> None: ...
@overload
def __init__(
self,
max_size: int,
mode: str,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
*,
errors: str | None = None,
) -> None: ...
@overload
def __init__(
self,
max_size: int = 0,
*,
mode: str,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: str | None = None,
prefix: str | None = None,
dir: str | None = None,
errors: str | None = None,
) -> None: ...
@property
def errors(self) -> str | None: ...
def rollover(self) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ...
+8 -16
View File
@@ -1,5 +1,6 @@
import _thread
import sys
from _thread import _excepthook, _ExceptHookArgs, get_native_id as get_native_id
from _typeshed import ProfileFunction, TraceFunction
from collections.abc import Callable, Iterable, Mapping
from types import TracebackType
@@ -26,15 +27,15 @@ __all__ = [
"BrokenBarrierError",
"Timer",
"ThreadError",
"ExceptHookArgs",
"setprofile",
"settrace",
"local",
"stack_size",
"excepthook",
"get_native_id",
]
if sys.version_info >= (3, 8):
__all__ += ["ExceptHookArgs", "excepthook", "get_native_id"]
if sys.version_info >= (3, 10):
__all__ += ["getprofile", "gettrace"]
@@ -50,10 +51,6 @@ def currentThread() -> Thread: ... # deprecated alias for current_thread()
def get_ident() -> int: ...
def enumerate() -> list[Thread]: ...
def main_thread() -> Thread: ...
if sys.version_info >= (3, 8):
from _thread import get_native_id as get_native_id
def settrace(func: TraceFunction) -> None: ...
def setprofile(func: ProfileFunction | None) -> None: ...
@@ -90,10 +87,8 @@ class Thread:
def start(self) -> None: ...
def run(self) -> None: ...
def join(self, timeout: float | None = None) -> None: ...
if sys.version_info >= (3, 8):
@property
def native_id(self) -> int | None: ... # only available on some platforms
@property
def native_id(self) -> int | None: ... # only available on some platforms
def is_alive(self) -> bool: ...
if sys.version_info < (3, 9):
def isAlive(self) -> bool: ...
@@ -159,11 +154,8 @@ class Event:
def clear(self) -> None: ...
def wait(self, timeout: float | None = None) -> bool: ...
if sys.version_info >= (3, 8):
from _thread import _excepthook, _ExceptHookArgs
excepthook = _excepthook
ExceptHookArgs = _ExceptHookArgs
excepthook = _excepthook
ExceptHookArgs = _ExceptHookArgs
class Timer(Thread):
args: Iterable[Any] # undocumented
+1 -5
View File
@@ -25,7 +25,7 @@ if sys.platform != "win32":
if sys.platform != "linux" and sys.platform != "darwin":
CLOCK_HIGHRES: int # Solaris only
if sys.version_info >= (3, 8) and sys.platform == "darwin":
if sys.platform == "darwin":
CLOCK_UPTIME_RAW: int
if sys.version_info >= (3, 9) and sys.platform == "linux":
@@ -64,10 +64,6 @@ class struct_time(structseq[Any | int], _TimeTuple):
def tm_gmtoff(self) -> int: ...
def asctime(t: _TimeTuple | struct_time = ...) -> str: ...
if sys.version_info < (3, 8):
def clock() -> float: ...
def ctime(secs: float | None = ...) -> str: ...
def gmtime(secs: float | None = ...) -> struct_time: ...
def localtime(secs: float | None = ...) -> struct_time: ...
+7 -11
View File
@@ -1712,9 +1712,7 @@ class Canvas(Widget, XView, YView):
) -> dict[str, tuple[str, str, str, str, str]] | None: ...
itemconfig = itemconfigure
def move(self, *args) -> None: ...
if sys.version_info >= (3, 8):
def moveto(self, tagOrId: str | int, x: Literal[""] | float = "", y: Literal[""] | float = "") -> None: ...
def moveto(self, tagOrId: str | int, x: Literal[""] | float = "", y: Literal[""] | float = "") -> None: ...
def postscript(self, cnf={}, **kw): ...
# tkinter does:
# lower = tag_lower
@@ -3338,9 +3336,8 @@ class PhotoImage(Image, _PhotoImageLike):
to: tuple[int, int] | None = None,
) -> None: ...
def write(self, filename: StrOrBytesPath, format: str | None = None, from_coords: tuple[int, int] | None = None) -> None: ...
if sys.version_info >= (3, 8):
def transparency_get(self, x: int, y: int) -> bool: ...
def transparency_set(self, x: int, y: int, boolean: bool) -> None: ...
def transparency_get(self, x: int, y: int) -> bool: ...
def transparency_set(self, x: int, y: int, boolean: bool) -> None: ...
class BitmapImage(Image, _BitmapImageLike):
# This should be kept in sync with PIL.ImageTK.BitmapImage.__init__()
@@ -3495,11 +3492,10 @@ class Spinbox(Widget, XView):
def selection_adjust(self, index): ...
def selection_clear(self): ...
def selection_element(self, element: Incomplete | None = None): ...
if sys.version_info >= (3, 8):
def selection_from(self, index: int) -> None: ...
def selection_present(self) -> None: ...
def selection_range(self, start: int, end: int) -> None: ...
def selection_to(self, index: int) -> None: ...
def selection_from(self, index: int) -> None: ...
def selection_present(self) -> None: ...
def selection_range(self, start: int, end: int) -> None: ...
def selection_to(self, index: int) -> None: ...
class LabelFrame(Widget):
def __init__(
+1 -6
View File
@@ -1,5 +1,4 @@
import _tkinter
import sys
import tkinter
from _typeshed import Incomplete
from collections.abc import Callable
@@ -1102,11 +1101,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
def parent(self, item: str | int) -> str: ...
def prev(self, item: str | int) -> str: ... # returning empty string means first item
def see(self, item: str | int) -> None: ...
if sys.version_info >= (3, 8):
def selection(self) -> tuple[str, ...]: ...
else:
def selection(self, selop: Incomplete | None = ..., items: Incomplete | None = None) -> tuple[str, ...]: ...
def selection(self) -> tuple[str, ...]: ...
@overload
def selection_set(self, __items: list[str] | tuple[str, ...] | list[int] | tuple[int, ...]) -> None: ...
@overload
+11 -11
View File
@@ -3,11 +3,14 @@ import sys
__all__ = [
"AMPER",
"AMPEREQUAL",
"ASYNC",
"AT",
"ATEQUAL",
"AWAIT",
"CIRCUMFLEX",
"CIRCUMFLEXEQUAL",
"COLON",
"COLONEQUAL",
"COMMA",
"DEDENT",
"DOT",
@@ -59,6 +62,8 @@ __all__ = [
"STAREQUAL",
"STRING",
"TILDE",
"TYPE_COMMENT",
"TYPE_IGNORE",
"VBAR",
"VBAREQUAL",
"tok_name",
@@ -67,9 +72,6 @@ __all__ = [
"COMMENT",
]
if sys.version_info >= (3, 8):
__all__ += ["ASYNC", "AWAIT", "COLONEQUAL", "TYPE_COMMENT", "TYPE_IGNORE"]
if sys.version_info >= (3, 10):
__all__ += ["SOFT_KEYWORD"]
@@ -129,9 +131,8 @@ AT: int
RARROW: int
ELLIPSIS: int
ATEQUAL: int
if sys.version_info >= (3, 8):
AWAIT: int
ASYNC: int
AWAIT: int
ASYNC: int
OP: int
ERRORTOKEN: int
N_TOKENS: int
@@ -140,11 +141,10 @@ tok_name: dict[int, str]
COMMENT: int
NL: int
ENCODING: int
if sys.version_info >= (3, 8):
TYPE_COMMENT: int
TYPE_IGNORE: int
COLONEQUAL: int
EXACT_TOKEN_TYPES: dict[str, int]
TYPE_COMMENT: int
TYPE_IGNORE: int
COLONEQUAL: int
EXACT_TOKEN_TYPES: dict[str, int]
if sys.version_info >= (3, 10):
SOFT_KEYWORD: int
+7 -8
View File
@@ -3,17 +3,21 @@ from _typeshed import FileDescriptorOrPath
from collections.abc import Callable, Generator, Iterable, Sequence
from re import Pattern
from token import *
from token import EXACT_TOKEN_TYPES as EXACT_TOKEN_TYPES
from typing import Any, NamedTuple, TextIO
from typing_extensions import TypeAlias
__all__ = [
"AMPER",
"AMPEREQUAL",
"ASYNC",
"AT",
"ATEQUAL",
"AWAIT",
"CIRCUMFLEX",
"CIRCUMFLEXEQUAL",
"COLON",
"COLONEQUAL",
"COMMA",
"COMMENT",
"DEDENT",
@@ -68,29 +72,24 @@ __all__ = [
"STAREQUAL",
"STRING",
"TILDE",
"TYPE_COMMENT",
"TYPE_IGNORE",
"TokenInfo",
"VBAR",
"VBAREQUAL",
"detect_encoding",
"generate_tokens",
"tok_name",
"tokenize",
"untokenize",
]
if sys.version_info >= (3, 8):
__all__ += ["ASYNC", "AWAIT", "COLONEQUAL", "generate_tokens", "TYPE_COMMENT", "TYPE_IGNORE"]
if sys.version_info >= (3, 10):
__all__ += ["SOFT_KEYWORD"]
if sys.version_info >= (3, 12):
__all__ += ["EXCLAMATION", "FSTRING_END", "FSTRING_MIDDLE", "FSTRING_START"]
if sys.version_info >= (3, 8):
from token import EXACT_TOKEN_TYPES as EXACT_TOKEN_TYPES
else:
EXACT_TOKEN_TYPES: dict[str, int]
cookie_re: Pattern[str]
blank_re: Pattern[bytes]
+1 -2
View File
@@ -240,8 +240,7 @@ class FrameSummary(Iterable[Any]):
def __getitem__(self, pos: int) -> Any: ...
def __iter__(self) -> Iterator[Any]: ...
def __eq__(self, other: object) -> bool: ...
if sys.version_info >= (3, 8):
def __len__(self) -> Literal[4]: ...
def __len__(self) -> Literal[4]: ...
class StackSummary(list[FrameSummary]):
@classmethod
+8 -34
View File
@@ -45,11 +45,9 @@ __all__ = [
"MethodWrapperType",
"WrapperDescriptorType",
"resolve_bases",
"CellType",
]
if sys.version_info >= (3, 8):
__all__ += ["CellType"]
if sys.version_info >= (3, 9):
__all__ += ["GenericAlias"]
@@ -68,9 +66,7 @@ _VT_co = TypeVar("_VT_co", covariant=True)
@final
class _Cell:
if sys.version_info >= (3, 8):
def __new__(cls, __contents: object = ...) -> Self: ...
def __new__(cls, __contents: object = ...) -> Self: ...
def __eq__(self, __value: object) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
cell_contents: Any
@@ -118,10 +114,8 @@ class CodeType:
def __hash__(self) -> int: ...
@property
def co_argcount(self) -> int: ...
if sys.version_info >= (3, 8):
@property
def co_posonlyargcount(self) -> int: ...
@property
def co_posonlyargcount(self) -> int: ...
@property
def co_kwonlyargcount(self) -> int: ...
@property
@@ -203,30 +197,11 @@ class CodeType:
__freevars: tuple[str, ...] = ...,
__cellvars: tuple[str, ...] = ...,
) -> Self: ...
elif sys.version_info >= (3, 8):
def __new__(
cls,
__argcount: int,
__posonlyargcount: int,
__kwonlyargcount: int,
__nlocals: int,
__stacksize: int,
__flags: int,
__codestring: bytes,
__constants: tuple[object, ...],
__names: tuple[str, ...],
__varnames: tuple[str, ...],
__filename: str,
__name: str,
__firstlineno: int,
__lnotab: bytes,
__freevars: tuple[str, ...] = ...,
__cellvars: tuple[str, ...] = ...,
) -> Self: ...
else:
def __new__(
cls,
__argcount: int,
__posonlyargcount: int,
__kwonlyargcount: int,
__nlocals: int,
__stacksize: int,
@@ -286,7 +261,7 @@ class CodeType:
co_name: str = ...,
co_linetable: bytes = ...,
) -> CodeType: ...
elif sys.version_info >= (3, 8):
else:
def replace(
self,
*,
@@ -515,7 +490,7 @@ class ClassMethodDescriptorType:
class TracebackType:
def __new__(cls, tb_next: TracebackType | None, tb_frame: FrameType, tb_lasti: int, tb_lineno: int) -> Self: ...
tb_next: TracebackType | None
# the rest are read-only even in 3.7
# the rest are read-only
@property
def tb_frame(self) -> FrameType: ...
@property
@@ -598,8 +573,7 @@ def coroutine(func: Callable[_P, Generator[Any, Any, _R]]) -> Callable[_P, Await
@overload
def coroutine(func: _Fn) -> _Fn: ...
if sys.version_info >= (3, 8):
CellType = _Cell
CellType = _Cell
if sys.version_info >= (3, 9):
class GenericAlias:
+43 -57
View File
@@ -1,4 +1,6 @@
import collections # Needed by aliases like DefaultDict, see mypy issue 2986
# TODO: The collections import is required, otherwise mypy crashes.
# https://github.com/python/mypy/issues/16744
import collections # noqa: F401 # pyright: ignore
import sys
import typing_extensions
from _collections_abc import dict_items, dict_keys, dict_values
@@ -46,6 +48,7 @@ __all__ = [
"DefaultDict",
"Deque",
"Dict",
"Final",
"FrozenSet",
"Generator",
"Generic",
@@ -55,6 +58,7 @@ __all__ = [
"Iterator",
"KeysView",
"List",
"Literal",
"Mapping",
"MappingView",
"MutableMapping",
@@ -63,6 +67,7 @@ __all__ = [
"NamedTuple",
"NewType",
"Optional",
"Protocol",
"Reversible",
"Sequence",
"Set",
@@ -71,38 +76,31 @@ __all__ = [
"SupportsBytes",
"SupportsComplex",
"SupportsFloat",
"SupportsIndex",
"SupportsInt",
"SupportsRound",
"Text",
"Tuple",
"Type",
"TypeVar",
"TypedDict",
"Union",
"ValuesView",
"TYPE_CHECKING",
"cast",
"final",
"get_args",
"get_origin",
"get_type_hints",
"no_type_check",
"no_type_check_decorator",
"overload",
"runtime_checkable",
"ForwardRef",
"NoReturn",
"OrderedDict",
]
if sys.version_info >= (3, 8):
__all__ += [
"Final",
"Literal",
"Protocol",
"SupportsIndex",
"TypedDict",
"final",
"get_args",
"get_origin",
"runtime_checkable",
]
if sys.version_info >= (3, 9):
__all__ += ["Annotated", "BinaryIO", "IO", "Match", "Pattern", "TextIO"]
@@ -199,12 +197,13 @@ ClassVar: _SpecialForm
Optional: _SpecialForm
Tuple: _SpecialForm
if sys.version_info >= (3, 8):
Final: _SpecialForm
def final(f: _T) -> _T: ...
Literal: _SpecialForm
# TypedDict is a (non-subscriptable) special form.
TypedDict: object
Final: _SpecialForm
def final(f: _T) -> _T: ...
Literal: _SpecialForm
# TypedDict is a (non-subscriptable) special form.
TypedDict: object
if sys.version_info >= (3, 11):
Self: _SpecialForm
@@ -329,8 +328,6 @@ if sys.version_info >= (3, 9):
# Predefined type variables.
AnyStr = TypeVar("AnyStr", str, bytes) # noqa: Y001
# Technically in 3.7 this inherited from GenericMeta. But let's not reflect that, since
# type checkers tend to assume that Protocols all have the ABCMeta metaclass.
class _ProtocolMeta(ABCMeta):
if sys.version_info >= (3, 12):
def __init__(cls, *args: Any, **kwargs: Any) -> None: ...
@@ -358,11 +355,10 @@ class SupportsBytes(Protocol, metaclass=ABCMeta):
@abstractmethod
def __bytes__(self) -> bytes: ...
if sys.version_info >= (3, 8):
@runtime_checkable
class SupportsIndex(Protocol, metaclass=ABCMeta):
@abstractmethod
def __index__(self) -> int: ...
@runtime_checkable
class SupportsIndex(Protocol, metaclass=ABCMeta):
@abstractmethod
def __index__(self) -> int: ...
@runtime_checkable
class SupportsAbs(Protocol[_T_co]):
@@ -602,9 +598,7 @@ class ItemsView(MappingView, AbstractSet[tuple[_KT_co, _VT_co]], Generic[_KT_co,
def __rand__(self, other: Iterable[_T]) -> set[_T]: ...
def __contains__(self, item: object) -> bool: ...
def __iter__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ...
def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ...
def __or__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
def __ror__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
def __sub__(self, other: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ...
@@ -618,9 +612,7 @@ class KeysView(MappingView, AbstractSet[_KT_co]):
def __rand__(self, other: Iterable[_T]) -> set[_T]: ...
def __contains__(self, key: object) -> bool: ...
def __iter__(self) -> Iterator[_KT_co]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[_KT_co]: ...
def __reversed__(self) -> Iterator[_KT_co]: ...
def __or__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ...
def __ror__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ...
def __sub__(self, other: Iterable[Any]) -> set[_KT_co]: ...
@@ -632,8 +624,7 @@ class ValuesView(MappingView, Collection[_VT_co]):
def __init__(self, mapping: Mapping[Any, _VT_co]) -> None: ... # undocumented
def __contains__(self, value: object) -> bool: ...
def __iter__(self) -> Iterator[_VT_co]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[_VT_co]: ...
def __reversed__(self) -> Iterator[_VT_co]: ...
class Mapping(Collection[_KT], Generic[_KT, _VT_co]):
# TODO: We wish the key type could also be covariant, but that doesn't work,
@@ -823,21 +814,22 @@ else:
obj: _get_type_hints_obj_allowed_types, globalns: dict[str, Any] | None = None, localns: dict[str, Any] | None = None
) -> dict[str, Any]: ...
if sys.version_info >= (3, 8):
def get_args(tp: Any) -> tuple[Any, ...]: ...
def get_args(tp: Any) -> tuple[Any, ...]: ...
if sys.version_info >= (3, 10):
@overload
def get_origin(tp: ParamSpecArgs | ParamSpecKwargs) -> ParamSpec: ...
@overload
def get_origin(tp: UnionType) -> type[UnionType]: ...
if sys.version_info >= (3, 9):
@overload
def get_origin(tp: GenericAlias) -> type: ...
@overload
def get_origin(tp: Any) -> Any | None: ...
else:
def get_origin(tp: Any) -> Any | None: ...
if sys.version_info >= (3, 10):
@overload
def get_origin(tp: ParamSpecArgs | ParamSpecKwargs) -> ParamSpec: ...
@overload
def get_origin(tp: UnionType) -> type[UnionType]: ...
if sys.version_info >= (3, 9):
@overload
def get_origin(tp: GenericAlias) -> type: ...
@overload
def get_origin(tp: Any) -> Any | None: ...
else:
def get_origin(tp: Any) -> Any | None: ...
@overload
def cast(typ: type[_T], val: Any) -> _T: ...
@@ -865,9 +857,7 @@ if sys.version_info >= (3, 11):
# Type constructors
class NamedTuple(tuple[Any, ...]):
if sys.version_info < (3, 8):
_field_types: ClassVar[collections.OrderedDict[str, type]]
elif sys.version_info < (3, 9):
if sys.version_info < (3, 9):
_field_types: ClassVar[dict[str, type]]
_field_defaults: ClassVar[dict[str, Any]]
_fields: ClassVar[tuple[str, ...]]
@@ -881,11 +871,7 @@ class NamedTuple(tuple[Any, ...]):
def __init__(self, __typename: str, __fields: None = None, **kwargs: Any) -> None: ...
@classmethod
def _make(cls, iterable: Iterable[Any]) -> typing_extensions.Self: ...
if sys.version_info >= (3, 8):
def _asdict(self) -> dict[str, Any]: ...
else:
def _asdict(self) -> collections.OrderedDict[str, Any]: ...
def _asdict(self) -> dict[str, Any]: ...
def _replace(self, **kwargs: Any) -> typing_extensions.Self: ...
# Internal mypy fallback type for all typed dicts (does not exist at runtime)
+2 -9
View File
@@ -1,5 +1,4 @@
import abc
import collections
import sys
import typing
from _collections_abc import dict_items, dict_keys, dict_values
@@ -353,9 +352,7 @@ else:
) -> IdentityFunction: ...
class NamedTuple(tuple[Any, ...]):
if sys.version_info < (3, 8):
_field_types: ClassVar[collections.OrderedDict[str, type]]
elif sys.version_info < (3, 9):
if sys.version_info < (3, 9):
_field_types: ClassVar[dict[str, type]]
_field_defaults: ClassVar[dict[str, Any]]
_fields: ClassVar[tuple[str, ...]]
@@ -366,11 +363,7 @@ else:
def __init__(self, typename: str, fields: None = None, **kwargs: Any) -> None: ...
@classmethod
def _make(cls, iterable: Iterable[Any]) -> Self: ...
if sys.version_info >= (3, 8):
def _asdict(self) -> dict[str, Any]: ...
else:
def _asdict(self) -> collections.OrderedDict[str, Any]: ...
def _asdict(self) -> dict[str, Any]: ...
def _replace(self, **kwargs: Any) -> Self: ...
class NewType:

Some files were not shown because too many files have changed in this diff Show More