Akuli and srittau: Remove Python 2 branches from Python 3 stubs (#5461)

* run script and do some manual changes (Akuli)

* do the whole thing manually (srittau)

* merge changes (Akuli)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
This commit is contained in:
Akuli
2021-05-15 15:33:39 +03:00
committed by GitHub
parent b0ef85288d
commit 17dcea4a68
106 changed files with 1539 additions and 3275 deletions

View File

@@ -1,4 +1,3 @@
import sys
import types
from opcode import (
EXTENDED_ARG as EXTENDED_ARG,
@@ -29,6 +28,3 @@ def dis(x: _have_code_or_string = ...) -> None: ...
def distb(tb: types.TracebackType = ...) -> None: ...
def disassemble(co: _have_code, lasti: int = ...) -> None: ...
def disco(co: _have_code, lasti: int = ...) -> None: ...
if sys.version_info >= (3, 0):
def show_code(co: _have_code) -> None: ...

View File

@@ -31,10 +31,6 @@ SOCK_RAW: SocketKind
SOCK_RDM: SocketKind
SOCK_SEQPACKET: SocketKind
if sys.platform == "linux" and sys.version_info >= (3,):
SOCK_CLOEXEC: SocketKind
SOCK_NONBLOCK: SocketKind
# Address families not mentioned in the docs
AF_AAL5: AddressFamily
AF_APPLETALK: AddressFamily
@@ -261,88 +257,6 @@ TCP_SYNCNT: int
TCP_WINDOW_CLAMP: int
# Specifically-documented constants
if sys.platform == "linux" and sys.version_info >= (3,):
AF_CAN: AddressFamily
PF_CAN: int
SOL_CAN_BASE: int
SOL_CAN_RAW: int
CAN_EFF_FLAG: int
CAN_EFF_MASK: int
CAN_ERR_FLAG: int
CAN_ERR_MASK: int
CAN_RAW: int
CAN_RAW_ERR_FILTER: int
CAN_RAW_FILTER: int
CAN_RAW_LOOPBACK: int
CAN_RAW_RECV_OWN_MSGS: int
CAN_RTR_FLAG: int
CAN_SFF_MASK: int
CAN_BCM: int
CAN_BCM_TX_SETUP: int
CAN_BCM_TX_DELETE: int
CAN_BCM_TX_READ: int
CAN_BCM_TX_SEND: int
CAN_BCM_RX_SETUP: int
CAN_BCM_RX_DELETE: int
CAN_BCM_RX_READ: int
CAN_BCM_TX_STATUS: int
CAN_BCM_TX_EXPIRED: int
CAN_BCM_RX_STATUS: int
CAN_BCM_RX_TIMEOUT: int
CAN_BCM_RX_CHANGED: int
CAN_RAW_FD_FRAMES: int
if sys.platform == "linux" and 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
if sys.platform == "linux" and sys.version_info >= (3, 7):
CAN_ISOTP: int
if sys.platform == "linux" and sys.version_info >= (3, 9):
CAN_J1939: int
J1939_MAX_UNICAST_ADDR: int
J1939_IDLE_ADDR: int
J1939_NO_ADDR: int
J1939_NO_NAME: int
J1939_PGN_REQUEST: int
J1939_PGN_ADDRESS_CLAIMED: int
J1939_PGN_ADDRESS_COMMANDED: int
J1939_PGN_PDU1_MAX: int
J1939_PGN_MAX: int
J1939_NO_PGN: int
SO_J1939_FILTER: int
SO_J1939_PROMISC: int
SO_J1939_SEND_PRIO: int
SO_J1939_ERRQUEUE: int
SCM_J1939_DEST_ADDR: int
SCM_J1939_DEST_NAME: int
SCM_J1939_PRIO: int
SCM_J1939_ERRQUEUE: int
J1939_NLA_PAD: int
J1939_NLA_BYTES_ACKED: int
J1939_EE_INFO_NONE: int
J1939_EE_INFO_TX_ABORT: int
J1939_FILTER_MAX: int
if sys.platform == "linux":
AF_PACKET: AddressFamily
PF_PACKET: int
@@ -354,29 +268,6 @@ if sys.platform == "linux":
PACKET_OTHERHOST: int
PACKET_OUTGOING: int
if sys.platform == "linux" and sys.version_info >= (3,):
AF_RDS: AddressFamily
PF_RDS: int
SOL_RDS: int
RDS_CANCEL_SENT_TO: int
RDS_CMSG_RDMA_ARGS: int
RDS_CMSG_RDMA_DEST: int
RDS_CMSG_RDMA_MAP: int
RDS_CMSG_RDMA_STATUS: int
RDS_CMSG_RDMA_UPDATE: int
RDS_CONG_MONITOR: int
RDS_FREE_MR: int
RDS_GET_MR: int
RDS_GET_MR_FOR_DEST: int
RDS_RDMA_DONTWAIT: int
RDS_RDMA_FENCE: int
RDS_RDMA_INVALIDATE: int
RDS_RDMA_NOTIFY_ME: int
RDS_RDMA_READWRITE: int
RDS_RDMA_SILENT: int
RDS_RDMA_USE_ONCE: int
RDS_RECVERR: int
if sys.platform == "win32":
SIO_RCVALL: int
SIO_KEEPALIVE_VALS: int
@@ -413,38 +304,8 @@ if sys.platform == "linux":
TIPC_WITHDRAWN: int
TIPC_ZONE_SCOPE: int
if sys.platform == "linux" and sys.version_info >= (3, 6):
AF_ALG: AddressFamily
SOL_ALG: int
ALG_OP_DECRYPT: int
ALG_OP_ENCRYPT: int
ALG_OP_SIGN: int
ALG_OP_VERIFY: int
ALG_SET_AEAD_ASSOCLEN: int
ALG_SET_AEAD_AUTHSIZE: int
ALG_SET_IV: int
ALG_SET_KEY: int
ALG_SET_OP: int
ALG_SET_PUBKEY: int
if sys.platform == "linux" and sys.version_info >= (3, 7):
AF_VSOCK: AddressFamily
IOCTL_VM_SOCKETS_GET_LOCAL_CID: int
VMADDR_CID_ANY: int
VMADDR_CID_HOST: int
VMADDR_PORT_ANY: int
SO_VM_SOCKETS_BUFFER_MAX_SIZE: int
SO_VM_SOCKETS_BUFFER_SIZE: int
SO_VM_SOCKETS_BUFFER_MIN_SIZE: int
VM_SOCKETS_INVALID_VERSION: int
AF_LINK: AddressFamily # Availability: BSD, macOS
# BDADDR_* and HCI_* listed with other bluetooth constants below
if sys.platform == "linux" and sys.version_info >= (3, 8):
AF_QIPCRTR: AddressFamily
# Semi-documented constants
# (Listed under "Socket families" in the docs, but not "Constants")
@@ -542,9 +403,7 @@ class socket:
@overload
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
def gettimeout(self) -> Optional[float]: ...
if sys.platform == "win32" and sys.version_info >= (3, 6):
def ioctl(self, control: int, option: Union[int, Tuple[int, int, int], bool]) -> None: ...
elif sys.platform == "win32":
if sys.platform == "win32":
def ioctl(self, control: int, option: Union[int, Tuple[int, int, int]]) -> None: ...
def listen(self, __backlog: int) -> None: ...
# Note that the makefile's documented windows-specific behavior is not represented
@@ -559,10 +418,6 @@ class socket:
def sendto(self, data: bytes, address: _Address) -> int: ...
@overload
def sendto(self, data: bytes, flags: int, address: _Address) -> int: ...
if sys.platform == "linux" and sys.version_info >= (3, 6):
def sendmsg_afalg(
self, msg: Iterable[bytes] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
) -> int: ...
def setblocking(self, flag: bool) -> None: ...
def settimeout(self, value: Optional[float]) -> None: ...
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
@@ -579,9 +434,6 @@ def create_connection(
) -> socket: ...
def fromfd(fd: int, family: int, type: int, proto: int = ...) -> socket: ...
if sys.platform == "win32" and sys.version_info >= (3, 3):
def fromshare(info: bytes) -> socket: ...
# the 5th tuple item is an address
def getaddrinfo(
host: Optional[Union[bytearray, bytes, Text]],

View File

@@ -14,11 +14,8 @@ nested_scopes: _Feature
print_function: _Feature
unicode_literals: _Feature
with_statement: _Feature
if sys.version_info >= (3, 0):
barry_as_FLUFL: _Feature
if sys.version_info >= (3, 5):
generator_stop: _Feature
barry_as_FLUFL: _Feature
generator_stop: _Feature
if sys.version_info >= (3, 7):
annotations: _Feature

View File

@@ -6,12 +6,8 @@ from typing import Any, Callable, Dict, Optional, Text, Tuple, Union
_Handler = Callable[[Exception], Tuple[Text, int]]
_String = Union[bytes, str]
_Errors = Union[str, Text, None]
if sys.version_info >= (3, 0):
_Decodable = bytes
_Encodable = str
else:
_Decodable = Union[bytes, Text]
_Encodable = Union[bytes, Text]
_Decodable = bytes
_Encodable = str
# This type is not exposed; it is defined in unicodeobject.c
class _EncodingMap(object):
@@ -28,10 +24,6 @@ def encode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) ->
def charmap_build(__map: Text) -> _MapT: ...
def ascii_decode(__data: _Decodable, __errors: _Errors = ...) -> Tuple[Text, int]: ...
def ascii_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
if sys.version_info < (3, 2):
def charbuffer_encode(__data: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def charmap_decode(__data: _Decodable, __errors: _Errors = ..., __mapping: Optional[_MapT] = ...) -> Tuple[Text, int]: ...
def charmap_encode(__str: _Encodable, __errors: _Errors = ..., __mapping: Optional[_MapT] = ...) -> Tuple[bytes, int]: ...
def escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[str, int]: ...
@@ -74,9 +66,7 @@ def utf_8_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int
if sys.platform == "win32":
def mbcs_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
def mbcs_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
if sys.version_info >= (3, 0):
def code_page_decode(__codepage: int, __data: bytes, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
def code_page_encode(__code_page: int, __str: Text, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
if sys.version_info >= (3, 6):
def oem_decode(__data: bytes, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
def oem_encode(__str: Text, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def code_page_decode(__codepage: int, __data: bytes, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
def code_page_encode(__code_page: int, __str: Text, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def oem_decode(__data: bytes, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
def oem_encode(__str: Text, __errors: _Errors = ...) -> Tuple[bytes, int]: ...

View File

@@ -1,5 +1,4 @@
import sys
from typing import Any, Iterable, Iterator, List, Optional, Protocol, Sequence, Text, Type, Union
from typing import Any, Iterable, Iterator, List, Optional, Protocol, Text, Type, Union
QUOTE_ALL: int
QUOTE_MINIMAL: int
@@ -24,20 +23,12 @@ _DialectLike = Union[str, Dialect, Type[Dialect]]
class _reader(Iterator[List[str]]):
dialect: Dialect
line_num: int
if sys.version_info >= (3, 0):
def __next__(self) -> List[str]: ...
else:
def next(self) -> List[str]: ...
def __next__(self) -> List[str]: ...
class _writer:
dialect: Dialect
if sys.version_info >= (3, 5):
def writerow(self, row: Iterable[Any]) -> Any: ...
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
else:
def writerow(self, row: Sequence[Any]) -> Any: ...
def writerows(self, rows: Iterable[Sequence[Any]]) -> None: ...
def writerow(self, row: Iterable[Any]) -> Any: ...
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
class _Writer(Protocol):
def write(self, s: str) -> Any: ...

View File

@@ -348,24 +348,17 @@ def tparm(
) -> bytes: ...
def typeahead(__fd: int) -> None: ...
def unctrl(__ch: _chtype) -> bytes: ...
if sys.version_info >= (3, 3):
def unget_wch(__ch: Union[int, str]) -> None: ...
def unget_wch(__ch: Union[int, str]) -> None: ...
def ungetch(__ch: _chtype) -> None: ...
def ungetmouse(__id: int, __x: int, __y: int, __z: int, __bstate: int) -> None: ...
if sys.version_info >= (3, 5):
def update_lines_cols() -> int: ...
def update_lines_cols() -> int: ...
def use_default_colors() -> None: ...
def use_env(__flag: bool) -> None: ...
class error(Exception): ...
class _CursesWindow:
if sys.version_info >= (3, 3):
encoding: str
encoding: str
@overload
def addch(self, ch: _chtype, attr: int = ...) -> None: ...
@overload
@@ -429,11 +422,10 @@ class _CursesWindow:
def getch(self) -> int: ...
@overload
def getch(self, y: int, x: int) -> int: ...
if sys.version_info >= (3, 3):
@overload
def get_wch(self) -> Union[int, str]: ...
@overload
def get_wch(self, y: int, x: int) -> Union[int, str]: ...
@overload
def get_wch(self) -> Union[int, str]: ...
@overload
def get_wch(self, y: int, x: int) -> Union[int, str]: ...
@overload
def getkey(self) -> str: ...
@overload

View File

@@ -11,20 +11,11 @@ _T = TypeVar("_T")
__all__: List[str]
def active_count() -> int: ...
if sys.version_info < (3,):
def activeCount() -> int: ...
def current_thread() -> Thread: ...
def currentThread() -> Thread: ...
if sys.version_info >= (3,):
def get_ident() -> int: ...
def get_ident() -> int: ...
def enumerate() -> List[Thread]: ...
if sys.version_info >= (3, 4):
def main_thread() -> Thread: ...
def main_thread() -> Thread: ...
if sys.version_info >= (3, 8):
from _thread import get_native_id as get_native_id
@@ -33,8 +24,7 @@ def settrace(func: _TF) -> None: ...
def setprofile(func: Optional[_PF]) -> None: ...
def stack_size(size: int = ...) -> int: ...
if sys.version_info >= (3,):
TIMEOUT_MAX: float
TIMEOUT_MAX: float
class ThreadError(Exception): ...
@@ -47,26 +37,16 @@ class Thread:
name: str
ident: Optional[int]
daemon: bool
if sys.version_info >= (3,):
def __init__(
self,
group: None = ...,
target: Optional[Callable[..., Any]] = ...,
name: Optional[str] = ...,
args: Iterable[Any] = ...,
kwargs: Optional[Mapping[str, Any]] = ...,
*,
daemon: Optional[bool] = ...,
) -> None: ...
else:
def __init__(
self,
group: None = ...,
target: Optional[Callable[..., Any]] = ...,
name: Optional[Text] = ...,
args: Iterable[Any] = ...,
kwargs: Optional[Mapping[Text, Any]] = ...,
) -> None: ...
def __init__(
self,
group: None = ...,
target: Optional[Callable[..., Any]] = ...,
name: Optional[str] = ...,
args: Iterable[Any] = ...,
kwargs: Optional[Mapping[str, Any]] = ...,
*,
daemon: Optional[bool] = ...,
) -> None: ...
def start(self) -> None: ...
def run(self) -> None: ...
def join(self, timeout: Optional[float] = ...) -> None: ...
@@ -89,10 +69,7 @@ class Lock:
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
if sys.version_info >= (3,):
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
else:
def acquire(self, blocking: bool = ...) -> bool: ...
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
def release(self) -> None: ...
def locked(self) -> bool: ...
@@ -102,10 +79,7 @@ class _RLock:
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
if sys.version_info >= (3,):
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
else:
def acquire(self, blocking: bool = ...) -> bool: ...
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
def release(self) -> None: ...
RLock = _RLock
@@ -116,14 +90,10 @@ class Condition:
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
if sys.version_info >= (3,):
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
else:
def acquire(self, blocking: bool = ...) -> bool: ...
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
def release(self) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> bool: ...
if sys.version_info >= (3,):
def wait_for(self, predicate: Callable[[], _T], timeout: Optional[float] = ...) -> _T: ...
def wait_for(self, predicate: Callable[[], _T], timeout: Optional[float] = ...) -> _T: ...
def notify(self, n: int = ...) -> None: ...
def notify_all(self) -> None: ...
def notifyAll(self) -> None: ...
@@ -133,12 +103,8 @@ class Semaphore:
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
if sys.version_info >= (3,):
def acquire(self, blocking: bool = ..., timeout: Optional[float] = ...) -> bool: ...
def __enter__(self, blocking: bool = ..., timeout: Optional[float] = ...) -> bool: ...
else:
def acquire(self, blocking: bool = ...) -> bool: ...
def __enter__(self, blocking: bool = ...) -> bool: ...
def acquire(self, blocking: bool = ..., timeout: Optional[float] = ...) -> bool: ...
def __enter__(self, blocking: bool = ..., timeout: Optional[float] = ...) -> bool: ...
if sys.version_info >= (3, 9):
def release(self, n: int = ...) -> None: ...
else:
@@ -149,8 +115,6 @@ class BoundedSemaphore(Semaphore): ...
class Event:
def __init__(self) -> None: ...
def is_set(self) -> bool: ...
if sys.version_info < (3,):
def isSet(self) -> bool: ...
def set(self) -> None: ...
def clear(self) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> bool: ...
@@ -162,27 +126,22 @@ if sys.version_info >= (3, 8):
ExceptHookArgs = _ExceptHookArgs
class Timer(Thread):
if sys.version_info >= (3,):
def __init__(
self,
interval: float,
function: Callable[..., Any],
args: Optional[Iterable[Any]] = ...,
kwargs: Optional[Mapping[str, Any]] = ...,
) -> None: ...
else:
def __init__(
self, interval: float, function: Callable[..., Any], args: Iterable[Any] = ..., kwargs: Mapping[str, Any] = ...
) -> None: ...
def __init__(
self,
interval: float,
function: Callable[..., Any],
args: Optional[Iterable[Any]] = ...,
kwargs: Optional[Mapping[str, Any]] = ...,
) -> None: ...
def cancel(self) -> None: ...
if sys.version_info >= (3,):
class Barrier:
parties: int
n_waiting: int
broken: bool
def __init__(self, parties: int, action: Optional[Callable[[], None]] = ..., timeout: Optional[float] = ...) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> int: ...
def reset(self) -> None: ...
def abort(self) -> None: ...
class BrokenBarrierError(RuntimeError): ...
class Barrier:
parties: int
n_waiting: int
broken: bool
def __init__(self, parties: int, action: Optional[Callable[[], None]] = ..., timeout: Optional[float] = ...) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> int: ...
def reset(self) -> None: ...
def abort(self) -> None: ...
class BrokenBarrierError(RuntimeError): ...

View File

@@ -1,5 +1,4 @@
import sys
from typing import Any, Callable, Iterable, List, Optional, TypeVar
from typing import Any, List, TypeVar
_T = TypeVar("_T")
@@ -8,7 +7,3 @@ def heappop(__heap: List[_T]) -> _T: ...
def heappush(__heap: List[_T], __item: _T) -> None: ...
def heappushpop(__heap: List[_T], __item: _T) -> _T: ...
def heapreplace(__heap: List[_T], __item: _T) -> _T: ...
if sys.version_info < (3,):
def nlargest(__n: int, __iterable: Iterable[_T], __key: Optional[Callable[[_T], Any]] = ...) -> List[_T]: ...
def nsmallest(__n: int, __iterable: Iterable[_T], __key: Optional[Callable[[_T], Any]] = ...) -> List[_T]: ...

View File

@@ -1,4 +1,3 @@
import sys
from typing import Tuple
# Actually Tuple[(int,) * 625]
@@ -11,5 +10,3 @@ class Random(object):
def setstate(self, __state: _State) -> None: ...
def random(self) -> float: ...
def getrandbits(self, __k: int) -> int: ...
if sys.version_info < (3,):
def jumpahead(self, i: int) -> None: ...

View File

@@ -15,7 +15,8 @@
import array
import mmap
import sys
from typing import AbstractSet, Any, Container, Iterable, Protocol, Text, Tuple, TypeVar, Union
from os import PathLike
from typing import AbstractSet, Any, Container, Iterable, Protocol, Tuple, TypeVar, Union
from typing_extensions import Literal, final
_KT = TypeVar("_KT")
@@ -40,11 +41,7 @@ class SupportsRDivMod(Protocol[_T_contra, _T_co]):
# Mapping-like protocols
class SupportsItems(Protocol[_KT_co, _VT_co]):
if sys.version_info >= (3,):
def items(self) -> AbstractSet[Tuple[_KT_co, _VT_co]]: ...
else:
# We want dictionaries to support this on Python 2.
def items(self) -> Iterable[Tuple[_KT_co, _VT_co]]: ...
def items(self) -> AbstractSet[Tuple[_KT_co, _VT_co]]: ...
class SupportsKeysAndGetItem(Protocol[_KT, _VT_co]):
def keys(self) -> Iterable[_KT]: ...
@@ -59,16 +56,9 @@ class SupportsItemAccess(SupportsGetItem[_KT_contra, _VT], Protocol[_KT_contra,
# StrPath and AnyPath can be used in places where a
# path can be used instead of a string, starting with Python 3.6.
if sys.version_info >= (3, 6):
from os import PathLike
StrPath = Union[str, PathLike[str]]
BytesPath = Union[bytes, PathLike[bytes]]
AnyPath = Union[str, bytes, PathLike[str], PathLike[bytes]]
else:
StrPath = Text
BytesPath = bytes
AnyPath = Union[Text, bytes]
StrPath = Union[str, PathLike[str]]
BytesPath = Union[bytes, PathLike[bytes]]
AnyPath = Union[str, bytes, PathLike[str], PathLike[bytes]]
OpenTextModeUpdating = Literal[
"r+",
@@ -155,12 +145,8 @@ class SupportsNoArgReadline(Protocol[_T_co]):
class SupportsWrite(Protocol[_T_contra]):
def write(self, __s: _T_contra) -> Any: ...
if sys.version_info >= (3,):
ReadableBuffer = Union[bytes, bytearray, memoryview, array.array[Any], mmap.mmap]
WriteableBuffer = Union[bytearray, memoryview, array.array[Any], mmap.mmap]
else:
ReadableBuffer = Union[bytes, bytearray, memoryview, array.array[Any], mmap.mmap, buffer]
WriteableBuffer = Union[bytearray, memoryview, array.array[Any], mmap.mmap, buffer]
ReadableBuffer = Union[bytes, bytearray, memoryview, array.array[Any], mmap.mmap]
WriteableBuffer = Union[bytearray, memoryview, array.array[Any], mmap.mmap]
if sys.version_info >= (3, 10):
from types import NoneType as NoneType

View File

@@ -1,7 +1,5 @@
import sys
from tkinter import Event, Misc, Widget
from typing import Optional, Protocol
if sys.version_info >= (3,):
from tkinter import Event, Misc, Widget
class DndSource(Protocol):
def dnd_end(self, target: Optional[Widget], event: Optional[Event[Misc]]) -> None: ...
class DndSource(Protocol):
def dnd_end(self, target: Optional[Widget], event: Optional[Event[Misc]]) -> None: ...

View File

@@ -1,67 +1,32 @@
import sys
from typing import Any, Dict, List, Optional, Tuple, Type, Union, overload
if sys.version_info >= (3, 0):
_defaultaction: str
_onceregistry: Dict[Any, Any]
else:
default_action: str
once_registry: Dict[Any, Any]
_defaultaction: str
_onceregistry: Dict[Any, Any]
filters: List[Tuple[Any, ...]]
if sys.version_info >= (3, 6):
@overload
def warn(
message: str, category: Optional[Type[Warning]] = ..., stacklevel: int = ..., source: Optional[Any] = ...
) -> None: ...
@overload
def warn(message: Warning, category: Any = ..., stacklevel: int = ..., source: Optional[Any] = ...) -> None: ...
@overload
def warn_explicit(
message: str,
category: Type[Warning],
filename: str,
lineno: int,
module: Optional[str] = ...,
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
module_globals: Optional[Dict[str, Any]] = ...,
source: Optional[Any] = ...,
) -> None: ...
@overload
def warn_explicit(
message: Warning,
category: Any,
filename: str,
lineno: int,
module: Optional[str] = ...,
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
module_globals: Optional[Dict[str, Any]] = ...,
source: Optional[Any] = ...,
) -> None: ...
else:
@overload
def warn(message: str, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ...
@overload
def warn(message: Warning, category: Any = ..., stacklevel: int = ...) -> None: ...
@overload
def warn_explicit(
message: str,
category: Type[Warning],
filename: str,
lineno: int,
module: Optional[str] = ...,
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
module_globals: Optional[Dict[str, Any]] = ...,
) -> None: ...
@overload
def warn_explicit(
message: Warning,
category: Any,
filename: str,
lineno: int,
module: Optional[str] = ...,
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
module_globals: Optional[Dict[str, Any]] = ...,
) -> None: ...
@overload
def warn(message: str, category: Optional[Type[Warning]] = ..., stacklevel: int = ..., source: Optional[Any] = ...) -> None: ...
@overload
def warn(message: Warning, category: Any = ..., stacklevel: int = ..., source: Optional[Any] = ...) -> None: ...
@overload
def warn_explicit(
message: str,
category: Type[Warning],
filename: str,
lineno: int,
module: Optional[str] = ...,
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
module_globals: Optional[Dict[str, Any]] = ...,
source: Optional[Any] = ...,
) -> None: ...
@overload
def warn_explicit(
message: Warning,
category: Any,
filename: str,
lineno: int,
module: Optional[str] = ...,
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
module_globals: Optional[Dict[str, Any]] = ...,
source: Optional[Any] = ...,
) -> None: ...

View File

@@ -14,8 +14,7 @@ class ProxyType(Generic[_T]): # "weakproxy"
def __getattr__(self, attr: str) -> Any: ...
class ReferenceType(Generic[_T]):
if sys.version_info >= (3, 4):
__callback__: Callable[[ReferenceType[_T]], Any]
__callback__: Callable[[ReferenceType[_T]], Any]
def __init__(self, o: _T, callback: Optional[Callable[[ReferenceType[_T]], Any]] = ...) -> None: ...
def __call__(self) -> Optional[_T]: ...
def __hash__(self) -> int: ...

View File

@@ -18,11 +18,10 @@ _Marker = Tuple[int, int, bytes]
class Aifc_read:
def __init__(self, f: _File) -> None: ...
if sys.version_info >= (3, 4):
def __enter__(self) -> Aifc_read: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...
def __enter__(self) -> Aifc_read: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...
def initfp(self, file: IO[bytes]) -> None: ...
def getfp(self) -> IO[bytes]: ...
def rewind(self) -> None: ...
@@ -43,11 +42,10 @@ class Aifc_read:
class Aifc_write:
def __init__(self, f: _File) -> None: ...
def __del__(self) -> None: ...
if sys.version_info >= (3, 4):
def __enter__(self) -> Aifc_write: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...
def __enter__(self) -> Aifc_write: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...
def initfp(self, file: IO[bytes]) -> None: ...
def aiff(self) -> None: ...
def aifc(self) -> None: ...

View File

@@ -1,4 +1 @@
import sys
if sys.version_info >= (3, 0):
def geohash(latitude: float, longitude: float, datedow: bytes) -> None: ...
def geohash(latitude: float, longitude: float, datedow: bytes) -> None: ...

View File

@@ -24,10 +24,7 @@ _T = TypeVar("_T")
_ActionT = TypeVar("_ActionT", bound=Action)
_N = TypeVar("_N")
if sys.version_info >= (3,):
_Text = str
else:
_Text = Union[str, unicode]
_Text = str
ONE_OR_MORE: str
OPTIONAL: str
@@ -108,9 +105,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
formatter_class: _FormatterClass
fromfile_prefix_chars: Optional[_Text]
add_help: bool
if sys.version_info >= (3, 5):
allow_abbrev: bool
allow_abbrev: bool
# undocumented
_positionals: _ArgumentGroup
@@ -134,7 +129,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
allow_abbrev: bool = ...,
exit_on_error: bool = ...,
) -> None: ...
elif sys.version_info >= (3, 5):
else:
def __init__(
self,
prog: Optional[str] = ...,
@@ -150,21 +145,6 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
add_help: bool = ...,
allow_abbrev: bool = ...,
) -> None: ...
else:
def __init__(
self,
prog: Optional[Text] = ...,
usage: Optional[Text] = ...,
description: Optional[Text] = ...,
epilog: Optional[Text] = ...,
parents: Sequence[ArgumentParser] = ...,
formatter_class: _FormatterClass = ...,
prefix_chars: Text = ...,
fromfile_prefix_chars: Optional[Text] = ...,
argument_default: Any = ...,
conflict_handler: Text = ...,
add_help: bool = ...,
) -> None: ...
# The type-ignores in these overloads should be temporary. See:
# https://github.com/python/typeshed/pull/2643#issuecomment-442280277
@overload
@@ -289,9 +269,7 @@ class HelpFormatter:
class RawDescriptionHelpFormatter(HelpFormatter): ...
class RawTextHelpFormatter(RawDescriptionHelpFormatter): ...
class ArgumentDefaultsHelpFormatter(HelpFormatter): ...
if sys.version_info >= (3,):
class MetavarTypeHelpFormatter(HelpFormatter): ...
class MetavarTypeHelpFormatter(HelpFormatter): ...
class Action(_AttributeHolder):
option_strings: Sequence[_Text]
@@ -351,14 +329,11 @@ class FileType:
# undocumented
_mode: _Text
_bufsize: int
if sys.version_info >= (3,):
_encoding: Optional[str]
_errors: Optional[str]
def __init__(
self, mode: str = ..., bufsize: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ...
) -> None: ...
else:
def __init__(self, mode: Text = ..., bufsize: Optional[int] = ...) -> None: ...
_encoding: Optional[str]
_errors: Optional[str]
def __init__(
self, mode: str = ..., bufsize: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ...
) -> None: ...
def __call__(self, string: Text) -> IO[Any]: ...
# undocumented

View File

@@ -9,8 +9,7 @@ _TypeCode = Union[_IntTypeCode, _FloatTypeCode, _UnicodeTypeCode]
_T = TypeVar("_T", int, float, Text)
if sys.version_info >= (3,):
typecodes: str
typecodes: str
class array(MutableSequence[_T], Generic[_T]):
typecode: _TypeCode
@@ -28,8 +27,7 @@ class array(MutableSequence[_T], Generic[_T]):
def byteswap(self) -> None: ...
def count(self, __v: Any) -> int: ...
def extend(self, __bb: Iterable[_T]) -> None: ...
if sys.version_info >= (3, 2):
def frombytes(self, __buffer: bytes) -> None: ...
def frombytes(self, __buffer: bytes) -> None: ...
def fromfile(self, __f: BinaryIO, __n: int) -> None: ...
def fromlist(self, __list: List[_T]) -> None: ...
def fromunicode(self, __ustr: str) -> None: ...
@@ -39,17 +37,12 @@ class array(MutableSequence[_T], Generic[_T]):
def index(self, __v: _T) -> int: ... # type: ignore # Overrides Sequence
def insert(self, __i: int, __v: _T) -> None: ...
def pop(self, __i: int = ...) -> _T: ...
if sys.version_info < (3,):
def read(self, f: BinaryIO, n: int) -> None: ...
def remove(self, __v: Any) -> None: ...
def reverse(self) -> None: ...
if sys.version_info >= (3, 2):
def tobytes(self) -> bytes: ...
def tobytes(self) -> bytes: ...
def tofile(self, __f: BinaryIO) -> None: ...
def tolist(self) -> List[_T]: ...
def tounicode(self) -> str: ...
if sys.version_info < (3,):
def write(self, f: BinaryIO) -> None: ...
if sys.version_info < (3, 9):
def fromstring(self, __buffer: bytes) -> None: ...
def tostring(self) -> bytes: ...
@@ -72,9 +65,5 @@ class array(MutableSequence[_T], Generic[_T]):
def __lt__(self, other: array[_T]) -> bool: ...
def __mul__(self, n: int) -> array[_T]: ...
def __rmul__(self, n: int) -> array[_T]: ...
if sys.version_info < (3,):
def __delslice__(self, i: int, j: int) -> None: ...
def __getslice__(self, i: int, j: int) -> array[_T]: ...
def __setslice__(self, i: int, j: int, y: array[_T]) -> None: ...
ArrayType = array

View File

@@ -1,8 +1,7 @@
import asyncore
import socket
import sys
from abc import abstractmethod
from typing import Optional, Sequence, Tuple, Union
from typing import Optional, Union
class simple_producer:
def __init__(self, data: bytes, buffer_size: int = ...) -> None: ...
@@ -28,12 +27,3 @@ class async_chat(asyncore.dispatcher):
def close_when_done(self) -> None: ...
def initiate_send(self) -> None: ...
def discard_buffers(self) -> None: ...
if sys.version_info < (3, 0):
class fifo:
def __init__(self, list: Sequence[Union[bytes, simple_producer]] = ...) -> None: ...
def __len__(self) -> int: ...
def is_empty(self) -> bool: ...
def first(self) -> bytes: ...
def push(self, data: Union[bytes, simple_producer]) -> None: ...
def pop(self) -> Tuple[int, bytes]: ...

View File

@@ -59,36 +59,6 @@ class dispatcher:
def handle_connect(self) -> None: ...
def handle_accept(self) -> None: ...
def handle_close(self) -> None: ...
if sys.version_info < (3, 5):
# Historically, some methods were "imported" from `self.socket` by
# means of `__getattr__`. This was long deprecated, and as of Python
# 3.5 has been removed; simply call the relevant methods directly on
# self.socket if necessary.
def detach(self) -> int: ...
def fileno(self) -> int: ...
# return value is an address
def getpeername(self) -> Any: ...
def getsockname(self) -> Any: ...
@overload
def getsockopt(self, level: int, optname: int, buflen: None = ...) -> int: ...
@overload
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
def gettimeout(self) -> float: ...
def ioctl(self, control: object, option: Tuple[int, int, int]) -> None: ...
# TODO the return value may be BinaryIO or TextIO, depending on mode
def makefile(
self, mode: str = ..., buffering: int = ..., encoding: str = ..., errors: str = ..., newline: str = ...
) -> Any: ...
# return type is an address
def recvfrom(self, bufsize: int, flags: int = ...) -> Any: ...
def recvfrom_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ...
def recv_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ...
def sendall(self, data: bytes, flags: int = ...) -> None: ...
def sendto(self, data: bytes, address: Union[Tuple[str, int], str], flags: int = ...) -> int: ...
def setblocking(self, flag: bool) -> None: ...
def settimeout(self, value: Union[float, None]) -> None: ...
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
def shutdown(self, how: int) -> None: ...
class dispatcher_with_send(dispatcher):
def __init__(self, sock: SocketType = ..., map: Optional[_maptype] = ...) -> None: ...

View File

@@ -1,12 +1,8 @@
import sys
from typing import IO, Optional, Union
if sys.version_info >= (3, 0):
_encodable = bytes
_decodable = Union[bytes, str]
else:
_encodable = Union[bytes, unicode]
_decodable = Union[bytes, unicode]
_encodable = bytes
_decodable = Union[bytes, str]
def b64encode(s: _encodable, altchars: Optional[bytes] = ...) -> bytes: ...
def b64decode(s: _decodable, altchars: Optional[bytes] = ..., validate: bool = ...) -> bytes: ...
@@ -23,18 +19,14 @@ if sys.version_info >= (3, 10):
def b32hexencode(s: _encodable) -> bytes: ...
def b32hexdecode(s: _decodable, casefold: bool = ...) -> bytes: ...
if sys.version_info >= (3, 4):
def a85encode(b: _encodable, *, foldspaces: bool = ..., wrapcol: int = ..., pad: bool = ..., adobe: bool = ...) -> bytes: ...
def a85decode(b: _decodable, *, foldspaces: bool = ..., adobe: bool = ..., ignorechars: Union[str, bytes] = ...) -> bytes: ...
def b85encode(b: _encodable, pad: bool = ...) -> bytes: ...
def b85decode(b: _decodable) -> bytes: ...
def a85encode(b: _encodable, *, foldspaces: bool = ..., wrapcol: int = ..., pad: bool = ..., adobe: bool = ...) -> bytes: ...
def a85decode(b: _decodable, *, foldspaces: bool = ..., adobe: bool = ..., ignorechars: Union[str, bytes] = ...) -> bytes: ...
def b85encode(b: _encodable, pad: bool = ...) -> bytes: ...
def b85decode(b: _decodable) -> bytes: ...
def decode(input: IO[bytes], output: IO[bytes]) -> None: ...
def encode(input: IO[bytes], output: IO[bytes]) -> None: ...
if sys.version_info >= (3,):
def encodebytes(s: bytes) -> bytes: ...
def decodebytes(s: bytes) -> bytes: ...
def encodebytes(s: bytes) -> bytes: ...
def decodebytes(s: bytes) -> bytes: ...
if sys.version_info < (3, 9):
def encodestring(s: bytes) -> bytes: ...

View File

@@ -1,15 +1,10 @@
import sys
from typing import Text, Union
from typing import Union
if sys.version_info >= (3, 0):
# But since Python 3.3 ASCII-only unicode strings are accepted by the
# a2b_* functions.
_Bytes = bytes
_Ascii = Union[bytes, str]
else:
# Python 2 accepts unicode ascii pretty much everywhere.
_Bytes = Text
_Ascii = Text
# Since Python 3.3 ASCII-only unicode strings are accepted by the
# a2b_* functions.
_Bytes = bytes
_Ascii = Union[bytes, str]
def a2b_uu(__data: _Ascii) -> bytes: ...
@@ -20,13 +15,7 @@ else:
def b2a_uu(__data: _Bytes) -> bytes: ...
def a2b_base64(__data: _Ascii) -> bytes: ...
if sys.version_info >= (3, 6):
def b2a_base64(__data: _Bytes, *, newline: bool = ...) -> bytes: ...
else:
def b2a_base64(__data: _Bytes) -> bytes: ...
def b2a_base64(__data: _Bytes, *, newline: bool = ...) -> bytes: ...
def a2b_qp(data: _Ascii, header: bool = ...) -> bytes: ...
def b2a_qp(data: _Bytes, quotetabs: bool = ..., istext: bool = ..., header: bool = ...) -> bytes: ...
def a2b_hqx(__data: _Ascii) -> bytes: ...

View File

@@ -10,36 +10,36 @@ _T = TypeVar("_T")
def compress(data: bytes, compresslevel: int = ...) -> bytes: ...
def decompress(data: bytes) -> bytes: ...
if sys.version_info >= (3, 3):
_OpenBinaryMode = Literal["r", "rb", "w", "wb", "x", "xb", "a", "ab"]
_OpenTextMode = Literal["rt", "wt", "xt", "at"]
@overload
def open(
filename: _PathOrFile,
mode: _OpenBinaryMode = ...,
compresslevel: int = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
) -> BZ2File: ...
@overload
def open(
filename: AnyPath,
mode: _OpenTextMode,
compresslevel: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
) -> TextIO: ...
@overload
def open(
filename: _PathOrFile,
mode: str,
compresslevel: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
) -> Union[BZ2File, TextIO]: ...
_OpenBinaryMode = Literal["r", "rb", "w", "wb", "x", "xb", "a", "ab"]
_OpenTextMode = Literal["rt", "wt", "xt", "at"]
@overload
def open(
filename: _PathOrFile,
mode: _OpenBinaryMode = ...,
compresslevel: int = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
) -> BZ2File: ...
@overload
def open(
filename: AnyPath,
mode: _OpenTextMode,
compresslevel: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
) -> TextIO: ...
@overload
def open(
filename: _PathOrFile,
mode: str,
compresslevel: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
) -> Union[BZ2File, TextIO]: ...
class BZ2File(io.BufferedIOBase, IO[bytes]):
def __enter__(self: _T) -> _T: ...
@@ -64,15 +64,10 @@ class BZ2Compressor(object):
def flush(self) -> bytes: ...
class BZ2Decompressor(object):
if sys.version_info >= (3, 5):
def decompress(self, data: bytes, max_length: int = ...) -> bytes: ...
else:
def decompress(self, data: bytes) -> bytes: ...
if sys.version_info >= (3, 3):
@property
def eof(self) -> bool: ...
if sys.version_info >= (3, 5):
@property
def needs_input(self) -> bool: ...
def decompress(self, data: bytes, max_length: int = ...) -> bytes: ...
@property
def eof(self) -> bool: ...
@property
def needs_input(self) -> bool: ...
@property
def unused_data(self) -> bytes: ...

View File

@@ -77,17 +77,10 @@ class HTMLCalendar(Calendar):
cssclass_year: str
cssclass_year_head: str
if sys.version_info >= (3, 0):
class different_locale:
def __init__(self, locale: _LocaleType) -> None: ...
def __enter__(self) -> _LocaleType: ...
def __exit__(self, *args: Any) -> None: ...
else:
class TimeEncoding:
def __init__(self, locale: _LocaleType) -> None: ...
def __enter__(self) -> _LocaleType: ...
def __exit__(self, *args: Any) -> None: ...
class different_locale:
def __init__(self, locale: _LocaleType) -> None: ...
def __enter__(self) -> _LocaleType: ...
def __exit__(self, *args: Any) -> None: ...
class LocaleTextCalendar(TextCalendar):
def __init__(self, firstweekday: int = ..., locale: Optional[_LocaleType] = ...) -> None: ...

View File

@@ -1,14 +1,12 @@
import sys
from typing import SupportsComplex, SupportsFloat, Tuple, Union
e: float
pi: float
if sys.version_info >= (3, 6):
inf: float
infj: complex
nan: float
nanj: complex
tau: float
inf: float
infj: complex
nan: float
nanj: complex
tau: float
_C = Union[SupportsFloat, SupportsComplex, complex]
@@ -21,10 +19,7 @@ def atanh(__z: _C) -> complex: ...
def cos(__z: _C) -> complex: ...
def cosh(__z: _C) -> complex: ...
def exp(__z: _C) -> complex: ...
if sys.version_info >= (3, 5):
def isclose(a: _C, b: _C, *, rel_tol: SupportsFloat = ..., abs_tol: SupportsFloat = ...) -> bool: ...
def isclose(a: _C, b: _C, *, rel_tol: SupportsFloat = ..., abs_tol: SupportsFloat = ...) -> bool: ...
def isinf(__z: _C) -> bool: ...
def isnan(__z: _C) -> bool: ...
def log(__x: _C, __y_obj: _C = ...) -> complex: ...
@@ -37,6 +32,4 @@ def sinh(__z: _C) -> complex: ...
def sqrt(__z: _C) -> complex: ...
def tan(__z: _C) -> complex: ...
def tanh(__z: _C) -> complex: ...
if sys.version_info >= (3,):
def isfinite(__z: _C) -> bool: ...
def isfinite(__z: _C) -> bool: ...

View File

@@ -1,4 +1,3 @@
import sys
from types import CodeType
from typing import Any, Callable, Mapping, Optional
@@ -12,25 +11,15 @@ class InteractiveInterpreter:
class InteractiveConsole(InteractiveInterpreter):
def __init__(self, locals: Optional[Mapping[str, Any]] = ..., filename: str = ...) -> None: ...
if sys.version_info >= (3, 6):
def interact(self, banner: Optional[str] = ..., exitmsg: Optional[str] = ...) -> None: ...
else:
def interact(self, banner: Optional[str] = ...) -> None: ...
def interact(self, banner: Optional[str] = ..., exitmsg: Optional[str] = ...) -> None: ...
def push(self, line: str) -> bool: ...
def resetbuffer(self) -> None: ...
def raw_input(self, prompt: str = ...) -> str: ...
if sys.version_info >= (3, 6):
def interact(
banner: Optional[str] = ...,
readfunc: Optional[Callable[[str], str]] = ...,
local: Optional[Mapping[str, Any]] = ...,
exitmsg: Optional[str] = ...,
) -> None: ...
else:
def interact(
banner: Optional[str] = ..., readfunc: Optional[Callable[[str], str]] = ..., local: Optional[Mapping[str, Any]] = ...
) -> None: ...
def interact(
banner: Optional[str] = ...,
readfunc: Optional[Callable[[str], str]] = ...,
local: Optional[Mapping[str, Any]] = ...,
exitmsg: Optional[str] = ...,
) -> None: ...
def compile_command(source: str, filename: str = ..., symbol: str = ...) -> Optional[CodeType]: ...

View File

@@ -1,4 +1,3 @@
import sys
import types
from abc import abstractmethod
from typing import (
@@ -234,10 +233,7 @@ class StreamReaderWriter(TextIO):
def read(self, size: int = ...) -> _Decoded: ...
def readline(self, size: Optional[int] = ...) -> _Decoded: ...
def readlines(self, sizehint: Optional[int] = ...) -> List[_Decoded]: ...
if sys.version_info >= (3,):
def __next__(self) -> Text: ...
else:
def next(self) -> Text: ...
def __next__(self) -> Text: ...
def __iter__(self: _T) -> _T: ...
# This actually returns None, but that's incompatible with the supertype
def write(self, data: _Decoded) -> int: ...
@@ -277,10 +273,7 @@ class StreamRecoder(BinaryIO):
def read(self, size: int = ...) -> bytes: ...
def readline(self, size: Optional[int] = ...) -> bytes: ...
def readlines(self, sizehint: Optional[int] = ...) -> List[bytes]: ...
if sys.version_info >= (3,):
def __next__(self) -> bytes: ...
else:
def next(self) -> bytes: ...
def __next__(self) -> bytes: ...
def __iter__(self: _SRT) -> _SRT: ...
def write(self, data: bytes) -> int: ...
def writelines(self, list: Iterable[bytes]) -> int: ... # type: ignore # it's supposed to return None

View File

@@ -26,10 +26,8 @@ class ThreadPoolExecutor(Executor):
initializer: Optional[Callable[..., None]] = ...,
initargs: Tuple[Any, ...] = ...,
) -> None: ...
elif sys.version_info >= (3, 6):
def __init__(self, max_workers: Optional[int] = ..., thread_name_prefix: str = ...) -> None: ...
else:
def __init__(self, max_workers: Optional[int] = ...) -> None: ...
def __init__(self, max_workers: Optional[int] = ..., thread_name_prefix: str = ...) -> None: ...
class _WorkItem(Generic[_S]):
future: Future[_S]

View File

@@ -1,13 +1,21 @@
import sys
from types import TracebackType
from typing import IO, Any, Callable, ContextManager, Iterable, Iterator, Optional, Type, TypeVar, overload
from typing import (
IO,
Any,
AsyncContextManager,
AsyncIterator,
Callable,
ContextManager,
Iterator,
Optional,
Type,
TypeVar,
overload,
)
from typing_extensions import Protocol
if sys.version_info >= (3, 5):
from typing import AsyncContextManager, AsyncIterator
if sys.version_info >= (3, 6):
AbstractContextManager = ContextManager
AbstractContextManager = ContextManager
if sys.version_info >= (3, 7):
AbstractAsyncContextManager = AsyncContextManager
@@ -19,22 +27,14 @@ _F = TypeVar("_F", bound=Callable[..., Any])
_ExitFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], bool]
_CM_EF = TypeVar("_CM_EF", ContextManager[Any], _ExitFunc)
if sys.version_info >= (3, 2):
class _GeneratorContextManager(ContextManager[_T_co]):
def __call__(self, func: _F) -> _F: ...
def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., _GeneratorContextManager[_T]]: ...
class _GeneratorContextManager(ContextManager[_T_co]):
def __call__(self, func: _F) -> _F: ...
else:
class GeneratorContextManager(ContextManager[_T_co]):
def __call__(self, func: _F) -> _F: ...
def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., ContextManager[_T]]: ...
def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., _GeneratorContextManager[_T]]: ...
if sys.version_info >= (3, 7):
def asynccontextmanager(func: Callable[..., AsyncIterator[_T]]) -> Callable[..., AsyncContextManager[_T]]: ...
if sys.version_info < (3,):
def nested(*mgr: ContextManager[Any]) -> ContextManager[Iterable[Any]]: ...
class _SupportsClose(Protocol):
def close(self) -> None: ...
@@ -50,37 +50,37 @@ if sys.version_info >= (3, 10):
class aclosing(AsyncContextManager[_SupportsAcloseT]):
def __init__(self, thing: _SupportsAcloseT) -> None: ...
if sys.version_info >= (3, 4):
class suppress(ContextManager[None]):
def __init__(self, *exceptions: Type[BaseException]) -> None: ...
def __exit__(
self, exctype: Optional[Type[BaseException]], excinst: Optional[BaseException], exctb: Optional[TracebackType]
) -> bool: ...
class redirect_stdout(ContextManager[_T_io]):
def __init__(self, new_target: _T_io) -> None: ...
class suppress(ContextManager[None]):
def __init__(self, *exceptions: Type[BaseException]) -> None: ...
def __exit__(
self, exctype: Optional[Type[BaseException]], excinst: Optional[BaseException], exctb: Optional[TracebackType]
) -> bool: ...
if sys.version_info >= (3, 5):
class redirect_stderr(ContextManager[_T_io]):
def __init__(self, new_target: _T_io) -> None: ...
class redirect_stdout(ContextManager[_T_io]):
def __init__(self, new_target: _T_io) -> None: ...
if sys.version_info >= (3,):
class ContextDecorator:
def __call__(self, func: _F) -> _F: ...
_U = TypeVar("_U", bound=ExitStack)
class ExitStack(ContextManager[ExitStack]):
def __init__(self) -> None: ...
def enter_context(self, cm: ContextManager[_T]) -> _T: ...
def push(self, exit: _CM_EF) -> _CM_EF: ...
def callback(self, callback: Callable[..., Any], *args: Any, **kwds: Any) -> Callable[..., Any]: ...
def pop_all(self: _U) -> _U: ...
def close(self) -> None: ...
def __enter__(self: _U) -> _U: ...
def __exit__(
self,
__exc_type: Optional[Type[BaseException]],
__exc_value: Optional[BaseException],
__traceback: Optional[TracebackType],
) -> bool: ...
class redirect_stderr(ContextManager[_T_io]):
def __init__(self, new_target: _T_io) -> None: ...
class ContextDecorator:
def __call__(self, func: _F) -> _F: ...
_U = TypeVar("_U", bound=ExitStack)
class ExitStack(ContextManager[ExitStack]):
def __init__(self) -> None: ...
def enter_context(self, cm: ContextManager[_T]) -> _T: ...
def push(self, exit: _CM_EF) -> _CM_EF: ...
def callback(self, callback: Callable[..., Any], *args: Any, **kwds: Any) -> Callable[..., Any]: ...
def pop_all(self: _U) -> _U: ...
def close(self) -> None: ...
def __enter__(self: _U) -> _U: ...
def __exit__(
self,
__exc_type: Optional[Type[BaseException]],
__exc_value: Optional[BaseException],
__traceback: Optional[TracebackType],
) -> bool: ...
if sys.version_info >= (3, 7):
from typing import Awaitable

View File

@@ -1,22 +1,21 @@
import sys
from typing import List, Optional, Union
if sys.version_info >= (3, 3):
class _Method: ...
METHOD_CRYPT: _Method
METHOD_MD5: _Method
METHOD_SHA256: _Method
METHOD_SHA512: _Method
if sys.version_info >= (3, 7):
METHOD_BLOWFISH: _Method
class _Method: ...
methods: List[_Method]
METHOD_CRYPT: _Method
METHOD_MD5: _Method
METHOD_SHA256: _Method
METHOD_SHA512: _Method
if sys.version_info >= (3, 7):
METHOD_BLOWFISH: _Method
if sys.version_info >= (3, 7):
def mksalt(method: Optional[_Method] = ..., *, rounds: Optional[int] = ...) -> str: ...
else:
def mksalt(method: Optional[_Method] = ...) -> str: ...
def crypt(word: str, salt: Optional[Union[str, _Method]] = ...) -> str: ...
methods: List[_Method]
if sys.version_info >= (3, 7):
def mksalt(method: Optional[_Method] = ..., *, rounds: Optional[int] = ...) -> str: ...
else:
def crypt(word: str, salt: str) -> str: ...
def mksalt(method: Optional[_Method] = ...) -> str: ...
def crypt(word: str, salt: Optional[Union[str, _Method]] = ...) -> str: ...

View File

@@ -19,7 +19,7 @@ from _csv import (
)
from typing import Any, Generic, Iterable, Iterator, List, Mapping, Optional, Sequence, Text, Type, TypeVar, overload
if sys.version_info >= (3, 8) or sys.version_info < (3, 6):
if sys.version_info >= (3, 8):
from typing import Dict as _DictReadMapping
else:
from collections import OrderedDict as _DictReadMapping
@@ -37,14 +37,13 @@ class excel(Dialect):
class excel_tab(excel):
delimiter: str
if sys.version_info >= (3,):
class unix_dialect(Dialect):
delimiter: str
quotechar: str
doublequote: bool
skipinitialspace: bool
lineterminator: str
quoting: int
class unix_dialect(Dialect):
delimiter: str
quotechar: str
doublequote: bool
skipinitialspace: bool
lineterminator: str
quoting: int
class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
fieldnames: Optional[Sequence[_T]]
@@ -76,10 +75,7 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
**kwds: Any,
) -> None: ...
def __iter__(self) -> DictReader[_T]: ...
if sys.version_info >= (3,):
def __next__(self) -> _DictReadMapping[_T, str]: ...
else:
def next(self) -> _DictReadMapping[_T, str]: ...
def __next__(self) -> _DictReadMapping[_T, str]: ...
class DictWriter(Generic[_T]):
fieldnames: Sequence[_T]

View File

@@ -200,10 +200,6 @@ class pointer(Generic[_CT], _PointerLike, _CData):
def __setitem__(self, s: slice, o: Iterable[_CT]) -> None: ...
def resize(obj: _CData, size: int) -> None: ...
if sys.version_info < (3,):
def set_conversion_mode(encoding: str, errors: str) -> Tuple[str, str]: ...
def set_errno(value: int) -> int: ...
if sys.platform == "win32":

View File

@@ -1,14 +1,10 @@
import sys
from time import struct_time
from typing import AnyStr, ClassVar, NamedTuple, Optional, SupportsAbs, Tuple, Type, TypeVar, Union, overload
from typing import ClassVar, NamedTuple, Optional, SupportsAbs, Tuple, Type, TypeVar, overload
_S = TypeVar("_S")
if sys.version_info >= (3,):
_Text = str
else:
_Text = Union[str, unicode]
_Text = str
MINYEAR: int
MAXYEAR: int
@@ -18,13 +14,12 @@ class tzinfo:
def dst(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
def fromutc(self, dt: datetime) -> datetime: ...
if sys.version_info >= (3, 2):
class timezone(tzinfo):
utc: ClassVar[timezone]
min: ClassVar[timezone]
max: ClassVar[timezone]
def __init__(self, offset: timedelta, name: str = ...) -> None: ...
def __hash__(self) -> int: ...
class timezone(tzinfo):
utc: ClassVar[timezone]
min: ClassVar[timezone]
max: ClassVar[timezone]
def __init__(self, offset: timedelta, name: str = ...) -> None: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 9):
class _IsoCalendarDate(NamedTuple):
@@ -59,10 +54,7 @@ class date:
def day(self) -> int: ...
def ctime(self) -> str: ...
def strftime(self, fmt: _Text) -> str: ...
if sys.version_info >= (3,):
def __format__(self, fmt: str) -> str: ...
else:
def __format__(self, fmt: AnyStr) -> AnyStr: ...
def __format__(self, fmt: str) -> str: ...
def isoformat(self) -> str: ...
def timetuple(self) -> struct_time: ...
def toordinal(self) -> int: ...
@@ -93,22 +85,16 @@ class time:
min: ClassVar[time]
max: ClassVar[time]
resolution: ClassVar[timedelta]
if sys.version_info >= (3, 6):
def __init__(
self,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
*,
fold: int = ...,
) -> None: ...
else:
def __init__(
self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: Optional[_tzinfo] = ...
) -> None: ...
def __init__(
self,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
*,
fold: int = ...,
) -> None: ...
@property
def hour(self) -> int: ...
@property
@@ -119,44 +105,32 @@ class time:
def microsecond(self) -> int: ...
@property
def tzinfo(self) -> Optional[_tzinfo]: ...
if sys.version_info >= (3, 6):
@property
def fold(self) -> int: ...
@property
def fold(self) -> int: ...
def __le__(self, other: time) -> bool: ...
def __lt__(self, other: time) -> bool: ...
def __ge__(self, other: time) -> bool: ...
def __gt__(self, other: time) -> bool: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 6):
def isoformat(self, timespec: str = ...) -> str: ...
else:
def isoformat(self) -> str: ...
def isoformat(self, timespec: str = ...) -> str: ...
if sys.version_info >= (3, 7):
@classmethod
def fromisoformat(cls: Type[_S], time_string: str) -> _S: ...
def strftime(self, fmt: _Text) -> str: ...
if sys.version_info >= (3,):
def __format__(self, fmt: str) -> str: ...
else:
def __format__(self, fmt: AnyStr) -> AnyStr: ...
def __format__(self, fmt: str) -> str: ...
def utcoffset(self) -> Optional[timedelta]: ...
def tzname(self) -> Optional[str]: ...
def dst(self) -> Optional[timedelta]: ...
if sys.version_info >= (3, 6):
def replace(
self,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
*,
fold: int = ...,
) -> time: ...
else:
def replace(
self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: Optional[_tzinfo] = ...
) -> time: ...
def replace(
self,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
*,
fold: int = ...,
) -> time: ...
_date = date
_time = time
@@ -165,31 +139,18 @@ class timedelta(SupportsAbs[timedelta]):
min: ClassVar[timedelta]
max: ClassVar[timedelta]
resolution: ClassVar[timedelta]
if sys.version_info >= (3, 6):
def __init__(
self,
days: float = ...,
seconds: float = ...,
microseconds: float = ...,
milliseconds: float = ...,
minutes: float = ...,
hours: float = ...,
weeks: float = ...,
*,
fold: int = ...,
) -> None: ...
else:
def __init__(
self,
days: float = ...,
seconds: float = ...,
microseconds: float = ...,
milliseconds: float = ...,
minutes: float = ...,
hours: float = ...,
weeks: float = ...,
) -> None: ...
def __init__(
self,
days: float = ...,
seconds: float = ...,
microseconds: float = ...,
milliseconds: float = ...,
minutes: float = ...,
hours: float = ...,
weeks: float = ...,
*,
fold: int = ...,
) -> None: ...
@property
def days(self) -> int: ...
@property
@@ -210,18 +171,12 @@ class timedelta(SupportsAbs[timedelta]):
def __floordiv__(self, other: timedelta) -> int: ...
@overload
def __floordiv__(self, other: int) -> timedelta: ...
if sys.version_info >= (3,):
@overload
def __truediv__(self, other: timedelta) -> float: ...
@overload
def __truediv__(self, other: float) -> timedelta: ...
def __mod__(self, other: timedelta) -> timedelta: ...
def __divmod__(self, other: timedelta) -> Tuple[int, timedelta]: ...
else:
@overload
def __div__(self, other: timedelta) -> float: ...
@overload
def __div__(self, other: float) -> timedelta: ...
@overload
def __truediv__(self, other: timedelta) -> float: ...
@overload
def __truediv__(self, other: float) -> timedelta: ...
def __mod__(self, other: timedelta) -> timedelta: ...
def __divmod__(self, other: timedelta) -> Tuple[int, timedelta]: ...
def __le__(self, other: timedelta) -> bool: ...
def __lt__(self, other: timedelta) -> bool: ...
def __ge__(self, other: timedelta) -> bool: ...
@@ -232,33 +187,19 @@ class datetime(date):
min: ClassVar[datetime]
max: ClassVar[datetime]
resolution: ClassVar[timedelta]
if sys.version_info >= (3, 6):
def __new__(
cls: Type[_S],
year: int,
month: int,
day: int,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
*,
fold: int = ...,
) -> _S: ...
else:
def __new__(
cls: Type[_S],
year: int,
month: int,
day: int,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
) -> _S: ...
def __new__(
cls: Type[_S],
year: int,
month: int,
day: int,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
*,
fold: int = ...,
) -> _S: ...
@property
def year(self) -> int: ...
@property
@@ -275,9 +216,8 @@ class datetime(date):
def microsecond(self) -> int: ...
@property
def tzinfo(self) -> Optional[_tzinfo]: ...
if sys.version_info >= (3, 6):
@property
def fold(self) -> int: ...
@property
def fold(self) -> int: ...
@classmethod
def fromtimestamp(cls: Type[_S], t: float, tz: Optional[_tzinfo] = ...) -> _S: ...
@classmethod
@@ -298,65 +238,39 @@ class datetime(date):
def now(cls, tz: _tzinfo) -> datetime: ...
@classmethod
def utcnow(cls: Type[_S]) -> _S: ...
if sys.version_info >= (3, 6):
@classmethod
def combine(cls, date: _date, time: _time, tzinfo: Optional[_tzinfo] = ...) -> datetime: ...
else:
@classmethod
def combine(cls, date: _date, time: _time) -> datetime: ...
@classmethod
def combine(cls, date: _date, time: _time, tzinfo: Optional[_tzinfo] = ...) -> datetime: ...
if sys.version_info >= (3, 7):
@classmethod
def fromisoformat(cls: Type[_S], date_string: str) -> _S: ...
def strftime(self, fmt: _Text) -> str: ...
if sys.version_info >= (3,):
def __format__(self, fmt: str) -> str: ...
else:
def __format__(self, fmt: AnyStr) -> AnyStr: ...
def __format__(self, fmt: str) -> str: ...
def toordinal(self) -> int: ...
def timetuple(self) -> struct_time: ...
if sys.version_info >= (3, 3):
def timestamp(self) -> float: ...
def timestamp(self) -> float: ...
def utctimetuple(self) -> struct_time: ...
def date(self) -> _date: ...
def time(self) -> _time: ...
def timetz(self) -> _time: ...
if sys.version_info >= (3, 6):
def replace(
self,
year: int = ...,
month: int = ...,
day: int = ...,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
*,
fold: int = ...,
) -> datetime: ...
else:
def replace(
self,
year: int = ...,
month: int = ...,
day: int = ...,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
) -> datetime: ...
def replace(
self,
year: int = ...,
month: int = ...,
day: int = ...,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
*,
fold: int = ...,
) -> datetime: ...
if sys.version_info >= (3, 8):
def astimezone(self: _S, tz: Optional[_tzinfo] = ...) -> _S: ...
elif sys.version_info >= (3, 3):
else:
def astimezone(self, tz: Optional[_tzinfo] = ...) -> datetime: ...
else:
def astimezone(self, tz: _tzinfo) -> datetime: ...
def ctime(self) -> str: ...
if sys.version_info >= (3, 6):
def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
else:
def isoformat(self, sep: str = ...) -> str: ...
def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
@classmethod
def strptime(cls, date_string: _Text, format: _Text) -> datetime: ...
def utcoffset(self) -> Optional[timedelta]: ...

View File

@@ -1,14 +1,10 @@
import numbers
import sys
from types import TracebackType
from typing import Any, Container, Dict, List, NamedTuple, Optional, Sequence, Text, Tuple, Type, TypeVar, Union, overload
_Decimal = Union[Decimal, int]
_DecimalNew = Union[Decimal, float, Text, Tuple[int, Sequence[int], int]]
if sys.version_info >= (3,):
_ComparableNum = Union[Decimal, float, numbers.Rational]
else:
_ComparableNum = Union[Decimal, float]
_ComparableNum = Union[Decimal, float, numbers.Rational]
_DecimalT = TypeVar("_DecimalT", bound=Decimal)
class DecimalTuple(NamedTuple):
@@ -25,17 +21,13 @@ ROUND_UP: str
ROUND_HALF_DOWN: str
ROUND_05UP: str
if sys.version_info >= (3,):
HAVE_THREADS: bool
MAX_EMAX: int
MAX_PREC: int
MIN_EMIN: int
MIN_ETINY: int
class DecimalException(ArithmeticError):
if sys.version_info < (3,):
def handle(self, context: Context, *args: Any) -> Optional[Decimal]: ...
HAVE_THREADS: bool
MAX_EMAX: int
MAX_PREC: int
MIN_EMIN: int
MIN_ETINY: int
class DecimalException(ArithmeticError): ...
class Clamped(DecimalException): ...
class InvalidOperation(DecimalException): ...
class ConversionSyntax(InvalidOperation): ...
@@ -48,9 +40,7 @@ class Rounded(DecimalException): ...
class Subnormal(DecimalException): ...
class Overflow(Inexact, Rounded): ...
class Underflow(Inexact, Rounded, Subnormal): ...
if sys.version_info >= (3,):
class FloatOperation(DecimalException, TypeError): ...
class FloatOperation(DecimalException, TypeError): ...
def setcontext(__context: Context) -> None: ...
def getcontext() -> Context: ...
@@ -60,69 +50,36 @@ class Decimal(object):
def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Optional[Context] = ...) -> _DecimalT: ...
@classmethod
def from_float(cls, __f: float) -> Decimal: ...
if sys.version_info >= (3,):
def __bool__(self) -> bool: ...
else:
def __nonzero__(self) -> bool: ...
def __div__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rdiv__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __ne__(self, other: object, context: Optional[Context] = ...) -> bool: ...
def __bool__(self) -> bool: ...
def compare(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __hash__(self) -> int: ...
def as_tuple(self) -> DecimalTuple: ...
if sys.version_info >= (3, 6):
def as_integer_ratio(self) -> Tuple[int, int]: ...
def as_integer_ratio(self) -> Tuple[int, int]: ...
def to_eng_string(self, context: Optional[Context] = ...) -> str: ...
if sys.version_info >= (3,):
def __abs__(self) -> Decimal: ...
def __add__(self, other: _Decimal) -> Decimal: ...
def __divmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ...
def __eq__(self, other: object) -> bool: ...
def __floordiv__(self, other: _Decimal) -> Decimal: ...
def __ge__(self, other: _ComparableNum) -> bool: ...
def __gt__(self, other: _ComparableNum) -> bool: ...
def __le__(self, other: _ComparableNum) -> bool: ...
def __lt__(self, other: _ComparableNum) -> bool: ...
def __mod__(self, other: _Decimal) -> Decimal: ...
def __mul__(self, other: _Decimal) -> Decimal: ...
def __neg__(self) -> Decimal: ...
def __pos__(self) -> Decimal: ...
def __pow__(self, other: _Decimal, modulo: Optional[_Decimal] = ...) -> Decimal: ...
def __radd__(self, other: _Decimal) -> Decimal: ...
def __rdivmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ...
def __rfloordiv__(self, other: _Decimal) -> Decimal: ...
def __rmod__(self, other: _Decimal) -> Decimal: ...
def __rmul__(self, other: _Decimal) -> Decimal: ...
def __rsub__(self, other: _Decimal) -> Decimal: ...
def __rtruediv__(self, other: _Decimal) -> Decimal: ...
def __str__(self) -> str: ...
def __sub__(self, other: _Decimal) -> Decimal: ...
def __truediv__(self, other: _Decimal) -> Decimal: ...
else:
def __abs__(self, round: bool = ..., context: Optional[Context] = ...) -> Decimal: ...
def __add__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __divmod__(self, other: _Decimal, context: Optional[Context] = ...) -> Tuple[Decimal, Decimal]: ...
def __eq__(self, other: object, context: Optional[Context] = ...) -> bool: ...
def __floordiv__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __ge__(self, other: _ComparableNum, context: Optional[Context] = ...) -> bool: ...
def __gt__(self, other: _ComparableNum, context: Optional[Context] = ...) -> bool: ...
def __le__(self, other: _ComparableNum, context: Optional[Context] = ...) -> bool: ...
def __lt__(self, other: _ComparableNum, context: Optional[Context] = ...) -> bool: ...
def __mod__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __mul__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __neg__(self, context: Optional[Context] = ...) -> Decimal: ...
def __pos__(self, context: Optional[Context] = ...) -> Decimal: ...
def __pow__(self, other: _Decimal, modulo: Optional[_Decimal] = ..., context: Optional[Context] = ...) -> Decimal: ...
def __radd__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rdivmod__(self, other: _Decimal, context: Optional[Context] = ...) -> Tuple[Decimal, Decimal]: ...
def __rfloordiv__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rmod__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rmul__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rsub__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rtruediv__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __str__(self, eng: bool = ..., context: Optional[Context] = ...) -> str: ...
def __sub__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __truediv__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __abs__(self) -> Decimal: ...
def __add__(self, other: _Decimal) -> Decimal: ...
def __divmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ...
def __eq__(self, other: object) -> bool: ...
def __floordiv__(self, other: _Decimal) -> Decimal: ...
def __ge__(self, other: _ComparableNum) -> bool: ...
def __gt__(self, other: _ComparableNum) -> bool: ...
def __le__(self, other: _ComparableNum) -> bool: ...
def __lt__(self, other: _ComparableNum) -> bool: ...
def __mod__(self, other: _Decimal) -> Decimal: ...
def __mul__(self, other: _Decimal) -> Decimal: ...
def __neg__(self) -> Decimal: ...
def __pos__(self) -> Decimal: ...
def __pow__(self, other: _Decimal, modulo: Optional[_Decimal] = ...) -> Decimal: ...
def __radd__(self, other: _Decimal) -> Decimal: ...
def __rdivmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ...
def __rfloordiv__(self, other: _Decimal) -> Decimal: ...
def __rmod__(self, other: _Decimal) -> Decimal: ...
def __rmul__(self, other: _Decimal) -> Decimal: ...
def __rsub__(self, other: _Decimal) -> Decimal: ...
def __rtruediv__(self, other: _Decimal) -> Decimal: ...
def __str__(self) -> str: ...
def __sub__(self, other: _Decimal) -> Decimal: ...
def __truediv__(self, other: _Decimal) -> Decimal: ...
def remainder_near(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __float__(self) -> float: ...
def __int__(self) -> int: ...
@@ -133,26 +90,17 @@ class Decimal(object):
def imag(self) -> Decimal: ...
def conjugate(self) -> Decimal: ...
def __complex__(self) -> complex: ...
if sys.version_info >= (3,):
@overload
def __round__(self) -> int: ...
@overload
def __round__(self, ndigits: int) -> Decimal: ...
def __floor__(self) -> int: ...
def __ceil__(self) -> int: ...
else:
def __long__(self) -> long: ...
@overload
def __round__(self) -> int: ...
@overload
def __round__(self, ndigits: int) -> Decimal: ...
def __floor__(self) -> int: ...
def __ceil__(self) -> int: ...
def fma(self, other: _Decimal, third: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rpow__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def normalize(self, context: Optional[Context] = ...) -> Decimal: ...
if sys.version_info >= (3,):
def quantize(self, exp: _Decimal, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
def same_quantum(self, other: _Decimal, context: Optional[Context] = ...) -> bool: ...
else:
def quantize(
self, exp: _Decimal, rounding: Optional[str] = ..., context: Optional[Context] = ..., watchexp: bool = ...
) -> Decimal: ...
def same_quantum(self, other: _Decimal) -> bool: ...
def quantize(self, exp: _Decimal, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
def same_quantum(self, other: _Decimal, context: Optional[Context] = ...) -> bool: ...
def to_integral_exact(self, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
def to_integral_value(self, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
def to_integral(self, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
@@ -160,23 +108,13 @@ class Decimal(object):
def max(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def min(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def adjusted(self) -> int: ...
if sys.version_info >= (3,):
def canonical(self) -> Decimal: ...
else:
def canonical(self, context: Optional[Context] = ...) -> Decimal: ...
def canonical(self) -> Decimal: ...
def compare_signal(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
if sys.version_info >= (3,):
def compare_total(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def compare_total_mag(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
else:
def compare_total(self, other: _Decimal) -> Decimal: ...
def compare_total_mag(self, other: _Decimal) -> Decimal: ...
def compare_total(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def compare_total_mag(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def copy_abs(self) -> Decimal: ...
def copy_negate(self) -> Decimal: ...
if sys.version_info >= (3,):
def copy_sign(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
else:
def copy_sign(self, other: _Decimal) -> Decimal: ...
def copy_sign(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def exp(self, context: Optional[Context] = ...) -> Decimal: ...
def is_canonical(self) -> bool: ...
def is_finite(self) -> bool: ...
@@ -225,46 +163,27 @@ class Context(object):
Emin: int
Emax: int
capitals: int
if sys.version_info >= (3,):
clamp: int
else:
_clamp: int
clamp: int
traps: Dict[_TrapType, bool]
flags: Dict[_TrapType, bool]
if sys.version_info >= (3,):
def __init__(
self,
prec: Optional[int] = ...,
rounding: Optional[str] = ...,
Emin: Optional[int] = ...,
Emax: Optional[int] = ...,
capitals: Optional[int] = ...,
clamp: Optional[int] = ...,
flags: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ...,
traps: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ...,
_ignored_flags: Optional[List[_TrapType]] = ...,
) -> None: ...
else:
def __init__(
self,
prec: Optional[int] = ...,
rounding: Optional[str] = ...,
traps: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ...,
flags: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ...,
Emin: Optional[int] = ...,
Emax: Optional[int] = ...,
capitals: Optional[int] = ...,
_clamp: Optional[int] = ...,
_ignored_flags: Optional[List[_TrapType]] = ...,
) -> None: ...
if sys.version_info >= (3,):
# __setattr__() only allows to set a specific set of attributes,
# already defined above.
def __delattr__(self, name: str) -> None: ...
def __reduce__(self) -> Tuple[Type[Context], Tuple[Any, ...]]: ...
def __init__(
self,
prec: Optional[int] = ...,
rounding: Optional[str] = ...,
Emin: Optional[int] = ...,
Emax: Optional[int] = ...,
capitals: Optional[int] = ...,
clamp: Optional[int] = ...,
flags: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ...,
traps: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ...,
_ignored_flags: Optional[List[_TrapType]] = ...,
) -> None: ...
# __setattr__() only allows to set a specific set of attributes,
# already defined above.
def __delattr__(self, name: str) -> None: ...
def __reduce__(self) -> Tuple[Type[Context], Tuple[Any, ...]]: ...
def clear_flags(self) -> None: ...
if sys.version_info >= (3,):
def clear_traps(self) -> None: ...
def clear_traps(self) -> None: ...
def copy(self) -> Context: ...
def __copy__(self) -> Context: ...
__hash__: Any = ...

View File

@@ -21,13 +21,7 @@ if sys.version_info >= (3, 9):
from types import GenericAlias
_T = TypeVar("_T")
if sys.version_info >= (3,):
_StrType = Text
else:
# Aliases can't point to type vars, so we need to redeclare AnyStr
_StrType = TypeVar("_StrType", Text, bytes)
_StrType = Text
_JunkCallback = Union[Callable[[Text], bool], Callable[[str], bool]]
class Match(NamedTuple):
@@ -105,28 +99,17 @@ class HtmlDiff(object):
linejunk: Optional[_JunkCallback] = ...,
charjunk: Optional[_JunkCallback] = ...,
) -> None: ...
if sys.version_info >= (3, 5):
def make_file(
self,
fromlines: Sequence[_StrType],
tolines: Sequence[_StrType],
fromdesc: _StrType = ...,
todesc: _StrType = ...,
context: bool = ...,
numlines: int = ...,
*,
charset: str = ...,
) -> _StrType: ...
else:
def make_file(
self,
fromlines: Sequence[_StrType],
tolines: Sequence[_StrType],
fromdesc: _StrType = ...,
todesc: _StrType = ...,
context: bool = ...,
numlines: int = ...,
) -> _StrType: ...
def make_file(
self,
fromlines: Sequence[_StrType],
tolines: Sequence[_StrType],
fromdesc: _StrType = ...,
todesc: _StrType = ...,
context: bool = ...,
numlines: int = ...,
*,
charset: str = ...,
) -> _StrType: ...
def make_table(
self,
fromlines: Sequence[_StrType],
@@ -138,16 +121,14 @@ class HtmlDiff(object):
) -> _StrType: ...
def restore(delta: Iterable[_StrType], which: int) -> Iterator[_StrType]: ...
if sys.version_info >= (3, 5):
def diff_bytes(
dfunc: Callable[[Sequence[str], Sequence[str], str, str, str, str, int, str], Iterator[str]],
a: Sequence[bytes],
b: Sequence[bytes],
fromfile: bytes = ...,
tofile: bytes = ...,
fromfiledate: bytes = ...,
tofiledate: bytes = ...,
n: int = ...,
lineterm: bytes = ...,
) -> Iterator[bytes]: ...
def diff_bytes(
dfunc: Callable[[Sequence[str], Sequence[str], str, str, str, str, int, str], Iterator[str]],
a: Sequence[bytes],
b: Sequence[bytes],
fromfile: bytes = ...,
tofile: bytes = ...,
fromfiledate: bytes = ...,
tofiledate: bytes = ...,
n: int = ...,
lineterm: bytes = ...,
) -> Iterator[bytes]: ...

View File

@@ -11,73 +11,56 @@ from opcode import (
hasjrel as hasjrel,
haslocal as haslocal,
hasname as hasname,
hasnargs as hasnargs,
opmap as opmap,
opname as opname,
stack_effect as stack_effect,
)
from typing import IO, Any, Callable, Dict, Iterator, List, NamedTuple, Optional, Tuple, Union
if sys.version_info >= (3, 4):
from opcode import stack_effect as stack_effect
if sys.version_info >= (3, 6):
from opcode import hasnargs as hasnargs
# Strictly this should not have to include Callable, but mypy doesn't use FunctionType
# for functions (python/mypy#3171)
_have_code = Union[types.MethodType, types.FunctionType, types.CodeType, type, Callable[..., Any]]
_have_code_or_string = Union[_have_code, str, bytes]
if sys.version_info >= (3, 4):
class Instruction(NamedTuple):
opname: str
opcode: int
arg: Optional[int]
argval: Any
argrepr: str
offset: int
starts_line: Optional[int]
is_jump_target: bool
class Bytecode:
codeobj: types.CodeType
first_line: int
def __init__(
self, x: _have_code_or_string, *, first_line: Optional[int] = ..., current_offset: Optional[int] = ...
) -> None: ...
def __iter__(self) -> Iterator[Instruction]: ...
def __repr__(self) -> str: ...
def info(self) -> str: ...
def dis(self) -> str: ...
@classmethod
def from_traceback(cls, tb: types.TracebackType) -> Bytecode: ...
class Instruction(NamedTuple):
opname: str
opcode: int
arg: Optional[int]
argval: Any
argrepr: str
offset: int
starts_line: Optional[int]
is_jump_target: bool
class Bytecode:
codeobj: types.CodeType
first_line: int
def __init__(
self, x: _have_code_or_string, *, first_line: Optional[int] = ..., current_offset: Optional[int] = ...
) -> None: ...
def __iter__(self) -> Iterator[Instruction]: ...
def __repr__(self) -> str: ...
def info(self) -> str: ...
def dis(self) -> str: ...
@classmethod
def from_traceback(cls, tb: types.TracebackType) -> Bytecode: ...
COMPILER_FLAG_NAMES: Dict[int, str]
def findlabels(code: _have_code) -> List[int]: ...
def findlinestarts(code: _have_code) -> Iterator[Tuple[int, int]]: ...
if sys.version_info >= (3, 0):
def pretty_flags(flags: int) -> str: ...
def code_info(x: _have_code_or_string) -> str: ...
def pretty_flags(flags: int) -> str: ...
def code_info(x: _have_code_or_string) -> str: ...
if sys.version_info >= (3, 7):
def dis(x: Optional[_have_code_or_string] = ..., *, file: Optional[IO[str]] = ..., depth: Optional[int] = ...) -> None: ...
elif sys.version_info >= (3, 4):
else:
def dis(x: Optional[_have_code_or_string] = ..., *, file: Optional[IO[str]] = ...) -> None: ...
else:
def dis(x: _have_code_or_string = ...) -> None: ...
if sys.version_info >= (3, 4):
def distb(tb: Optional[types.TracebackType] = ..., *, file: Optional[IO[str]] = ...) -> None: ...
def disassemble(co: _have_code, lasti: int = ..., *, file: Optional[IO[str]] = ...) -> None: ...
def disco(co: _have_code, lasti: int = ..., *, file: Optional[IO[str]] = ...) -> None: ...
def show_code(co: _have_code, *, file: Optional[IO[str]] = ...) -> None: ...
def get_instructions(x: _have_code, *, first_line: Optional[int] = ...) -> Iterator[Instruction]: ...
else:
def distb(tb: types.TracebackType = ...) -> None: ...
def disassemble(co: _have_code, lasti: int = ...) -> None: ...
def disco(co: _have_code, lasti: int = ...) -> None: ...
if sys.version_info >= (3, 0):
def show_code(co: _have_code) -> None: ...
def distb(tb: Optional[types.TracebackType] = ..., *, file: Optional[IO[str]] = ...) -> None: ...
def disassemble(co: _have_code, lasti: int = ..., *, file: Optional[IO[str]] = ...) -> None: ...
def disco(co: _have_code, lasti: int = ..., *, file: Optional[IO[str]] = ...) -> None: ...
def show_code(co: _have_code, *, file: Optional[IO[str]] = ...) -> None: ...
def get_instructions(x: _have_code, *, first_line: Optional[int] = ...) -> Iterator[Instruction]: ...

View File

@@ -1,4 +1,3 @@
import sys
import types
import unittest
from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Type, Union
@@ -24,8 +23,7 @@ REPORT_UDIFF: int
REPORT_CDIFF: int
REPORT_NDIFF: int
REPORT_ONLY_FIRST_FAILURE: int
if sys.version_info >= (3, 4):
FAIL_FAST: int
FAIL_FAST: int
REPORTING_FLAGS: int
@@ -189,11 +187,7 @@ class SkipDocTestCase(DocTestCase):
def test_skip(self) -> None: ...
def shortDescription(self) -> str: ...
if sys.version_info >= (3, 4):
class _DocTestSuite(unittest.TestSuite): ...
else:
_DocTestSuite = unittest.TestSuite
class _DocTestSuite(unittest.TestSuite): ...
def DocTestSuite(
module: Union[None, str, types.ModuleType] = ...,

View File

@@ -1,25 +1,12 @@
import sys
from typing import Optional
def version() -> str: ...
if sys.version_info >= (3, 0):
def bootstrap(
*,
root: Optional[str] = ...,
upgrade: bool = ...,
user: bool = ...,
altinstall: bool = ...,
default_pip: bool = ...,
verbosity: int = ...,
) -> None: ...
else:
def bootstrap(
root: Optional[str] = ...,
upgrade: bool = ...,
user: bool = ...,
altinstall: bool = ...,
default_pip: bool = ...,
verbosity: int = ...,
) -> None: ...
def bootstrap(
*,
root: Optional[str] = ...,
upgrade: bool = ...,
user: bool = ...,
altinstall: bool = ...,
default_pip: bool = ...,
verbosity: int = ...,
) -> None: ...

View File

@@ -1,44 +1,30 @@
import sys
from os import PathLike
from typing import Any, AnyStr, Callable, Dict, Generic, Iterable, List, Optional, Sequence, Text, Tuple, Union
if sys.version_info >= (3, 6):
from os import PathLike
if sys.version_info >= (3, 9):
from types import GenericAlias
DEFAULT_IGNORES: List[str]
if sys.version_info >= (3, 6):
def cmp(
f1: Union[bytes, Text, PathLike[AnyStr]], f2: Union[bytes, Text, PathLike[AnyStr]], shallow: Union[int, bool] = ...
) -> bool: ...
def cmpfiles(
a: Union[AnyStr, PathLike[AnyStr]],
b: Union[AnyStr, PathLike[AnyStr]],
common: Iterable[AnyStr],
shallow: Union[int, bool] = ...,
) -> Tuple[List[AnyStr], List[AnyStr], List[AnyStr]]: ...
else:
def cmp(f1: Union[bytes, Text], f2: Union[bytes, Text], shallow: Union[int, bool] = ...) -> bool: ...
def cmpfiles(
a: AnyStr, b: AnyStr, common: Iterable[AnyStr], shallow: Union[int, bool] = ...
) -> Tuple[List[AnyStr], List[AnyStr], List[AnyStr]]: ...
def cmp(
f1: Union[bytes, Text, PathLike[AnyStr]], f2: Union[bytes, Text, PathLike[AnyStr]], shallow: Union[int, bool] = ...
) -> bool: ...
def cmpfiles(
a: Union[AnyStr, PathLike[AnyStr]],
b: Union[AnyStr, PathLike[AnyStr]],
common: Iterable[AnyStr],
shallow: Union[int, bool] = ...,
) -> Tuple[List[AnyStr], List[AnyStr], List[AnyStr]]: ...
class dircmp(Generic[AnyStr]):
if sys.version_info >= (3, 6):
def __init__(
self,
a: Union[AnyStr, PathLike[AnyStr]],
b: Union[AnyStr, PathLike[AnyStr]],
ignore: Optional[Sequence[AnyStr]] = ...,
hide: Optional[Sequence[AnyStr]] = ...,
) -> None: ...
else:
def __init__(
self, a: AnyStr, b: AnyStr, ignore: Optional[Sequence[AnyStr]] = ..., hide: Optional[Sequence[AnyStr]] = ...
) -> None: ...
def __init__(
self,
a: Union[AnyStr, PathLike[AnyStr]],
b: Union[AnyStr, PathLike[AnyStr]],
ignore: Optional[Sequence[AnyStr]] = ...,
hide: Optional[Sequence[AnyStr]] = ...,
) -> None: ...
left: AnyStr
right: AnyStr
hide: Sequence[AnyStr]
@@ -69,5 +55,4 @@ class dircmp(Generic[AnyStr]):
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
if sys.version_info >= (3,):
def clear_cache() -> None: ...
def clear_cache() -> None: ...

View File

@@ -54,9 +54,8 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]):
) -> None: ...
def __del__(self) -> None: ...
def close(self) -> None: ...
if sys.version_info >= (3, 2):
def __enter__(self) -> FileInput[AnyStr]: ...
def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ...
def __enter__(self) -> FileInput[AnyStr]: ...
def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ...
def __iter__(self) -> Iterator[AnyStr]: ...
def __next__(self) -> AnyStr: ...
def __getitem__(self, i: int) -> AnyStr: ...
@@ -70,9 +69,4 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]):
def isstdin(self) -> bool: ...
def hook_compressed(filename: AnyPath, mode: str) -> IO[Any]: ...
if sys.version_info >= (3, 6):
def hook_encoded(encoding: str, errors: Optional[str] = ...) -> Callable[[AnyPath, str], IO[Any]]: ...
else:
def hook_encoded(encoding: str) -> Callable[[AnyPath, str], IO[Any]]: ...
def hook_encoded(encoding: str, errors: Optional[str] = ...) -> Callable[[AnyPath, str], IO[Any]]: ...

View File

@@ -87,19 +87,6 @@ class Fraction(Rational):
def __rtruediv__(self, other: float) -> float: ...
@overload
def __rtruediv__(self, other: complex) -> complex: ...
if sys.version_info < (3, 0):
@overload
def __div__(self, other: Union[int, Fraction]) -> Fraction: ...
@overload
def __div__(self, other: float) -> float: ...
@overload
def __div__(self, other: complex) -> complex: ...
@overload
def __rdiv__(self, other: Union[int, Fraction]) -> Fraction: ...
@overload
def __rdiv__(self, other: float) -> float: ...
@overload
def __rdiv__(self, other: complex) -> complex: ...
@overload
def __floordiv__(self, other: Union[int, Fraction]) -> int: ...
@overload
@@ -138,23 +125,19 @@ class Fraction(Rational):
def __neg__(self) -> Fraction: ...
def __abs__(self) -> Fraction: ...
def __trunc__(self) -> int: ...
if sys.version_info >= (3, 0):
def __floor__(self) -> int: ...
def __ceil__(self) -> int: ...
@overload
def __round__(self, ndigits: None = ...) -> int: ...
@overload
def __round__(self, ndigits: int) -> Fraction: ...
def __floor__(self) -> int: ...
def __ceil__(self) -> int: ...
@overload
def __round__(self, ndigits: None = ...) -> int: ...
@overload
def __round__(self, ndigits: int) -> Fraction: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def __lt__(self, other: _ComparableNum) -> bool: ...
def __gt__(self, other: _ComparableNum) -> bool: ...
def __le__(self, other: _ComparableNum) -> bool: ...
def __ge__(self, other: _ComparableNum) -> bool: ...
if sys.version_info >= (3, 0):
def __bool__(self) -> bool: ...
else:
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
# Not actually defined within fractions.py, but provides more useful
# overrides
@property

View File

@@ -1,9 +1,8 @@
import sys
from _typeshed import SupportsRead, SupportsReadline
from socket import socket
from ssl import SSLContext
from types import TracebackType
from typing import Any, BinaryIO, Callable, Dict, Iterable, Iterator, List, Optional, Text, TextIO, Tuple, Type, TypeVar, Union
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Text, TextIO, Tuple, Type, TypeVar, Union
from typing_extensions import Literal
_T = TypeVar("_T")
@@ -13,8 +12,7 @@ MSG_OOB: int
FTP_PORT: int
MAXLINE: int
CRLF: str
if sys.version_info >= (3,):
B_CRLF: bytes
B_CRLF: bytes
class Error(Exception): ...
class error_reply(Error): ...
@@ -39,36 +37,25 @@ class FTP:
timeout: int
af: int
lastresp: str
if sys.version_info >= (3,):
file: Optional[TextIO]
encoding: str
def __enter__(self: _T) -> _T: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...
else:
file: Optional[BinaryIO]
if sys.version_info >= (3, 3):
source_address: Optional[Tuple[str, int]]
def __init__(
self,
host: Text = ...,
user: Text = ...,
passwd: Text = ...,
acct: Text = ...,
timeout: float = ...,
source_address: Optional[Tuple[str, int]] = ...,
) -> None: ...
def connect(
self, host: Text = ..., port: int = ..., timeout: float = ..., source_address: Optional[Tuple[str, int]] = ...
) -> str: ...
else:
def __init__(
self, host: Text = ..., user: Text = ..., passwd: Text = ..., acct: Text = ..., timeout: float = ...
) -> None: ...
def connect(self, host: Text = ..., port: int = ..., timeout: float = ...) -> str: ...
file: Optional[TextIO]
encoding: str
def __enter__(self: _T) -> _T: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...
source_address: Optional[Tuple[str, int]]
def __init__(
self,
host: Text = ...,
user: Text = ...,
passwd: Text = ...,
acct: Text = ...,
timeout: float = ...,
source_address: Optional[Tuple[str, int]] = ...,
) -> None: ...
def connect(
self, host: Text = ..., port: int = ..., timeout: float = ..., source_address: Optional[Tuple[str, int]] = ...
) -> str: ...
def getwelcome(self) -> str: ...
def set_debuglevel(self, level: int) -> None: ...
def debug(self, level: int) -> None: ...
@@ -108,8 +95,7 @@ class FTP:
def nlst(self, *args: Text) -> List[str]: ...
# Technically only the last arg can be a Callable but ...
def dir(self, *args: Union[str, Callable[[str], None]]) -> None: ...
if sys.version_info >= (3, 3):
def mlsd(self, path: Text = ..., facts: Iterable[str] = ...) -> Iterator[Tuple[str, Dict[str, str]]]: ...
def mlsd(self, path: Text = ..., facts: Iterable[str] = ...) -> Iterator[Tuple[str, Dict[str, str]]]: ...
def rename(self, fromname: Text, toname: Text) -> str: ...
def delete(self, filename: Text) -> str: ...
def cwd(self, dirname: Text) -> str: ...
@@ -141,16 +127,7 @@ class FTP_TLS(FTP):
def auth(self) -> str: ...
def prot_p(self) -> str: ...
def prot_c(self) -> str: ...
if sys.version_info >= (3, 3):
def ccc(self) -> str: ...
if sys.version_info < (3,):
class Netrc:
def __init__(self, filename: Optional[Text] = ...) -> None: ...
def get_hosts(self) -> List[str]: ...
def get_account(self, host: Text) -> Tuple[Optional[str], Optional[str], Optional[str]]: ...
def get_macros(self) -> List[str]: ...
def get_macro(self, macro: Text) -> Tuple[str, ...]: ...
def ccc(self) -> str: ...
def parse150(resp: str) -> Optional[int]: ... # undocumented
def parse227(resp: str) -> Tuple[str, int]: ... # undocumented

View File

@@ -1,5 +1,4 @@
import os
import sys
from _typeshed import AnyPath, BytesPath, StrPath, SupportsLessThanT
from typing import List, Sequence, Tuple, Union, overload
from typing_extensions import Literal
@@ -25,8 +24,6 @@ def isdir(s: AnyPath) -> bool: ...
def getatime(filename: AnyPath) -> float: ...
def getmtime(filename: AnyPath) -> float: ...
def getctime(filename: AnyPath) -> float: ...
if sys.version_info >= (3, 4):
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...

View File

@@ -17,18 +17,13 @@ if sys.version_info >= (3, 8):
@overload
def new(key: bytes, *, digestmod: _DigestMod) -> HMAC: ...
elif sys.version_info >= (3, 4):
def new(key: bytes, msg: Optional[ReadableBuffer] = ..., digestmod: Optional[_DigestMod] = ...) -> HMAC: ...
else:
def new(key: bytes, msg: Optional[ReadableBuffer] = ..., digestmod: Optional[_DigestMod] = ...) -> HMAC: ...
class HMAC:
if sys.version_info >= (3,):
digest_size: int
if sys.version_info >= (3, 4):
block_size: int
name: str
digest_size: int
block_size: int
name: str
def __init__(self, key: bytes, msg: Optional[ReadableBuffer] = ..., digestmod: _DigestMod = ...) -> None: ...
def update(self, msg: ReadableBuffer) -> None: ...
def digest(self) -> bytes: ...

View File

@@ -58,10 +58,9 @@ class IMAP4:
def create(self, mailbox: str) -> _CommandResults: ...
def delete(self, mailbox: str) -> _CommandResults: ...
def deleteacl(self, mailbox: str, who: str) -> _CommandResults: ...
if sys.version_info >= (3, 5):
def enable(self, capability: str) -> _CommandResults: ...
def __enter__(self) -> IMAP4: ...
def __exit__(self, t: Optional[Type[BaseException]], v: Optional[BaseException], tb: Optional[TracebackType]) -> None: ...
def enable(self, capability: str) -> _CommandResults: ...
def __enter__(self) -> IMAP4: ...
def __exit__(self, t: Optional[Type[BaseException]], v: Optional[BaseException], tb: Optional[TracebackType]) -> None: ...
def expunge(self) -> _CommandResults: ...
def fetch(self, message_set: str, message_parts: str) -> Tuple[str, _AnyResponseData]: ...
def getacl(self, mailbox: str) -> _CommandResults: ...
@@ -85,8 +84,7 @@ class IMAP4:
def setannotation(self, *args: str) -> _CommandResults: ...
def setquota(self, root: str, limits: str) -> _CommandResults: ...
def sort(self, sort_criteria: str, charset: str, *search_criteria: str) -> _CommandResults: ...
if sys.version_info >= (3,):
def starttls(self, ssl_context: Optional[Any] = ...) -> Tuple[Literal["OK"], List[None]]: ...
def starttls(self, ssl_context: Optional[Any] = ...) -> Tuple[Literal["OK"], List[None]]: ...
def status(self, mailbox: str, names: str) -> _CommandResults: ...
def store(self, message_set: str, command: str, flags: str) -> _CommandResults: ...
def subscribe(self, mailbox: str) -> _CommandResults: ...
@@ -111,7 +109,7 @@ class IMAP4_SSL(IMAP4):
ssl_context: Optional[SSLContext] = ...,
timeout: Optional[float] = ...,
) -> None: ...
elif sys.version_info >= (3, 3):
else:
def __init__(
self,
host: str = ...,
@@ -120,10 +118,6 @@ class IMAP4_SSL(IMAP4):
certfile: Optional[str] = ...,
ssl_context: Optional[SSLContext] = ...,
) -> None: ...
else:
def __init__(
self, host: str = ..., port: int = ..., keyfile: Optional[str] = ..., certfile: Optional[str] = ...
) -> None: ...
host: str = ...
port: int = ...
sock: _socket = ...

View File

@@ -1,5 +1,4 @@
import os
import sys
from typing import Any, BinaryIO, Callable, List, Optional, Protocol, Text, Union, overload
class _ReadableBinary(Protocol):
@@ -7,10 +6,7 @@ class _ReadableBinary(Protocol):
def read(self, size: int) -> bytes: ...
def seek(self, offset: int) -> Any: ...
if sys.version_info >= (3, 6):
_File = Union[Text, os.PathLike[Text], _ReadableBinary]
else:
_File = Union[Text, _ReadableBinary]
_File = Union[Text, os.PathLike[Text], _ReadableBinary]
@overload
def what(file: _File, h: None = ...) -> Optional[str]: ...

View File

@@ -1,4 +1,3 @@
import sys
from typing import Dict, Text
ENDMARKER: int
@@ -54,13 +53,11 @@ DOUBLESLASHEQUAL: int
OP: int
COMMENT: int
NL: int
if sys.version_info >= (3,):
RARROW: int
if sys.version_info >= (3, 5):
AT: int
ATEQUAL: int
AWAIT: int
ASYNC: int
RARROW: int
AT: int
ATEQUAL: int
AWAIT: int
ASYNC: int
ERRORTOKEN: int
N_TOKENS: int
NT_OFFSET: int

View File

@@ -1,4 +1,3 @@
import sys
from lib2to3.pgen2.grammar import Grammar
from typing import Any, Callable, Dict, Iterator, List, Optional, Text, Tuple, TypeVar, Union
@@ -36,9 +35,6 @@ class Base:
def leaves(self) -> Iterator[Leaf]: ...
def depth(self) -> int: ...
def get_suffix(self) -> Text: ...
if sys.version_info < (3,):
def get_prefix(self) -> Text: ...
def set_prefix(self, prefix: Text) -> None: ...
class Node(Base):
fixers_applied: List[Any]

View File

@@ -1,4 +1,3 @@
import sys
from typing import Any, Dict, List, Optional, Text
_ModuleGlobals = Dict[str, Any]
@@ -8,6 +7,4 @@ def clearcache() -> None: ...
def getlines(filename: Text, module_globals: Optional[_ModuleGlobals] = ...) -> List[str]: ...
def checkcache(filename: Optional[Text] = ...) -> None: ...
def updatecache(filename: Text, module_globals: Optional[_ModuleGlobals] = ...) -> List[str]: ...
if sys.version_info >= (3, 5):
def lazycache(filename: Text, module_globals: _ModuleGlobals) -> bool: ...
def lazycache(filename: Text, module_globals: _ModuleGlobals) -> bool: ...

View File

@@ -1,12 +1,9 @@
import sys
from decimal import Decimal
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union
# workaround for mypy#2010
if sys.version_info >= (3, 0):
from builtins import str as _str
else:
from __builtin__ import str as _str
from builtins import str as _str
from decimal import Decimal
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union
CODESET: int
D_T_FMT: int
@@ -98,10 +95,7 @@ else:
def format_string(f: _str, val: Any, grouping: bool = ...) -> _str: ...
def currency(val: Union[int, float, Decimal], symbol: bool = ..., grouping: bool = ..., international: bool = ...) -> _str: ...
if sys.version_info >= (3, 5):
def delocalize(string: _str) -> _str: ...
def delocalize(string: _str) -> _str: ...
def atof(string: _str, func: Callable[[_str], float] = ...) -> float: ...
def atoi(string: _str) -> int: ...
def str(val: float) -> _str: ...

View File

@@ -1,4 +1,3 @@
import sys
from _typeshed import AnyPath, BytesPath, StrPath
from genericpath import (
commonprefix as commonprefix,
@@ -9,10 +8,11 @@ from genericpath import (
getsize as getsize,
isdir as isdir,
isfile as isfile,
samefile as samefile,
sameopenfile as sameopenfile,
samestat as samestat,
)
if sys.version_info >= (3, 4):
from genericpath import samefile as samefile, sameopenfile as sameopenfile, samestat as samestat
from os import PathLike
# Re-export common definitions from posixpath to reduce duplication
from posixpath import (
@@ -36,69 +36,34 @@ from typing import AnyStr, Optional, Text, Tuple, overload
altsep: Optional[str]
if sys.version_info >= (3, 6):
from os import PathLike
@overload
def basename(s: PathLike[AnyStr]) -> AnyStr: ...
@overload
def basename(s: AnyStr) -> AnyStr: ...
@overload
def dirname(s: PathLike[AnyStr]) -> AnyStr: ...
@overload
def dirname(s: AnyStr) -> AnyStr: ...
@overload
def normcase(path: PathLike[AnyStr]) -> AnyStr: ...
@overload
def normcase(path: AnyStr) -> AnyStr: ...
@overload
def normpath(s: PathLike[AnyStr]) -> AnyStr: ...
@overload
def normpath(s: AnyStr) -> AnyStr: ...
@overload
def realpath(path: PathLike[AnyStr]) -> AnyStr: ...
@overload
def realpath(path: AnyStr) -> AnyStr: ...
else:
def basename(s: AnyStr) -> AnyStr: ...
def dirname(s: AnyStr) -> AnyStr: ...
def normcase(path: AnyStr) -> AnyStr: ...
def normpath(s: AnyStr) -> AnyStr: ...
def realpath(path: AnyStr) -> AnyStr: ...
@overload
def basename(s: PathLike[AnyStr]) -> AnyStr: ...
@overload
def basename(s: AnyStr) -> AnyStr: ...
@overload
def dirname(s: PathLike[AnyStr]) -> AnyStr: ...
@overload
def dirname(s: AnyStr) -> AnyStr: ...
@overload
def normcase(path: PathLike[AnyStr]) -> AnyStr: ...
@overload
def normcase(path: AnyStr) -> AnyStr: ...
@overload
def normpath(s: PathLike[AnyStr]) -> AnyStr: ...
@overload
def normpath(s: AnyStr) -> AnyStr: ...
@overload
def realpath(path: PathLike[AnyStr]) -> AnyStr: ...
@overload
def realpath(path: AnyStr) -> AnyStr: ...
def islink(s: AnyPath) -> bool: ...
if sys.version_info >= (3, 6):
# Mypy complains that the signatures overlap, but things seem to behave correctly anyway.
@overload
def join(s: StrPath, *paths: StrPath) -> Text: ...
@overload
def join(s: BytesPath, *paths: BytesPath) -> bytes: ...
elif sys.version_info >= (3, 0):
def join(s: AnyStr, *paths: AnyStr) -> AnyStr: ...
else:
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
# (Since Python 2 allows that, too)
# Note that e.g. os.path.join("a", "b", "c", "d", u"e") will still result in
# a type error.
@overload
def join(__p1: bytes, *p: bytes) -> bytes: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
@overload
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
@overload
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
@overload
def join(__p1: Text, *p: AnyPath) -> Text: ...
if sys.version_info >= (3, 6):
@overload
def split(s: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
@overload
def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
else:
def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
# Mypy complains that the signatures overlap, but things seem to behave correctly anyway.
@overload
def join(s: StrPath, *paths: StrPath) -> Text: ...
@overload
def join(s: BytesPath, *paths: BytesPath) -> bytes: ...
@overload
def split(s: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
@overload
def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ...

View File

@@ -3,11 +3,9 @@ from typing import Iterable, Optional, SupportsFloat, SupportsInt, Tuple, overlo
e: float
pi: float
if sys.version_info >= (3, 5):
inf: float
nan: float
if sys.version_info >= (3, 6):
tau: float
inf: float
nan: float
tau: float
def acos(__x: SupportsFloat) -> float: ...
def acosh(__x: SupportsFloat) -> float: ...
@@ -16,12 +14,7 @@ def asinh(__x: SupportsFloat) -> float: ...
def atan(__x: SupportsFloat) -> float: ...
def atan2(__y: SupportsFloat, __x: SupportsFloat) -> float: ...
def atanh(__x: SupportsFloat) -> float: ...
if sys.version_info >= (3,):
def ceil(__x: SupportsFloat) -> int: ...
else:
def ceil(__x: SupportsFloat) -> float: ...
def ceil(__x: SupportsFloat) -> int: ...
if sys.version_info >= (3, 8):
def comb(__n: int, __k: int) -> int: ...
@@ -40,13 +33,7 @@ def exp(__x: SupportsFloat) -> float: ...
def expm1(__x: SupportsFloat) -> float: ...
def fabs(__x: SupportsFloat) -> float: ...
def factorial(__x: SupportsInt) -> int: ...
if sys.version_info >= (3,):
def floor(__x: SupportsFloat) -> int: ...
else:
def floor(__x: SupportsFloat) -> float: ...
def floor(__x: SupportsFloat) -> int: ...
def fmod(__x: SupportsFloat, __y: SupportsFloat) -> float: ...
def frexp(__x: SupportsFloat) -> Tuple[float, int]: ...
def fsum(__seq: Iterable[float]) -> float: ...
@@ -55,7 +42,7 @@ def gamma(__x: SupportsFloat) -> float: ...
if sys.version_info >= (3, 9):
def gcd(*integers: int) -> int: ...
elif sys.version_info >= (3, 5):
else:
def gcd(__x: int, __y: int) -> int: ...
if sys.version_info >= (3, 8):
@@ -64,14 +51,9 @@ if sys.version_info >= (3, 8):
else:
def hypot(__x: SupportsFloat, __y: SupportsFloat) -> float: ...
if sys.version_info >= (3, 5):
def isclose(a: SupportsFloat, b: SupportsFloat, *, rel_tol: SupportsFloat = ..., abs_tol: SupportsFloat = ...) -> bool: ...
def isclose(a: SupportsFloat, b: SupportsFloat, *, rel_tol: SupportsFloat = ..., abs_tol: SupportsFloat = ...) -> bool: ...
def isinf(__x: SupportsFloat) -> bool: ...
if sys.version_info >= (3,):
def isfinite(__x: SupportsFloat) -> bool: ...
def isfinite(__x: SupportsFloat) -> bool: ...
def isnan(__x: SupportsFloat) -> bool: ...
if sys.version_info >= (3, 8):
@@ -85,10 +67,7 @@ def lgamma(__x: SupportsFloat) -> float: ...
def log(x: SupportsFloat, base: SupportsFloat = ...) -> float: ...
def log10(__x: SupportsFloat) -> float: ...
def log1p(__x: SupportsFloat) -> float: ...
if sys.version_info >= (3, 3):
def log2(__x: SupportsFloat) -> float: ...
def log2(__x: SupportsFloat) -> float: ...
def modf(__x: SupportsFloat) -> Tuple[float, float]: ...
if sys.version_info >= (3, 9):

View File

@@ -1,6 +1,6 @@
import sys
from _typeshed import ReadableBuffer
from typing import AnyStr, ContextManager, Generic, Iterable, Iterator, Optional, Sequence, Sized, Union, overload
from typing import AnyStr, ContextManager, Generic, Iterable, Iterator, Optional, Sized, Union, overload
ACCESS_DEFAULT: int
ACCESS_READ: int
@@ -48,41 +48,26 @@ class _mmap(Generic[AnyStr]):
def write_byte(self, byte: AnyStr) -> None: ...
def __len__(self) -> int: ...
if sys.version_info >= (3,):
class mmap(_mmap[bytes], ContextManager[mmap], Iterable[bytes], Sized):
closed: bool
if sys.version_info >= (3, 8) and sys.platform != "win32":
def madvise(self, option: int, start: int = ..., length: int = ...) -> None: ...
def find(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ...
def rfind(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ...
def read(self, n: Optional[int] = ...) -> bytes: ...
if sys.version_info >= (3, 6):
def write(self, bytes: ReadableBuffer) -> int: ...
else:
def write(self, bytes: ReadableBuffer) -> None: ...
@overload
def __getitem__(self, index: int) -> int: ...
@overload
def __getitem__(self, index: slice) -> bytes: ...
def __delitem__(self, index: Union[int, slice]) -> None: ...
@overload
def __setitem__(self, index: int, object: int) -> None: ...
@overload
def __setitem__(self, index: slice, object: bytes) -> None: ...
# Doesn't actually exist, but the object is actually iterable because it has __getitem__ and
# __len__, so we claim that there is also an __iter__ to help type checkers.
def __iter__(self) -> Iterator[bytes]: ...
else:
class mmap(_mmap[bytes], Sequence[bytes]):
def find(self, string: bytes, start: int = ..., end: int = ...) -> int: ...
def rfind(self, string: bytes, start: int = ..., stop: int = ...) -> int: ...
def read(self, num: int) -> bytes: ...
def write(self, string: bytes) -> None: ...
def __getitem__(self, index: Union[int, slice]) -> bytes: ...
def __getslice__(self, i: Optional[int], j: Optional[int]) -> bytes: ...
def __delitem__(self, index: Union[int, slice]) -> None: ...
def __setitem__(self, index: Union[int, slice], object: bytes) -> None: ...
class mmap(_mmap[bytes], ContextManager[mmap], Iterable[bytes], Sized):
closed: bool
if sys.version_info >= (3, 8) and sys.platform != "win32":
def madvise(self, option: int, start: int = ..., length: int = ...) -> None: ...
def find(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ...
def rfind(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ...
def read(self, n: Optional[int] = ...) -> bytes: ...
def write(self, bytes: ReadableBuffer) -> int: ...
@overload
def __getitem__(self, index: int) -> int: ...
@overload
def __getitem__(self, index: slice) -> bytes: ...
def __delitem__(self, index: Union[int, slice]) -> None: ...
@overload
def __setitem__(self, index: int, object: int) -> None: ...
@overload
def __setitem__(self, index: slice, object: bytes) -> None: ...
# Doesn't actually exist, but the object is actually iterable because it has __getitem__ and
# __len__, so we claim that there is also an __iter__ to help type checkers.
def __iter__(self) -> Iterator[bytes]: ...
if sys.version_info >= (3, 8) and sys.platform != "win32":
MADV_NORMAL: int

View File

@@ -62,8 +62,7 @@ class ModuleFinder:
def find_all_submodules(self, m: Module) -> Iterable[str]: ... # undocumented
def import_module(self, partname: str, fqname: str, parent: Module) -> Optional[Module]: ... # undocumented
def load_module(self, fqname: str, fp: IO[str], pathname: str, file_info: Tuple[str, str, str]) -> Module: ... # undocumented
if sys.version_info >= (3, 6):
def scan_opcodes(self, co: CodeType) -> Iterator[Tuple[str, Tuple[Any, ...]]]: ... # undocumented
def scan_opcodes(self, co: CodeType) -> Iterator[Tuple[str, Tuple[Any, ...]]]: ... # undocumented
def scan_code(self, co: CodeType, m: Module) -> None: ... # undocumented
def load_package(self, fqname: str, pathname: str) -> Module: ... # undocumented
def add_module(self, fqname: str) -> Module: ... # undocumented

View File

@@ -1,7 +1,6 @@
# Note: these stubs are incomplete. The more complex type
# signatures are currently omitted.
import sys
from abc import ABCMeta, abstractmethod
from typing import Any, Optional, SupportsFloat, overload
@@ -12,10 +11,7 @@ class Number(metaclass=ABCMeta):
class Complex(Number):
@abstractmethod
def __complex__(self) -> complex: ...
if sys.version_info >= (3, 0):
def __bool__(self) -> bool: ...
else:
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
@property
@abstractmethod
def real(self) -> Any: ...
@@ -36,11 +32,6 @@ class Complex(Number):
def __mul__(self, other: Any) -> Any: ...
@abstractmethod
def __rmul__(self, other: Any) -> Any: ...
if sys.version_info < (3, 0):
@abstractmethod
def __div__(self, other): ...
@abstractmethod
def __rdiv__(self, other): ...
@abstractmethod
def __truediv__(self, other: Any) -> Any: ...
@abstractmethod
@@ -52,25 +43,22 @@ class Complex(Number):
def __abs__(self) -> Real: ...
def conjugate(self) -> Any: ...
def __eq__(self, other: Any) -> bool: ...
if sys.version_info < (3, 0):
def __ne__(self, other: Any) -> bool: ...
class Real(Complex, SupportsFloat):
@abstractmethod
def __float__(self) -> float: ...
@abstractmethod
def __trunc__(self) -> int: ...
if sys.version_info >= (3, 0):
@abstractmethod
def __floor__(self) -> int: ...
@abstractmethod
def __ceil__(self) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: None = ...) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: int) -> Any: ...
@abstractmethod
def __floor__(self) -> int: ...
@abstractmethod
def __ceil__(self) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: None = ...) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: int) -> Any: ...
def __divmod__(self, other: Any) -> Any: ...
def __rdivmod__(self, other: Any) -> Any: ...
@abstractmethod
@@ -102,12 +90,8 @@ class Rational(Real):
def __float__(self) -> float: ...
class Integral(Rational):
if sys.version_info >= (3, 0):
@abstractmethod
def __int__(self) -> int: ...
else:
@abstractmethod
def __long__(self) -> long: ...
@abstractmethod
def __int__(self) -> int: ...
def __index__(self) -> int: ...
@abstractmethod
def __pow__(self, exponent: Any, modulus: Optional[Any] = ...) -> Any: ...

View File

@@ -18,8 +18,7 @@ EXTENDED_ARG: int
if sys.version_info >= (3, 8):
def stack_effect(__opcode: int, __oparg: Optional[int] = ..., *, jump: Optional[bool] = ...) -> int: ...
elif sys.version_info >= (3, 4):
else:
def stack_effect(__opcode: int, __oparg: Optional[int] = ...) -> int: ...
if sys.version_info >= (3, 6):
hasnargs: List[int]
hasnargs: List[int]

View File

@@ -1,4 +1,3 @@
import sys
from typing import (
Any,
Container,
@@ -41,11 +40,6 @@ def add(__a: Any, __b: Any) -> Any: ...
def __add__(a: Any, b: Any) -> Any: ...
def and_(__a: Any, __b: Any) -> Any: ...
def __and__(a: Any, b: Any) -> Any: ...
if sys.version_info < (3,):
def div(a: Any, b: Any) -> Any: ...
def __div__(a: Any, b: Any) -> Any: ...
def floordiv(__a: Any, __b: Any) -> Any: ...
def __floordiv__(a: Any, b: Any) -> Any: ...
def index(__a: Any) -> int: ...
@@ -60,11 +54,8 @@ def mod(__a: Any, __b: Any) -> Any: ...
def __mod__(a: Any, b: Any) -> Any: ...
def mul(__a: Any, __b: Any) -> Any: ...
def __mul__(a: Any, b: Any) -> Any: ...
if sys.version_info >= (3, 5):
def matmul(__a: Any, __b: Any) -> Any: ...
def __matmul__(a: Any, b: Any) -> Any: ...
def matmul(__a: Any, __b: Any) -> Any: ...
def __matmul__(a: Any, b: Any) -> Any: ...
def neg(__a: Any) -> Any: ...
def __neg__(a: Any) -> Any: ...
def or_(__a: Any, __b: Any) -> Any: ...
@@ -98,11 +89,6 @@ def __delitem__(a: MutableSequence[Any], b: int) -> None: ...
def __delitem__(a: MutableSequence[Any], b: slice) -> None: ...
@overload
def __delitem__(a: MutableMapping[_K, Any], b: _K) -> None: ...
if sys.version_info < (3,):
def delslice(a: MutableSequence[Any], b: int, c: int) -> None: ...
def __delslice__(a: MutableSequence[Any], b: int, c: int) -> None: ...
@overload
def getitem(__a: Sequence[_T], __b: int) -> _T: ...
@overload
@@ -115,20 +101,7 @@ def __getitem__(a: Sequence[_T], b: int) -> _T: ...
def __getitem__(a: Sequence[_T], b: slice) -> Sequence[_T]: ...
@overload
def __getitem__(a: Mapping[_K, _V], b: _K) -> _V: ...
if sys.version_info < (3,):
def getslice(a: Sequence[_T], b: int, c: int) -> Sequence[_T]: ...
def __getslice__(a: Sequence[_T], b: int, c: int) -> Sequence[_T]: ...
def indexOf(__a: Sequence[_T], __b: _T) -> int: ...
if sys.version_info < (3,):
def repeat(a: Any, b: int) -> Any: ...
def __repeat__(a: Any, b: int) -> Any: ...
if sys.version_info < (3,):
def sequenceIncludes(a: Container[Any], b: Any) -> bool: ...
@overload
def setitem(__a: MutableSequence[_T], __b: int, __c: _T) -> None: ...
@overload
@@ -141,13 +114,7 @@ def __setitem__(a: MutableSequence[_T], b: int, c: _T) -> None: ...
def __setitem__(a: MutableSequence[_T], b: slice, c: Sequence[_T]) -> None: ...
@overload
def __setitem__(a: MutableMapping[_K, _V], b: _K, c: _V) -> None: ...
if sys.version_info < (3,):
def setslice(a: MutableSequence[_T], b: int, c: int, v: Sequence[_T]) -> None: ...
def __setslice__(a: MutableSequence[_T], b: int, c: int, v: Sequence[_T]) -> None: ...
if sys.version_info >= (3, 4):
def length_hint(__obj: Any, __default: int = ...) -> int: ...
def length_hint(__obj: Any, __default: int = ...) -> int: ...
class attrgetter(Generic[_T_co]):
@overload
@@ -185,11 +152,6 @@ def iand(__a: Any, __b: Any) -> Any: ...
def __iand__(a: Any, b: Any) -> Any: ...
def iconcat(__a: Any, __b: Any) -> Any: ...
def __iconcat__(a: Any, b: Any) -> Any: ...
if sys.version_info < (3,):
def idiv(a: Any, b: Any) -> Any: ...
def __idiv__(a: Any, b: Any) -> Any: ...
def ifloordiv(__a: Any, __b: Any) -> Any: ...
def __ifloordiv__(a: Any, b: Any) -> Any: ...
def ilshift(__a: Any, __b: Any) -> Any: ...
@@ -198,20 +160,12 @@ def imod(__a: Any, __b: Any) -> Any: ...
def __imod__(a: Any, b: Any) -> Any: ...
def imul(__a: Any, __b: Any) -> Any: ...
def __imul__(a: Any, b: Any) -> Any: ...
if sys.version_info >= (3, 5):
def imatmul(__a: Any, __b: Any) -> Any: ...
def __imatmul__(a: Any, b: Any) -> Any: ...
def imatmul(__a: Any, __b: Any) -> Any: ...
def __imatmul__(a: Any, b: Any) -> Any: ...
def ior(__a: Any, __b: Any) -> Any: ...
def __ior__(a: Any, b: Any) -> Any: ...
def ipow(__a: Any, __b: Any) -> Any: ...
def __ipow__(a: Any, b: Any) -> Any: ...
if sys.version_info < (3,):
def irepeat(a: Any, b: int) -> Any: ...
def __irepeat__(a: Any, b: int) -> Any: ...
def irshift(__a: Any, __b: Any) -> Any: ...
def __irshift__(a: Any, b: Any) -> Any: ...
def isub(__a: Any, __b: Any) -> Any: ...
@@ -220,9 +174,3 @@ def itruediv(__a: Any, __b: Any) -> Any: ...
def __itruediv__(a: Any, b: Any) -> Any: ...
def ixor(__a: Any, __b: Any) -> Any: ...
def __ixor__(a: Any, b: Any) -> Any: ...
if sys.version_info < (3,):
def isCallable(x: Any) -> bool: ...
def isMappingType(x: Any) -> bool: ...
def isNumberType(x: Any) -> bool: ...
def isSequenceType(x: Any) -> bool: ...

View File

@@ -1,12 +1,6 @@
import sys
from typing import IO, Any, AnyStr, Callable, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Type, Union, overload
# See https://groups.google.com/forum/#!topic/python-ideas/gA1gdj3RZ5g
if sys.version_info >= (3,):
_Text = str
else:
_Text = Union[str, unicode]
from typing import IO, Any, AnyStr, Callable, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Type, overload
_Text = str
NO_DEFAULT: Tuple[_Text, ...]
SUPPRESS_HELP: _Text
SUPPRESS_USAGE: _Text
@@ -14,9 +8,6 @@ SUPPRESS_USAGE: _Text
def check_builtin(option: Option, opt: Any, value: _Text) -> Any: ...
def check_choice(option: Option, opt: Any, value: _Text) -> Any: ...
if sys.version_info < (3,):
def isbasestring(x: Any) -> bool: ...
class OptParseError(Exception):
msg: _Text
def __init__(self, msg: _Text) -> None: ...

View File

@@ -45,34 +45,15 @@ class Pdb(Bdb, Cmd):
curindex: int
curframe: Optional[FrameType]
curframe_locals: Mapping[str, Any]
if sys.version_info >= (3, 6):
def __init__(
self,
completekey: str = ...,
stdin: Optional[IO[str]] = ...,
stdout: Optional[IO[str]] = ...,
skip: Optional[Iterable[str]] = ...,
nosigint: bool = ...,
readrc: bool = ...,
) -> None: ...
elif sys.version_info >= (3, 2):
def __init__(
self,
completekey: str = ...,
stdin: Optional[IO[str]] = ...,
stdout: Optional[IO[str]] = ...,
skip: Optional[Iterable[str]] = ...,
nosigint: bool = ...,
) -> None: ...
else:
def __init__(
self,
completekey: str = ...,
stdin: Optional[IO[str]] = ...,
stdout: Optional[IO[str]] = ...,
skip: Optional[Iterable[str]] = ...,
) -> None: ...
def __init__(
self,
completekey: str = ...,
stdin: Optional[IO[str]] = ...,
stdout: Optional[IO[str]] = ...,
skip: Optional[Iterable[str]] = ...,
nosigint: bool = ...,
readrc: bool = ...,
) -> None: ...
def forget(self) -> None: ...
def setup(self, f: Optional[FrameType], tb: Optional[TracebackType]) -> None: ...
def execRcLines(self) -> None: ...
@@ -140,111 +121,54 @@ class Pdb(Bdb, Cmd):
do_h = do_help
def help_exec(self) -> None: ...
def help_pdb(self) -> None: ...
if sys.version_info < (3, 2):
def help_help(self) -> None: ...
def help_h(self) -> None: ...
def help_where(self) -> None: ...
def help_w(self) -> None: ...
def help_down(self) -> None: ...
def help_d(self) -> None: ...
def help_up(self) -> None: ...
def help_u(self) -> None: ...
def help_break(self) -> None: ...
def help_b(self) -> None: ...
def help_clear(self) -> None: ...
def help_cl(self) -> None: ...
def help_tbreak(self) -> None: ...
def help_enable(self) -> None: ...
def help_disable(self) -> None: ...
def help_ignore(self) -> None: ...
def help_condition(self) -> None: ...
def help_step(self) -> None: ...
def help_s(self) -> None: ...
def help_until(self) -> None: ...
def help_unt(self) -> None: ...
def help_next(self) -> None: ...
def help_n(self) -> None: ...
def help_return(self) -> None: ...
def help_r(self) -> None: ...
def help_continue(self) -> None: ...
def help_cont(self) -> None: ...
def help_c(self) -> None: ...
def help_jump(self) -> None: ...
def help_j(self) -> None: ...
def help_debug(self) -> None: ...
def help_list(self) -> None: ...
def help_l(self) -> None: ...
def help_args(self) -> None: ...
def help_a(self) -> None: ...
def help_p(self) -> None: ...
def help_pp(self) -> None: ...
def help_run(self) -> None: ...
def help_quit(self) -> None: ...
def help_q(self) -> None: ...
def help_whatis(self) -> None: ...
def help_EOF(self) -> None: ...
def help_alias(self) -> None: ...
def help_unalias(self) -> None: ...
def help_commands(self) -> None: ...
help_bt = help_w
help_restart = help_run
help_exit = help_q
if sys.version_info >= (3, 2):
def sigint_handler(self, signum: signal.Signals, frame: FrameType) -> None: ...
def message(self, msg: str) -> None: ...
def error(self, msg: str) -> None: ...
def _select_frame(self, number: int) -> None: ...
def _getval_except(self, arg: str, frame: Optional[FrameType] = ...) -> object: ...
def _print_lines(
self, lines: Sequence[str], start: int, breaks: Sequence[int] = ..., frame: Optional[FrameType] = ...
) -> None: ...
def _cmdloop(self) -> None: ...
def do_display(self, arg: str) -> Optional[bool]: ...
def do_interact(self, arg: str) -> Optional[bool]: ...
def do_longlist(self, arg: str) -> Optional[bool]: ...
def do_source(self, arg: str) -> Optional[bool]: ...
def do_undisplay(self, arg: str) -> Optional[bool]: ...
do_ll = do_longlist
if sys.version_info >= (3, 3):
def _complete_location(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ...
def _complete_bpnumber(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ...
def _complete_expression(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ...
def complete_undisplay(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ...
def complete_unalias(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ...
complete_commands = _complete_bpnumber
complete_break = _complete_location
complete_b = _complete_location
complete_tbreak = _complete_location
complete_enable = _complete_bpnumber
complete_disable = _complete_bpnumber
complete_condition = _complete_bpnumber
complete_ignore = _complete_bpnumber
complete_clear = _complete_location
complete_cl = _complete_location
complete_debug = _complete_expression
complete_print = _complete_expression
complete_p = _complete_expression
complete_pp = _complete_expression
complete_source = _complete_expression
complete_whatis = _complete_expression
complete_display = _complete_expression
def sigint_handler(self, signum: signal.Signals, frame: FrameType) -> None: ...
def message(self, msg: str) -> None: ...
def error(self, msg: str) -> None: ...
def _select_frame(self, number: int) -> None: ...
def _getval_except(self, arg: str, frame: Optional[FrameType] = ...) -> object: ...
def _print_lines(
self, lines: Sequence[str], start: int, breaks: Sequence[int] = ..., frame: Optional[FrameType] = ...
) -> None: ...
def _cmdloop(self) -> None: ...
def do_display(self, arg: str) -> Optional[bool]: ...
def do_interact(self, arg: str) -> Optional[bool]: ...
def do_longlist(self, arg: str) -> Optional[bool]: ...
def do_source(self, arg: str) -> Optional[bool]: ...
def do_undisplay(self, arg: str) -> Optional[bool]: ...
do_ll = do_longlist
def _complete_location(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ...
def _complete_bpnumber(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ...
def _complete_expression(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ...
def complete_undisplay(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ...
def complete_unalias(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ...
complete_commands = _complete_bpnumber
complete_break = _complete_location
complete_b = _complete_location
complete_tbreak = _complete_location
complete_enable = _complete_bpnumber
complete_disable = _complete_bpnumber
complete_condition = _complete_bpnumber
complete_ignore = _complete_bpnumber
complete_clear = _complete_location
complete_cl = _complete_location
complete_debug = _complete_expression
complete_print = _complete_expression
complete_p = _complete_expression
complete_pp = _complete_expression
complete_source = _complete_expression
complete_whatis = _complete_expression
complete_display = _complete_expression
if sys.version_info >= (3, 7):
def _runmodule(self, module_name: str) -> None: ...
if sys.version_info >= (3,) and sys.version_info < (3, 4):
do_print = do_p
# undocumented
def find_function(funcname: str, filename: str) -> Optional[Tuple[str, str, int]]: ...
def main() -> None: ...
def help() -> None: ...
if sys.version_info >= (3, 2):
def getsourcelines(obj: _SourceObjectType) -> Tuple[List[str], int]: ...
def lasti2lineno(code: CodeType, lasti: int) -> int: ...
def getsourcelines(obj: _SourceObjectType) -> Tuple[List[str], int]: ...
def lasti2lineno(code: CodeType, lasti: int) -> int: ...
class _rstr(str):
def __repr__(self) -> _rstr: ...

View File

@@ -2,8 +2,7 @@ import sys
from typing import IO, Any, Callable, Iterable, Iterator, Mapping, Optional, Tuple, Type, Union
HIGHEST_PROTOCOL: int
if sys.version_info >= (3, 0):
DEFAULT_PROTOCOL: int
DEFAULT_PROTOCOL: int
bytes_types: Tuple[Type[Any], ...] # undocumented
@@ -38,18 +37,12 @@ if sys.version_info >= (3, 8):
__data: bytes, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ..., buffers: Optional[Iterable[Any]] = ...
) -> Any: ...
elif sys.version_info >= (3, 0):
else:
def dump(obj: Any, file: IO[bytes], protocol: Optional[int] = ..., *, fix_imports: bool = ...) -> None: ...
def dumps(obj: Any, protocol: Optional[int] = ..., *, fix_imports: bool = ...) -> bytes: ...
def load(file: IO[bytes], *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ...
def loads(data: bytes, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ...
else:
def dump(obj: Any, file: IO[bytes], protocol: Optional[int] = ...) -> None: ...
def dumps(obj: Any, protocol: Optional[int] = ...) -> bytes: ...
def load(file: IO[bytes]) -> Any: ...
def loads(string: bytes) -> Any: ...
class PickleError(Exception): ...
class PicklingError(PickleError): ...
class UnpicklingError(PickleError): ...
@@ -64,8 +57,7 @@ _reducedtype = Union[
class Pickler:
fast: bool
if sys.version_info >= (3, 3):
dispatch_table: Mapping[type, Callable[[Any], _reducedtype]]
dispatch_table: Mapping[type, Callable[[Any], _reducedtype]]
if sys.version_info >= (3, 8):
def __init__(
@@ -77,10 +69,8 @@ class Pickler:
buffer_callback: _BufferCallback = ...,
) -> None: ...
def reducer_override(self, obj: Any) -> Any: ...
elif sys.version_info >= (3, 0):
def __init__(self, file: IO[bytes], protocol: Optional[int] = ..., *, fix_imports: bool = ...) -> None: ...
else:
def __init__(self, file: IO[bytes], protocol: Optional[int] = ...) -> None: ...
def __init__(self, file: IO[bytes], protocol: Optional[int] = ..., *, fix_imports: bool = ...) -> None: ...
def dump(self, __obj: Any) -> None: ...
def clear_memo(self) -> None: ...
def persistent_id(self, obj: Any) -> Any: ...
@@ -96,14 +86,11 @@ class Unpickler:
errors: str = ...,
buffers: Optional[Iterable[Any]] = ...,
) -> None: ...
elif sys.version_info >= (3, 0):
def __init__(self, file: IO[bytes], *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> None: ...
else:
def __init__(self, file: IO[bytes]) -> None: ...
def __init__(self, file: IO[bytes], *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> None: ...
def load(self) -> Any: ...
def find_class(self, __module_name: str, __global_name: str) -> Any: ...
if sys.version_info >= (3, 0):
def persistent_load(self, pid: Any) -> Any: ...
def persistent_load(self, pid: Any) -> Any: ...
MARK: bytes
STOP: bytes
@@ -164,23 +151,21 @@ NEWFALSE: bytes
LONG1: bytes
LONG4: bytes
if sys.version_info >= (3, 0):
# protocol 3
BINBYTES: bytes
SHORT_BINBYTES: bytes
# protocol 3
BINBYTES: bytes
SHORT_BINBYTES: bytes
if sys.version_info >= (3, 4):
# protocol 4
SHORT_BINUNICODE: bytes
BINUNICODE8: bytes
BINBYTES8: bytes
EMPTY_SET: bytes
ADDITEMS: bytes
FROZENSET: bytes
NEWOBJ_EX: bytes
STACK_GLOBAL: bytes
MEMOIZE: bytes
FRAME: bytes
# protocol 4
SHORT_BINUNICODE: bytes
BINUNICODE8: bytes
BINBYTES8: bytes
EMPTY_SET: bytes
ADDITEMS: bytes
FROZENSET: bytes
NEWOBJ_EX: bytes
STACK_GLOBAL: bytes
MEMOIZE: bytes
FRAME: bytes
def encode_long(x: int) -> bytes: ... # undocumented
def decode_long(data: bytes) -> int: ... # undocumented

View File

@@ -1,18 +1,13 @@
import sys
from typing import IO, Any, Callable, Iterator, List, MutableMapping, Optional, Text, Tuple, Type, Union
_Reader = Callable[[IO[bytes]], Any]
if sys.version_info >= (3, 0):
bytes_types: Tuple[Type[Any], ...]
bytes_types: Tuple[Type[Any], ...]
UP_TO_NEWLINE: int
TAKEN_FROM_ARGUMENT1: int
TAKEN_FROM_ARGUMENT4: int
if sys.version_info >= (3, 3):
TAKEN_FROM_ARGUMENT4U: int
if sys.version_info >= (3, 4):
TAKEN_FROM_ARGUMENT8U: int
TAKEN_FROM_ARGUMENT4U: int
TAKEN_FROM_ARGUMENT8U: int
class ArgumentDescriptor(object):
name: str
@@ -33,13 +28,13 @@ def read_int4(f: IO[bytes]) -> int: ...
int4: ArgumentDescriptor
if sys.version_info >= (3, 3):
def read_uint4(f: IO[bytes]) -> int: ...
uint4: ArgumentDescriptor
def read_uint4(f: IO[bytes]) -> int: ...
if sys.version_info >= (3, 5):
def read_uint8(f: IO[bytes]) -> int: ...
uint8: ArgumentDescriptor
uint4: ArgumentDescriptor
def read_uint8(f: IO[bytes]) -> int: ...
uint8: ArgumentDescriptor
def read_stringnl(f: IO[bytes], decode: bool = ..., stripquotes: bool = ...) -> Union[bytes, Text]: ...
@@ -61,31 +56,33 @@ def read_string4(f: IO[bytes]) -> str: ...
string4: ArgumentDescriptor
if sys.version_info >= (3, 3):
def read_bytes1(f: IO[bytes]) -> bytes: ...
bytes1: ArgumentDescriptor
def read_bytes4(f: IO[bytes]) -> bytes: ...
bytes4: ArgumentDescriptor
def read_bytes1(f: IO[bytes]) -> bytes: ...
if sys.version_info >= (3, 4):
def read_bytes8(f: IO[bytes]) -> bytes: ...
bytes8: ArgumentDescriptor
bytes1: ArgumentDescriptor
def read_bytes4(f: IO[bytes]) -> bytes: ...
bytes4: ArgumentDescriptor
def read_bytes8(f: IO[bytes]) -> bytes: ...
bytes8: ArgumentDescriptor
def read_unicodestringnl(f: IO[bytes]) -> Text: ...
unicodestringnl: ArgumentDescriptor
if sys.version_info >= (3, 4):
def read_unicodestring1(f: IO[bytes]) -> Text: ...
unicodestring1: ArgumentDescriptor
def read_unicodestring1(f: IO[bytes]) -> Text: ...
unicodestring1: ArgumentDescriptor
def read_unicodestring4(f: IO[bytes]) -> Text: ...
unicodestring4: ArgumentDescriptor
if sys.version_info >= (3, 4):
def read_unicodestring8(f: IO[bytes]) -> Text: ...
unicodestring8: ArgumentDescriptor
def read_unicodestring8(f: IO[bytes]) -> Text: ...
unicodestring8: ArgumentDescriptor
def read_decimalnl_short(f: IO[bytes]) -> int: ...
def read_decimalnl_long(f: IO[bytes]) -> int: ...
@@ -120,19 +117,16 @@ pylong: StackObject
pyinteger_or_bool: StackObject
pybool: StackObject
pyfloat: StackObject
if sys.version_info >= (3, 4):
pybytes_or_str: StackObject
pybytes_or_str: StackObject
pystring: StackObject
if sys.version_info >= (3, 0):
pybytes: StackObject
pybytes: StackObject
pyunicode: StackObject
pynone: StackObject
pytuple: StackObject
pylist: StackObject
pydict: StackObject
if sys.version_info >= (3, 4):
pyset: StackObject
pyfrozenset: StackObject
pyset: StackObject
pyfrozenset: StackObject
anyobject: StackObject
markobject: StackObject
stackslice: StackObject
@@ -160,20 +154,10 @@ opcodes: List[OpcodeInfo]
def genops(pickle: Union[bytes, IO[bytes]]) -> Iterator[Tuple[OpcodeInfo, Optional[Any], Optional[int]]]: ...
def optimize(p: Union[bytes, IO[bytes]]) -> bytes: ...
if sys.version_info >= (3, 2):
def dis(
pickle: Union[bytes, IO[bytes]],
out: Optional[IO[str]] = ...,
memo: Optional[MutableMapping[int, Any]] = ...,
indentlevel: int = ...,
annotate: int = ...,
) -> None: ...
else:
def dis(
pickle: Union[bytes, IO[bytes]],
out: Optional[IO[str]] = ...,
memo: Optional[MutableMapping[int, Any]] = ...,
indentlevel: int = ...,
) -> None: ...
def dis(
pickle: Union[bytes, IO[bytes]],
out: Optional[IO[str]] = ...,
memo: Optional[MutableMapping[int, Any]] = ...,
indentlevel: int = ...,
annotate: int = ...,
) -> None: ...

View File

@@ -1,22 +1,14 @@
import sys
from _typeshed import SupportsRead
from importlib.abc import Loader, MetaPathFinder, PathEntryFinder
from typing import IO, Any, Callable, Iterable, Iterator, List, NamedTuple, Optional, Tuple, Union
if sys.version_info >= (3,):
from importlib.abc import Loader, MetaPathFinder, PathEntryFinder
else:
Loader = Any
MetaPathFinder = Any
PathEntryFinder = Any
class ModuleInfo(NamedTuple):
module_finder: Union[MetaPathFinder, PathEntryFinder]
name: str
ispkg: bool
if sys.version_info >= (3, 6):
class ModuleInfo(NamedTuple):
module_finder: Union[MetaPathFinder, PathEntryFinder]
name: str
ispkg: bool
_ModuleInfoLike = ModuleInfo
else:
_ModuleInfoLike = Tuple[Union[MetaPathFinder, PathEntryFinder], str, bool]
_ModuleInfoLike = ModuleInfo
def extend_path(path: List[str], name: str) -> List[str]: ...

View File

@@ -1,13 +1,13 @@
import sys
from enum import Enum
from typing import IO, Any, Dict as DictT, Mapping, MutableMapping, Optional, Text, Type, Union
if sys.version_info >= (3,):
from enum import Enum
class PlistFormat(Enum):
FMT_XML: int
FMT_BINARY: int
FMT_XML = PlistFormat.FMT_XML
FMT_BINARY = PlistFormat.FMT_BINARY
class PlistFormat(Enum):
FMT_XML: int
FMT_BINARY: int
FMT_XML = PlistFormat.FMT_XML
FMT_BINARY = PlistFormat.FMT_BINARY
_Path = Union[str, Text]
@@ -15,7 +15,7 @@ if sys.version_info >= (3, 9):
def load(fp: IO[bytes], *, fmt: Optional[PlistFormat] = ..., dict_type: Type[MutableMapping[str, Any]] = ...) -> Any: ...
def loads(value: bytes, *, fmt: Optional[PlistFormat] = ..., dict_type: Type[MutableMapping[str, Any]] = ...) -> Any: ...
elif sys.version_info >= (3, 4):
else:
def load(
fp: IO[bytes],
*,
@@ -31,11 +31,10 @@ elif sys.version_info >= (3, 4):
dict_type: Type[MutableMapping[str, Any]] = ...,
) -> Any: ...
if sys.version_info >= (3, 4):
def dump(
value: Mapping[str, Any], fp: IO[bytes], *, fmt: PlistFormat = ..., sort_keys: bool = ..., skipkeys: bool = ...
) -> None: ...
def dumps(value: Mapping[str, Any], *, fmt: PlistFormat = ..., skipkeys: bool = ..., sort_keys: bool = ...) -> bytes: ...
def dump(
value: Mapping[str, Any], fp: IO[bytes], *, fmt: PlistFormat = ..., sort_keys: bool = ..., skipkeys: bool = ...
) -> None: ...
def dumps(value: Mapping[str, Any], *, fmt: PlistFormat = ..., skipkeys: bool = ..., sort_keys: bool = ...) -> bytes: ...
if sys.version_info < (3, 9):
def readPlist(pathOrFile: Union[_Path, IO[bytes]]) -> Any: ...
@@ -43,12 +42,6 @@ if sys.version_info < (3, 9):
def readPlistFromBytes(data: bytes) -> Any: ...
def writePlistToBytes(value: Mapping[str, Any]) -> bytes: ...
if sys.version_info < (3,):
def readPlistFromResource(path: _Path, restype: str = ..., resid: int = ...) -> Any: ...
def writePlistToResource(rootObject: Mapping[str, Any], path: _Path, restype: str = ..., resid: int = ...) -> None: ...
def readPlistFromString(data: str) -> Any: ...
def writePlistToString(rootObject: Mapping[str, Any]) -> str: ...
if sys.version_info < (3, 7):
class Dict(DictT[str, Any]):
def __getattr__(self, attr: str) -> Any: ...

View File

@@ -1,6 +1,5 @@
import socket
import ssl
import sys
from typing import Any, BinaryIO, Dict, List, Optional, Pattern, Text, Tuple, overload
_LongResp = Tuple[bytes, List[bytes], int]
@@ -14,9 +13,7 @@ LF: bytes
CRLF: bytes
class POP3:
if sys.version_info >= (3, 0):
encoding: Text
encoding: Text
host: Text
port: int
sock: socket.socket
@@ -37,37 +34,25 @@ class POP3:
def close(self) -> None: ...
def rpop(self, user: Text) -> bytes: ...
timestamp: Pattern[Text]
if sys.version_info < (3, 0):
def apop(self, user: Text, secret: Text) -> bytes: ...
else:
def apop(self, user: Text, password: Text) -> bytes: ...
def apop(self, user: Text, password: Text) -> bytes: ...
def top(self, which: Any, howmuch: int) -> _LongResp: ...
@overload
def uidl(self) -> _LongResp: ...
@overload
def uidl(self, which: Any) -> bytes: ...
if sys.version_info >= (3, 5):
def utf8(self) -> bytes: ...
if sys.version_info >= (3, 4):
def capa(self) -> Dict[Text, List[Text]]: ...
def stls(self, context: Optional[ssl.SSLContext] = ...) -> bytes: ...
def utf8(self) -> bytes: ...
def capa(self) -> Dict[Text, List[Text]]: ...
def stls(self, context: Optional[ssl.SSLContext] = ...) -> bytes: ...
class POP3_SSL(POP3):
if sys.version_info >= (3, 0):
def __init__(
self,
host: Text,
port: int = ...,
keyfile: Optional[Text] = ...,
certfile: Optional[Text] = ...,
timeout: float = ...,
context: Optional[ssl.SSLContext] = ...,
) -> None: ...
else:
def __init__(
self, host: Text, port: int = ..., keyfile: Optional[Text] = ..., certfile: Optional[Text] = ..., timeout: float = ...
) -> None: ...
if sys.version_info >= (3, 4):
# "context" is actually the last argument, but that breaks LSP and it doesn't really matter because all the arguments are ignored
def stls(self, context: Any = ..., keyfile: Any = ..., certfile: Any = ...) -> bytes: ...
def __init__(
self,
host: Text,
port: int = ...,
keyfile: Optional[Text] = ...,
certfile: Optional[Text] = ...,
timeout: float = ...,
context: Optional[ssl.SSLContext] = ...,
) -> None: ...
# "context" is actually the last argument, but that breaks LSP and it doesn't really matter because all the arguments are ignored
def stls(self, context: Any = ..., keyfile: Any = ..., certfile: Any = ...) -> bytes: ...

View File

@@ -24,14 +24,11 @@ elif sys.version_info >= (3, 8):
sort_dicts: bool = ...,
) -> str: ...
elif sys.version_info >= (3, 4):
else:
def pformat(
object: object, indent: int = ..., width: int = ..., depth: Optional[int] = ..., *, compact: bool = ...
) -> str: ...
else:
def pformat(object: object, indent: int = ..., width: int = ..., depth: Optional[int] = ...) -> str: ...
if sys.version_info >= (3, 10):
def pp(
object: object,
@@ -82,7 +79,7 @@ elif sys.version_info >= (3, 8):
sort_dicts: bool = ...,
) -> None: ...
elif sys.version_info >= (3, 4):
else:
def pprint(
object: object,
stream: Optional[IO[str]] = ...,
@@ -93,11 +90,6 @@ elif sys.version_info >= (3, 4):
compact: bool = ...,
) -> None: ...
else:
def pprint(
object: object, stream: Optional[IO[str]] = ..., indent: int = ..., width: int = ..., depth: Optional[int] = ...
) -> None: ...
def isreadable(object: object) -> bool: ...
def isrecursive(object: object) -> bool: ...
def saferepr(object: object) -> str: ...
@@ -126,7 +118,7 @@ class PrettyPrinter:
compact: bool = ...,
sort_dicts: bool = ...,
) -> None: ...
elif sys.version_info >= (3, 4):
else:
def __init__(
self,
indent: int = ...,
@@ -136,10 +128,6 @@ class PrettyPrinter:
*,
compact: bool = ...,
) -> None: ...
else:
def __init__(
self, indent: int = ..., width: int = ..., depth: Optional[int] = ..., stream: Optional[IO[str]] = ...
) -> None: ...
def pformat(self, object: object) -> str: ...
def pprint(self, object: object) -> None: ...
def isreadable(self, object: object) -> bool: ...

View File

@@ -1,4 +1,3 @@
import sys
from typing import Callable, Iterable, Tuple, Union
_Reader = Callable[[int], bytes]
@@ -13,9 +12,4 @@ def openpty() -> Tuple[int, int]: ...
def master_open() -> Tuple[int, str]: ...
def slave_open(tty_name: str) -> int: ...
def fork() -> Tuple[int, int]: ...
if sys.version_info >= (3, 4):
def spawn(argv: Union[str, Iterable[str]], master_read: _Reader = ..., stdin_read: _Reader = ...) -> int: ...
else:
def spawn(argv: Union[str, Iterable[str]], master_read: _Reader = ..., stdin_read: _Reader = ...) -> None: ...
def spawn(argv: Union[str, Iterable[str]], master_read: _Reader = ..., stdin_read: _Reader = ...) -> int: ...

View File

@@ -39,14 +39,9 @@ elif sys.version_info >= (3, 7):
invalidation_mode: Optional[PycInvalidationMode] = ...,
) -> Optional[AnyStr]: ...
elif sys.version_info >= (3, 2):
else:
def compile(
file: AnyStr, cfile: Optional[AnyStr] = ..., dfile: Optional[AnyStr] = ..., doraise: bool = ..., optimize: int = ...
) -> Optional[AnyStr]: ...
else:
def compile(
file: _EitherStr, cfile: Optional[_EitherStr] = ..., dfile: Optional[_EitherStr] = ..., doraise: bool = ...
) -> None: ...
def main(args: Optional[List[Text]] = ...) -> int: ...

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import SupportsWrite
from reprlib import Repr
from types import MethodType, ModuleType, TracebackType
from typing import (
IO,
@@ -19,11 +19,6 @@ from typing import (
Union,
)
if sys.version_info >= (3,):
from reprlib import Repr
else:
from repr import Repr
# the return type of sys.exc_info(), used by ErrorDuringImport.__init__
_Exc_Info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
@@ -265,9 +260,3 @@ class ModuleScanner:
def apropos(key: str) -> None: ...
def ispath(x: Any) -> bool: ...
def cli() -> None: ...
if sys.version_info < (3,):
def serve(
port: int, callback: Optional[Callable[[Any], None]] = ..., completer: Optional[Callable[[], None]] = ...
) -> None: ...
def gui() -> None: ...

View File

@@ -1,9 +1,7 @@
import sys
from typing import Dict
if sys.version_info >= (3, 2):
codes: Dict[str, int]
messages: Dict[int, str]
codes: Dict[str, int]
messages: Dict[int, str]
XML_ERROR_ABORTED: str
XML_ERROR_ASYNC_ENTITY: str

View File

@@ -1,4 +1,3 @@
import sys
from _typeshed import AnyPath
from typing import Callable, Optional, Sequence
@@ -12,10 +11,7 @@ def insert_text(__string: str) -> None: ...
def redisplay() -> None: ...
def read_history_file(__filename: Optional[AnyPath] = ...) -> None: ...
def write_history_file(__filename: Optional[AnyPath] = ...) -> None: ...
if sys.version_info >= (3, 5):
def append_history_file(__nelements: int, __filename: Optional[AnyPath] = ...) -> None: ...
def append_history_file(__nelements: int, __filename: Optional[AnyPath] = ...) -> None: ...
def get_history_length() -> int: ...
def set_history_length(__length: int) -> None: ...
def clear_history() -> None: ...
@@ -24,10 +20,7 @@ def get_history_item(__index: int) -> str: ...
def remove_history_item(__pos: int) -> None: ...
def replace_history_item(__pos: int, __line: str) -> None: ...
def add_history(__string: str) -> None: ...
if sys.version_info >= (3, 6):
def set_auto_history(__enabled: bool) -> None: ...
def set_auto_history(__enabled: bool) -> None: ...
def set_startup_hook(__function: Optional[Callable[[], None]] = ...) -> None: ...
def set_pre_input_hook(__function: Optional[Callable[[], None]] = ...) -> None: ...
def set_completer(__function: _CompleterT = ...) -> None: ...

View File

@@ -1,10 +1,6 @@
import sys
from typing import Any, Dict, Optional, Union
from typing import Any, Dict, Optional
if sys.version_info >= (3,):
_Text = str
else:
_Text = Union[str, unicode]
_Text = str
class Completer:
def __init__(self, namespace: Optional[Dict[str, Any]] = ...) -> None: ...

View File

@@ -1,4 +1,3 @@
import sys
from typing import Any, Callable, Dict, List, NamedTuple, Optional, Text, Tuple
class Event(NamedTuple):
@@ -9,30 +8,24 @@ class Event(NamedTuple):
kwargs: Dict[Text, Any]
class scheduler:
if sys.version_info >= (3, 3):
def __init__(self, timefunc: Callable[[], float] = ..., delayfunc: Callable[[float], None] = ...) -> None: ...
def enterabs(
self,
time: float,
priority: Any,
action: Callable[..., Any],
argument: Tuple[Any, ...] = ...,
kwargs: Dict[str, Any] = ...,
) -> Event: ...
def enter(
self,
delay: float,
priority: Any,
action: Callable[..., Any],
argument: Tuple[Any, ...] = ...,
kwargs: Dict[str, Any] = ...,
) -> Event: ...
def run(self, blocking: bool = ...) -> Optional[float]: ...
else:
def __init__(self, timefunc: Callable[[], float], delayfunc: Callable[[float], None]) -> None: ...
def enterabs(self, time: float, priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...]) -> Event: ...
def enter(self, delay: float, priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...]) -> Event: ...
def run(self) -> None: ...
def __init__(self, timefunc: Callable[[], float] = ..., delayfunc: Callable[[float], None] = ...) -> None: ...
def enterabs(
self,
time: float,
priority: Any,
action: Callable[..., Any],
argument: Tuple[Any, ...] = ...,
kwargs: Dict[str, Any] = ...,
) -> Event: ...
def enter(
self,
delay: float,
priority: Any,
action: Callable[..., Any],
argument: Tuple[Any, ...] = ...,
kwargs: Dict[str, Any] = ...,
) -> Event: ...
def run(self, blocking: bool = ...) -> Optional[float]: ...
def cancel(self, event: Event) -> None: ...
def empty(self) -> bool: ...
@property

View File

@@ -28,10 +28,7 @@ def select(
__rlist: Iterable[Any], __wlist: Iterable[Any], __xlist: Iterable[Any], __timeout: Optional[float] = ...
) -> Tuple[List[Any], List[Any], List[Any]]: ...
if sys.version_info >= (3, 3):
error = OSError
else:
class error(Exception): ...
error = OSError
if sys.platform != "linux" and sys.platform != "win32":
# BSD only
@@ -103,18 +100,14 @@ if sys.platform != "linux" and sys.platform != "win32":
if sys.platform == "linux":
class epoll(object):
if sys.version_info >= (3, 3):
def __init__(self, sizehint: int = ..., flags: int = ...) -> None: ...
else:
def __init__(self, sizehint: int = ...) -> None: ...
if sys.version_info >= (3, 4):
def __enter__(self) -> epoll: ...
def __exit__(
self,
exc_type: Optional[Type[BaseException]] = ...,
exc_val: Optional[BaseException] = ...,
exc_tb: Optional[TracebackType] = ...,
) -> None: ...
def __init__(self, sizehint: int = ..., flags: int = ...) -> None: ...
def __enter__(self) -> epoll: ...
def __exit__(
self,
exc_type: Optional[Type[BaseException]] = ...,
exc_val: Optional[BaseException] = ...,
exc_tb: Optional[TracebackType] = ...,
) -> None: ...
def close(self) -> None: ...
closed: bool
def fileno(self) -> int: ...
@@ -139,14 +132,12 @@ if sys.platform == "linux":
EPOLL_RDHUP: int
if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32":
if sys.version_info >= (3, 3):
# Solaris only
class devpoll:
if sys.version_info >= (3, 4):
def close(self) -> None: ...
closed: bool
def fileno(self) -> int: ...
def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
def modify(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
def unregister(self, fd: FileDescriptorLike) -> None: ...
def poll(self, timeout: Optional[float] = ...) -> List[Tuple[int, int]]: ...
# Solaris only
class devpoll:
def close(self) -> None: ...
closed: bool
def fileno(self) -> int: ...
def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
def modify(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
def unregister(self, fd: FileDescriptorLike) -> None: ...
def poll(self, timeout: Optional[float] = ...) -> List[Tuple[int, int]]: ...

View File

@@ -1,67 +1,27 @@
import os
import sys
from _typeshed import StrPath, SupportsRead, SupportsWrite
from typing import (
Any,
AnyStr,
Callable,
Iterable,
List,
NamedTuple,
Optional,
Sequence,
Set,
Tuple,
Type,
TypeVar,
Union,
overload,
)
from typing import Any, AnyStr, Callable, Iterable, List, NamedTuple, Optional, Sequence, Set, Tuple, TypeVar, Union, overload
if sys.version_info >= (3, 6):
_AnyStr = str
_AnyPath = TypeVar("_AnyPath", str, os.PathLike[str])
# Return value of some functions that may either return a path-like object that was passed in or
# a string
_PathReturn = Any
elif sys.version_info >= (3,):
_AnyStr = str
_AnyPath = str
_PathReturn = str
else:
_AnyStr = TypeVar("_AnyStr", str, unicode)
_AnyPath = TypeVar("_AnyPath", str, unicode)
_PathReturn = Type[None]
_AnyStr = str
_AnyPath = TypeVar("_AnyPath", str, os.PathLike[str])
# Return value of some functions that may either return a path-like object that was passed in or
# a string
_PathReturn = Any
if sys.version_info >= (3,):
class Error(OSError): ...
class SameFileError(Error): ...
class SpecialFileError(OSError): ...
class ExecError(OSError): ...
class ReadError(OSError): ...
class RegistryError(Exception): ...
else:
class Error(EnvironmentError): ...
class SpecialFileError(EnvironmentError): ...
class ExecError(EnvironmentError): ...
class Error(OSError): ...
class SameFileError(Error): ...
class SpecialFileError(OSError): ...
class ExecError(OSError): ...
class ReadError(OSError): ...
class RegistryError(Exception): ...
def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ...
if sys.version_info >= (3,):
def copyfile(src: StrPath, dst: _AnyPath, *, follow_symlinks: bool = ...) -> _AnyPath: ...
def copymode(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ...
def copystat(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ...
def copy(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ...
def copy2(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ...
else:
def copyfile(src: StrPath, dst: StrPath) -> None: ...
def copymode(src: StrPath, dst: StrPath) -> None: ...
def copystat(src: StrPath, dst: StrPath) -> None: ...
def copy(src: StrPath, dst: StrPath) -> _PathReturn: ...
def copy2(src: StrPath, dst: StrPath) -> _PathReturn: ...
def copyfile(src: StrPath, dst: _AnyPath, *, follow_symlinks: bool = ...) -> _AnyPath: ...
def copymode(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ...
def copystat(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ...
def copy(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ...
def copy2(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ...
def ignore_patterns(*patterns: StrPath) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
if sys.version_info >= (3, 8):
@@ -75,7 +35,7 @@ if sys.version_info >= (3, 8):
dirs_exist_ok: bool = ...,
) -> _PathReturn: ...
elif sys.version_info >= (3,):
else:
def copytree(
src: StrPath,
dst: StrPath,
@@ -85,43 +45,26 @@ elif sys.version_info >= (3,):
ignore_dangling_symlinks: bool = ...,
) -> _PathReturn: ...
else:
def copytree(
src: AnyStr,
dst: AnyStr,
symlinks: bool = ...,
ignore: Union[None, Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]]] = ...,
) -> _PathReturn: ...
if sys.version_info >= (3,):
def rmtree(
path: Union[bytes, StrPath], ignore_errors: bool = ..., onerror: Optional[Callable[[Any, Any, Any], Any]] = ...
) -> None: ...
else:
def rmtree(
path: _AnyPath, ignore_errors: bool = ..., onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ...
) -> None: ...
def rmtree(
path: Union[bytes, StrPath], ignore_errors: bool = ..., onerror: Optional[Callable[[Any, Any, Any], Any]] = ...
) -> None: ...
_CopyFn = Union[Callable[[str, str], None], Callable[[StrPath, StrPath], None]]
if sys.version_info >= (3, 9):
def move(src: StrPath, dst: StrPath, copy_function: _CopyFn = ...) -> _PathReturn: ...
elif sys.version_info >= (3, 5):
else:
# See https://bugs.python.org/issue32689
def move(src: str, dst: StrPath, copy_function: _CopyFn = ...) -> _PathReturn: ...
else:
def move(src: StrPath, dst: StrPath) -> _PathReturn: ...
class _ntuple_diskusage(NamedTuple):
total: int
used: int
free: int
if sys.version_info >= (3,):
class _ntuple_diskusage(NamedTuple):
total: int
used: int
free: int
def disk_usage(path: StrPath) -> _ntuple_diskusage: ...
def chown(path: StrPath, user: Optional[Union[str, int]] = ..., group: Optional[Union[str, int]] = ...) -> None: ...
def disk_usage(path: StrPath) -> _ntuple_diskusage: ...
def chown(path: StrPath, user: Optional[Union[str, int]] = ..., group: Optional[Union[str, int]] = ...) -> None: ...
if sys.version_info >= (3, 8):
@overload
@@ -129,7 +72,7 @@ if sys.version_info >= (3, 8):
@overload
def which(cmd: bytes, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[bytes]: ...
elif sys.version_info >= (3,):
else:
def which(cmd: StrPath, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[str]: ...
def make_archive(
@@ -152,19 +95,16 @@ def register_archive_format(
) -> None: ...
def unregister_archive_format(name: str) -> None: ...
if sys.version_info >= (3,):
if sys.version_info >= (3, 7):
def unpack_archive(filename: StrPath, extract_dir: Optional[StrPath] = ..., format: Optional[str] = ...) -> None: ...
else:
# See http://bugs.python.org/issue30218
def unpack_archive(filename: str, extract_dir: Optional[StrPath] = ..., format: Optional[str] = ...) -> None: ...
def register_unpack_format(
name: str,
extensions: List[str],
function: Any,
extra_args: Optional[Sequence[Tuple[str, Any]]] = ...,
description: str = ...,
) -> None: ...
def unregister_unpack_format(name: str) -> None: ...
def get_unpack_formats() -> List[Tuple[str, List[str], str]]: ...
def get_terminal_size(fallback: Tuple[int, int] = ...) -> os.terminal_size: ...
if sys.version_info >= (3, 7):
def unpack_archive(filename: StrPath, extract_dir: Optional[StrPath] = ..., format: Optional[str] = ...) -> None: ...
else:
# See http://bugs.python.org/issue30218
def unpack_archive(filename: str, extract_dir: Optional[StrPath] = ..., format: Optional[str] = ...) -> None: ...
def register_unpack_format(
name: str, extensions: List[str], function: Any, extra_args: Optional[Sequence[Tuple[str, Any]]] = ..., description: str = ...
) -> None: ...
def unregister_unpack_format(name: str) -> None: ...
def get_unpack_formats() -> List[Tuple[str, List[str], str]]: ...
def get_terminal_size(fallback: Tuple[int, int] = ...) -> os.terminal_size: ...

View File

@@ -1,7 +1,6 @@
import asynchat
import asyncore
import socket
import sys
from typing import Any, DefaultDict, List, Optional, Text, Tuple, Type, Union
_Address = Tuple[str, int] # (host, port)
@@ -10,39 +9,35 @@ class SMTPChannel(asynchat.async_chat):
COMMAND: int
DATA: int
if sys.version_info >= (3,):
command_size_limits: DefaultDict[str, int]
smtp_server: SMTPServer
conn: socket.socket
addr: Any
received_lines: List[Text]
smtp_state: int
seen_greeting: str
mailfrom: str
rcpttos: List[str]
received_data: str
fqdn: str
peer: str
command_size_limits: DefaultDict[str, int]
smtp_server: SMTPServer
conn: socket.socket
addr: Any
received_lines: List[Text]
smtp_state: int
seen_greeting: str
mailfrom: str
rcpttos: List[str]
received_data: str
fqdn: str
peer: str
command_size_limit: int
data_size_limit: int
command_size_limit: int
data_size_limit: int
enable_SMTPUTF8: bool
@property
def max_command_size_limit(self) -> int: ...
if sys.version_info >= (3,):
def __init__(
self,
server: SMTPServer,
conn: socket.socket,
addr: Any,
data_size_limit: int = ...,
map: Optional[asyncore._maptype] = ...,
enable_SMTPUTF8: bool = ...,
decode_data: bool = ...,
) -> None: ...
else:
def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ...) -> None: ...
enable_SMTPUTF8: bool
@property
def max_command_size_limit(self) -> int: ...
def __init__(
self,
server: SMTPServer,
conn: socket.socket,
addr: Any,
data_size_limit: int = ...,
map: Optional[asyncore._maptype] = ...,
enable_SMTPUTF8: bool = ...,
decode_data: bool = ...,
) -> None: ...
# base asynchat.async_chat.push() accepts bytes
def push(self, msg: Text) -> None: ... # type: ignore
def collect_incoming_data(self, data: bytes) -> None: ...
@@ -54,30 +49,25 @@ class SMTPChannel(asynchat.async_chat):
def smtp_RCPT(self, arg: str) -> None: ...
def smtp_RSET(self, arg: str) -> None: ...
def smtp_DATA(self, arg: str) -> None: ...
if sys.version_info >= (3, 3):
def smtp_EHLO(self, arg: str) -> None: ...
def smtp_HELP(self, arg: str) -> None: ...
def smtp_VRFY(self, arg: str) -> None: ...
def smtp_EXPN(self, arg: str) -> None: ...
def smtp_EHLO(self, arg: str) -> None: ...
def smtp_HELP(self, arg: str) -> None: ...
def smtp_VRFY(self, arg: str) -> None: ...
def smtp_EXPN(self, arg: str) -> None: ...
class SMTPServer(asyncore.dispatcher):
channel_class: Type[SMTPChannel]
data_size_limit: int
enable_SMTPUTF8: bool
if sys.version_info >= (3,):
def __init__(
self,
localaddr: _Address,
remoteaddr: _Address,
data_size_limit: int = ...,
map: Optional[asyncore._maptype] = ...,
enable_SMTPUTF8: bool = ...,
decode_data: bool = ...,
) -> None: ...
else:
def __init__(self, localaddr: _Address, remoteaddr: _Address, data_size_limit: int = ...) -> None: ...
def __init__(
self,
localaddr: _Address,
remoteaddr: _Address,
data_size_limit: int = ...,
map: Optional[asyncore._maptype] = ...,
enable_SMTPUTF8: bool = ...,
decode_data: bool = ...,
) -> None: ...
def handle_accepted(self, conn: socket.socket, addr: Any) -> None: ...
def process_message(
self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: Union[bytes, str], **kwargs: Any

View File

@@ -1,17 +1,14 @@
import sys
from _typeshed import AnyPath
from typing import NamedTuple, Optional, Tuple, Union
from typing import NamedTuple, Optional, Union
if sys.version_info >= (3, 5):
class SndHeaders(NamedTuple):
filetype: str
framerate: int
nchannels: int
nframes: int
sampwidth: Union[int, str]
_SndHeaders = SndHeaders
else:
_SndHeaders = Tuple[str, int, int, int, Union[int, str]]
class SndHeaders(NamedTuple):
filetype: str
framerate: int
nchannels: int
nframes: int
sampwidth: Union[int, str]
_SndHeaders = SndHeaders
def what(filename: AnyPath) -> Optional[_SndHeaders]: ...
def whathdr(filename: AnyPath) -> Optional[_SndHeaders]: ...

View File

@@ -1,4 +1,5 @@
import sys
from enum import IntEnum, IntFlag
from typing import Any, BinaryIO, Iterable, List, Optional, Text, TextIO, Tuple, TypeVar, Union, overload
from typing_extensions import Literal
@@ -13,8 +14,7 @@ from typing_extensions import Literal
# Constants defined by Python (i.e. not OS constants re-exported from C)
has_ipv6: bool
SocketType: Any
if sys.version_info >= (3,):
SocketIO: Any
SocketIO: Any
# Re-exported errno
EAGAIN: int
@@ -35,7 +35,7 @@ SOCK_RAW: SocketKind
SOCK_RDM: SocketKind
SOCK_SEQPACKET: SocketKind
if sys.platform == "linux" and sys.version_info >= (3,):
if sys.platform == "linux":
SOCK_CLOEXEC: SocketKind
SOCK_NONBLOCK: SocketKind
@@ -268,7 +268,7 @@ if sys.version_info >= (3, 7):
# Specifically-documented constants
if sys.platform == "linux" and sys.version_info >= (3,):
if sys.platform == "linux":
AF_CAN: AddressFamily
PF_CAN: int
SOL_CAN_BASE: int
@@ -361,7 +361,7 @@ if sys.platform == "linux":
PACKET_OTHERHOST: int
PACKET_OUTGOING: int
if sys.platform == "linux" and sys.version_info >= (3,):
if sys.platform == "linux":
AF_RDS: AddressFamily
PF_RDS: int
SOL_RDS: int
@@ -387,8 +387,7 @@ if sys.platform == "linux" and sys.version_info >= (3,):
if sys.platform == "win32":
SIO_RCVALL: int
SIO_KEEPALIVE_VALS: int
if sys.version_info >= (3, 6):
SIO_LOOPBACK_FAST_PATH: int
SIO_LOOPBACK_FAST_PATH: int
RCVALL_IPLEVEL: int
RCVALL_MAX: int
RCVALL_OFF: int
@@ -422,7 +421,7 @@ if sys.platform == "linux":
TIPC_WITHDRAWN: int
TIPC_ZONE_SCOPE: int
if sys.platform == "linux" and sys.version_info >= (3, 6):
if sys.platform == "linux":
AF_ALG: AddressFamily
SOL_ALG: int
ALG_OP_DECRYPT: int
@@ -451,13 +450,12 @@ AF_LINK: AddressFamily # Availability: BSD, macOS
# BDADDR_* and HCI_* listed with other bluetooth constants below
if sys.version_info >= (3, 6):
SO_DOMAIN: int
SO_PASSSEC: int
SO_PEERSEC: int
SO_PROTOCOL: int
TCP_CONGESTION: int
TCP_USER_TIMEOUT: int
SO_DOMAIN: int
SO_PASSSEC: int
SO_PEERSEC: int
SO_PROTOCOL: int
TCP_CONGESTION: int
TCP_USER_TIMEOUT: int
if sys.platform == "linux" and sys.version_info >= (3, 8):
AF_QIPCRTR: AddressFamily
@@ -506,90 +504,76 @@ if sys.platform == "darwin":
SYSPROTO_CONTROL: int
# enum versions of above flags
if sys.version_info >= (3, 4):
from enum import IntEnum
class AddressFamily(IntEnum):
AF_UNIX: int
AF_INET: int
AF_INET6: int
AF_AAL5: int
AF_ALG: int
AF_APPLETALK: int
AF_ASH: int
AF_ATMPVC: int
AF_ATMSVC: int
AF_AX25: int
AF_BLUETOOTH: int
AF_BRIDGE: int
AF_CAN: int
AF_DECnet: int
AF_ECONET: int
AF_IPX: int
AF_IRDA: int
AF_KEY: int
AF_LINK: int
AF_LLC: int
AF_NETBEUI: int
AF_NETLINK: int
AF_NETROM: int
AF_PACKET: int
AF_PPPOX: int
AF_QIPCRTR: int
AF_RDS: int
AF_ROSE: int
AF_ROUTE: int
AF_SECURITY: int
AF_SNA: int
AF_SYSTEM: int
AF_TIPC: int
AF_UNSPEC: int
AF_VSOCK: int
AF_WANPIPE: int
AF_X25: int
class SocketKind(IntEnum):
SOCK_STREAM: int
SOCK_DGRAM: int
SOCK_RAW: int
SOCK_RDM: int
SOCK_SEQPACKET: int
SOCK_CLOEXEC: int
SOCK_NONBLOCK: int
class AddressFamily(IntEnum):
AF_UNIX: int
AF_INET: int
AF_INET6: int
AF_AAL5: int
AF_ALG: int
AF_APPLETALK: int
AF_ASH: int
AF_ATMPVC: int
AF_ATMSVC: int
AF_AX25: int
AF_BLUETOOTH: int
AF_BRIDGE: int
AF_CAN: int
AF_DECnet: int
AF_ECONET: int
AF_IPX: int
AF_IRDA: int
AF_KEY: int
AF_LINK: int
AF_LLC: int
AF_NETBEUI: int
AF_NETLINK: int
AF_NETROM: int
AF_PACKET: int
AF_PPPOX: int
AF_QIPCRTR: int
AF_RDS: int
AF_ROSE: int
AF_ROUTE: int
AF_SECURITY: int
AF_SNA: int
AF_SYSTEM: int
AF_TIPC: int
AF_UNSPEC: int
AF_VSOCK: int
AF_WANPIPE: int
AF_X25: int
else:
AddressFamily = int
SocketKind = int
class SocketKind(IntEnum):
SOCK_STREAM: int
SOCK_DGRAM: int
SOCK_RAW: int
SOCK_RDM: int
SOCK_SEQPACKET: int
SOCK_CLOEXEC: int
SOCK_NONBLOCK: int
if sys.version_info >= (3, 6):
from enum import IntFlag
class AddressInfo(IntFlag):
AI_ADDRCONFIG: int
AI_ALL: int
AI_CANONNAME: int
AI_NUMERICHOST: int
AI_NUMERICSERV: int
AI_PASSIVE: int
AI_V4MAPPED: int
class MsgFlag(IntFlag):
MSG_CTRUNC: int
MSG_DONTROUTE: int
MSG_DONTWAIT: int
MSG_EOR: int
MSG_OOB: int
MSG_PEEK: int
MSG_TRUNC: int
MSG_WAITALL: int
class AddressInfo(IntFlag):
AI_ADDRCONFIG: int
AI_ALL: int
AI_CANONNAME: int
AI_NUMERICHOST: int
AI_NUMERICSERV: int
AI_PASSIVE: int
AI_V4MAPPED: int
else:
AddressInfo = int
MsgFlag = int
class MsgFlag(IntFlag):
MSG_CTRUNC: int
MSG_DONTROUTE: int
MSG_DONTWAIT: int
MSG_EOR: int
MSG_OOB: int
MSG_PEEK: int
MSG_TRUNC: int
MSG_WAITALL: int
# ----- Exceptions -----
if sys.version_info < (3,):
class error(IOError): ...
else:
error = OSError
error = OSError
class herror(error):
def __init__(self, herror: int = ..., string: str = ...) -> None: ...
@@ -617,13 +601,9 @@ class socket:
family: int
type: int
proto: int
if sys.version_info < (3,):
def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ...
else:
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: Optional[int] = ...) -> None: ...
def __enter__(self: _SelfT) -> _SelfT: ...
def __exit__(self, *args: Any) -> None: ...
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: Optional[int] = ...) -> None: ...
def __enter__(self: _SelfT) -> _SelfT: ...
def __exit__(self, *args: Any) -> None: ...
# --- methods ---
def accept(self) -> Tuple[socket, _RetAddress]: ...
def bind(self, address: Union[_Address, bytes]) -> None: ...
@@ -633,8 +613,7 @@ class socket:
def detach(self) -> int: ...
def dup(self) -> socket: ...
def fileno(self) -> int: ...
if sys.version_info >= (3, 4):
def get_inheritable(self) -> bool: ...
def get_inheritable(self) -> bool: ...
def getpeername(self) -> _RetAddress: ...
def getsockname(self) -> _RetAddress: ...
@overload
@@ -644,42 +623,34 @@ class socket:
if sys.version_info >= (3, 7):
def getblocking(self) -> bool: ...
def gettimeout(self) -> Optional[float]: ...
if sys.platform == "win32" and sys.version_info >= (3, 6):
if sys.platform == "win32":
def ioctl(self, control: int, option: Union[int, Tuple[int, int, int], bool]) -> None: ...
elif sys.platform == "win32":
def ioctl(self, control: int, option: Union[int, Tuple[int, int, int]]) -> None: ...
if sys.version_info >= (3, 5):
def listen(self, __backlog: int = ...) -> None: ...
else:
def listen(self, __backlog: int) -> None: ...
def listen(self, __backlog: int = ...) -> None: ...
# Note that the makefile's documented windows-specific behavior is not represented
if sys.version_info >= (3,):
# mode strings with duplicates are intentionally excluded
@overload
def makefile(
self,
mode: Literal["r", "w", "rw", "wr", ""] = ...,
buffering: Optional[int] = ...,
*,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
) -> TextIO: ...
@overload
def makefile(
self,
mode: Literal["b", "rb", "br", "wb", "bw", "rwb", "rbw", "wrb", "wbr", "brw", "bwr"],
buffering: Optional[int] = ...,
*,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
) -> BinaryIO: ...
else:
def makefile(self, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
# mode strings with duplicates are intentionally excluded
@overload
def makefile(
self,
mode: Literal["r", "w", "rw", "wr", ""] = ...,
buffering: Optional[int] = ...,
*,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
) -> TextIO: ...
@overload
def makefile(
self,
mode: Literal["b", "rb", "br", "wb", "bw", "rwb", "rbw", "wrb", "wbr", "brw", "bwr"],
buffering: Optional[int] = ...,
*,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
) -> BinaryIO: ...
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
def recvfrom(self, bufsize: int, flags: int = ...) -> Tuple[bytes, _RetAddress]: ...
if sys.version_info >= (3, 3) and sys.platform != "win32":
if sys.platform != "win32":
def recvmsg(self, __bufsize: int, __ancbufsize: int = ..., __flags: int = ...) -> Tuple[bytes, List[_CMSG], int, Any]: ...
def recvmsg_into(
self, __buffers: Iterable[_WriteBuffer], __ancbufsize: int = ..., __flags: int = ...
@@ -692,26 +663,22 @@ class socket:
def sendto(self, data: bytes, address: _Address) -> int: ...
@overload
def sendto(self, data: bytes, flags: int, address: _Address) -> int: ...
if sys.version_info >= (3, 3) and sys.platform != "win32":
if sys.platform != "win32":
def sendmsg(
self, __buffers: Iterable[bytes], __ancdata: Iterable[_CMSG] = ..., __flags: int = ..., __address: _Address = ...
) -> int: ...
if sys.platform == "linux" and sys.version_info >= (3, 6):
if sys.platform == "linux":
def sendmsg_afalg(
self, msg: Iterable[bytes] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
) -> int: ...
if sys.version_info >= (3,):
def sendfile(self, file: BinaryIO, offset: int = ..., count: Optional[int] = ...) -> int: ...
def set_inheritable(self, inheritable: bool) -> None: ...
def sendfile(self, file: BinaryIO, offset: int = ..., count: Optional[int] = ...) -> int: ...
def set_inheritable(self, inheritable: bool) -> None: ...
def setblocking(self, flag: bool) -> None: ...
def settimeout(self, value: Optional[float]) -> None: ...
if sys.version_info < (3, 6):
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
else:
@overload
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
@overload
def setsockopt(self, level: int, optname: int, value: None, optlen: int) -> None: ...
@overload
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
@overload
def setsockopt(self, level: int, optname: int, value: None, optlen: int) -> None: ...
if sys.platform == "win32":
def share(self, process_id: int) -> bytes: ...
def shutdown(self, how: int) -> None: ...
@@ -735,30 +702,18 @@ if sys.version_info >= (3, 8):
def fromfd(fd: int, family: int, type: int, proto: int = ...) -> socket: ...
if sys.platform == "win32" and sys.version_info >= (3, 3):
if sys.platform == "win32":
def fromshare(info: bytes) -> socket: ...
# the 5th tuple item is an address
if sys.version_info >= (3,):
def getaddrinfo(
host: Optional[Union[bytearray, bytes, Text]],
port: Union[str, int, None],
family: int = ...,
type: int = ...,
proto: int = ...,
flags: int = ...,
) -> List[Tuple[AddressFamily, SocketKind, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]: ...
else:
def getaddrinfo(
host: Optional[Union[bytearray, bytes, Text]],
port: Union[str, int, None],
family: int = ...,
socktype: int = ...,
proto: int = ...,
flags: int = ...,
) -> List[Tuple[AddressFamily, SocketKind, int, str, Tuple[Any, ...]]]: ...
def getaddrinfo(
host: Optional[Union[bytearray, bytes, Text]],
port: Union[str, int, None],
family: int = ...,
type: int = ...,
proto: int = ...,
flags: int = ...,
) -> List[Tuple[AddressFamily, SocketKind, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]: ...
def getfqdn(name: str = ...) -> str: ...
def gethostbyname(hostname: str) -> str: ...
def gethostbyname_ex(hostname: str) -> Tuple[str, List[str], List[str]]: ...
@@ -792,18 +747,16 @@ if sys.version_info >= (3, 9):
) -> int: ...
def recv_fds(sock: socket, bufsize: int, maxfds: int, flags: int = ...) -> Tuple[bytes, List[int], int, Any]: ...
if sys.version_info >= (3, 3):
def CMSG_LEN(length: int) -> int: ...
def CMSG_SPACE(length: int) -> int: ...
def CMSG_LEN(length: int) -> int: ...
def CMSG_SPACE(length: int) -> int: ...
def getdefaulttimeout() -> Optional[float]: ...
def setdefaulttimeout(timeout: Optional[float]) -> None: ...
if sys.version_info >= (3, 3):
if sys.platform != "win32":
def sethostname(name: str) -> None: ...
# 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: ...
if sys.platform != "win32":
def sethostname(name: str) -> None: ...
# 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: ...

View File

@@ -18,10 +18,7 @@ def TimestampFromTicks(ticks: float) -> Timestamp: ...
version_info: Tuple[int, int, int]
sqlite_version_info: Tuple[int, int, int]
if sys.version_info >= (3,):
Binary = memoryview
else:
Binary = buffer
Binary = memoryview
# The remaining definitions are imported from _sqlite3.
@@ -79,18 +76,6 @@ if sys.version_info >= (3, 7):
uri: bool = ...,
) -> Connection: ...
elif sys.version_info >= (3, 4):
def connect(
database: Union[bytes, Text],
timeout: float = ...,
detect_types: int = ...,
isolation_level: Optional[str] = ...,
check_same_thread: bool = ...,
factory: Optional[Type[Connection]] = ...,
cached_statements: int = ...,
uri: bool = ...,
) -> Connection: ...
else:
def connect(
database: Union[bytes, Text],
@@ -100,6 +85,7 @@ else:
check_same_thread: bool = ...,
factory: Optional[Type[Connection]] = ...,
cached_statements: int = ...,
uri: bool = ...,
) -> Connection: ...
def enable_callback_tracebacks(__enable: bool) -> None: ...
@@ -196,10 +182,7 @@ class Cursor(Iterator[Any]):
def setinputsizes(self, *args: Any, **kwargs: Any) -> None: ...
def setoutputsize(self, *args: Any, **kwargs: Any) -> None: ...
def __iter__(self) -> Cursor: ...
if sys.version_info >= (3, 0):
def __next__(self) -> Any: ...
else:
def next(self) -> Any: ...
def __next__(self) -> Any: ...
class DataError(DatabaseError): ...
class DatabaseError(Error): ...
@@ -210,73 +193,7 @@ class InternalError(DatabaseError): ...
class NotSupportedError(DatabaseError): ...
class OperationalError(DatabaseError): ...
if sys.version_info >= (3,):
OptimizedUnicode = str
else:
class OptimizedUnicode(object):
maketrans: Any
def __init__(self, *args, **kwargs): ...
def capitalize(self, *args, **kwargs): ...
def casefold(self, *args, **kwargs): ...
def center(self, *args, **kwargs): ...
def count(self, *args, **kwargs): ...
def encode(self, *args, **kwargs): ...
def endswith(self, *args, **kwargs): ...
def expandtabs(self, *args, **kwargs): ...
def find(self, *args, **kwargs): ...
def format(self, *args, **kwargs): ...
def format_map(self, *args, **kwargs): ...
def index(self, *args, **kwargs): ...
def isalnum(self, *args, **kwargs): ...
def isalpha(self, *args, **kwargs): ...
def isdecimal(self, *args, **kwargs): ...
def isdigit(self, *args, **kwargs): ...
def isidentifier(self, *args, **kwargs): ...
def islower(self, *args, **kwargs): ...
def isnumeric(self, *args, **kwargs): ...
def isprintable(self, *args, **kwargs): ...
def isspace(self, *args, **kwargs): ...
def istitle(self, *args, **kwargs): ...
def isupper(self, *args, **kwargs): ...
def join(self, *args, **kwargs): ...
def ljust(self, *args, **kwargs): ...
def lower(self, *args, **kwargs): ...
def lstrip(self, *args, **kwargs): ...
def partition(self, *args, **kwargs): ...
def replace(self, *args, **kwargs): ...
def rfind(self, *args, **kwargs): ...
def rindex(self, *args, **kwargs): ...
def rjust(self, *args, **kwargs): ...
def rpartition(self, *args, **kwargs): ...
def rsplit(self, *args, **kwargs): ...
def rstrip(self, *args, **kwargs): ...
def split(self, *args, **kwargs): ...
def splitlines(self, *args, **kwargs): ...
def startswith(self, *args, **kwargs): ...
def strip(self, *args, **kwargs): ...
def swapcase(self, *args, **kwargs): ...
def title(self, *args, **kwargs): ...
def translate(self, *args, **kwargs): ...
def upper(self, *args, **kwargs): ...
def zfill(self, *args, **kwargs): ...
def __add__(self, other): ...
def __contains__(self, *args, **kwargs): ...
def __eq__(self, other): ...
def __format__(self, *args, **kwargs): ...
def __ge__(self, other): ...
def __getitem__(self, index): ...
def __getnewargs__(self, *args, **kwargs): ...
def __gt__(self, other): ...
def __hash__(self): ...
def __iter__(self): ...
def __le__(self, other): ...
def __len__(self, *args, **kwargs): ...
def __lt__(self, other): ...
def __mod__(self, other): ...
def __mul__(self, other): ...
def __ne__(self, other): ...
def __rmod__(self, other): ...
def __rmul__(self, other): ...
OptimizedUnicode = str
class PrepareProtocol(object):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...

View File

@@ -1,5 +1,5 @@
import sys
from sre_constants import (
SRE_FLAG_ASCII as SRE_FLAG_ASCII,
SRE_FLAG_DEBUG as SRE_FLAG_DEBUG,
SRE_FLAG_DOTALL as SRE_FLAG_DOTALL,
SRE_FLAG_IGNORECASE as SRE_FLAG_IGNORECASE,
@@ -11,21 +11,16 @@ from sre_constants import (
SRE_INFO_CHARSET as SRE_INFO_CHARSET,
SRE_INFO_LITERAL as SRE_INFO_LITERAL,
SRE_INFO_PREFIX as SRE_INFO_PREFIX,
_NamedIntConstant,
)
from sre_parse import SubPattern
from typing import Any, List, Pattern, Tuple, Type, Union
if sys.version_info >= (3,):
from sre_constants import SRE_FLAG_ASCII as SRE_FLAG_ASCII
from typing import Any, List, Pattern, Union
MAXCODE: int
if sys.version_info < (3, 0):
STRING_TYPES: Tuple[Type[str], Type[unicode]]
_IsStringType = int
else:
from sre_constants import _NamedIntConstant
def dis(code: List[_NamedIntConstant]) -> None: ...
_IsStringType = bool
def dis(code: List[_NamedIntConstant]) -> None: ...
_IsStringType = bool
def isstring(obj: Any) -> _IsStringType: ...
def compile(p: Union[str, bytes, SubPattern], flags: int = ...) -> Pattern[Any]: ...

View File

@@ -1,12 +1,10 @@
import enum
import socket
import sys
from _typeshed import StrPath
from typing import Any, Callable, ClassVar, Dict, Iterable, List, NamedTuple, Optional, Set, Text, Tuple, Type, Union, overload
from typing import Any, Callable, Dict, Iterable, List, NamedTuple, Optional, Set, Text, Tuple, Type, Union, overload
from typing_extensions import Literal
if sys.version_info >= (3, 4):
import enum
_PCTRTT = Tuple[Tuple[str, str], ...]
_PCTRTTT = Tuple[_PCTRTT, ...]
_PeerCertRetDictType = Dict[str, Union[str, _PCTRTTT, _PCTRTT]]
@@ -14,10 +12,7 @@ _PeerCertRetType = Union[_PeerCertRetDictType, bytes, None]
_EnumRetType = List[Tuple[bytes, str, Union[Set[str], bool]]]
_PasswordType = Union[Callable[[], Union[str, bytes]], str, bytes]
if sys.version_info >= (3, 5):
_SC1ArgT = Union[SSLSocket, SSLObject]
else:
_SC1ArgT = SSLSocket
_SC1ArgT = Union[SSLSocket, SSLObject]
_SrvnmeCbType = Callable[[_SC1ArgT, Optional[str], SSLSocket], Optional[int]]
class SSLError(OSError):
@@ -84,10 +79,8 @@ else:
_create_default_https_context: Callable[..., SSLContext]
if sys.version_info >= (3, 3):
def RAND_bytes(__num: int) -> bytes: ...
def RAND_pseudo_bytes(__num: int) -> Tuple[bytes, bool]: ...
def RAND_bytes(__num: int) -> bytes: ...
def RAND_pseudo_bytes(__num: int) -> Tuple[bytes, bool]: ...
def RAND_status() -> bool: ...
def RAND_egd(path: str) -> None: ...
def RAND_add(__s: bytes, __entropy: float) -> None: ...
@@ -128,55 +121,43 @@ PROTOCOL_TLSv1: int
PROTOCOL_TLSv1_1: int
PROTOCOL_TLSv1_2: int
PROTOCOL_TLS: int
if sys.version_info >= (3, 6):
PROTOCOL_TLS_CLIENT: int
PROTOCOL_TLS_SERVER: int
PROTOCOL_TLS_CLIENT: int
PROTOCOL_TLS_SERVER: int
if sys.version_info >= (3, 6):
class Options(enum.IntFlag):
OP_ALL: int
OP_NO_SSLv2: int
OP_NO_SSLv3: int
OP_NO_TLSv1: int
OP_NO_TLSv1_1: int
OP_NO_TLSv1_2: int
OP_NO_TLSv1_3: int
OP_CIPHER_SERVER_PREFERENCE: int
OP_SINGLE_DH_USE: int
OP_SINGLE_ECDH_USE: int
OP_NO_COMPRESSION: int
OP_NO_TICKET: int
if sys.version_info >= (3, 7):
OP_NO_RENEGOTIATION: int
if sys.version_info >= (3, 8):
OP_ENABLE_MIDDLEBOX_COMPAT: int
OP_ALL: Options
OP_NO_SSLv2: Options
OP_NO_SSLv3: Options
OP_NO_TLSv1: Options
OP_NO_TLSv1_1: Options
OP_NO_TLSv1_2: Options
OP_NO_TLSv1_3: Options
OP_CIPHER_SERVER_PREFERENCE: Options
OP_SINGLE_DH_USE: Options
OP_SINGLE_ECDH_USE: Options
OP_NO_COMPRESSION: Options
OP_NO_TICKET: Options
if sys.version_info >= (3, 7):
OP_NO_RENEGOTIATION: Options
if sys.version_info >= (3, 8):
OP_ENABLE_MIDDLEBOX_COMPAT: Options
else:
class Options(enum.IntFlag):
OP_ALL: int
OP_NO_SSLv2: int
OP_NO_SSLv3: int
OP_NO_TLSv1: int
OP_NO_TLSv1_1: int
OP_NO_TLSv1_2: int
OP_NO_TLSv1_3: int
OP_CIPHER_SERVER_PREFERENCE: int
OP_SINGLE_DH_USE: int
OP_SINGLE_ECDH_USE: int
OP_NO_COMPRESSION: int
OP_NO_TICKET: int
if sys.version_info >= (3, 7):
OP_NO_RENEGOTIATION: int
if sys.version_info >= (3, 8):
OP_ENABLE_MIDDLEBOX_COMPAT: int
OP_ALL: Options
OP_NO_SSLv2: Options
OP_NO_SSLv3: Options
OP_NO_TLSv1: Options
OP_NO_TLSv1_1: Options
OP_NO_TLSv1_2: Options
OP_NO_TLSv1_3: Options
OP_CIPHER_SERVER_PREFERENCE: Options
OP_SINGLE_DH_USE: Options
OP_SINGLE_ECDH_USE: Options
OP_NO_COMPRESSION: Options
OP_NO_TICKET: Options
if sys.version_info >= (3, 7):
OP_NO_RENEGOTIATION: Options
if sys.version_info >= (3, 8):
OP_ENABLE_MIDDLEBOX_COMPAT: Options
if sys.version_info >= (3, 7):
HAS_NEVER_CHECK_COMMON_NAME: bool
@@ -230,23 +211,16 @@ class _ASN1Object(NamedTuple):
longname: str
oid: str
if sys.version_info >= (3, 4):
class Purpose(_ASN1Object, enum.Enum):
SERVER_AUTH: _ASN1Object
CLIENT_AUTH: _ASN1Object
else:
class Purpose(_ASN1Object):
SERVER_AUTH: ClassVar[Purpose]
CLIENT_AUTH: ClassVar[Purpose]
class Purpose(_ASN1Object, enum.Enum):
SERVER_AUTH: _ASN1Object
CLIENT_AUTH: _ASN1Object
class SSLSocket(socket.socket):
context: SSLContext
server_side: bool
server_hostname: Optional[str]
if sys.version_info >= (3, 6):
session: Optional[SSLSession]
session_reused: Optional[bool]
session: Optional[SSLSession]
session_reused: Optional[bool]
if sys.version_info < (3, 7):
def __init__(
self,
@@ -293,8 +267,7 @@ class SSLSocket(socket.socket):
@overload
def getpeercert(self, binary_form: bool) -> _PeerCertRetType: ...
def cipher(self) -> Optional[Tuple[str, str, int]]: ...
if sys.version_info >= (3, 5):
def shared_ciphers(self) -> Optional[List[Tuple[str, str, int]]]: ...
def shared_ciphers(self) -> Optional[List[Tuple[str, str, int]]]: ...
def compression(self) -> Optional[str]: ...
def get_channel_binding(self, cb_type: str = ...) -> Optional[bytes]: ...
def selected_alpn_protocol(self) -> Optional[str]: ...
@@ -318,24 +291,15 @@ if sys.version_info >= (3, 7):
class SSLContext:
check_hostname: bool
if sys.version_info >= (3, 6):
options: Options
else:
options: int
options: Options
if sys.version_info >= (3, 8):
post_handshake_auth: bool
if sys.version_info >= (3, 5):
def __new__(cls, protocol: int = ..., *args: Any, **kwargs: Any) -> SSLContext: ...
else:
def __new__(cls, protocol: int, *args: Any, **kwargs: Any) -> SSLContext: ...
def __new__(cls, protocol: int = ..., *args: Any, **kwargs: Any) -> SSLContext: ...
@property
def protocol(self) -> int: ...
verify_flags: int
verify_mode: int
if sys.version_info >= (3, 5):
def __init__(self, protocol: int = ...) -> None: ...
else:
def __init__(self, protocol: int) -> None: ...
def __init__(self, protocol: int = ...) -> None: ...
def cert_store_stats(self) -> Dict[str, int]: ...
def load_cert_chain(
self, certfile: StrPath, keyfile: Optional[StrPath] = ..., password: Optional[_PasswordType] = ...
@@ -358,102 +322,87 @@ class SSLContext:
def set_servername_callback(self, __method: Optional[_SrvnmeCbType]) -> None: ...
def load_dh_params(self, __path: str) -> None: ...
def set_ecdh_curve(self, __name: str) -> None: ...
if sys.version_info >= (3, 6):
def wrap_socket(
self,
sock: socket.socket,
server_side: bool = ...,
do_handshake_on_connect: bool = ...,
suppress_ragged_eofs: bool = ...,
server_hostname: Optional[str] = ...,
session: Optional[SSLSession] = ...,
) -> SSLSocket: ...
else:
def wrap_socket(
self,
sock: socket.socket,
server_side: bool = ...,
do_handshake_on_connect: bool = ...,
suppress_ragged_eofs: bool = ...,
server_hostname: Optional[str] = ...,
) -> SSLSocket: ...
if sys.version_info >= (3, 6):
def wrap_bio(
self,
incoming: MemoryBIO,
outgoing: MemoryBIO,
server_side: bool = ...,
server_hostname: Optional[str] = ...,
session: Optional[SSLSession] = ...,
) -> SSLObject: ...
elif sys.version_info >= (3, 5):
def wrap_bio(
self, incoming: MemoryBIO, outgoing: MemoryBIO, server_side: bool = ..., server_hostname: Optional[str] = ...
) -> SSLObject: ...
def wrap_socket(
self,
sock: socket.socket,
server_side: bool = ...,
do_handshake_on_connect: bool = ...,
suppress_ragged_eofs: bool = ...,
server_hostname: Optional[str] = ...,
session: Optional[SSLSession] = ...,
) -> SSLSocket: ...
def wrap_bio(
self,
incoming: MemoryBIO,
outgoing: MemoryBIO,
server_side: bool = ...,
server_hostname: Optional[str] = ...,
session: Optional[SSLSession] = ...,
) -> SSLObject: ...
def session_stats(self) -> Dict[str, int]: ...
if sys.version_info >= (3, 7):
hostname_checks_common_name: bool
maximum_version: TLSVersion
minimum_version: TLSVersion
if sys.version_info >= (3, 5):
class SSLObject:
context: SSLContext
server_side: bool
server_hostname: Optional[str]
if sys.version_info >= (3, 6):
session: Optional[SSLSession]
session_reused: bool
if sys.version_info >= (3, 7):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
else:
def __init__(
self, sslobj: Any, owner: Optional[Union[SSLSocket, SSLObject]] = ..., session: Optional[Any] = ...
) -> None: ...
def read(self, len: int = ..., buffer: Optional[bytearray] = ...) -> bytes: ...
def write(self, data: bytes) -> int: ...
@overload
def getpeercert(self, binary_form: Literal[False] = ...) -> Optional[_PeerCertRetDictType]: ...
@overload
def getpeercert(self, binary_form: Literal[True]) -> Optional[bytes]: ...
@overload
def getpeercert(self, binary_form: bool) -> _PeerCertRetType: ...
def selected_alpn_protocol(self) -> Optional[str]: ...
def selected_npn_protocol(self) -> Optional[str]: ...
def cipher(self) -> Optional[Tuple[str, str, int]]: ...
def shared_ciphers(self) -> Optional[List[Tuple[str, str, int]]]: ...
def compression(self) -> Optional[str]: ...
def pending(self) -> int: ...
def do_handshake(self) -> None: ...
def unwrap(self) -> None: ...
def version(self) -> Optional[str]: ...
def get_channel_binding(self, cb_type: str = ...) -> Optional[bytes]: ...
if sys.version_info >= (3, 8):
def verify_client_post_handshake(self) -> None: ...
class MemoryBIO:
pending: int
eof: bool
def read(self, __size: int = ...) -> bytes: ...
def write(self, __buf: bytes) -> int: ...
def write_eof(self) -> None: ...
class SSLObject:
context: SSLContext
server_side: bool
server_hostname: Optional[str]
session: Optional[SSLSession]
session_reused: bool
if sys.version_info >= (3, 7):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
else:
def __init__(
self, sslobj: Any, owner: Optional[Union[SSLSocket, SSLObject]] = ..., session: Optional[Any] = ...
) -> None: ...
def read(self, len: int = ..., buffer: Optional[bytearray] = ...) -> bytes: ...
def write(self, data: bytes) -> int: ...
@overload
def getpeercert(self, binary_form: Literal[False] = ...) -> Optional[_PeerCertRetDictType]: ...
@overload
def getpeercert(self, binary_form: Literal[True]) -> Optional[bytes]: ...
@overload
def getpeercert(self, binary_form: bool) -> _PeerCertRetType: ...
def selected_alpn_protocol(self) -> Optional[str]: ...
def selected_npn_protocol(self) -> Optional[str]: ...
def cipher(self) -> Optional[Tuple[str, str, int]]: ...
def shared_ciphers(self) -> Optional[List[Tuple[str, str, int]]]: ...
def compression(self) -> Optional[str]: ...
def pending(self) -> int: ...
def do_handshake(self) -> None: ...
def unwrap(self) -> None: ...
def version(self) -> Optional[str]: ...
def get_channel_binding(self, cb_type: str = ...) -> Optional[bytes]: ...
if sys.version_info >= (3, 8):
def verify_client_post_handshake(self) -> None: ...
if sys.version_info >= (3, 6):
class SSLSession:
id: bytes
time: int
timeout: int
ticket_lifetime_hint: int
has_ticket: bool
class VerifyFlags(enum.IntFlag):
VERIFY_DEFAULT: int
VERIFY_CRL_CHECK_LEAF: int
VERIFY_CRL_CHECK_CHAIN: int
VERIFY_X509_STRICT: int
VERIFY_X509_TRUSTED_FIRST: int
class VerifyMode(enum.IntEnum):
CERT_NONE: int
CERT_OPTIONAL: int
CERT_REQUIRED: int
class MemoryBIO:
pending: int
eof: bool
def read(self, __size: int = ...) -> bytes: ...
def write(self, __buf: bytes) -> int: ...
def write_eof(self) -> None: ...
class SSLSession:
id: bytes
time: int
timeout: int
ticket_lifetime_hint: int
has_ticket: bool
class VerifyFlags(enum.IntFlag):
VERIFY_DEFAULT: int
VERIFY_CRL_CHECK_LEAF: int
VERIFY_CRL_CHECK_CHAIN: int
VERIFY_X509_STRICT: int
VERIFY_X509_TRUSTED_FIRST: int
class VerifyMode(enum.IntEnum):
CERT_NONE: int
CERT_OPTIONAL: int
CERT_REQUIRED: int
# TODO below documented in cpython but not in docs.python.org
# taken from python 3.4

View File

@@ -6,21 +6,14 @@ from typing import Any, Iterator, Text, Tuple, Union
class error(Exception): ...
_FmtType = Union[bytes, Text]
if sys.version_info >= (3,):
_BufferType = Union[array[int], bytes, bytearray, memoryview, mmap]
_WriteBufferType = Union[array[Any], bytearray, memoryview, mmap]
else:
_BufferType = Union[array[int], bytes, bytearray, buffer, memoryview, mmap]
_WriteBufferType = Union[array[Any], bytearray, buffer, memoryview, mmap]
_BufferType = Union[array[int], bytes, bytearray, memoryview, mmap]
_WriteBufferType = Union[array[Any], bytearray, memoryview, mmap]
def pack(fmt: _FmtType, *v: Any) -> bytes: ...
def pack_into(fmt: _FmtType, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ...
def unpack(__format: _FmtType, __buffer: _BufferType) -> Tuple[Any, ...]: ...
def unpack_from(__format: _FmtType, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ...
if sys.version_info >= (3, 4):
def iter_unpack(__format: _FmtType, __buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ...
def iter_unpack(__format: _FmtType, __buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ...
def calcsize(__format: _FmtType) -> int: ...
class Struct:
@@ -34,5 +27,4 @@ class Struct:
def pack_into(self, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ...
def unpack(self, __buffer: _BufferType) -> Tuple[Any, ...]: ...
def unpack_from(self, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ...
if sys.version_info >= (3, 4):
def iter_unpack(self, __buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ...
def iter_unpack(self, __buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ...

View File

@@ -1,5 +1,5 @@
import sys
from typing import IO, Any, NamedTuple, NoReturn, Optional, Text, Tuple, Union
from typing import IO, Any, NamedTuple, NoReturn, Optional, Text, Union
_File = Union[Text, IO[bytes]]
@@ -20,23 +20,18 @@ AUDIO_FILE_ENCODING_ADPCM_G723_5: int
AUDIO_FILE_ENCODING_ALAW_8: int
AUDIO_UNKNOWN_SIZE: int
if sys.version_info >= (3, 0):
class _sunau_params(NamedTuple):
nchannels: int
sampwidth: int
framerate: int
nframes: int
comptype: str
compname: str
else:
_sunau_params = Tuple[int, int, int, int, str, str]
class _sunau_params(NamedTuple):
nchannels: int
sampwidth: int
framerate: int
nframes: int
comptype: str
compname: str
class Au_read:
def __init__(self, f: _File) -> None: ...
if sys.version_info >= (3, 3):
def __enter__(self) -> Au_read: ...
def __exit__(self, *args: Any) -> None: ...
def __enter__(self) -> Au_read: ...
def __exit__(self, *args: Any) -> None: ...
def getfp(self) -> Optional[IO[bytes]]: ...
def rewind(self) -> None: ...
def close(self) -> None: ...
@@ -55,9 +50,8 @@ class Au_read:
class Au_write:
def __init__(self, f: _File) -> None: ...
if sys.version_info >= (3, 3):
def __enter__(self) -> Au_write: ...
def __exit__(self, *args: Any) -> None: ...
def __enter__(self) -> Au_write: ...
def __exit__(self, *args: Any) -> None: ...
def setnchannels(self, nchannels: int) -> None: ...
def getnchannels(self) -> int: ...
def setsampwidth(self, sampwidth: int) -> None: ...

View File

@@ -13,8 +13,6 @@ class SymbolTable(object):
def is_nested(self) -> bool: ...
def has_children(self) -> bool: ...
def has_exec(self) -> bool: ...
if sys.version_info < (3, 0):
def has_import_star(self) -> bool: ...
def get_identifiers(self) -> Sequence[str]: ...
def lookup(self, name: str) -> Symbol: ...
def get_symbols(self) -> List[Symbol]: ...
@@ -42,8 +40,7 @@ class Symbol(object):
def is_global(self) -> bool: ...
def is_declared_global(self) -> bool: ...
def is_local(self) -> bool: ...
if sys.version_info >= (3, 6):
def is_annotated(self) -> bool: ...
def is_annotated(self) -> bool: ...
def is_free(self) -> bool: ...
def is_imported(self) -> bool: ...
def is_assigned(self) -> bool: ...

View File

@@ -45,16 +45,10 @@ REGULAR_TYPES: Tuple[bytes, ...]
GNU_TYPES: Tuple[bytes, ...]
PAX_FIELDS: Tuple[str, ...]
PAX_NUMBER_FIELDS: Dict[str, type]
if sys.version_info >= (3,):
PAX_NAME_FIELDS: Set[str]
PAX_NAME_FIELDS: Set[str]
ENCODING: str
if sys.version_info < (3,):
TAR_PLAIN: int
TAR_GZIPPED: int
def open(
name: Optional[AnyPath] = ...,
mode: str = ...,
@@ -92,8 +86,6 @@ class TarFile(Iterable[TarInfo]):
debug: Optional[int]
errorlevel: Optional[int]
offset: int # undocumented
if sys.version_info < (3,):
posix: bool
def __init__(
self,
name: Optional[AnyPath] = ...,
@@ -204,23 +196,14 @@ class TarFile(Iterable[TarInfo]):
def getmember(self, name: str) -> TarInfo: ...
def getmembers(self) -> List[TarInfo]: ...
def getnames(self) -> List[str]: ...
if sys.version_info >= (3, 5):
def list(self, verbose: bool = ..., *, members: Optional[List[TarInfo]] = ...) -> None: ...
else:
def list(self, verbose: bool = ...) -> None: ...
def list(self, verbose: bool = ..., *, members: Optional[List[TarInfo]] = ...) -> None: ...
def next(self) -> Optional[TarInfo]: ...
if sys.version_info >= (3, 5):
def extractall(
self, path: AnyPath = ..., members: Optional[Iterable[TarInfo]] = ..., *, numeric_owner: bool = ...
) -> None: ...
else:
def extractall(self, path: AnyPath = ..., members: Optional[Iterable[TarInfo]] = ...) -> None: ...
if sys.version_info >= (3, 5):
def extract(
self, member: Union[str, TarInfo], path: AnyPath = ..., set_attrs: bool = ..., *, numeric_owner: bool = ...
) -> None: ...
else:
def extract(self, member: Union[str, TarInfo], path: AnyPath = ...) -> None: ...
def extractall(
self, path: AnyPath = ..., members: Optional[Iterable[TarInfo]] = ..., *, numeric_owner: bool = ...
) -> None: ...
def extract(
self, member: Union[str, TarInfo], path: AnyPath = ..., set_attrs: bool = ..., *, numeric_owner: bool = ...
) -> None: ...
def extractfile(self, member: Union[str, TarInfo]) -> Optional[IO[bytes]]: ...
def makedir(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def makefile(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
@@ -228,10 +211,7 @@ class TarFile(Iterable[TarInfo]):
def makefifo(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def makedev(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def makelink(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
if sys.version_info >= (3, 5):
def chown(self, tarinfo: TarInfo, targetpath: AnyPath, numeric_owner: bool) -> None: ... # undocumented
else:
def chown(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def chown(self, tarinfo: TarInfo, targetpath: AnyPath, numeric_owner: bool) -> None: ... # undocumented
def chmod(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
def utime(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
if sys.version_info >= (3, 7):
@@ -243,7 +223,7 @@ class TarFile(Iterable[TarInfo]):
*,
filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...,
) -> None: ...
elif sys.version_info >= (3,):
else:
def add(
self,
name: StrPath,
@@ -253,15 +233,6 @@ class TarFile(Iterable[TarInfo]):
*,
filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...,
) -> None: ...
else:
def add(
self,
name: str,
arcname: Optional[str] = ...,
recursive: bool = ...,
exclude: Optional[Callable[[str], bool]] = ...,
filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...,
) -> None: ...
def addfile(self, tarinfo: TarInfo, fileobj: Optional[IO[bytes]] = ...) -> None: ...
def gettarinfo(
self, name: Optional[str] = ..., arcname: Optional[str] = ..., fileobj: Optional[IO[bytes]] = ...
@@ -277,10 +248,6 @@ else:
if sys.version_info < (3, 8):
def filemode(mode: int) -> str: ... # undocumented
if sys.version_info < (3,):
class TarFileCompat:
def __init__(self, filename: str, mode: str = ..., compression: int = ...) -> None: ...
class TarError(Exception): ...
class ReadError(TarError): ...
class CompressionError(TarError): ...
@@ -309,12 +276,8 @@ class TarInfo:
gname: str
pax_headers: Mapping[str, str]
def __init__(self, name: str = ...) -> None: ...
if sys.version_info >= (3,):
@classmethod
def frombuf(cls, buf: bytes, encoding: str, errors: str) -> TarInfo: ...
else:
@classmethod
def frombuf(cls, buf: bytes) -> TarInfo: ...
@classmethod
def frombuf(cls, buf: bytes, encoding: str, errors: str) -> TarInfo: ...
@classmethod
def fromtarfile(cls, tarfile: TarFile) -> TarInfo: ...
@property

View File

@@ -1,5 +1,4 @@
import socket
import sys
from typing import Any, Callable, Match, Optional, Pattern, Sequence, Tuple, Union
DEBUGLEVEL: int
@@ -110,6 +109,5 @@ class Telnet:
def expect(
self, list: Sequence[Union[Pattern[bytes], bytes]], timeout: Optional[float] = ...
) -> Tuple[int, Optional[Match[bytes]], bytes]: ...
if sys.version_info >= (3, 6):
def __enter__(self) -> Telnet: ...
def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ...
def __enter__(self) -> Telnet: ...
def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ...

View File

@@ -11,20 +11,11 @@ _T = TypeVar("_T")
__all__: List[str]
def active_count() -> int: ...
if sys.version_info < (3,):
def activeCount() -> int: ...
def current_thread() -> Thread: ...
def currentThread() -> Thread: ...
if sys.version_info >= (3,):
def get_ident() -> int: ...
def get_ident() -> int: ...
def enumerate() -> List[Thread]: ...
if sys.version_info >= (3, 4):
def main_thread() -> Thread: ...
def main_thread() -> Thread: ...
if sys.version_info >= (3, 8):
from _thread import get_native_id as get_native_id
@@ -33,8 +24,7 @@ def settrace(func: _TF) -> None: ...
def setprofile(func: Optional[_PF]) -> None: ...
def stack_size(size: int = ...) -> int: ...
if sys.version_info >= (3,):
TIMEOUT_MAX: float
TIMEOUT_MAX: float
class ThreadError(Exception): ...
@@ -47,26 +37,16 @@ class Thread:
name: str
ident: Optional[int]
daemon: bool
if sys.version_info >= (3,):
def __init__(
self,
group: None = ...,
target: Optional[Callable[..., Any]] = ...,
name: Optional[str] = ...,
args: Iterable[Any] = ...,
kwargs: Optional[Mapping[str, Any]] = ...,
*,
daemon: Optional[bool] = ...,
) -> None: ...
else:
def __init__(
self,
group: None = ...,
target: Optional[Callable[..., Any]] = ...,
name: Optional[Text] = ...,
args: Iterable[Any] = ...,
kwargs: Optional[Mapping[Text, Any]] = ...,
) -> None: ...
def __init__(
self,
group: None = ...,
target: Optional[Callable[..., Any]] = ...,
name: Optional[str] = ...,
args: Iterable[Any] = ...,
kwargs: Optional[Mapping[str, Any]] = ...,
*,
daemon: Optional[bool] = ...,
) -> None: ...
def start(self) -> None: ...
def run(self) -> None: ...
def join(self, timeout: Optional[float] = ...) -> None: ...
@@ -89,10 +69,7 @@ class Lock:
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
if sys.version_info >= (3,):
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
else:
def acquire(self, blocking: bool = ...) -> bool: ...
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
def release(self) -> None: ...
def locked(self) -> bool: ...
@@ -102,10 +79,7 @@ class _RLock:
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
if sys.version_info >= (3,):
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
else:
def acquire(self, blocking: bool = ...) -> bool: ...
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
def release(self) -> None: ...
RLock = _RLock
@@ -116,14 +90,10 @@ class Condition:
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
if sys.version_info >= (3,):
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
else:
def acquire(self, blocking: bool = ...) -> bool: ...
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
def release(self) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> bool: ...
if sys.version_info >= (3,):
def wait_for(self, predicate: Callable[[], _T], timeout: Optional[float] = ...) -> _T: ...
def wait_for(self, predicate: Callable[[], _T], timeout: Optional[float] = ...) -> _T: ...
def notify(self, n: int = ...) -> None: ...
def notify_all(self) -> None: ...
def notifyAll(self) -> None: ...
@@ -133,12 +103,8 @@ class Semaphore:
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
if sys.version_info >= (3,):
def acquire(self, blocking: bool = ..., timeout: Optional[float] = ...) -> bool: ...
def __enter__(self, blocking: bool = ..., timeout: Optional[float] = ...) -> bool: ...
else:
def acquire(self, blocking: bool = ...) -> bool: ...
def __enter__(self, blocking: bool = ...) -> bool: ...
def acquire(self, blocking: bool = ..., timeout: Optional[float] = ...) -> bool: ...
def __enter__(self, blocking: bool = ..., timeout: Optional[float] = ...) -> bool: ...
if sys.version_info >= (3, 9):
def release(self, n: int = ...) -> None: ...
else:
@@ -149,8 +115,6 @@ class BoundedSemaphore(Semaphore): ...
class Event:
def __init__(self) -> None: ...
def is_set(self) -> bool: ...
if sys.version_info < (3,):
def isSet(self) -> bool: ...
def set(self) -> None: ...
def clear(self) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> bool: ...
@@ -162,27 +126,22 @@ if sys.version_info >= (3, 8):
ExceptHookArgs = _ExceptHookArgs
class Timer(Thread):
if sys.version_info >= (3,):
def __init__(
self,
interval: float,
function: Callable[..., Any],
args: Optional[Iterable[Any]] = ...,
kwargs: Optional[Mapping[str, Any]] = ...,
) -> None: ...
else:
def __init__(
self, interval: float, function: Callable[..., Any], args: Iterable[Any] = ..., kwargs: Mapping[str, Any] = ...
) -> None: ...
def __init__(
self,
interval: float,
function: Callable[..., Any],
args: Optional[Iterable[Any]] = ...,
kwargs: Optional[Mapping[str, Any]] = ...,
) -> None: ...
def cancel(self) -> None: ...
if sys.version_info >= (3,):
class Barrier:
parties: int
n_waiting: int
broken: bool
def __init__(self, parties: int, action: Optional[Callable[[], None]] = ..., timeout: Optional[float] = ...) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> int: ...
def reset(self) -> None: ...
def abort(self) -> None: ...
class BrokenBarrierError(RuntimeError): ...
class Barrier:
parties: int
n_waiting: int
broken: bool
def __init__(self, parties: int, action: Optional[Callable[[], None]] = ..., timeout: Optional[float] = ...) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> int: ...
def reset(self) -> None: ...
def abort(self) -> None: ...
class BrokenBarrierError(RuntimeError): ...

View File

@@ -1,13 +1,9 @@
import sys
from types import SimpleNamespace
from typing import Any, NamedTuple, Optional, Tuple, Union
if sys.version_info >= (3, 3):
from types import SimpleNamespace
_TimeTuple = Tuple[int, int, int, int, int, int, int, int, int]
if sys.version_info < (3, 3):
accept2dyear: bool
altzone: int
daylight: int
timezone: int
@@ -20,7 +16,7 @@ if sys.version_info >= (3, 7):
CLOCK_PROF: int # FreeBSD, NetBSD, OpenBSD
CLOCK_UPTIME: int # FreeBSD, OpenBSD
if sys.version_info >= (3, 3) and sys.platform != "win32":
if sys.platform != "win32":
CLOCK_MONOTONIC: int
CLOCK_MONOTONIC_RAW: int
CLOCK_PROCESS_CPUTIME_ID: int
@@ -52,36 +48,29 @@ class _struct_time(NamedTuple):
@property
def n_unnamed_fields(self) -> int: ...
if sys.version_info >= (3, 3):
class struct_time(_struct_time):
def __init__(
self,
o: Union[
Tuple[int, int, int, int, int, int, int, int, int],
Tuple[int, int, int, int, int, int, int, int, int, str],
Tuple[int, int, int, int, int, int, int, int, int, str, int],
],
_arg: Any = ...,
) -> None: ...
def __new__(
cls,
o: Union[
Tuple[int, int, int, int, int, int, int, int, int],
Tuple[int, int, int, int, int, int, int, int, int, str],
Tuple[int, int, int, int, int, int, int, int, int, str, int],
],
_arg: Any = ...,
) -> struct_time: ...
if sys.version_info >= (3, 6) or sys.platform != "win32":
@property
def tm_zone(self) -> str: ...
@property
def tm_gmtoff(self) -> int: ...
else:
class struct_time(_struct_time):
def __init__(self, o: _TimeTuple, _arg: Any = ...) -> None: ...
def __new__(cls, o: _TimeTuple, _arg: Any = ...) -> struct_time: ...
class struct_time(_struct_time):
def __init__(
self,
o: Union[
Tuple[int, int, int, int, int, int, int, int, int],
Tuple[int, int, int, int, int, int, int, int, int, str],
Tuple[int, int, int, int, int, int, int, int, int, str, int],
],
_arg: Any = ...,
) -> None: ...
def __new__(
cls,
o: Union[
Tuple[int, int, int, int, int, int, int, int, int],
Tuple[int, int, int, int, int, int, int, int, int, str],
Tuple[int, int, int, int, int, int, int, int, int, str, int],
],
_arg: Any = ...,
) -> struct_time: ...
@property
def tm_zone(self) -> str: ...
@property
def tm_gmtoff(self) -> int: ...
def asctime(t: Union[_TimeTuple, struct_time] = ...) -> str: ...
@@ -100,15 +89,15 @@ def time() -> float: ...
if sys.platform != "win32":
def tzset() -> None: ... # Unix only
if sys.version_info >= (3, 3):
def get_clock_info(name: str) -> SimpleNamespace: ...
def monotonic() -> float: ...
def perf_counter() -> float: ...
def process_time() -> float: ...
if sys.platform != "win32":
def clock_getres(clk_id: int) -> float: ... # Unix only
def clock_gettime(clk_id: int) -> float: ... # Unix only
def clock_settime(clk_id: int, time: float) -> None: ... # Unix only
def get_clock_info(name: str) -> SimpleNamespace: ...
def monotonic() -> float: ...
def perf_counter() -> float: ...
def process_time() -> float: ...
if sys.platform != "win32":
def clock_getres(clk_id: int) -> float: ... # Unix only
def clock_gettime(clk_id: int) -> float: ... # Unix only
def clock_settime(clk_id: int, time: float) -> None: ... # Unix only
if sys.version_info >= (3, 7):
if sys.platform != "win32":

View File

@@ -1,4 +1,3 @@
import sys
from typing import IO, Any, Callable, Dict, List, Optional, Sequence, Text, Tuple, Union
_str = Union[str, Text]
@@ -8,36 +7,25 @@ _stmt = Union[_str, Callable[[], Any]]
default_timer: _Timer
class Timer:
if sys.version_info >= (3, 5):
def __init__(
self, stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., globals: Optional[Dict[str, Any]] = ...
) -> None: ...
else:
def __init__(self, stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ...) -> None: ...
def __init__(
self, stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., globals: Optional[Dict[str, Any]] = ...
) -> None: ...
def print_exc(self, file: Optional[IO[str]] = ...) -> None: ...
def timeit(self, number: int = ...) -> float: ...
def repeat(self, repeat: int = ..., number: int = ...) -> List[float]: ...
if sys.version_info >= (3, 6):
def autorange(self, callback: Optional[Callable[[int, float], Any]] = ...) -> Tuple[int, float]: ...
def autorange(self, callback: Optional[Callable[[int, float], Any]] = ...) -> Tuple[int, float]: ...
if sys.version_info >= (3, 5):
def timeit(
stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., number: int = ..., globals: Optional[Dict[str, Any]] = ...
) -> float: ...
def repeat(
stmt: _stmt = ...,
setup: _stmt = ...,
timer: _Timer = ...,
repeat: int = ...,
number: int = ...,
globals: Optional[Dict[str, Any]] = ...,
) -> List[float]: ...
else:
def timeit(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., number: int = ...) -> float: ...
def repeat(
stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., repeat: int = ..., number: int = ...
) -> List[float]: ...
def timeit(
stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., number: int = ..., globals: Optional[Dict[str, Any]] = ...
) -> float: ...
def repeat(
stmt: _stmt = ...,
setup: _stmt = ...,
timer: _Timer = ...,
repeat: int = ...,
number: int = ...,
globals: Optional[Dict[str, Any]] = ...,
) -> List[float]: ...
_timerFunc = Callable[[], float]

View File

@@ -26,8 +26,6 @@ GREATER: int
EQUAL: int
DOT: int
PERCENT: int
if sys.version_info < (3,):
BACKQUOTE: int
LBRACE: int
RBRACE: int
EQEQUAL: int
@@ -53,16 +51,11 @@ DOUBLESTAREQUAL: int
DOUBLESLASH: int
DOUBLESLASHEQUAL: int
AT: int
if sys.version_info >= (3,):
RARROW: int
ELLIPSIS: int
if sys.version_info >= (3, 5):
ATEQUAL: int
if sys.version_info < (3, 7):
# These were removed in Python 3.7 but added back in Python 3.8
AWAIT: int
ASYNC: int
if sys.version_info >= (3, 8):
RARROW: int
ELLIPSIS: int
ATEQUAL: int
if sys.version_info < (3, 7) or sys.version_info >= (3, 8):
# These were removed in Python 3.7 but added back in Python 3.8
AWAIT: int
ASYNC: int
OP: int

View File

@@ -17,7 +17,7 @@ if sys.version_info >= (3, 10):
chain: bool = ...,
) -> None: ...
elif sys.version_info >= (3,):
else:
def print_exception(
etype: Optional[Type[BaseException]],
value: Optional[BaseException],
@@ -27,36 +27,15 @@ elif sys.version_info >= (3,):
chain: bool = ...,
) -> None: ...
else:
def print_exception(
etype: Optional[Type[BaseException]],
value: Optional[BaseException],
tb: Optional[TracebackType],
limit: Optional[int] = ...,
file: Optional[IO[str]] = ...,
) -> None: ...
if sys.version_info >= (3,):
def print_exc(limit: Optional[int] = ..., file: Optional[IO[str]] = ..., chain: bool = ...) -> None: ...
def print_last(limit: Optional[int] = ..., file: Optional[IO[str]] = ..., chain: bool = ...) -> None: ...
else:
def print_exc(limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ...
def print_last(limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ...
def print_exc(limit: Optional[int] = ..., file: Optional[IO[str]] = ..., chain: bool = ...) -> None: ...
def print_last(limit: Optional[int] = ..., file: Optional[IO[str]] = ..., chain: bool = ...) -> None: ...
def print_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ...
def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> StackSummary: ...
def extract_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> StackSummary: ...
def format_list(extracted_list: List[FrameSummary]) -> List[str]: ...
if sys.version_info >= (3, 5):
def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> StackSummary: ...
def extract_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> StackSummary: ...
def format_list(extracted_list: List[FrameSummary]) -> List[str]: ...
# undocumented
def print_list(extracted_list: List[FrameSummary], file: Optional[SupportsWrite[str]] = ...) -> None: ...
else:
def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[_PT]: ...
def extract_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> List[_PT]: ...
def format_list(extracted_list: List[_PT]) -> List[str]: ...
# undocumented
def print_list(extracted_list: List[FrameSummary], file: Optional[SupportsWrite[str]] = ...) -> None: ...
if sys.version_info >= (3, 10):
def format_exception_only(__exc: Optional[Type[BaseException]], value: Optional[BaseException] = ...) -> List[str]: ...
@@ -73,7 +52,7 @@ if sys.version_info >= (3, 10):
chain: bool = ...,
) -> List[str]: ...
elif sys.version_info >= (3,):
else:
def format_exception(
etype: Optional[Type[BaseException]],
value: Optional[BaseException],
@@ -82,116 +61,97 @@ elif sys.version_info >= (3,):
chain: bool = ...,
) -> List[str]: ...
else:
def format_exception(
etype: Optional[Type[BaseException]],
value: Optional[BaseException],
tb: Optional[TracebackType],
limit: Optional[int] = ...,
) -> List[str]: ...
if sys.version_info >= (3,):
def format_exc(limit: Optional[int] = ..., chain: bool = ...) -> str: ...
else:
def format_exc(limit: Optional[int] = ...) -> str: ...
def format_exc(limit: Optional[int] = ..., chain: bool = ...) -> str: ...
def format_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[str]: ...
def format_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> List[str]: ...
def clear_frames(tb: TracebackType) -> None: ...
def walk_stack(f: Optional[FrameType]) -> Iterator[Tuple[FrameType, int]]: ...
def walk_tb(tb: Optional[TracebackType]) -> Iterator[Tuple[FrameType, int]]: ...
if sys.version_info >= (3, 4):
def clear_frames(tb: TracebackType) -> None: ...
if sys.version_info >= (3, 5):
def walk_stack(f: Optional[FrameType]) -> Iterator[Tuple[FrameType, int]]: ...
def walk_tb(tb: Optional[TracebackType]) -> Iterator[Tuple[FrameType, int]]: ...
if sys.version_info < (3,):
def tb_lineno(tb: TracebackType) -> int: ...
if sys.version_info >= (3, 5):
class TracebackException:
__cause__: TracebackException
__context__: TracebackException
__suppress_context__: bool
stack: StackSummary
exc_type: Type[BaseException]
filename: str
lineno: int
text: str
offset: int
msg: str
if sys.version_info >= (3, 10):
def __init__(
self,
exc_type: Type[BaseException],
exc_value: BaseException,
exc_traceback: TracebackType,
*,
limit: Optional[int] = ...,
lookup_lines: bool = ...,
capture_locals: bool = ...,
compact: bool = ...,
_seen: Optional[Set[int]] = ...,
) -> None: ...
@classmethod
def from_exception(
cls,
exc: BaseException,
*,
limit: Optional[int] = ...,
lookup_lines: bool = ...,
capture_locals: bool = ...,
compact: bool = ...,
) -> TracebackException: ...
else:
def __init__(
self,
exc_type: Type[BaseException],
exc_value: BaseException,
exc_traceback: TracebackType,
*,
limit: Optional[int] = ...,
lookup_lines: bool = ...,
capture_locals: bool = ...,
_seen: Optional[Set[int]] = ...,
) -> None: ...
@classmethod
def from_exception(
cls, exc: BaseException, *, limit: Optional[int] = ..., lookup_lines: bool = ..., capture_locals: bool = ...
) -> TracebackException: ...
def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ...
def format_exception_only(self) -> Generator[str, None, None]: ...
class FrameSummary(Iterable[Any]):
filename: str
lineno: int
name: str
line: str
locals: Optional[Dict[str, str]]
class TracebackException:
__cause__: TracebackException
__context__: TracebackException
__suppress_context__: bool
stack: StackSummary
exc_type: Type[BaseException]
filename: str
lineno: int
text: str
offset: int
msg: str
if sys.version_info >= (3, 10):
def __init__(
self,
filename: str,
lineno: int,
name: str,
*,
lookup_line: bool = ...,
locals: Optional[Mapping[str, str]] = ...,
line: Optional[str] = ...,
) -> None: ...
# TODO: more precise typing for __getitem__ and __iter__,
# for a namedtuple-like view on (filename, lineno, name, str).
def __getitem__(self, i: int) -> Any: ...
def __iter__(self) -> Iterator[Any]: ...
class StackSummary(List[FrameSummary]):
@classmethod
def extract(
cls,
frame_gen: Generator[Tuple[FrameType, int], None, None],
exc_type: Type[BaseException],
exc_value: BaseException,
exc_traceback: TracebackType,
*,
limit: Optional[int] = ...,
lookup_lines: bool = ...,
capture_locals: bool = ...,
) -> StackSummary: ...
compact: bool = ...,
_seen: Optional[Set[int]] = ...,
) -> None: ...
@classmethod
def from_list(cls, a_list: List[_PT]) -> StackSummary: ...
def format(self) -> List[str]: ...
def from_exception(
cls,
exc: BaseException,
*,
limit: Optional[int] = ...,
lookup_lines: bool = ...,
capture_locals: bool = ...,
compact: bool = ...,
) -> TracebackException: ...
else:
def __init__(
self,
exc_type: Type[BaseException],
exc_value: BaseException,
exc_traceback: TracebackType,
*,
limit: Optional[int] = ...,
lookup_lines: bool = ...,
capture_locals: bool = ...,
_seen: Optional[Set[int]] = ...,
) -> None: ...
@classmethod
def from_exception(
cls, exc: BaseException, *, limit: Optional[int] = ..., lookup_lines: bool = ..., capture_locals: bool = ...
) -> TracebackException: ...
def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ...
def format_exception_only(self) -> Generator[str, None, None]: ...
class FrameSummary(Iterable[Any]):
filename: str
lineno: int
name: str
line: str
locals: Optional[Dict[str, str]]
def __init__(
self,
filename: str,
lineno: int,
name: str,
*,
lookup_line: bool = ...,
locals: Optional[Mapping[str, str]] = ...,
line: Optional[str] = ...,
) -> None: ...
# TODO: more precise typing for __getitem__ and __iter__,
# for a namedtuple-like view on (filename, lineno, name, str).
def __getitem__(self, i: int) -> Any: ...
def __iter__(self) -> Iterator[Any]: ...
class StackSummary(List[FrameSummary]):
@classmethod
def extract(
cls,
frame_gen: Generator[Tuple[FrameType, int], None, None],
*,
limit: Optional[int] = ...,
lookup_lines: bool = ...,
capture_locals: bool = ...,
) -> StackSummary: ...
@classmethod
def from_list(cls, a_list: List[_PT]) -> StackSummary: ...
def format(self) -> List[str]: ...

View File

@@ -1,13 +1,6 @@
import sys
from tkinter import Canvas, PhotoImage
from typing import Any, Callable, Dict, List, Optional, Sequence, Text, Tuple, TypeVar, Union, overload
if sys.version_info >= (3,):
from tkinter import Canvas, PhotoImage
else:
# TODO: Replace these aliases once we have Python 2 stubs for the Tkinter module.
Canvas = Any
PhotoImage = Any
# Note: '_Color' is the alias we use for arguments and _AnyColor is the
# alias we use for return types. Really, these two aliases should be the
# same, but as per the "no union returns" typeshed policy, we'll return
@@ -32,17 +25,16 @@ class TurtleScreenBase(object):
xscale: float = ...
yscale: float = ...
def __init__(self, cv: Canvas) -> None: ...
if sys.version_info >= (3,):
def mainloop(self) -> None: ...
def textinput(self, title: str, prompt: str) -> Optional[str]: ...
def numinput(
self,
title: str,
prompt: str,
default: Optional[float] = ...,
minval: Optional[float] = ...,
maxval: Optional[float] = ...,
) -> Optional[float]: ...
def mainloop(self) -> None: ...
def textinput(self, title: str, prompt: str) -> Optional[str]: ...
def numinput(
self,
title: str,
prompt: str,
default: Optional[float] = ...,
minval: Optional[float] = ...,
maxval: Optional[float] = ...,
) -> Optional[float]: ...
class Terminator(Exception): ...
class TurtleGraphicsError(Exception): ...
@@ -102,9 +94,8 @@ class TurtleScreen(TurtleScreenBase):
resetscreen = reset
clearscreen = clear
addshape = register_shape
if sys.version_info >= (3,):
def onkeypress(self, fun: Callable[[], Any], key: Optional[str] = ...) -> None: ...
onkeyrelease = onkey
def onkeypress(self, fun: Callable[[], Any], key: Optional[str] = ...) -> None: ...
onkeyrelease = onkey
class TNavigator(object):
START_ORIENTATION: Dict[str, Vec2D] = ...
@@ -239,19 +230,18 @@ class RawTurtle(TPen, TNavigator):
def shapesize(
self, stretch_wid: Optional[float] = ..., stretch_len: Optional[float] = ..., outline: Optional[float] = ...
) -> None: ...
if sys.version_info >= (3,):
@overload
def shearfactor(self, shear: None = ...) -> float: ...
@overload
def shearfactor(self, shear: float) -> None: ...
# Unsafely overlaps when no arguments are provided
@overload
def shapetransform(self) -> Tuple[float, float, float, float]: ... # type: ignore
@overload
def shapetransform(
self, t11: Optional[float] = ..., t12: Optional[float] = ..., t21: Optional[float] = ..., t22: Optional[float] = ...
) -> None: ...
def get_shapepoly(self) -> Optional[_PolygonCoords]: ...
@overload
def shearfactor(self, shear: None = ...) -> float: ...
@overload
def shearfactor(self, shear: float) -> None: ...
# Unsafely overlaps when no arguments are provided
@overload
def shapetransform(self) -> Tuple[float, float, float, float]: ... # type: ignore
@overload
def shapetransform(
self, t11: Optional[float] = ..., t12: Optional[float] = ..., t21: Optional[float] = ..., t22: Optional[float] = ...
) -> None: ...
def get_shapepoly(self) -> Optional[_PolygonCoords]: ...
def settiltangle(self, angle: float) -> None: ...
@overload
def tiltangle(self, angle: None = ...) -> float: ...
@@ -317,12 +307,10 @@ def write_docstringdict(filename: str = ...) -> None: ...
# Note: mainloop() was always present in the global scope, but was added to
# TurtleScreenBase in Python 3.0
def mainloop() -> None: ...
if sys.version_info >= (3,):
def textinput(title: str, prompt: str) -> Optional[str]: ...
def numinput(
title: str, prompt: str, default: Optional[float] = ..., minval: Optional[float] = ..., maxval: Optional[float] = ...
) -> Optional[float]: ...
def textinput(title: str, prompt: str) -> Optional[str]: ...
def numinput(
title: str, prompt: str, default: Optional[float] = ..., minval: Optional[float] = ..., maxval: Optional[float] = ...
) -> Optional[float]: ...
# Functions copied from TurtleScreen:
@@ -375,9 +363,10 @@ onscreenclick = onclick
resetscreen = reset
clearscreen = clear
addshape = register_shape
if sys.version_info >= (3,):
def onkeypress(fun: Callable[[], Any], key: Optional[str] = ...) -> None: ...
onkeyrelease = onkey
def onkeypress(fun: Callable[[], Any], key: Optional[str] = ...) -> None: ...
onkeyrelease = onkey
# Functions copied from _Screen:
@@ -508,21 +497,19 @@ def shape(name: str) -> None: ...
def shapesize() -> Tuple[float, float, float]: ... # type: ignore
@overload
def shapesize(stretch_wid: Optional[float] = ..., stretch_len: Optional[float] = ..., outline: Optional[float] = ...) -> None: ...
@overload
def shearfactor(shear: None = ...) -> float: ...
@overload
def shearfactor(shear: float) -> None: ...
if sys.version_info >= (3,):
@overload
def shearfactor(shear: None = ...) -> float: ...
@overload
def shearfactor(shear: float) -> None: ...
# Unsafely overlaps when no arguments are provided
@overload
def shapetransform() -> Tuple[float, float, float, float]: ... # type: ignore
@overload
def shapetransform(
t11: Optional[float] = ..., t12: Optional[float] = ..., t21: Optional[float] = ..., t22: Optional[float] = ...
) -> None: ...
def get_shapepoly() -> Optional[_PolygonCoords]: ...
# Unsafely overlaps when no arguments are provided
@overload
def shapetransform() -> Tuple[float, float, float, float]: ... # type: ignore
@overload
def shapetransform(
t11: Optional[float] = ..., t12: Optional[float] = ..., t21: Optional[float] = ..., t22: Optional[float] = ...
) -> None: ...
def get_shapepoly() -> Optional[_PolygonCoords]: ...
def settiltangle(angle: float) -> None: ...
@overload
def tiltangle(angle: None = ...) -> float: ...

View File

@@ -3,9 +3,16 @@ import sys
from typing import (
TYPE_CHECKING as TYPE_CHECKING,
Any,
AsyncContextManager as AsyncContextManager,
AsyncGenerator as AsyncGenerator,
AsyncIterable as AsyncIterable,
AsyncIterator as AsyncIterator,
Awaitable as Awaitable,
Callable,
ChainMap as ChainMap,
ClassVar as ClassVar,
ContextManager as ContextManager,
Coroutine as Coroutine,
Counter as Counter,
DefaultDict as DefaultDict,
Deque as Deque,
@@ -55,15 +62,9 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
def pop(self, k: NoReturn, default: _T = ...) -> object: ... # type: ignore
def update(self: _T, __m: _T) -> None: ...
if sys.version_info >= (3, 0):
def items(self) -> ItemsView[str, object]: ...
def keys(self) -> KeysView[str]: ...
def values(self) -> ValuesView[object]: ...
else:
def has_key(self, k: str) -> bool: ...
def viewitems(self) -> ItemsView[str, object]: ...
def viewkeys(self) -> KeysView[str]: ...
def viewvalues(self) -> ValuesView[object]: ...
def items(self) -> ItemsView[str, object]: ...
def keys(self) -> KeysView[str]: ...
def values(self) -> ValuesView[object]: ...
def __delitem__(self, k: NoReturn) -> None: ...
# TypedDict is a (non-subscriptable) special form.
@@ -71,21 +72,6 @@ TypedDict: object = ...
OrderedDict = _Alias()
if sys.version_info >= (3, 3):
from typing import ChainMap as ChainMap
if sys.version_info >= (3, 5):
from typing import (
AsyncContextManager as AsyncContextManager,
AsyncIterable as AsyncIterable,
AsyncIterator as AsyncIterator,
Awaitable as Awaitable,
Coroutine as Coroutine,
)
if sys.version_info >= (3, 6):
from typing import AsyncGenerator as AsyncGenerator
def get_type_hints(
obj: Callable[..., Any],
globalns: Optional[Dict[str, Any]] = ...,

View File

@@ -96,7 +96,7 @@ class NonCallableMock(Base, Any): # type: ignore
def assert_not_called(self) -> None: ...
def assert_called_once_with(self, *args: Any, **kwargs: Any) -> None: ...
def _format_mock_failure_message(self, args: Any, kwargs: Any, action: str = ...) -> str: ...
elif sys.version_info >= (3, 5):
else:
def assert_called_with(_mock_self, *args: Any, **kwargs: Any) -> None: ...
def assert_not_called(_mock_self) -> None: ...
def assert_called_once_with(_mock_self, *args: Any, **kwargs: Any) -> None: ...
@@ -104,7 +104,7 @@ class NonCallableMock(Base, Any): # type: ignore
if sys.version_info >= (3, 8):
def assert_called(self) -> None: ...
def assert_called_once(self) -> None: ...
elif sys.version_info >= (3, 6):
else:
def assert_called(_mock_self) -> None: ...
def assert_called_once(_mock_self) -> None: ...
def reset_mock(self, visited: Any = ..., *, return_value: bool = ..., side_effect: bool = ...) -> None: ...

View File

@@ -71,29 +71,11 @@ class UUID:
@property
def version(self) -> Optional[_Int]: ...
def __int__(self) -> _Int: ...
if sys.version_info >= (3,):
def __eq__(self, other: Any) -> bool: ...
def __lt__(self, other: Any) -> bool: ...
def __le__(self, other: Any) -> bool: ...
def __gt__(self, other: Any) -> bool: ...
def __ge__(self, other: Any) -> bool: ...
else:
def get_bytes(self) -> _Bytes: ...
def get_bytes_le(self) -> _Bytes: ...
def get_clock_seq(self) -> _Int: ...
def get_clock_seq_hi_variant(self) -> _Int: ...
def get_clock_seq_low(self) -> _Int: ...
def get_fields(self) -> _FieldsType: ...
def get_hex(self) -> str: ...
def get_node(self) -> _Int: ...
def get_time(self) -> _Int: ...
def get_time_hi_version(self) -> _Int: ...
def get_time_low(self) -> _Int: ...
def get_time_mid(self) -> _Int: ...
def get_urn(self) -> str: ...
def get_variant(self) -> str: ...
def get_version(self) -> Optional[_Int]: ...
def __cmp__(self, other: Any) -> _Int: ...
def __eq__(self, other: Any) -> bool: ...
def __lt__(self, other: Any) -> bool: ...
def __le__(self, other: Any) -> bool: ...
def __gt__(self, other: Any) -> bool: ...
def __ge__(self, other: Any) -> bool: ...
def getnode() -> int: ...
def uuid1(node: Optional[_Int] = ..., clock_seq: Optional[_Int] = ...) -> UUID: ...

View File

@@ -1,4 +1,3 @@
import sys
from types import ModuleType, TracebackType
from typing import Any, List, Optional, TextIO, Type, Union, overload
from typing_extensions import Literal
@@ -31,28 +30,17 @@ class WarningMessage:
lineno: int
file: Optional[TextIO]
line: Optional[str]
if sys.version_info >= (3, 6):
source: Optional[Any]
def __init__(
self,
message: Union[Warning, str],
category: Type[Warning],
filename: str,
lineno: int,
file: Optional[TextIO] = ...,
line: Optional[str] = ...,
source: Optional[Any] = ...,
) -> None: ...
else:
def __init__(
self,
message: Union[Warning, str],
category: Type[Warning],
filename: str,
lineno: int,
file: Optional[TextIO] = ...,
line: Optional[str] = ...,
) -> None: ...
source: Optional[Any]
def __init__(
self,
message: Union[Warning, str],
category: Type[Warning],
filename: str,
lineno: int,
file: Optional[TextIO] = ...,
line: Optional[str] = ...,
source: Optional[Any] = ...,
) -> None: ...
class catch_warnings:
@overload

View File

@@ -1,5 +1,5 @@
import sys
from typing import IO, Any, BinaryIO, NamedTuple, NoReturn, Optional, Text, Tuple, Union
from typing import IO, Any, BinaryIO, NamedTuple, NoReturn, Optional, Text, Union
_File = Union[Text, IO[bytes]]
@@ -7,23 +7,18 @@ class Error(Exception): ...
WAVE_FORMAT_PCM: int
if sys.version_info >= (3, 0):
class _wave_params(NamedTuple):
nchannels: int
sampwidth: int
framerate: int
nframes: int
comptype: str
compname: str
else:
_wave_params = Tuple[int, int, int, int, str, str]
class _wave_params(NamedTuple):
nchannels: int
sampwidth: int
framerate: int
nframes: int
comptype: str
compname: str
class Wave_read:
def __init__(self, f: _File) -> None: ...
if sys.version_info >= (3, 0):
def __enter__(self) -> Wave_read: ...
def __exit__(self, *args: Any) -> None: ...
def __enter__(self) -> Wave_read: ...
def __exit__(self, *args: Any) -> None: ...
def getfp(self) -> Optional[BinaryIO]: ...
def rewind(self) -> None: ...
def close(self) -> None: ...
@@ -42,9 +37,8 @@ class Wave_read:
class Wave_write:
def __init__(self, f: _File) -> None: ...
if sys.version_info >= (3, 0):
def __enter__(self) -> Wave_write: ...
def __exit__(self, *args: Any) -> None: ...
def __enter__(self) -> Wave_write: ...
def __exit__(self, *args: Any) -> None: ...
def setnchannels(self, nchannels: int) -> None: ...
def getnchannels(self) -> int: ...
def setsampwidth(self, sampwidth: int) -> None: ...

View File

@@ -1,4 +1,3 @@
import sys
import types
from _weakrefset import WeakSet as WeakSet
from typing import (
@@ -29,9 +28,6 @@ from _weakref import (
ref as ref,
)
if sys.version_info < (3, 0):
from exceptions import ReferenceError as ReferenceError
_S = TypeVar("_S")
_T = TypeVar("_T")
_KT = TypeVar("_KT")
@@ -39,10 +35,9 @@ _VT = TypeVar("_VT")
ProxyTypes: Tuple[Type[Any], ...]
if sys.version_info >= (3, 4):
class WeakMethod(ref[types.MethodType]):
def __new__(cls, meth: types.MethodType, callback: Optional[Callable[[types.MethodType], Any]] = ...) -> WeakMethod: ...
def __call__(self) -> Optional[types.MethodType]: ...
class WeakMethod(ref[types.MethodType]):
def __new__(cls, meth: types.MethodType, callback: Optional[Callable[[types.MethodType], Any]] = ...) -> WeakMethod: ...
def __call__(self) -> Optional[types.MethodType]: ...
class WeakValueDictionary(MutableMapping[_KT, _VT]):
@overload
@@ -53,24 +48,14 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
def __getitem__(self, k: _KT) -> _VT: ...
def __setitem__(self, k: _KT, v: _VT) -> None: ...
def __delitem__(self, v: _KT) -> None: ...
if sys.version_info < (3, 0):
def has_key(self, key: object) -> bool: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
def copy(self) -> WeakValueDictionary[_KT, _VT]: ...
if sys.version_info >= (3, 0):
# These are incompatible with Mapping
def keys(self) -> Iterator[_KT]: ... # type: ignore
def values(self) -> Iterator[_VT]: ... # type: ignore
def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore
else:
def keys(self) -> List[_KT]: ...
def values(self) -> List[_VT]: ...
def items(self) -> List[Tuple[_KT, _VT]]: ...
def iterkeys(self) -> Iterator[_KT]: ...
def itervalues(self) -> Iterator[_VT]: ...
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
# These are incompatible with Mapping
def keys(self) -> Iterator[_KT]: ... # type: ignore
def values(self) -> Iterator[_VT]: ... # type: ignore
def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore
def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ...
def valuerefs(self) -> List[KeyedRef[_KT, _VT]]: ...
@@ -89,32 +74,20 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
def __getitem__(self, k: _KT) -> _VT: ...
def __setitem__(self, k: _KT, v: _VT) -> None: ...
def __delitem__(self, v: _KT) -> None: ...
if sys.version_info < (3, 0):
def has_key(self, key: object) -> bool: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
def copy(self) -> WeakKeyDictionary[_KT, _VT]: ...
if sys.version_info >= (3, 0):
# These are incompatible with Mapping
def keys(self) -> Iterator[_KT]: ... # type: ignore
def values(self) -> Iterator[_VT]: ... # type: ignore
def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore
else:
def keys(self) -> List[_KT]: ...
def values(self) -> List[_VT]: ...
def items(self) -> List[Tuple[_KT, _VT]]: ...
def iterkeys(self) -> Iterator[_KT]: ...
def itervalues(self) -> Iterator[_VT]: ...
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
def iterkeyrefs(self) -> Iterator[ref[_KT]]: ...
# These are incompatible with Mapping
def keys(self) -> Iterator[_KT]: ... # type: ignore
def values(self) -> Iterator[_VT]: ... # type: ignore
def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore
def keyrefs(self) -> List[ref[_KT]]: ...
if sys.version_info >= (3, 4):
class finalize:
def __init__(self, __obj: object, __func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
def __call__(self, _: Any = ...) -> Optional[Any]: ...
def detach(self) -> Optional[Tuple[Any, Any, Tuple[Any, ...], Dict[str, Any]]]: ...
def peek(self) -> Optional[Tuple[Any, Any, Tuple[Any, ...], Dict[str, Any]]]: ...
alive: bool
atexit: bool
class finalize:
def __init__(self, __obj: object, __func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
def __call__(self, _: Any = ...) -> Optional[Any]: ...
def detach(self) -> Optional[Tuple[Any, Any, Tuple[Any, ...], Dict[str, Any]]]: ...
def peek(self) -> Optional[Tuple[Any, Any, Tuple[Any, ...], Dict[str, Any]]]: ...
alive: bool
atexit: bool

View File

@@ -1,4 +1,3 @@
import sys
from abc import abstractmethod
from types import TracebackType
from typing import IO, Callable, Dict, List, MutableMapping, Optional, Text, Tuple, Type
@@ -10,9 +9,7 @@ from .util import FileWrapper
_exc_info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
def format_date_time(timestamp: Optional[float]) -> str: ... # undocumented
if sys.version_info >= (3, 2):
def read_environ() -> Dict[str, str]: ...
def read_environ() -> Dict[str, str]: ...
class BaseHandler:
wsgi_version: Tuple[int, int] # undocumented

View File

@@ -1,4 +1,3 @@
import sys
from typing import List, Optional, Pattern, Tuple, overload
_HeaderList = List[Tuple[str, str]]
@@ -6,16 +5,11 @@ _HeaderList = List[Tuple[str, str]]
tspecials: Pattern[str] # undocumented
class Headers:
if sys.version_info < (3, 5):
def __init__(self, headers: _HeaderList) -> None: ...
else:
def __init__(self, headers: Optional[_HeaderList] = ...) -> None: ...
def __init__(self, headers: Optional[_HeaderList] = ...) -> None: ...
def __len__(self) -> int: ...
def __setitem__(self, name: str, val: str) -> None: ...
def __delitem__(self, name: str) -> None: ...
def __getitem__(self, name: str) -> Optional[str]: ...
if sys.version_info < (3,):
def has_key(self, name: str) -> bool: ...
def __contains__(self, name: str) -> bool: ...
def get_all(self, name: str) -> List[str]: ...
@overload
@@ -25,7 +19,6 @@ class Headers:
def keys(self) -> List[str]: ...
def values(self) -> List[str]: ...
def items(self) -> _HeaderList: ...
if sys.version_info >= (3,):
def __bytes__(self) -> bytes: ...
def __bytes__(self) -> bytes: ...
def setdefault(self, name: str, value: str) -> str: ...
def add_header(self, _name: str, _value: Optional[str], **_params: Optional[str]) -> None: ...

View File

@@ -1,14 +1,9 @@
import sys
from http.server import BaseHTTPRequestHandler, HTTPServer
from typing import List, Optional, Type, TypeVar, overload
from .handlers import SimpleHandler
from .types import ErrorStream, StartResponse, WSGIApplication, WSGIEnvironment
if sys.version_info >= (3, 0):
from http.server import BaseHTTPRequestHandler, HTTPServer
else:
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
server_version: str # undocumented
sys_version: str # undocumented
software_version: str # undocumented

View File

@@ -1,4 +1,3 @@
import sys
from typing import IO, Any, Callable, Optional
from .types import WSGIEnvironment
@@ -10,10 +9,7 @@ class FileWrapper:
def __init__(self, filelike: IO[bytes], blksize: int = ...) -> None: ...
def __getitem__(self, key: Any) -> bytes: ...
def __iter__(self) -> FileWrapper: ...
if sys.version_info >= (3, 0):
def __next__(self) -> bytes: ...
else:
def next(self) -> bytes: ...
def __next__(self) -> bytes: ...
def guess_scheme(environ: WSGIEnvironment) -> str: ...
def application_uri(environ: WSGIEnvironment) -> str: ...

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