clean python 3 specific stuff from stdlib/@python2 stubs (#5451)

This commit is contained in:
Akuli
2021-05-15 01:19:05 +03:00
committed by GitHub
parent f94d838814
commit 5ec4f06263
121 changed files with 1024 additions and 4801 deletions

View File

@@ -14,13 +14,4 @@ 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
if sys.version_info >= (3, 7):
annotations: _Feature
all_feature_names: List[str] # undocumented

View File

@@ -4,32 +4,7 @@ from typing import Callable, MutableSequence, Optional, Sequence, TypeVar
_T = TypeVar("_T")
if sys.version_info >= (3, 10):
def bisect_left(
a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ..., *, key: Optional[Callable[[_T], SupportsLessThan]] = ...
) -> int: ...
def bisect_right(
a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ..., *, key: Optional[Callable[[_T], SupportsLessThan]] = ...
) -> int: ...
def insort_left(
a: MutableSequence[_T],
x: _T,
lo: int = ...,
hi: Optional[int] = ...,
*,
key: Optional[Callable[[_T], SupportsLessThan]] = ...,
) -> None: ...
def insort_right(
a: MutableSequence[_T],
x: _T,
lo: int = ...,
hi: Optional[int] = ...,
*,
key: Optional[Callable[[_T], SupportsLessThan]] = ...,
) -> None: ...
else:
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> int: ...
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> int: ...
def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> None: ...
def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> None: ...
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> int: ...
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> int: ...
def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> None: ...
def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> None: ...

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 = Union[bytes, Text]
_Encodable = Union[bytes, Text]
# This type is not exposed; it is defined in unicodeobject.c
class _EncodingMap(object):
@@ -28,10 +24,7 @@ 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 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]: ...
@@ -43,11 +36,8 @@ def raw_unicode_escape_encode(__str: _Encodable, __errors: _Errors = ...) -> Tup
def readbuffer_encode(__data: _String, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def unicode_escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ...
def unicode_escape_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
if sys.version_info < (3, 8):
def unicode_internal_decode(__obj: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ...
def unicode_internal_encode(__obj: _String, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def unicode_internal_decode(__obj: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ...
def unicode_internal_encode(__obj: _String, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def utf_16_be_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
def utf_16_be_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def utf_16_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
@@ -74,9 +64,3 @@ 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]: ...

View File

@@ -24,20 +24,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: Sequence[Any]) -> Any: ...
def writerows(self, rows: Iterable[Sequence[Any]]) -> None: ...
class _Writer(Protocol):
def write(self, s: str) -> Any: ...

View File

@@ -57,8 +57,6 @@ A_COLOR: int
A_DIM: int
A_HORIZONTAL: int
A_INVIS: int
if sys.version_info >= (3, 7):
A_ITALIC: int
A_LEFT: int
A_LOW: int
A_NORMAL: int
@@ -269,12 +267,7 @@ def cbreak(__flag: bool = ...) -> None: ...
def color_content(__color_number: int) -> Tuple[int, int, int]: ...
# Changed in Python 3.8.8 and 3.9.2
if sys.version_info >= (3, 8):
def color_pair(pair_number: int) -> int: ...
else:
def color_pair(__color_number: int) -> int: ...
def color_pair(__color_number: int) -> int: ...
def curs_set(__visibility: int) -> int: ...
def def_prog_mode() -> None: ...
def def_shell_mode() -> None: ...
@@ -348,24 +341,14 @@ 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 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 use_default_colors() -> None: ...
def use_env(__flag: bool) -> None: ...
class error(Exception): ...
class _CursesWindow:
if sys.version_info >= (3, 3):
encoding: str
@overload
def addch(self, ch: _chtype, attr: int = ...) -> None: ...
@overload
@@ -429,11 +412,6 @@ 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 getkey(self) -> str: ...
@overload
@@ -532,11 +510,3 @@ class _CursesWindow:
def vline(self, ch: _chtype, n: int) -> None: ...
@overload
def vline(self, y: int, x: int, ch: _chtype, n: int) -> None: ...
if sys.version_info >= (3, 8):
class _ncurses_version(NamedTuple):
major: int
minor: int
patch: int
ncurses_version: _ncurses_version
window = _CursesWindow # undocumented

View File

@@ -11,31 +11,14 @@ _T = TypeVar("_T")
__all__: List[str]
def active_count() -> int: ...
if sys.version_info < (3,):
def activeCount() -> int: ...
def activeCount() -> int: ...
def current_thread() -> Thread: ...
def currentThread() -> Thread: ...
if sys.version_info >= (3,):
def get_ident() -> int: ...
def enumerate() -> List[Thread]: ...
if sys.version_info >= (3, 4):
def main_thread() -> Thread: ...
if sys.version_info >= (3, 8):
from _thread import get_native_id as get_native_id
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
class ThreadError(Exception): ...
class local(object):
@@ -47,37 +30,21 @@ 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[Text] = ...,
args: Iterable[Any] = ...,
kwargs: Optional[Mapping[Text, Any]] = ...,
) -> None: ...
def start(self) -> None: ...
def run(self) -> None: ...
def join(self, timeout: Optional[float] = ...) -> None: ...
def getName(self) -> str: ...
def setName(self, name: Text) -> None: ...
if sys.version_info >= (3, 8):
@property
def native_id(self) -> Optional[int]: ... # only available on some platforms
def is_alive(self) -> bool: ...
if sys.version_info < (3, 9):
def isAlive(self) -> bool: ...
def isAlive(self) -> bool: ...
def isDaemon(self) -> bool: ...
def setDaemon(self, daemonic: bool) -> None: ...
@@ -89,10 +56,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 = ...) -> bool: ...
def release(self) -> None: ...
def locked(self) -> bool: ...
@@ -102,10 +66,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 = ...) -> bool: ...
def release(self) -> None: ...
RLock = _RLock
@@ -116,14 +77,9 @@ 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 = ...) -> 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 notify(self, n: int = ...) -> None: ...
def notify_all(self) -> None: ...
def notifyAll(self) -> None: ...
@@ -133,56 +89,22 @@ 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: ...
if sys.version_info >= (3, 9):
def release(self, n: int = ...) -> None: ...
else:
def release(self) -> None: ...
def acquire(self, blocking: bool = ...) -> bool: ...
def __enter__(self, blocking: bool = ...) -> bool: ...
def release(self) -> None: ...
class BoundedSemaphore(Semaphore): ...
class Event:
def __init__(self) -> None: ...
def is_set(self) -> bool: ...
if sys.version_info < (3,):
def isSet(self) -> bool: ...
def isSet(self) -> bool: ...
def set(self) -> None: ...
def clear(self) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> bool: ...
if sys.version_info >= (3, 8):
from _thread import _excepthook, _ExceptHookArgs
excepthook = _excepthook
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: Iterable[Any] = ..., kwargs: 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): ...

View File

@@ -8,7 +8,5 @@ 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]: ...
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

@@ -11,5 +11,4 @@ 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: ...
def jumpahead(self, i: int) -> None: ...

View File

@@ -26,16 +26,3 @@ def get_ident() -> int: ...
def stack_size(size: int = ...) -> int: ...
TIMEOUT_MAX: float
if sys.version_info >= (3, 8):
def get_native_id() -> int: ... # only available on some platforms
class _ExceptHookArgs(Tuple[Type[BaseException], Optional[BaseException], Optional[TracebackType], Optional[Thread]]):
@property
def exc_type(self) -> Type[BaseException]: ...
@property
def exc_value(self) -> Optional[BaseException]: ...
@property
def exc_traceback(self) -> Optional[TracebackType]: ...
@property
def thread(self) -> Optional[Thread]: ...
_excepthook: Callable[[_ExceptHookArgs], Any]

View File

@@ -40,11 +40,8 @@ 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]]: ...
# We want dictionaries to support this on Python 2.
def items(self) -> Iterable[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 = Text
BytesPath = bytes
AnyPath = Union[Text, bytes]
OpenTextModeUpdating = Literal[
"r+",
@@ -155,17 +145,10 @@ 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, buffer]
WriteableBuffer = Union[bytearray, memoryview, array.array[Any], mmap.mmap, buffer]
if sys.version_info >= (3, 10):
from types import NoneType as NoneType
else:
# Used by type checkers for checks involving None (does not exist at runtime)
@final
class NoneType:
def __bool__(self) -> Literal[False]: ...
# Used by type checkers for checks involving None (does not exist at runtime)
@final
class NoneType:
def __bool__(self) -> Literal[False]: ...

View File

@@ -1,7 +1,2 @@
import sys
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: ...

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]
default_action: str
once_registry: 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 = ...) -> 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: ...

View File

@@ -1,9 +1,6 @@
import sys
from typing import Any, Callable, Generic, List, Optional, TypeVar, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
_C = TypeVar("_C", bound=Callable[..., Any])
_T = TypeVar("_T")
@@ -14,13 +11,9 @@ 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]
def __init__(self, o: _T, callback: Optional[Callable[[ReferenceType[_T]], Any]] = ...) -> None: ...
def __call__(self) -> Optional[_T]: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
ref = ReferenceType

View File

@@ -1,9 +1,6 @@
import sys
from typing import Any, Generic, Iterable, Iterator, MutableSet, Optional, TypeVar, Union
if sys.version_info >= (3, 9):
from types import GenericAlias
_S = TypeVar("_S")
_T = TypeVar("_T")
_SelfT = TypeVar("_SelfT", bound=WeakSet[Any])
@@ -43,5 +40,3 @@ class WeakSet(MutableSet[_T], Generic[_T]):
def union(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
def __or__(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
def isdisjoint(self, other: Iterable[_T]) -> bool: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...

View File

@@ -18,11 +18,6 @@ _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 initfp(self, file: IO[bytes]) -> None: ...
def getfp(self) -> IO[bytes]: ...
def rewind(self) -> None: ...
@@ -43,11 +38,6 @@ 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 initfp(self, file: IO[bytes]) -> None: ...
def aiff(self) -> None: ...
def aifc(self) -> None: ...
@@ -78,11 +68,9 @@ def open(f: _File, mode: Literal["r", "rb"]) -> Aifc_read: ...
def open(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ...
@overload
def open(f: _File, mode: Optional[str] = ...) -> Any: ...
if sys.version_info < (3, 9):
@overload
def openfp(f: _File, mode: Literal["r", "rb"]) -> Aifc_read: ...
@overload
def openfp(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ...
@overload
def openfp(f: _File, mode: Optional[str] = ...) -> Any: ...
@overload
def openfp(f: _File, mode: Literal["r", "rb"]) -> Aifc_read: ...
@overload
def openfp(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ...
@overload
def openfp(f: _File, mode: Optional[str] = ...) -> Any: ...

View File

@@ -1,4 +1 @@
import sys
if sys.version_info >= (3, 0):
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 = Union[str, unicode]
ONE_OR_MORE: str
OPTIONAL: str
@@ -109,62 +106,24 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
fromfile_prefix_chars: Optional[_Text]
add_help: bool
if sys.version_info >= (3, 5):
allow_abbrev: bool
# undocumented
_positionals: _ArgumentGroup
_optionals: _ArgumentGroup
_subparsers: Optional[_ArgumentGroup]
if sys.version_info >= (3, 9):
def __init__(
self,
prog: Optional[str] = ...,
usage: Optional[str] = ...,
description: Optional[str] = ...,
epilog: Optional[str] = ...,
parents: Sequence[ArgumentParser] = ...,
formatter_class: _FormatterClass = ...,
prefix_chars: str = ...,
fromfile_prefix_chars: Optional[str] = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
add_help: bool = ...,
allow_abbrev: bool = ...,
exit_on_error: bool = ...,
) -> None: ...
elif sys.version_info >= (3, 5):
def __init__(
self,
prog: Optional[str] = ...,
usage: Optional[str] = ...,
description: Optional[str] = ...,
epilog: Optional[str] = ...,
parents: Sequence[ArgumentParser] = ...,
formatter_class: _FormatterClass = ...,
prefix_chars: str = ...,
fromfile_prefix_chars: Optional[str] = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
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: ...
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
@@ -177,35 +136,19 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore
@overload
def parse_args(self, *, namespace: _N) -> _N: ...
if sys.version_info >= (3, 7):
def add_subparsers(
self,
*,
title: str = ...,
description: Optional[str] = ...,
prog: str = ...,
parser_class: Type[ArgumentParser] = ...,
action: Type[Action] = ...,
option_string: str = ...,
dest: Optional[str] = ...,
required: bool = ...,
help: Optional[str] = ...,
metavar: Optional[str] = ...,
) -> _SubParsersAction: ...
else:
def add_subparsers(
self,
*,
title: Text = ...,
description: Optional[Text] = ...,
prog: Text = ...,
parser_class: Type[ArgumentParser] = ...,
action: Type[Action] = ...,
option_string: Text = ...,
dest: Optional[Text] = ...,
help: Optional[Text] = ...,
metavar: Optional[Text] = ...,
) -> _SubParsersAction: ...
def add_subparsers(
self,
*,
title: Text = ...,
description: Optional[Text] = ...,
prog: Text = ...,
parser_class: Type[ArgumentParser] = ...,
action: Type[Action] = ...,
option_string: Text = ...,
dest: Optional[Text] = ...,
help: Optional[Text] = ...,
metavar: Optional[Text] = ...,
) -> _SubParsersAction: ...
def print_usage(self, file: Optional[IO[str]] = ...) -> None: ...
def print_help(self, file: Optional[IO[str]] = ...) -> None: ...
def format_usage(self) -> str: ...
@@ -216,13 +159,6 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
def convert_arg_line_to_args(self, arg_line: Text) -> List[str]: ...
def exit(self, status: int = ..., message: Optional[Text] = ...) -> NoReturn: ...
def error(self, message: Text) -> NoReturn: ...
if sys.version_info >= (3, 7):
def parse_intermixed_args(
self, args: Optional[Sequence[str]] = ..., namespace: Optional[Namespace] = ...
) -> Namespace: ...
def parse_known_intermixed_args(
self, args: Optional[Sequence[str]] = ..., namespace: Optional[Namespace] = ...
) -> Tuple[Namespace, List[str]]: ...
# undocumented
def _get_optional_actions(self) -> List[Action]: ...
def _get_positional_actions(self) -> List[Action]: ...
@@ -290,9 +226,6 @@ class RawDescriptionHelpFormatter(HelpFormatter): ...
class RawTextHelpFormatter(RawDescriptionHelpFormatter): ...
class ArgumentDefaultsHelpFormatter(HelpFormatter): ...
if sys.version_info >= (3,):
class MetavarTypeHelpFormatter(HelpFormatter): ...
class Action(_AttributeHolder):
option_strings: Sequence[_Text]
dest: _Text
@@ -324,22 +257,6 @@ class Action(_AttributeHolder):
values: Union[Text, Sequence[Any], None],
option_string: Optional[Text] = ...,
) -> None: ...
if sys.version_info >= (3, 9):
def format_usage(self) -> str: ...
if sys.version_info >= (3, 9):
class BooleanOptionalAction(Action):
def __init__(
self,
option_strings: Sequence[str],
dest: str,
default: Union[_T, str, None] = ...,
type: Optional[Union[Callable[[Text], _T], Callable[[str], _T], FileType]] = ...,
choices: Optional[Iterable[_T]] = ...,
required: bool = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...,
) -> None: ...
class Namespace(_AttributeHolder):
def __init__(self, **kwargs: Any) -> None: ...
@@ -351,14 +268,7 @@ 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: ...
def __init__(self, mode: Text = ..., bufsize: Optional[int] = ...) -> None: ...
def __call__(self, string: Text) -> IO[Any]: ...
# undocumented
@@ -451,27 +361,15 @@ class _SubParsersAction(Action):
_name_parser_map: Dict[_Text, ArgumentParser]
choices: Dict[_Text, ArgumentParser]
_choices_actions: List[Action]
if sys.version_info >= (3, 7):
def __init__(
self,
option_strings: Sequence[Text],
prog: Text,
parser_class: Type[ArgumentParser],
dest: Text = ...,
required: bool = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...,
) -> None: ...
else:
def __init__(
self,
option_strings: Sequence[Text],
prog: Text,
parser_class: Type[ArgumentParser],
dest: Text = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...,
) -> None: ...
def __init__(
self,
option_strings: Sequence[Text],
prog: Text,
parser_class: Type[ArgumentParser],
dest: Text = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...,
) -> None: ...
# TODO: Type keyword args properly.
def add_parser(self, name: Text, **kwargs: Any) -> ArgumentParser: ...
def _get_subactions(self) -> List[Action]: ...
@@ -479,9 +377,8 @@ class _SubParsersAction(Action):
# undocumented
class ArgumentTypeError(Exception): ...
if sys.version_info < (3, 7):
# undocumented
def _ensure_value(namespace: Namespace, name: Text, value: Any) -> Any: ...
# undocumented
def _ensure_value(namespace: Namespace, name: Text, value: Any) -> Any: ...
# undocumented
def _get_action_name(argument: Optional[Action]) -> Optional[str]: ...

View File

@@ -9,9 +9,6 @@ _TypeCode = Union[_IntTypeCode, _FloatTypeCode, _UnicodeTypeCode]
_T = TypeVar("_T", int, float, Text)
if sys.version_info >= (3,):
typecodes: str
class array(MutableSequence[_T], Generic[_T]):
typecode: _TypeCode
itemsize: int
@@ -28,31 +25,21 @@ 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 fromfile(self, __f: BinaryIO, __n: int) -> None: ...
def fromlist(self, __list: List[_T]) -> None: ...
def fromunicode(self, __ustr: str) -> None: ...
if sys.version_info >= (3, 10):
def index(self, __v: _T, __start: int = ..., __stop: int = ...) -> int: ...
else:
def index(self, __v: _T) -> int: ... # type: ignore # Overrides Sequence
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 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 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: ...
def write(self, f: BinaryIO) -> None: ...
def fromstring(self, __buffer: bytes) -> None: ...
def tostring(self) -> bytes: ...
def __len__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> _T: ...
@@ -72,9 +59,8 @@ 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: ...
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

@@ -29,11 +29,10 @@ class async_chat(asyncore.dispatcher):
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]: ...
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,35 @@ 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: ...
# 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 = Union[bytes, unicode]
_decodable = Union[bytes, unicode]
def b64encode(s: _encodable, altchars: Optional[bytes] = ...) -> bytes: ...
def b64decode(s: _decodable, altchars: Optional[bytes] = ..., validate: bool = ...) -> bytes: ...
@@ -18,24 +14,7 @@ def b32encode(s: _encodable) -> bytes: ...
def b32decode(s: _decodable, casefold: bool = ..., map01: Optional[bytes] = ...) -> bytes: ...
def b16encode(s: _encodable) -> bytes: ...
def b16decode(s: _decodable, casefold: bool = ...) -> bytes: ...
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 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: ...
if sys.version_info < (3, 9):
def encodestring(s: bytes) -> bytes: ...
def decodestring(s: bytes) -> bytes: ...
def encodestring(s: bytes) -> bytes: ...
def decodestring(s: bytes) -> bytes: ...

View File

@@ -1,32 +1,14 @@
import sys
from typing import Text, 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
# Python 2 accepts unicode ascii pretty much everywhere.
_Bytes = Text
_Ascii = Text
def a2b_uu(__data: _Ascii) -> bytes: ...
if sys.version_info >= (3, 7):
def b2a_uu(__data: _Bytes, *, backtick: bool = ...) -> bytes: ...
else:
def b2a_uu(__data: _Bytes) -> bytes: ...
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) -> 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: ...
@@ -36,13 +18,7 @@ def b2a_hqx(__data: _Bytes) -> bytes: ...
def crc_hqx(__data: _Bytes, __crc: int) -> int: ...
def crc32(__data: _Bytes, __crc: int = ...) -> int: ...
def b2a_hex(__data: _Bytes) -> bytes: ...
if sys.version_info >= (3, 8):
def hexlify(data: bytes, sep: Union[str, bytes] = ..., bytes_per_sep: int = ...) -> bytes: ...
else:
def hexlify(__data: _Bytes) -> bytes: ...
def hexlify(__data: _Bytes) -> bytes: ...
def a2b_hex(__hexstr: _Ascii) -> bytes: ...
def unhexlify(__hexstr: _Ascii) -> bytes: ...

View File

@@ -10,45 +10,11 @@ _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]: ...
class BZ2File(io.BufferedIOBase, IO[bytes]):
def __enter__(self: _T) -> _T: ...
if sys.version_info >= (3, 9):
def __init__(self, filename: _PathOrFile, mode: str = ..., *, compresslevel: int = ...) -> None: ...
else:
def __init__(
self, filename: _PathOrFile, mode: str = ..., buffering: Optional[Any] = ..., compresslevel: int = ...
) -> None: ...
def __init__(
self, filename: _PathOrFile, mode: str = ..., buffering: Optional[Any] = ..., compresslevel: int = ...
) -> None: ...
def read(self, size: Optional[int] = ...) -> bytes: ...
def read1(self, size: int = ...) -> bytes: ...
def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore
@@ -64,15 +30,6 @@ 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) -> bytes: ...
@property
def unused_data(self) -> bytes: ...

View File

@@ -26,8 +26,5 @@ class Profile:
def run(self: _SelfT, cmd: str) -> _SelfT: ...
def runctx(self: _SelfT, cmd: str, globals: Dict[str, Any], locals: Dict[str, Any]) -> _SelfT: ...
def runcall(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ...
if sys.version_info >= (3, 8):
def __enter__(self: _SelfT) -> _SelfT: ...
def __exit__(self, *exc_info: Any) -> None: ...
def label(code: Union[str, CodeType]) -> _Label: ... # undocumented

View File

@@ -33,9 +33,6 @@ class Calendar:
def yeardatescalendar(self, year: int, width: int = ...) -> List[List[int]]: ...
def yeardays2calendar(self, year: int, width: int = ...) -> List[List[Tuple[int, int]]]: ...
def yeardayscalendar(self, year: int, width: int = ...) -> List[List[int]]: ...
if sys.version_info >= (3, 7):
def itermonthdays3(self, year: int, month: int) -> Iterable[Tuple[int, int, int]]: ...
def itermonthdays4(self, year: int, month: int) -> Iterable[Tuple[int, int, int, int]]: ...
class TextCalendar(Calendar):
def prweek(self, theweek: int, width: int) -> None: ...
@@ -68,26 +65,11 @@ class HTMLCalendar(Calendar):
def formatmonth(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
def formatyear(self, theyear: int, width: int = ...) -> str: ...
def formatyearpage(self, theyear: int, width: int = ..., css: Optional[str] = ..., encoding: Optional[str] = ...) -> str: ...
if sys.version_info >= (3, 7):
cssclasses: List[str]
cssclass_noday: str
cssclasses_weekday_head: List[str]
cssclass_month_head: str
cssclass_month: str
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 TimeEncoding:
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

@@ -3,13 +3,6 @@ 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
_C = Union[SupportsFloat, SupportsComplex, complex]
def acos(__z: _C) -> complex: ...
@@ -21,10 +14,6 @@ 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 isinf(__z: _C) -> bool: ...
def isnan(__z: _C) -> bool: ...
def log(__x: _C, __y_obj: _C = ...) -> complex: ...
@@ -37,6 +26,3 @@ 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: ...

View File

@@ -12,25 +12,12 @@ 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] = ...) -> 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]] = ...
) -> None: ...
def compile_command(source: str, filename: str = ..., symbol: str = ...) -> Optional[CodeType]: ...

View File

@@ -234,10 +234,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 +274,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

@@ -3,14 +3,6 @@ from types import TracebackType
from typing import IO, Any, Callable, ContextManager, Iterable, 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
if sys.version_info >= (3, 7):
AbstractAsyncContextManager = AsyncContextManager
_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
_T_io = TypeVar("_T_io", bound=Optional[IO[str]])
@@ -19,21 +11,11 @@ _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]]: ...
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]]: ...
def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., ContextManager[_T]]: ...
def nested(*mgr: ContextManager[Any]) -> ContextManager[Iterable[Any]]: ...
class _SupportsClose(Protocol):
def close(self) -> None: ...
@@ -42,74 +24,3 @@ _SupportsCloseT = TypeVar("_SupportsCloseT", bound=_SupportsClose)
class closing(ContextManager[_SupportsCloseT]):
def __init__(self, thing: _SupportsCloseT) -> None: ...
if sys.version_info >= (3, 10):
class _SupportsAclose(Protocol):
async def aclose(self) -> None: ...
_SupportsAcloseT = TypeVar("_SupportsAcloseT", bound=_SupportsAclose)
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: ...
if sys.version_info >= (3, 5):
class redirect_stderr(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: ...
if sys.version_info >= (3, 7):
from typing import Awaitable
_S = TypeVar("_S", bound=AsyncExitStack)
_ExitCoroFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], Awaitable[bool]]
_CallbackCoroFunc = Callable[..., Awaitable[Any]]
_ACM_EF = TypeVar("_ACM_EF", AsyncContextManager[Any], _ExitCoroFunc)
class AsyncExitStack(AsyncContextManager[AsyncExitStack]):
def __init__(self) -> None: ...
def enter_context(self, cm: ContextManager[_T]) -> _T: ...
def enter_async_context(self, cm: AsyncContextManager[_T]) -> Awaitable[_T]: ...
def push(self, exit: _CM_EF) -> _CM_EF: ...
def push_async_exit(self, exit: _ACM_EF) -> _ACM_EF: ...
def callback(self, callback: Callable[..., Any], *args: Any, **kwds: Any) -> Callable[..., Any]: ...
def push_async_callback(self, callback: _CallbackCoroFunc, *args: Any, **kwds: Any) -> _CallbackCoroFunc: ...
def pop_all(self: _S) -> _S: ...
def aclose(self) -> Awaitable[None]: ...
def __aenter__(self: _S) -> Awaitable[_S]: ...
def __aexit__(
self,
__exc_type: Optional[Type[BaseException]],
__exc_value: Optional[BaseException],
__traceback: Optional[TracebackType],
) -> Awaitable[bool]: ...
if sys.version_info >= (3, 7):
@overload
def nullcontext(enter_result: _T) -> ContextManager[_T]: ...
@overload
def nullcontext() -> ContextManager[None]: ...

View File

@@ -1,22 +1,4 @@
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
methods: List[_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: ...
else:
def crypt(word: str, salt: str) -> str: ...
def crypt(word: str, salt: str) -> str: ...

View File

@@ -17,12 +17,21 @@ from _csv import (
unregister_dialect as unregister_dialect,
writer as writer,
)
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):
from typing import Dict as _DictReadMapping
else:
from collections import OrderedDict as _DictReadMapping
from typing import (
Any,
Dict as _DictReadMapping,
Generic,
Iterable,
Iterator,
List,
Mapping,
Optional,
Sequence,
Text,
Type,
TypeVar,
overload,
)
_T = TypeVar("_T")
@@ -37,15 +46,6 @@ 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 DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
fieldnames: Optional[Sequence[_T]]
restkey: Optional[str]
@@ -76,10 +76,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]
@@ -96,10 +93,7 @@ class DictWriter(Generic[_T]):
*args: Any,
**kwds: Any,
) -> None: ...
if sys.version_info >= (3, 8):
def writeheader(self) -> Any: ...
else:
def writeheader(self) -> None: ...
def writeheader(self) -> None: ...
def writerow(self, rowdict: Mapping[_T, Any]) -> Any: ...
def writerows(self, rowdicts: Iterable[Mapping[_T, Any]]) -> None: ...

View File

@@ -19,9 +19,6 @@ from typing import (
overload,
)
if sys.version_info >= (3, 9):
from types import GenericAlias
_T = TypeVar("_T")
_DLLT = TypeVar("_DLLT", bound=CDLL)
_CT = TypeVar("_CT", bound=_CData)
@@ -36,25 +33,9 @@ class CDLL(object):
_name: str = ...
_handle: int = ...
_FuncPtr: Type[_FuncPointer] = ...
if sys.version_info >= (3, 8):
def __init__(
self,
name: Optional[str],
mode: int = ...,
handle: Optional[int] = ...,
use_errno: bool = ...,
use_last_error: bool = ...,
winmode: Optional[int] = ...,
) -> None: ...
else:
def __init__(
self,
name: Optional[str],
mode: int = ...,
handle: Optional[int] = ...,
use_errno: bool = ...,
use_last_error: bool = ...,
) -> None: ...
def __init__(
self, name: Optional[str], mode: int = ..., handle: Optional[int] = ..., use_errno: bool = ..., use_last_error: bool = ...
) -> None: ...
def __getattr__(self, name: str) -> _NamedFuncPointer: ...
def __getitem__(self, name: str) -> _NamedFuncPointer: ...
@@ -69,8 +50,6 @@ class LibraryLoader(Generic[_DLLT]):
def __getattr__(self, name: str) -> _DLLT: ...
def __getitem__(self, name: str) -> _DLLT: ...
def LoadLibrary(self, name: str) -> _DLLT: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
cdll: LibraryLoader[CDLL] = ...
if sys.platform == "win32":
@@ -200,10 +179,7 @@ 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_conversion_mode(encoding: str, errors: str) -> Tuple[str, str]: ...
def set_errno(value: int) -> int: ...
if sys.platform == "win32":
@@ -315,5 +291,3 @@ class Array(Generic[_CT], _CData):
# Can't inherit from Sized because the metaclass conflict between
# Sized and _CData prevents using _CDataMeta.
def __len__(self) -> int: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...

View File

@@ -4,10 +4,7 @@ from typing import AnyStr, ClassVar, NamedTuple, Optional, SupportsAbs, Tuple, T
_S = TypeVar("_S")
if sys.version_info >= (3,):
_Text = str
else:
_Text = Union[str, unicode]
_Text = Union[str, unicode]
MINYEAR: int
MAXYEAR: int
@@ -18,20 +15,6 @@ 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: ...
if sys.version_info >= (3, 9):
class _IsoCalendarDate(NamedTuple):
year: int
week: int
weekday: int
_tzinfo = tzinfo
class date:
@@ -45,12 +28,6 @@ class date:
def today(cls: Type[_S]) -> _S: ...
@classmethod
def fromordinal(cls: Type[_S], n: int) -> _S: ...
if sys.version_info >= (3, 7):
@classmethod
def fromisoformat(cls: Type[_S], date_string: str) -> _S: ...
if sys.version_info >= (3, 8):
@classmethod
def fromisocalendar(cls: Type[_S], year: int, week: int, day: int) -> _S: ...
@property
def year(self) -> int: ...
@property
@@ -59,10 +36,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: AnyStr) -> AnyStr: ...
def isoformat(self) -> str: ...
def timetuple(self) -> struct_time: ...
def toordinal(self) -> int: ...
@@ -71,12 +45,8 @@ class date:
def __lt__(self, other: date) -> bool: ...
def __ge__(self, other: date) -> bool: ...
def __gt__(self, other: date) -> bool: ...
if sys.version_info >= (3, 8):
def __add__(self: _S, other: timedelta) -> _S: ...
def __radd__(self: _S, other: timedelta) -> _S: ...
else:
def __add__(self, other: timedelta) -> date: ...
def __radd__(self, other: timedelta) -> date: ...
def __add__(self, other: timedelta) -> date: ...
def __radd__(self, other: timedelta) -> date: ...
@overload
def __sub__(self, other: timedelta) -> date: ...
@overload
@@ -84,31 +54,15 @@ class date:
def __hash__(self) -> int: ...
def weekday(self) -> int: ...
def isoweekday(self) -> int: ...
if sys.version_info >= (3, 9):
def isocalendar(self) -> _IsoCalendarDate: ...
else:
def isocalendar(self) -> Tuple[int, int, int]: ...
def isocalendar(self) -> Tuple[int, int, int]: ...
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] = ...
) -> None: ...
@property
def hour(self) -> int: ...
@property
@@ -119,44 +73,20 @@ class time:
def microsecond(self) -> int: ...
@property
def tzinfo(self) -> Optional[_tzinfo]: ...
if sys.version_info >= (3, 6):
@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: ...
if sys.version_info >= (3, 7):
@classmethod
def fromisoformat(cls: Type[_S], time_string: str) -> _S: ...
def isoformat(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: AnyStr) -> AnyStr: ...
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] = ...
) -> time: ...
_date = date
_time = time
@@ -165,31 +95,16 @@ 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 = ...,
) -> None: ...
@property
def days(self) -> int: ...
@property
@@ -210,18 +125,10 @@ 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 __div__(self, other: timedelta) -> float: ...
@overload
def __div__(self, other: float) -> timedelta: ...
def __le__(self, other: timedelta) -> bool: ...
def __lt__(self, other: timedelta) -> bool: ...
def __ge__(self, other: timedelta) -> bool: ...
@@ -232,33 +139,17 @@ 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] = ...,
) -> _S: ...
@property
def year(self) -> int: ...
@property
@@ -275,9 +166,6 @@ class datetime(date):
def microsecond(self) -> int: ...
@property
def tzinfo(self) -> Optional[_tzinfo]: ...
if sys.version_info >= (3, 6):
@property
def fold(self) -> int: ...
@classmethod
def fromtimestamp(cls: Type[_S], t: float, tz: Optional[_tzinfo] = ...) -> _S: ...
@classmethod
@@ -286,77 +174,38 @@ class datetime(date):
def today(cls: Type[_S]) -> _S: ...
@classmethod
def fromordinal(cls: Type[_S], n: int) -> _S: ...
if sys.version_info >= (3, 8):
@classmethod
def now(cls: Type[_S], tz: Optional[_tzinfo] = ...) -> _S: ...
else:
@overload
@classmethod
def now(cls: Type[_S], tz: None = ...) -> _S: ...
@overload
@classmethod
def now(cls, tz: _tzinfo) -> datetime: ...
@overload
@classmethod
def now(cls: Type[_S], tz: None = ...) -> _S: ...
@overload
@classmethod
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: ...
if sys.version_info >= (3, 7):
@classmethod
def fromisoformat(cls: Type[_S], date_string: str) -> _S: ...
@classmethod
def combine(cls, date: _date, time: _time) -> datetime: ...
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: AnyStr) -> AnyStr: ...
def toordinal(self) -> int: ...
def timetuple(self) -> struct_time: ...
if sys.version_info >= (3, 3):
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: ...
if sys.version_info >= (3, 8):
def astimezone(self: _S, tz: Optional[_tzinfo] = ...) -> _S: ...
elif sys.version_info >= (3, 3):
def astimezone(self, tz: Optional[_tzinfo] = ...) -> datetime: ...
else:
def astimezone(self, tz: _tzinfo) -> datetime: ...
def replace(
self,
year: int = ...,
month: int = ...,
day: int = ...,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
) -> datetime: ...
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 = ...) -> str: ...
@classmethod
def strptime(cls, date_string: _Text, format: _Text) -> datetime: ...
def utcoffset(self) -> Optional[timedelta]: ...
@@ -366,12 +215,8 @@ class datetime(date):
def __lt__(self, other: datetime) -> bool: ... # type: ignore
def __ge__(self, other: datetime) -> bool: ... # type: ignore
def __gt__(self, other: datetime) -> bool: ... # type: ignore
if sys.version_info >= (3, 8):
def __add__(self: _S, other: timedelta) -> _S: ...
def __radd__(self: _S, other: timedelta) -> _S: ...
else:
def __add__(self, other: timedelta) -> datetime: ...
def __radd__(self, other: timedelta) -> datetime: ...
def __add__(self, other: timedelta) -> datetime: ...
def __radd__(self, other: timedelta) -> datetime: ...
@overload # type: ignore
def __sub__(self, other: datetime) -> timedelta: ...
@overload
@@ -379,7 +224,4 @@ class datetime(date):
def __hash__(self) -> int: ...
def weekday(self) -> int: ...
def isoweekday(self) -> int: ...
if sys.version_info >= (3, 9):
def isocalendar(self) -> _IsoCalendarDate: ...
else:
def isocalendar(self) -> Tuple[int, int, int]: ...
def isocalendar(self) -> Tuple[int, int, int]: ...

View File

@@ -5,10 +5,7 @@ from typing import Any, Container, Dict, List, NamedTuple, Optional, Sequence, T
_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]
_DecimalT = TypeVar("_DecimalT", bound=Decimal)
class DecimalTuple(NamedTuple):
@@ -25,16 +22,8 @@ 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]: ...
def handle(self, context: Context, *args: Any) -> Optional[Decimal]: ...
class Clamped(DecimalException): ...
class InvalidOperation(DecimalException): ...
@@ -49,9 +38,6 @@ class Subnormal(DecimalException): ...
class Overflow(Inexact, Rounded): ...
class Underflow(Inexact, Rounded, Subnormal): ...
if sys.version_info >= (3,):
class FloatOperation(DecimalException, TypeError): ...
def setcontext(__context: Context) -> None: ...
def getcontext() -> Context: ...
def localcontext(ctx: Optional[Context] = ...) -> _ContextManager: ...
@@ -60,69 +46,38 @@ 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 __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 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 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, 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 remainder_near(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __float__(self) -> float: ...
def __int__(self) -> int: ...
@@ -133,26 +88,14 @@ 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: ...
def __long__(self) -> long: ...
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] = ..., watchexp: bool = ...
) -> Decimal: ...
def same_quantum(self, other: _Decimal) -> 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 +103,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, context: Optional[Context] = ...) -> 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) -> Decimal: ...
def compare_total_mag(self, other: _Decimal) -> 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) -> Decimal: ...
def exp(self, context: Optional[Context] = ...) -> Decimal: ...
def is_canonical(self) -> bool: ...
def is_finite(self) -> bool: ...
@@ -225,46 +158,22 @@ 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] = ...,
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: ...
def clear_flags(self) -> None: ...
if sys.version_info >= (3,):
def clear_traps(self) -> None: ...
def copy(self) -> Context: ...
def __copy__(self) -> Context: ...
__hash__: Any = ...

View File

@@ -17,16 +17,10 @@ from typing import (
overload,
)
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)
# Aliases can't point to type vars, so we need to redeclare AnyStr
_StrType = TypeVar("_StrType", Text, bytes)
_JunkCallback = Union[Callable[[Text], bool], Callable[[str], bool]]
@@ -42,20 +36,13 @@ class SequenceMatcher(Generic[_T]):
def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ...
def set_seq1(self, a: Sequence[_T]) -> None: ...
def set_seq2(self, b: Sequence[_T]) -> None: ...
if sys.version_info >= (3, 9):
def find_longest_match(
self, alo: int = ..., ahi: Optional[int] = ..., blo: int = ..., bhi: Optional[int] = ...
) -> Match: ...
else:
def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ...
def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ...
def get_matching_blocks(self) -> List[Match]: ...
def get_opcodes(self) -> List[Tuple[str, int, int, int, int]]: ...
def get_grouped_opcodes(self, n: int = ...) -> Iterable[List[Tuple[str, int, int, int, int]]]: ...
def ratio(self) -> float: ...
def quick_ratio(self) -> float: ...
def real_quick_ratio(self) -> float: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
# mypy thinks the signatures of the overloads overlap, but the types still work fine
@overload
@@ -105,28 +92,15 @@ 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 = ...,
) -> _StrType: ...
def make_table(
self,
fromlines: Sequence[_StrType],
@@ -138,16 +112,3 @@ 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]: ...

View File

@@ -16,68 +16,19 @@ from opcode import (
)
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: ...
COMPILER_FLAG_NAMES: Dict[int, str]
def findlabels(code: _have_code) -> List[int]: ...
def findlinestarts(code: _have_code) -> Iterator[Tuple[int, int]]: ...
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 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):
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 show_code(co: _have_code) -> None: ...

View File

@@ -24,9 +24,6 @@ REPORT_UDIFF: int
REPORT_CDIFF: int
REPORT_NDIFF: int
REPORT_ONLY_FIRST_FAILURE: int
if sys.version_info >= (3, 4):
FAIL_FAST: int
REPORTING_FLAGS: int
BLANKLINE_MARKER: str
@@ -189,11 +186,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
_DocTestSuite = unittest.TestSuite
def DocTestSuite(
module: Union[None, str, types.ModuleType] = ...,

View File

@@ -2,24 +2,11 @@ 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,17 @@
import sys
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], 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]]: ...
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: AnyStr, b: AnyStr, ignore: Optional[Sequence[AnyStr]] = ..., hide: Optional[Sequence[AnyStr]] = ...
) -> None: ...
left: AnyStr
right: AnyStr
hide: Sequence[AnyStr]
@@ -66,8 +39,3 @@ class dircmp(Generic[AnyStr]):
def phase3(self) -> None: ...
def phase4(self) -> None: ...
def phase4_closure(self) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
if sys.version_info >= (3,):
def clear_cache() -> None: ...

View File

@@ -2,26 +2,14 @@ import sys
from _typeshed import AnyPath
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Optional, Union
if sys.version_info >= (3, 8):
def input(
files: Union[AnyPath, Iterable[AnyPath], None] = ...,
inplace: bool = ...,
backup: str = ...,
*,
mode: str = ...,
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
) -> FileInput[AnyStr]: ...
else:
def input(
files: Union[AnyPath, Iterable[AnyPath], None] = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
mode: str = ...,
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
) -> FileInput[AnyStr]: ...
def input(
files: Union[AnyPath, Iterable[AnyPath], None] = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
mode: str = ...,
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
) -> FileInput[AnyStr]: ...
def close() -> None: ...
def nextfile() -> None: ...
def filename() -> str: ...
@@ -32,31 +20,17 @@ def isfirstline() -> bool: ...
def isstdin() -> bool: ...
class FileInput(Iterable[AnyStr], Generic[AnyStr]):
if sys.version_info >= (3, 8):
def __init__(
self,
files: Union[None, AnyPath, Iterable[AnyPath]] = ...,
inplace: bool = ...,
backup: str = ...,
*,
mode: str = ...,
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
) -> None: ...
else:
def __init__(
self,
files: Union[None, AnyPath, Iterable[AnyPath]] = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
mode: str = ...,
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
) -> None: ...
def __init__(
self,
files: Union[None, AnyPath, Iterable[AnyPath]] = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
mode: str = ...,
openhook: Callable[[AnyPath, str], IO[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 __iter__(self) -> Iterator[AnyStr]: ...
def __next__(self) -> AnyStr: ...
def __getitem__(self, i: int) -> AnyStr: ...
@@ -70,9 +44,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) -> Callable[[AnyPath, str], IO[Any]]: ...

View File

@@ -7,15 +7,14 @@ from typing_extensions import Literal
_ComparableNum = Union[int, float, Decimal, Real]
_T = TypeVar("_T")
if sys.version_info < (3, 9):
@overload
def gcd(a: int, b: int) -> int: ...
@overload
def gcd(a: Integral, b: int) -> Integral: ...
@overload
def gcd(a: int, b: Integral) -> Integral: ...
@overload
def gcd(a: Integral, b: Integral) -> Integral: ...
@overload
def gcd(a: int, b: int) -> int: ...
@overload
def gcd(a: Integral, b: int) -> Integral: ...
@overload
def gcd(a: int, b: Integral) -> Integral: ...
@overload
def gcd(a: Integral, b: Integral) -> Integral: ...
class Fraction(Rational):
@overload
@@ -33,8 +32,6 @@ class Fraction(Rational):
@classmethod
def from_decimal(cls, dec: Decimal) -> Fraction: ...
def limit_denominator(self, max_denominator: int = ...) -> Fraction: ...
if sys.version_info >= (3, 8):
def as_integer_ratio(self) -> Tuple[int, int]: ...
@property
def numerator(self) -> int: ...
@property
@@ -87,19 +84,18 @@ 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 __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 +134,13 @@ 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 __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 __nonzero__(self) -> bool: ...
# Not actually defined within fractions.py, but provides more useful
# overrides
@property

View File

@@ -13,8 +13,6 @@ MSG_OOB: int
FTP_PORT: int
MAXLINE: int
CRLF: str
if sys.version_info >= (3,):
B_CRLF: bytes
class Error(Exception): ...
class error_reply(Error): ...
@@ -40,35 +38,11 @@ class FTP:
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[BinaryIO]
def __init__(
self, host: Text = ..., user: Text = ..., passwd: Text = ..., acct: Text = ..., timeout: float = ...
) -> None: ...
def connect(self, host: Text = ..., port: int = ..., timeout: float = ...) -> str: ...
def getwelcome(self) -> str: ...
def set_debuglevel(self, level: int) -> None: ...
def debug(self, level: int) -> None: ...
@@ -108,8 +82,6 @@ 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 rename(self, fromname: Text, toname: Text) -> str: ...
def delete(self, filename: Text) -> str: ...
def cwd(self, dirname: Text) -> str: ...
@@ -141,16 +113,13 @@ 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, ...]: ...
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 parse150(resp: str) -> Optional[int]: ... # undocumented
def parse227(resp: str) -> Tuple[str, int]: ... # undocumented

View File

@@ -25,8 +25,3 @@ 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: ...

View File

@@ -9,26 +9,9 @@ _DigestMod = Union[str, Callable[[], _Hash], ModuleType]
digest_size: None
if sys.version_info >= (3, 8):
# In reality digestmod has a default value, but the function always throws an error
# if the argument is not given, so we pretend it is a required argument.
@overload
def new(key: bytes, msg: Optional[ReadableBuffer], digestmod: _DigestMod) -> HMAC: ...
@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: ...
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
def __init__(self, key: bytes, msg: Optional[ReadableBuffer] = ..., digestmod: _DigestMod = ...) -> None: ...
def update(self, msg: ReadableBuffer) -> None: ...
def digest(self) -> bytes: ...
@@ -39,6 +22,3 @@ class HMAC:
def compare_digest(__a: ReadableBuffer, __b: ReadableBuffer) -> bool: ...
@overload
def compare_digest(__a: AnyStr, __b: AnyStr) -> bool: ...
if sys.version_info >= (3, 7):
def digest(key: bytes, msg: ReadableBuffer, digest: str) -> bytes: ...

View File

@@ -31,12 +31,8 @@ class IMAP4:
welcome: bytes = ...
capabilities: Tuple[str] = ...
PROTOCOL_VERSION: str = ...
if sys.version_info >= (3, 9):
def __init__(self, host: str = ..., port: int = ..., timeout: Optional[float] = ...) -> None: ...
def open(self, host: str = ..., port: int = ..., timeout: Optional[float] = ...) -> None: ...
else:
def __init__(self, host: str = ..., port: int = ...) -> None: ...
def open(self, host: str = ..., port: int = ...) -> None: ...
def __init__(self, host: str = ..., port: int = ...) -> None: ...
def open(self, host: str = ..., port: int = ...) -> None: ...
def __getattr__(self, attr: str) -> Any: ...
host: str = ...
port: int = ...
@@ -58,10 +54,6 @@ 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 expunge(self) -> _CommandResults: ...
def fetch(self, message_set: str, message_parts: str) -> Tuple[str, _AnyResponseData]: ...
def getacl(self, mailbox: str) -> _CommandResults: ...
@@ -85,54 +77,25 @@ 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 status(self, mailbox: str, names: str) -> _CommandResults: ...
def store(self, message_set: str, command: str, flags: str) -> _CommandResults: ...
def subscribe(self, mailbox: str) -> _CommandResults: ...
def thread(self, threading_algorithm: str, charset: str, *search_criteria: str) -> _CommandResults: ...
def uid(self, command: str, *args: str) -> _CommandResults: ...
def unsubscribe(self, mailbox: str) -> _CommandResults: ...
if sys.version_info >= (3, 9):
def unselect(self) -> _CommandResults: ...
def xatom(self, name: str, *args: str) -> _CommandResults: ...
def print_log(self) -> None: ...
class IMAP4_SSL(IMAP4):
keyfile: str = ...
certfile: str = ...
if sys.version_info >= (3, 9):
def __init__(
self,
host: str = ...,
port: int = ...,
keyfile: Optional[str] = ...,
certfile: Optional[str] = ...,
ssl_context: Optional[SSLContext] = ...,
timeout: Optional[float] = ...,
) -> None: ...
elif sys.version_info >= (3, 3):
def __init__(
self,
host: str = ...,
port: int = ...,
keyfile: Optional[str] = ...,
certfile: Optional[str] = ...,
ssl_context: Optional[SSLContext] = ...,
) -> None: ...
else:
def __init__(
self, host: str = ..., port: int = ..., keyfile: Optional[str] = ..., certfile: Optional[str] = ...
) -> None: ...
def __init__(self, host: str = ..., port: int = ..., keyfile: Optional[str] = ..., certfile: Optional[str] = ...) -> None: ...
host: str = ...
port: int = ...
sock: _socket = ...
sslobj: SSLSocket = ...
file: IO[Any] = ...
if sys.version_info >= (3, 9):
def open(self, host: str = ..., port: Optional[int] = ..., timeout: Optional[float] = ...) -> None: ...
else:
def open(self, host: str = ..., port: Optional[int] = ...) -> None: ...
def open(self, host: str = ..., port: Optional[int] = ...) -> None: ...
def read(self, size: int) -> bytes: ...
def readline(self) -> bytes: ...
def send(self, data: bytes) -> None: ...
@@ -150,10 +113,7 @@ class IMAP4_stream(IMAP4):
process: subprocess.Popen[bytes] = ...
writefile: IO[Any] = ...
readfile: IO[Any] = ...
if sys.version_info >= (3, 9):
def open(self, host: Optional[str] = ..., port: Optional[int] = ..., timeout: Optional[float] = ...) -> None: ...
else:
def open(self, host: Optional[str] = ..., port: Optional[int] = ...) -> None: ...
def open(self, host: Optional[str] = ..., port: Optional[int] = ...) -> None: ...
def read(self, size: int) -> bytes: ...
def readline(self) -> bytes: ...
def send(self, data: bytes) -> None: ...

View File

@@ -7,10 +7,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, _ReadableBinary]
@overload
def what(file: _File, h: None = ...) -> Optional[str]: ...

View File

@@ -87,9 +87,6 @@ class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]):
def overlaps(self, other: _BaseNetwork[_A]) -> bool: ...
@property
def prefixlen(self) -> int: ...
if sys.version_info >= (3, 7):
def subnet_of(self: _T, other: _T) -> bool: ...
def supernet_of(self: _T, other: _T) -> bool: ...
def subnets(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> Iterator[_T]: ...
def supernet(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> _T: ...
@property

View File

@@ -4,7 +4,3 @@ from typing import Sequence, Text
def iskeyword(s: Text) -> bool: ...
kwlist: Sequence[str]
if sys.version_info >= (3, 9):
def issoftkeyword(s: str) -> bool: ...
softkwlist: Sequence[str]

View File

@@ -54,13 +54,6 @@ 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
ERRORTOKEN: int
N_TOKENS: int
NT_OFFSET: int

View File

@@ -36,9 +36,8 @@ 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: ...
def get_prefix(self) -> Text: ...
def set_prefix(self, prefix: Text) -> None: ...
class Node(Base):
fixers_applied: List[Any]

View File

@@ -8,6 +8,3 @@ 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: ...

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 __builtin__ 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
@@ -90,18 +87,8 @@ def resetlocale(category: int = ...) -> None: ...
def strcoll(string1: _str, string2: _str) -> int: ...
def strxfrm(string: _str) -> _str: ...
def format(percent: _str, value: Union[float, Decimal], grouping: bool = ..., monetary: bool = ..., *additional: Any) -> _str: ...
if sys.version_info >= (3, 7):
def format_string(f: _str, val: Any, grouping: bool = ..., monetary: bool = ...) -> _str: ...
else:
def format_string(f: _str, val: Any, grouping: bool = ...) -> _str: ...
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 atof(string: _str, func: Callable[[_str], float] = ...) -> float: ...
def atoi(string: _str) -> int: ...
def str(val: float) -> _str: ...

View File

@@ -11,9 +11,6 @@ from genericpath import (
isfile as isfile,
)
if sys.version_info >= (3, 4):
from genericpath import samefile as samefile, sameopenfile as sameopenfile, samestat as samestat
# Re-export common definitions from posixpath to reduce duplication
from posixpath import (
abspath as abspath,
@@ -36,69 +33,25 @@ 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: ...
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: ...
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]: ...
# 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: ...
def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ...

View File

@@ -25,9 +25,6 @@ from typing import (
)
from typing_extensions import Literal
if sys.version_info >= (3, 9):
from types import GenericAlias
_T = TypeVar("_T")
_MessageT = TypeVar("_MessageT", bound=Message)
_MessageData = Union[email.message.Message, bytes, str, IO[str], IO[bytes]]
@@ -80,8 +77,6 @@ class Mailbox(Generic[_MessageT]):
def lock(self) -> None: ...
def unlock(self) -> None: ...
def close(self) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
class Maildir(Mailbox[MaildirMessage]):
@@ -190,8 +185,6 @@ class _ProxyFile(Generic[AnyStr]):
def flush(self) -> None: ...
@property
def closed(self) -> bool: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
class _PartialFile(_ProxyFile[AnyStr]):
def __init__(self, f: IO[AnyStr], start: Optional[int] = ..., stop: Optional[int] = ...) -> None: ...

View File

@@ -3,11 +3,6 @@ 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
def acos(__x: SupportsFloat) -> float: ...
def acosh(__x: SupportsFloat) -> float: ...
@@ -16,106 +11,36 @@ 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: ...
if sys.version_info >= (3, 8):
def comb(__n: int, __k: int) -> int: ...
def ceil(__x: SupportsFloat) -> float: ...
def copysign(__x: SupportsFloat, __y: SupportsFloat) -> float: ...
def cos(__x: SupportsFloat) -> float: ...
def cosh(__x: SupportsFloat) -> float: ...
def degrees(__x: SupportsFloat) -> float: ...
if sys.version_info >= (3, 8):
def dist(__p: Iterable[SupportsFloat], __q: Iterable[SupportsFloat]) -> float: ...
def erf(__x: SupportsFloat) -> float: ...
def erfc(__x: SupportsFloat) -> float: ...
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) -> float: ...
def fmod(__x: SupportsFloat, __y: SupportsFloat) -> float: ...
def frexp(__x: SupportsFloat) -> Tuple[float, int]: ...
def fsum(__seq: Iterable[float]) -> float: ...
def gamma(__x: SupportsFloat) -> float: ...
if sys.version_info >= (3, 9):
def gcd(*integers: int) -> int: ...
elif sys.version_info >= (3, 5):
def gcd(__x: int, __y: int) -> int: ...
if sys.version_info >= (3, 8):
def hypot(*coordinates: SupportsFloat) -> float: ...
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 hypot(__x: SupportsFloat, __y: SupportsFloat) -> float: ...
def isinf(__x: SupportsFloat) -> bool: ...
if sys.version_info >= (3,):
def isfinite(__x: SupportsFloat) -> bool: ...
def isnan(__x: SupportsFloat) -> bool: ...
if sys.version_info >= (3, 8):
def isqrt(__n: int) -> int: ...
if sys.version_info >= (3, 9):
def lcm(*integers: int) -> int: ...
def ldexp(__x: SupportsFloat, __i: int) -> float: ...
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 modf(__x: SupportsFloat) -> Tuple[float, float]: ...
if sys.version_info >= (3, 9):
def nextafter(__x: SupportsFloat, __y: SupportsFloat) -> float: ...
if sys.version_info >= (3, 8):
def perm(__n: int, __k: Optional[int] = ...) -> int: ...
def pow(__x: SupportsFloat, __y: SupportsFloat) -> float: ...
if sys.version_info >= (3, 8):
@overload
def prod(__iterable: Iterable[int], *, start: int = ...) -> int: ... # type: ignore
@overload
def prod(__iterable: Iterable[SupportsFloat], *, start: SupportsFloat = ...) -> float: ...
def radians(__x: SupportsFloat) -> float: ...
if sys.version_info >= (3, 7):
def remainder(__x: SupportsFloat, __y: SupportsFloat) -> float: ...
def sin(__x: SupportsFloat) -> float: ...
def sinh(__x: SupportsFloat) -> float: ...
def sqrt(__x: SupportsFloat) -> float: ...
def tan(__x: SupportsFloat) -> float: ...
def tanh(__x: SupportsFloat) -> float: ...
def trunc(__x: SupportsFloat) -> int: ...
if sys.version_info >= (3, 9):
def ulp(__x: SupportsFloat) -> float: ...

View File

@@ -1,13 +1,7 @@
import sys
from typing import IO, Dict, List, Optional, Sequence, Text, Tuple, Union
if sys.version_info >= (3, 8):
from os import PathLike
def guess_type(url: Union[Text, PathLike[str]], strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ...
else:
def guess_type(url: Text, strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ...
def guess_type(url: Text, strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ...
def guess_all_extensions(type: str, strict: bool = ...) -> List[str]: ...
def guess_extension(type: str, strict: bool = ...) -> Optional[str]: ...
def init(files: Optional[Sequence[str]] = ...) -> None: ...

View File

@@ -34,10 +34,7 @@ class _mmap(Generic[AnyStr]):
self, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ...
) -> None: ...
def close(self) -> None: ...
if sys.version_info >= (3, 8):
def flush(self, offset: int = ..., size: int = ...) -> None: ...
else:
def flush(self, offset: int = ..., size: int = ...) -> int: ...
def flush(self, offset: int = ..., size: int = ...) -> int: ...
def move(self, dest: int, src: int, count: int) -> None: ...
def read_byte(self) -> AnyStr: ...
def readline(self) -> AnyStr: ...
@@ -48,73 +45,12 @@ 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: ...
if sys.version_info >= (3, 8) and sys.platform != "win32":
MADV_NORMAL: int
MADV_RANDOM: int
MADV_SEQUENTIAL: int
MADV_WILLNEED: int
MADV_DONTNEED: int
if sys.platform == "linux":
MADV_REMOVE: int
MADV_DONTFORK: int
MADV_DOFORK: int
MADV_HWPOISON: int
MADV_MERGEABLE: int
MADV_UNMERGEABLE: int
# Seems like this constant is not defined in glibc.
# See https://github.com/python/typeshed/pull/5360 for details
# MADV_SOFT_OFFLINE: int
MADV_HUGEPAGE: int
MADV_NOHUGEPAGE: int
MADV_DONTDUMP: int
MADV_DODUMP: int
MADV_FREE: int
# This Values are defined for FreeBSD but type checkers do not support conditions for these
if sys.platform != "linux" and sys.platform != "darwin":
MADV_NOSYNC: int
MADV_AUTOSYNC: int
MADV_NOCORE: int
MADV_CORE: int
MADV_PROTECT: int
if sys.version_info >= (3, 10) and sys.platform == "darwin":
MADV_FREE_REUSABLE: int
MADV_FREE_REUSE: int
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: ...

View File

@@ -30,23 +30,13 @@ class ModuleFinder:
indent: int # undocumented
excludes: Container[str] # undocumented
replace_paths: Sequence[Tuple[str, str]] # undocumented
if sys.version_info >= (3, 8):
def __init__(
self,
path: Optional[List[str]] = ...,
debug: int = ...,
excludes: Optional[Container[str]] = ...,
replace_paths: Optional[Sequence[Tuple[str, str]]] = ...,
) -> None: ...
else:
def __init__(
self,
path: Optional[List[str]] = ...,
debug: int = ...,
excludes: Container[str] = ...,
replace_paths: Sequence[Tuple[str, str]] = ...,
) -> None: ...
def __init__(
self,
path: Optional[List[str]] = ...,
debug: int = ...,
excludes: Container[str] = ...,
replace_paths: Sequence[Tuple[str, str]] = ...,
) -> None: ...
def msg(self, level: int, str: str, *args: Any) -> None: ... # undocumented
def msgin(self, *args: Any) -> None: ... # undocumented
def msgout(self, *args: Any) -> None: ... # undocumented
@@ -62,8 +52,6 @@ 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_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

@@ -7,8 +7,7 @@ if sys.platform == "win32":
from _msi import _Database
AMD64: bool
if sys.version_info < (3, 7):
Itanium: bool
Itanium: bool
Win64: bool
datasizemask: Literal[0x00FF]

View File

@@ -74,9 +74,8 @@ class _NNTPBase:
def over(
self, message_spec: Union[None, str, List[Any], Tuple[Any, ...]], *, file: _File = ...
) -> Tuple[str, List[Tuple[int, Dict[str, str]]]]: ...
if sys.version_info < (3, 9):
def xgtitle(self, group: str, *, file: _File = ...) -> Tuple[str, List[Tuple[str, str]]]: ...
def xpath(self, id: Any) -> Tuple[str, str]: ...
def xgtitle(self, group: str, *, file: _File = ...) -> Tuple[str, List[Tuple[str, str]]]: ...
def xpath(self, id: Any) -> Tuple[str, str]: ...
def date(self) -> Tuple[str, datetime.datetime]: ...
def post(self, data: Union[bytes, Iterable[bytes]]) -> str: ...
def ihave(self, message_id: Any, data: Union[bytes, Iterable[bytes]]) -> str: ...

View File

@@ -12,10 +12,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 __nonzero__(self) -> bool: ...
@property
@abstractmethod
def real(self) -> Any: ...
@@ -36,11 +33,10 @@ 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 __div__(self, other): ...
@abstractmethod
def __rdiv__(self, other): ...
@abstractmethod
def __truediv__(self, other: Any) -> Any: ...
@abstractmethod
@@ -52,25 +48,13 @@ 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: ...
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: ...
def __divmod__(self, other: Any) -> Any: ...
def __rdivmod__(self, other: Any) -> Any: ...
@abstractmethod
@@ -102,12 +86,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 __long__(self) -> long: ...
def __index__(self) -> int: ...
@abstractmethod
def __pow__(self, exponent: Any, modulus: Optional[Any] = ...) -> Any: ...

View File

@@ -14,12 +14,3 @@ opname: List[str]
opmap: Dict[str, int]
HAVE_ARGUMENT: int
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):
def stack_effect(__opcode: int, __oparg: Optional[int] = ...) -> int: ...
if sys.version_info >= (3, 6):
hasnargs: List[int]

View File

@@ -41,11 +41,8 @@ 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 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 +57,6 @@ 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 neg(__a: Any) -> Any: ...
def __neg__(a: Any) -> Any: ...
def or_(__a: Any, __b: Any) -> Any: ...
@@ -98,11 +90,8 @@ 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: ...
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 +104,12 @@ 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 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: ...
def repeat(a: Any, b: int) -> Any: ...
def __repeat__(a: Any, b: int) -> Any: ...
def sequenceIncludes(a: Container[Any], b: Any) -> bool: ...
@overload
def setitem(__a: MutableSequence[_T], __b: int, __c: _T) -> None: ...
@overload
@@ -141,13 +122,8 @@ 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 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: ...
class attrgetter(Generic[_T_co]):
@overload
@@ -185,11 +161,8 @@ 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 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 +171,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 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 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 +185,7 @@ 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: ...
def isCallable(x: Any) -> bool: ...
def isMappingType(x: Any) -> bool: ...
def isNumberType(x: Any) -> bool: ...
def isSequenceType(x: Any) -> bool: ...

View File

@@ -2,10 +2,7 @@ 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]
_Text = Union[str, unicode]
NO_DEFAULT: Tuple[_Text, ...]
SUPPRESS_HELP: _Text
@@ -13,9 +10,7 @@ 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: ...
def isbasestring(x: Any) -> bool: ...
class OptParseError(Exception):
msg: _Text

View File

@@ -37,15 +37,6 @@ _T = TypeVar("_T")
error = OSError
if sys.version_info >= (3, 2):
supports_bytes_environ: bool
if sys.version_info >= (3, 3):
supports_dir_fd: Set[Callable[..., Any]]
supports_fd: Set[Callable[..., Any]]
supports_effective_ids: Set[Callable[..., Any]]
supports_follow_symlinks: Set[Callable[..., Any]]
SEEK_SET: int
SEEK_CUR: int
SEEK_END: int
@@ -110,9 +101,6 @@ class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]):
def __len__(self) -> int: ...
environ: _Environ[str]
if sys.version_info >= (3, 2):
environb: _Environ[bytes]
if sys.platform != "win32":
# Unix only
confstr_names: Dict[str, int]
@@ -245,11 +233,7 @@ def symlink(source: AnyPath, link_name: AnyPath) -> None: ...
def unlink(path: AnyPath) -> None: ...
# TODO: add ns, dir_fd, follow_symlinks argument
if sys.version_info >= (3, 0):
def utime(path: AnyPath, times: Optional[Tuple[float, float]] = ...) -> None: ...
else:
def utime(path: AnyPath, times: Optional[Tuple[float, float]]) -> None: ...
def utime(path: AnyPath, times: Optional[Tuple[float, float]]) -> None: ...
if sys.platform != "win32":
# Unix only
@@ -275,19 +259,9 @@ if sys.platform != "win32":
def pathconf(path: AnyPath, name: Union[str, int]) -> int: ...
def statvfs(path: AnyPath) -> _StatVFS: ...
if sys.version_info >= (3, 6):
def walk(
top: Union[AnyStr, PathLike[AnyStr]],
topdown: bool = ...,
onerror: Optional[Callable[[OSError], Any]] = ...,
followlinks: bool = ...,
) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr]]]: ...
else:
def walk(
top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ..., followlinks: bool = ...
) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr]]]: ...
def walk(
top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ..., followlinks: bool = ...
) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr]]]: ...
def abort() -> NoReturn: ...
# These are defined as execl(file, *args) but the first *arg is mandatory.
@@ -317,18 +291,10 @@ if sys.platform != "win32":
def nice(increment: int) -> int: ...
def plock(op: int) -> None: ... # ???op is int?
if sys.version_info >= (3, 0):
class popen(_TextIOWrapper):
# TODO 'b' modes or bytes command not accepted?
def __init__(self, command: str, mode: str = ..., bufsize: int = ...) -> None: ...
def close(self) -> Any: ... # may return int
else:
def popen(command: str, *args, **kwargs) -> IO[Any]: ...
def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
def popen3(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any], IO[Any]]: ...
def popen4(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
def popen(command: str, *args, **kwargs) -> IO[Any]: ...
def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
def popen3(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any], IO[Any]]: ...
def popen4(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
def spawnl(mode: int, path: AnyPath, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
def spawnle(mode: int, path: AnyPath, arg0: Union[bytes, Text], *args: Any) -> int: ... # Imprecise sig
def spawnv(mode: int, path: AnyPath, args: List[Union[bytes, Text]]) -> int: ...
@@ -362,18 +328,9 @@ else:
def getloadavg() -> Tuple[float, float, float]: ...
def sysconf(name: Union[str, int]) -> int: ...
if sys.version_info >= (3, 0):
def sched_getaffinity(id: int) -> Set[int]: ...
if sys.version_info >= (3, 3):
class waitresult:
si_pid: int
def waitid(idtype: int, id: int, options: int) -> waitresult: ...
if sys.version_info < (3, 0):
def tmpfile() -> IO[Any]: ...
def tmpnam() -> str: ...
def tempnam(dir: str = ..., prefix: str = ...) -> str: ...
def tmpfile() -> IO[Any]: ...
def tmpnam() -> str: ...
def tempnam(dir: str = ..., prefix: str = ...) -> str: ...
P_ALL: int
WEXITED: int

View File

@@ -16,13 +16,7 @@ def run(statement: str, globals: Optional[Dict[str, Any]] = ..., locals: Optiona
def runeval(expression: str, globals: Optional[Dict[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...) -> Any: ...
def runctx(statement: str, globals: Dict[str, Any], locals: Mapping[str, Any]) -> None: ...
def runcall(func: Callable[..., _T], *args: Any, **kwds: Any) -> Optional[_T]: ...
if sys.version_info >= (3, 7):
def set_trace(*, header: Optional[str] = ...) -> None: ...
else:
def set_trace() -> None: ...
def set_trace() -> None: ...
def post_mortem(t: Optional[TracebackType] = ...) -> None: ...
def pm() -> None: ...
@@ -45,34 +39,13 @@ 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]] = ...,
) -> None: ...
def forget(self) -> None: ...
def setup(self, f: Optional[FrameType], tb: Optional[TracebackType]) -> None: ...
def execRcLines(self) -> None: ...
@@ -140,101 +113,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
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
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
# undocumented
@@ -242,9 +168,5 @@ 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: ...
class _rstr(str):
def __repr__(self) -> _rstr: ...

View File

@@ -2,53 +2,12 @@ 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
bytes_types: Tuple[Type[Any], ...] # undocumented
if sys.version_info >= (3, 8):
# TODO: holistic design for buffer interface (typing.Buffer?)
class PickleBuffer:
# buffer must be a buffer-providing object
def __init__(self, buffer: Any) -> None: ...
def raw(self) -> memoryview: ...
def release(self) -> None: ...
_BufferCallback = Optional[Callable[[PickleBuffer], Any]]
def dump(
obj: Any,
file: IO[bytes],
protocol: Optional[int] = ...,
*,
fix_imports: bool = ...,
buffer_callback: _BufferCallback = ...,
) -> None: ...
def dumps(
obj: Any, protocol: Optional[int] = ..., *, fix_imports: bool = ..., buffer_callback: _BufferCallback = ...
) -> bytes: ...
def load(
file: IO[bytes],
*,
fix_imports: bool = ...,
encoding: str = ...,
errors: str = ...,
buffers: Optional[Iterable[Any]] = ...,
) -> Any: ...
def loads(
__data: bytes, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ..., buffers: Optional[Iterable[Any]] = ...
) -> Any: ...
elif sys.version_info >= (3, 0):
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: ...
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): ...
@@ -64,46 +23,15 @@ _reducedtype = Union[
class Pickler:
fast: bool
if sys.version_info >= (3, 3):
dispatch_table: Mapping[type, Callable[[Any], _reducedtype]]
if sys.version_info >= (3, 8):
def __init__(
self,
file: IO[bytes],
protocol: Optional[int] = ...,
*,
fix_imports: bool = ...,
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] = ...) -> None: ...
def dump(self, __obj: Any) -> None: ...
def clear_memo(self) -> None: ...
def persistent_id(self, obj: Any) -> Any: ...
class Unpickler:
if sys.version_info >= (3, 8):
def __init__(
self,
file: IO[bytes],
*,
fix_imports: bool = ...,
encoding: str = ...,
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]) -> 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: ...
MARK: bytes
STOP: bytes
@@ -164,23 +92,5 @@ NEWFALSE: bytes
LONG1: bytes
LONG4: bytes
if sys.version_info >= (3, 0):
# 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
def encode_long(x: int) -> bytes: ... # undocumented
def decode_long(data: bytes) -> int: ... # undocumented

View File

@@ -3,16 +3,9 @@ from typing import IO, Any, Callable, Iterator, List, MutableMapping, Optional,
_Reader = Callable[[IO[bytes]], Any]
if sys.version_info >= (3, 0):
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
class ArgumentDescriptor(object):
name: str
@@ -33,14 +26,6 @@ def read_int4(f: IO[bytes]) -> int: ...
int4: ArgumentDescriptor
if sys.version_info >= (3, 3):
def read_uint4(f: IO[bytes]) -> int: ...
uint4: ArgumentDescriptor
if sys.version_info >= (3, 5):
def read_uint8(f: IO[bytes]) -> int: ...
uint8: ArgumentDescriptor
def read_stringnl(f: IO[bytes], decode: bool = ..., stripquotes: bool = ...) -> Union[bytes, Text]: ...
stringnl: ArgumentDescriptor
@@ -61,32 +46,14 @@ 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
if sys.version_info >= (3, 4):
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_unicodestring4(f: IO[bytes]) -> Text: ...
unicodestring4: ArgumentDescriptor
if sys.version_info >= (3, 4):
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 +87,12 @@ pylong: StackObject
pyinteger_or_bool: StackObject
pybool: StackObject
pyfloat: StackObject
if sys.version_info >= (3, 4):
pybytes_or_str: StackObject
pystring: StackObject
if sys.version_info >= (3, 0):
pybytes: StackObject
pyunicode: StackObject
pynone: StackObject
pytuple: StackObject
pylist: StackObject
pydict: StackObject
if sys.version_info >= (3, 4):
pyset: StackObject
pyfrozenset: StackObject
anyobject: StackObject
markobject: StackObject
stackslice: StackObject
@@ -160,20 +120,9 @@ 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 = ...,
) -> None: ...

View File

@@ -2,21 +2,11 @@ import sys
from _typeshed import SupportsRead
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
Loader = Any
MetaPathFinder = Any
PathEntryFinder = Any
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 = Tuple[Union[MetaPathFinder, PathEntryFinder], str, bool]
def extend_path(path: List[str], name: str) -> List[str]: ...
@@ -36,6 +26,3 @@ def walk_packages(
path: Optional[Iterable[str]] = ..., prefix: str = ..., onerror: Optional[Callable[[str], None]] = ...
) -> Iterator[_ModuleInfoLike]: ...
def get_data(package: str, resource: str) -> Optional[bytes]: ...
if sys.version_info >= (3, 9):
def resolve_name(name: str) -> Any: ...

View File

@@ -1,72 +1,25 @@
import sys
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
_Path = Union[str, Text]
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: ...
def readPlist(pathOrFile: Union[_Path, IO[bytes]]) -> Any: ...
def writePlist(value: Mapping[str, Any], pathOrFile: Union[_Path, IO[bytes]]) -> None: ...
def readPlistFromBytes(data: bytes) -> Any: ...
def writePlistToBytes(value: Mapping[str, Any]) -> bytes: ...
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: ...
elif sys.version_info >= (3, 4):
def load(
fp: IO[bytes],
*,
fmt: Optional[PlistFormat] = ...,
use_builtin_types: bool = ...,
dict_type: Type[MutableMapping[str, Any]] = ...,
) -> Any: ...
def loads(
value: bytes,
*,
fmt: Optional[PlistFormat] = ...,
use_builtin_types: bool = ...,
dict_type: Type[MutableMapping[str, Any]] = ...,
) -> Any: ...
class Dict(DictT[str, Any]):
def __getattr__(self, attr: str) -> Any: ...
def __setattr__(self, attr: str, value: Any) -> None: ...
def __delattr__(self, attr: str) -> None: ...
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: ...
if sys.version_info < (3, 9):
def readPlist(pathOrFile: Union[_Path, IO[bytes]]) -> Any: ...
def writePlist(value: Mapping[str, Any], pathOrFile: Union[_Path, IO[bytes]]) -> None: ...
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: ...
def __setattr__(self, attr: str, value: Any) -> None: ...
def __delattr__(self, attr: str) -> None: ...
if sys.version_info < (3, 9):
class Data:
data: bytes
def __init__(self, data: bytes) -> None: ...
if sys.version_info >= (3, 8):
class UID:
data: int
def __init__(self, data: int) -> None: ...
def __index__(self) -> int: ...
def __reduce__(self) -> Any: ...
def __hash__(self) -> int: ...
class Data:
data: bytes
def __init__(self, data: bytes) -> None: ...
class InvalidFileException(ValueError):
def __init__(self, message: str = ...) -> None: ...

View File

@@ -14,9 +14,6 @@ LF: bytes
CRLF: bytes
class POP3:
if sys.version_info >= (3, 0):
encoding: Text
host: Text
port: int
sock: socket.socket
@@ -37,37 +34,14 @@ 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, secret: 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: ...
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 = ...
) -> None: ...

View File

@@ -1,145 +1,18 @@
import sys
from typing import IO, Any, Dict, Optional, Tuple
if sys.version_info >= (3, 10):
def pformat(
object: object,
indent: int = ...,
width: int = ...,
depth: Optional[int] = ...,
*,
compact: bool = ...,
sort_dicts: bool = ...,
underscore_numbers: bool = ...,
) -> str: ...
elif sys.version_info >= (3, 8):
def pformat(
object: object,
indent: int = ...,
width: int = ...,
depth: Optional[int] = ...,
*,
compact: bool = ...,
sort_dicts: bool = ...,
) -> str: ...
elif sys.version_info >= (3, 4):
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,
stream: Optional[IO[str]] = ...,
indent: int = ...,
width: int = ...,
depth: Optional[int] = ...,
*,
compact: bool = ...,
sort_dicts: bool = ...,
underscore_numbers: bool = ...,
) -> None: ...
elif sys.version_info >= (3, 8):
def pp(
object: object,
stream: Optional[IO[str]] = ...,
indent: int = ...,
width: int = ...,
depth: Optional[int] = ...,
*,
compact: bool = ...,
sort_dicts: bool = ...,
) -> None: ...
if sys.version_info >= (3, 10):
def pprint(
object: object,
stream: Optional[IO[str]] = ...,
indent: int = ...,
width: int = ...,
depth: Optional[int] = ...,
*,
compact: bool = ...,
sort_dicts: bool = ...,
underscore_numbers: bool = ...,
) -> None: ...
elif sys.version_info >= (3, 8):
def pprint(
object: object,
stream: Optional[IO[str]] = ...,
indent: int = ...,
width: int = ...,
depth: Optional[int] = ...,
*,
compact: bool = ...,
sort_dicts: bool = ...,
) -> None: ...
elif sys.version_info >= (3, 4):
def pprint(
object: object,
stream: Optional[IO[str]] = ...,
indent: int = ...,
width: int = ...,
depth: Optional[int] = ...,
*,
compact: bool = ...,
) -> None: ...
else:
def pprint(
object: object, stream: Optional[IO[str]] = ..., indent: int = ..., width: int = ..., depth: Optional[int] = ...
) -> None: ...
def pformat(object: object, indent: int = ..., width: int = ..., depth: Optional[int] = ...) -> str: ...
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: ...
class PrettyPrinter:
if sys.version_info >= (3, 10):
def __init__(
self,
indent: int = ...,
width: int = ...,
depth: Optional[int] = ...,
stream: Optional[IO[str]] = ...,
*,
compact: bool = ...,
sort_dicts: bool = ...,
underscore_numbers: bool = ...,
) -> None: ...
elif sys.version_info >= (3, 8):
def __init__(
self,
indent: int = ...,
width: int = ...,
depth: Optional[int] = ...,
stream: Optional[IO[str]] = ...,
*,
compact: bool = ...,
sort_dicts: bool = ...,
) -> None: ...
elif sys.version_info >= (3, 4):
def __init__(
self,
indent: int = ...,
width: int = ...,
depth: Optional[int] = ...,
stream: Optional[IO[str]] = ...,
*,
compact: bool = ...,
) -> None: ...
else:
def __init__(
self, indent: int = ..., width: int = ..., depth: Optional[int] = ..., stream: Optional[IO[str]] = ...
) -> None: ...
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

@@ -7,19 +7,6 @@ from typing import IO, Any, Dict, Iterable, List, Optional, Text, Tuple, TypeVar
_Selector = Union[str, float, int]
_T = TypeVar("_T", bound=Stats)
if sys.version_info >= (3, 7):
from enum import Enum
class SortKey(str, Enum):
CALLS: str
CUMULATIVE: str
FILENAME: str
LINE: str
NAME: str
NFL: str
PCALLS: str
STDNAME: str
TIME: str
class Stats:
sort_arg_dict_default: Dict[str, Tuple[Any, str]]
def __init__(

View File

@@ -13,9 +13,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 = ...) -> None: ...

View File

@@ -10,43 +10,7 @@ class PyCompileError(Exception):
msg: str
def __init__(self, exc_type: Type[BaseException], exc_value: BaseException, file: str, msg: str = ...) -> None: ...
if sys.version_info >= (3, 7):
import enum
class PycInvalidationMode(enum.Enum):
TIMESTAMP: int = ...
CHECKED_HASH: int = ...
UNCHECKED_HASH: int = ...
def _get_default_invalidation_mode() -> PycInvalidationMode: ...
if sys.version_info >= (3, 8):
def compile(
file: AnyStr,
cfile: Optional[AnyStr] = ...,
dfile: Optional[AnyStr] = ...,
doraise: bool = ...,
optimize: int = ...,
invalidation_mode: Optional[PycInvalidationMode] = ...,
quiet: int = ...,
) -> Optional[AnyStr]: ...
elif sys.version_info >= (3, 7):
def compile(
file: AnyStr,
cfile: Optional[AnyStr] = ...,
dfile: Optional[AnyStr] = ...,
doraise: bool = ...,
optimize: int = ...,
invalidation_mode: Optional[PycInvalidationMode] = ...,
) -> Optional[AnyStr]: ...
elif sys.version_info >= (3, 2):
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 compile(
file: _EitherStr, cfile: Optional[_EitherStr] = ..., dfile: Optional[_EitherStr] = ..., doraise: bool = ...
) -> None: ...
def main(args: Optional[List[Text]] = ...) -> int: ...

View File

@@ -8,30 +8,14 @@ class Class:
methods: Dict[str, int]
file: int
lineno: int
if sys.version_info >= (3, 7):
def __init__(
self,
module: str,
name: str,
super: Optional[List[Union[Class, str]]],
file: str,
lineno: int,
parent: Optional[Class] = ...,
) -> None: ...
else:
def __init__(self, module: str, name: str, super: Optional[List[Union[Class, str]]], file: str, lineno: int) -> None: ...
def __init__(self, module: str, name: str, super: Optional[List[Union[Class, str]]], file: str, lineno: int) -> None: ...
class Function:
module: str
name: str
file: int
lineno: int
if sys.version_info >= (3, 7):
def __init__(self, module: str, name: str, file: str, lineno: int, parent: Optional[Function] = ...) -> None: ...
else:
def __init__(self, module: str, name: str, file: str, lineno: int) -> None: ...
def __init__(self, module: str, name: str, file: str, lineno: int) -> None: ...
def readmodule(module: str, path: Optional[Sequence[str]] = ...) -> Dict[str, Class]: ...
def readmodule_ex(module: str, path: Optional[Sequence[str]] = ...) -> Dict[str, Union[Class, Function, List[str]]]: ...

View File

@@ -19,10 +19,7 @@ from typing import (
Union,
)
if sys.version_info >= (3,):
from reprlib import Repr
else:
from repr import Repr
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 +262,5 @@ 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: ...
def serve(port: int, callback: Optional[Callable[[Any], None]] = ..., completer: Optional[Callable[[], None]] = ...) -> None: ...
def gui() -> None: ...

View File

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

View File

@@ -12,10 +12,6 @@ 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 get_history_length() -> int: ...
def set_history_length(__length: int) -> None: ...
def clear_history() -> None: ...
@@ -24,10 +20,6 @@ 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_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,7 @@
import sys
from typing import Any, Dict, Optional, Union
if sys.version_info >= (3,):
_Text = str
else:
_Text = Union[str, unicode]
_Text = Union[str, unicode]
class Completer:
def __init__(self, namespace: Optional[Dict[str, Any]] = ...) -> None: ...

View File

@@ -9,30 +9,10 @@ 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, ...]) -> Event: ...
def enter(self, delay: float, priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...]) -> Event: ...
def run(self) -> None: ...
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): ...
class error(Exception): ...
if sys.platform != "linux" and sys.platform != "win32":
# BSD only
@@ -103,18 +100,7 @@ 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 = ...) -> None: ...
def close(self) -> None: ...
closed: bool
def fileno(self) -> int: ...
@@ -137,16 +123,3 @@ if sys.platform == "linux":
EPOLLWRBAND: int
EPOLLWRNORM: int
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]]: ...

View File

@@ -18,120 +18,29 @@ from typing import (
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 = TypeVar("_AnyStr", str, unicode)
_AnyPath = TypeVar("_AnyPath", str, unicode)
_PathReturn = Type[None]
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(EnvironmentError): ...
class SpecialFileError(EnvironmentError): ...
class ExecError(EnvironmentError): ...
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: 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 ignore_patterns(*patterns: StrPath) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
if sys.version_info >= (3, 8):
def copytree(
src: StrPath,
dst: StrPath,
symlinks: bool = ...,
ignore: Union[None, Callable[[str, List[str]], Iterable[str]], Callable[[StrPath, List[str]], Iterable[str]]] = ...,
copy_function: Callable[[str, str], None] = ...,
ignore_dangling_symlinks: bool = ...,
dirs_exist_ok: bool = ...,
) -> _PathReturn: ...
elif sys.version_info >= (3,):
def copytree(
src: StrPath,
dst: StrPath,
symlinks: bool = ...,
ignore: Union[None, Callable[[str, List[str]], Iterable[str]], Callable[[StrPath, List[str]], Iterable[str]]] = ...,
copy_function: Callable[[str, str], None] = ...,
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 copytree(
src: AnyStr, dst: AnyStr, symlinks: bool = ..., ignore: Union[None, Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]]] = ...
) -> _PathReturn: ...
def rmtree(path: _AnyPath, ignore_errors: bool = ..., onerror: Optional[Callable[[Any, _AnyPath, 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):
# See https://bugs.python.org/issue32689
def move(src: str, dst: StrPath, copy_function: _CopyFn = ...) -> _PathReturn: ...
else:
def move(src: StrPath, dst: StrPath) -> _PathReturn: ...
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: ...
if sys.version_info >= (3, 8):
@overload
def which(cmd: StrPath, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[str]: ...
@overload
def which(cmd: bytes, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[bytes]: ...
elif sys.version_info >= (3,):
def which(cmd: StrPath, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[str]: ...
def move(src: StrPath, dst: StrPath) -> _PathReturn: ...
def make_archive(
base_name: _AnyStr,
format: str,
@@ -151,20 +60,3 @@ def register_archive_format(
description: str = ...,
) -> 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: ...

View File

@@ -9,40 +9,7 @@ _Address = Tuple[str, int] # (host, port)
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_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: ...
def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ...) -> 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 +21,13 @@ 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: ...
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 = ...) -> 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

@@ -2,16 +2,7 @@ import sys
from _typeshed import AnyPath
from typing import NamedTuple, Optional, Tuple, 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]]
_SndHeaders = Tuple[str, int, int, int, Union[int, str]]
def what(filename: AnyPath) -> Optional[_SndHeaders]: ...
def whathdr(filename: AnyPath) -> Optional[_SndHeaders]: ...

View File

@@ -13,9 +13,6 @@ 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
# Re-exported errno
EAGAIN: int
EBADF: int
@@ -263,9 +260,6 @@ TCP_NODELAY: int
TCP_QUICKACK: int
TCP_SYNCNT: int
TCP_WINDOW_CLAMP: int
if sys.version_info >= (3, 7):
TCP_NOTSENT_LOWAT: int
# Specifically-documented constants
if sys.platform == "linux" and sys.version_info >= (3,):
@@ -387,8 +381,6 @@ 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
RCVALL_IPLEVEL: int
RCVALL_MAX: int
RCVALL_OFF: int
@@ -451,14 +443,6 @@ 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
if sys.platform == "linux" and sys.version_info >= (3, 8):
AF_QIPCRTR: AddressFamily
@@ -506,90 +490,15 @@ 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
AddressFamily = int
SocketKind = int
else:
AddressFamily = int
SocketKind = 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
else:
AddressInfo = int
MsgFlag = int
AddressInfo = int
MsgFlag = int
# ----- Exceptions -----
if sys.version_info < (3,):
class error(IOError): ...
else:
error = OSError
class error(IOError): ...
class herror(error):
def __init__(self, herror: int = ..., string: str = ...) -> None: ...
@@ -617,13 +526,7 @@ 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 = ...) -> None: ...
# --- methods ---
def accept(self) -> Tuple[socket, _RetAddress]: ...
def bind(self, address: Union[_Address, bytes]) -> None: ...
@@ -633,57 +536,22 @@ 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 getpeername(self) -> _RetAddress: ...
def getsockname(self) -> _RetAddress: ...
@overload
def getsockopt(self, level: int, optname: int) -> int: ...
@overload
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
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):
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: ...
def makefile(self, mode: unicode = ..., buffering: int = ...) -> 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":
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 = ...
) -> Tuple[int, List[_CMSG], int, Any]: ...
def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> Tuple[int, _RetAddress]: ...
def recv_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> int: ...
def send(self, data: bytes, flags: int = ...) -> int: ...
@@ -692,73 +560,38 @@ 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":
def sendmsg(
self, __buffers: Iterable[bytes], __ancdata: Iterable[_CMSG] = ..., __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: ...
if sys.version_info >= (3,):
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: ...
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
if sys.platform == "win32":
def share(self, process_id: int) -> bytes: ...
def shutdown(self, how: int) -> None: ...
# ----- Functions -----
if sys.version_info >= (3, 7):
def close(fd: int) -> None: ...
def create_connection(
address: Tuple[Optional[str], int],
timeout: Optional[float] = ...,
source_address: Optional[Tuple[Union[bytearray, bytes, Text], int]] = ...,
) -> socket: ...
if sys.version_info >= (3, 8):
def create_server(
address: _Address, *, family: int = ..., backlog: Optional[int] = ..., reuse_port: bool = ..., dualstack_ipv6: bool = ...
) -> socket: ...
def has_dualstack_ipv6() -> bool: ...
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
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 = ...,
socktype: int = ...,
proto: int = ...,
flags: int = ...,
) -> List[Tuple[AddressFamily, SocketKind, int, str, Tuple[Any, ...]]]: ...
def getfqdn(name: str = ...) -> str: ...
def gethostbyname(hostname: str) -> str: ...
def gethostbyname_ex(hostname: str) -> Tuple[str, List[str], List[str]]: ...
@@ -783,27 +616,5 @@ def inet_aton(ip_string: str) -> bytes: ... # ret val 4 bytes in length
def inet_ntoa(packed_ip: bytes) -> str: ...
def inet_pton(address_family: int, ip_string: str) -> bytes: ...
def inet_ntop(address_family: int, packed_ip: bytes) -> str: ...
if sys.version_info >= (3, 9):
if sys.platform != "win32":
# flags and address appear to be unused in send_fds and recv_fds
def send_fds(
sock: socket, buffers: Iterable[bytes], fds: Union[bytes, Iterable[int]], flags: int = ..., address: None = ...
) -> 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 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: ...

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 = buffer
# The remaining definitions are imported from _sqlite3.
@@ -66,52 +63,24 @@ version: str
# TODO: adapt needs to get probed
def adapt(obj, protocol, alternate): ...
def complete_statement(sql: str) -> bool: ...
if sys.version_info >= (3, 7):
def connect(
database: Union[bytes, Text, os.PathLike[Text]],
timeout: float = ...,
detect_types: int = ...,
isolation_level: Optional[str] = ...,
check_same_thread: bool = ...,
factory: Optional[Type[Connection]] = ...,
cached_statements: int = ...,
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],
timeout: float = ...,
detect_types: int = ...,
isolation_level: Optional[str] = ...,
check_same_thread: bool = ...,
factory: Optional[Type[Connection]] = ...,
cached_statements: int = ...,
) -> Connection: ...
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 = ...,
) -> Connection: ...
def enable_callback_tracebacks(__enable: bool) -> None: ...
def enable_shared_cache(enable: int) -> None: ...
def register_adapter(__type: Type[_T], __caster: Callable[[_T], Union[int, float, str, bytes]]) -> None: ...
def register_converter(__name: str, __converter: Callable[[bytes], Any]) -> None: ...
if sys.version_info < (3, 8):
class Cache(object):
def __init__(self, *args, **kwargs) -> None: ...
def display(self, *args, **kwargs) -> None: ...
def get(self, *args, **kwargs) -> None: ...
class Cache(object):
def __init__(self, *args, **kwargs) -> None: ...
def display(self, *args, **kwargs) -> None: ...
def get(self, *args, **kwargs) -> None: ...
class _AggregateProtocol(Protocol):
def step(self, value: int) -> None: ...
@@ -138,10 +107,7 @@ class Connection(object):
def commit(self) -> None: ...
def create_aggregate(self, name: str, n_arg: int, aggregate_class: Callable[[], _AggregateProtocol]) -> None: ...
def create_collation(self, __name: str, __callback: Any) -> None: ...
if sys.version_info >= (3, 8):
def create_function(self, name: str, narg: int, func: Any, *, deterministic: bool = ...) -> None: ...
else:
def create_function(self, name: str, num_params: int, func: Any) -> None: ...
def create_function(self, name: str, num_params: int, func: Any) -> None: ...
def cursor(self, cursorClass: Optional[type] = ...) -> Cursor: ...
def execute(self, sql: str, parameters: Iterable[Any] = ...) -> Cursor: ...
# TODO: please check in executemany() if seq_of_parameters type is possible like this
@@ -161,16 +127,6 @@ class Connection(object):
# without sqlite3 loadable extension support. see footnotes https://docs.python.org/3/library/sqlite3.html#f1
def enable_load_extension(self, enabled: bool) -> None: ...
def load_extension(self, path: str) -> None: ...
if sys.version_info >= (3, 7):
def backup(
self,
target: Connection,
*,
pages: int = ...,
progress: Optional[Callable[[int, int, int], object]] = ...,
name: str = ...,
sleep: float = ...,
) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def __enter__(self) -> Connection: ...
def __exit__(self, t: Optional[type], exc: Optional[BaseException], tb: Optional[Any]) -> None: ...
@@ -196,10 +152,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 +163,70 @@ 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): ...
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): ...
class PrepareProtocol(object):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
@@ -297,8 +247,7 @@ class Row(object):
def __lt__(self, other): ...
def __ne__(self, other): ...
if sys.version_info < (3, 8):
class Statement(object):
def __init__(self, *args, **kwargs): ...
class Statement(object):
def __init__(self, *args, **kwargs): ...
class Warning(Exception): ...

View File

@@ -15,17 +15,9 @@ from sre_constants import (
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
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
STRING_TYPES: Tuple[Type[str], Type[unicode]]
_IsStringType = int
def isstring(obj: Any) -> _IsStringType: ...
def compile(p: Union[str, bytes, SubPattern], flags: int = ...) -> Pattern[Any]: ...

View File

@@ -4,9 +4,6 @@ from _typeshed import StrPath
from typing import Any, Callable, ClassVar, 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 +11,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 = SSLSocket
_SrvnmeCbType = Callable[[_SC1ArgT, Optional[str], SSLSocket], Optional[int]]
class SSLError(OSError):
@@ -29,14 +23,7 @@ class SSLWantReadError(SSLError): ...
class SSLWantWriteError(SSLError): ...
class SSLSyscallError(SSLError): ...
class SSLEOFError(SSLError): ...
if sys.version_info >= (3, 7):
class SSLCertVerificationError(SSLError, ValueError):
verify_code: int
verify_message: str
CertificateError = SSLCertVerificationError
else:
class CertificateError(ValueError): ...
class CertificateError(ValueError): ...
def wrap_socket(
sock: socket.socket,
@@ -53,41 +40,21 @@ def wrap_socket(
def create_default_context(
purpose: Any = ..., *, cafile: Optional[str] = ..., capath: Optional[str] = ..., cadata: Union[Text, bytes, None] = ...
) -> SSLContext: ...
if sys.version_info >= (3, 7):
def _create_unverified_context(
protocol: int = ...,
*,
cert_reqs: int = ...,
check_hostname: bool = ...,
purpose: Any = ...,
certfile: Optional[str] = ...,
keyfile: Optional[str] = ...,
cafile: Optional[str] = ...,
capath: Optional[str] = ...,
cadata: Union[Text, bytes, None] = ...,
) -> SSLContext: ...
else:
def _create_unverified_context(
protocol: int = ...,
*,
cert_reqs: Optional[int] = ...,
check_hostname: bool = ...,
purpose: Any = ...,
certfile: Optional[str] = ...,
keyfile: Optional[str] = ...,
cafile: Optional[str] = ...,
capath: Optional[str] = ...,
cadata: Union[Text, bytes, None] = ...,
) -> SSLContext: ...
def _create_unverified_context(
protocol: int = ...,
*,
cert_reqs: Optional[int] = ...,
check_hostname: bool = ...,
purpose: Any = ...,
certfile: Optional[str] = ...,
keyfile: Optional[str] = ...,
cafile: Optional[str] = ...,
capath: Optional[str] = ...,
cadata: Union[Text, bytes, None] = ...,
) -> SSLContext: ...
_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_status() -> bool: ...
def RAND_egd(path: str) -> None: ...
def RAND_add(__s: bytes, __entropy: float) -> None: ...
@@ -128,64 +95,17 @@ 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
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_CIPHER_SERVER_PREFERENCE: int
OP_SINGLE_DH_USE: int
OP_SINGLE_ECDH_USE: int
OP_NO_COMPRESSION: 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:
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_CIPHER_SERVER_PREFERENCE: int
OP_SINGLE_DH_USE: int
OP_SINGLE_ECDH_USE: int
OP_NO_COMPRESSION: int
if sys.version_info >= (3, 7):
HAS_NEVER_CHECK_COMMON_NAME: bool
HAS_SSLv2: bool
HAS_SSLv3: bool
HAS_TLSv1: bool
HAS_TLSv1_1: bool
HAS_TLSv1_2: bool
HAS_TLSv1_3: bool
HAS_ALPN: bool
HAS_ECDH: bool
HAS_SNI: bool
@@ -230,47 +150,35 @@ 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):
SERVER_AUTH: ClassVar[Purpose]
CLIENT_AUTH: ClassVar[Purpose]
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]
if sys.version_info < (3, 7):
def __init__(
self,
sock: Optional[socket.socket] = ...,
keyfile: Optional[str] = ...,
certfile: Optional[str] = ...,
server_side: bool = ...,
cert_reqs: int = ...,
ssl_version: int = ...,
ca_certs: Optional[str] = ...,
do_handshake_on_connect: bool = ...,
family: int = ...,
type: int = ...,
proto: int = ...,
fileno: Optional[int] = ...,
suppress_ragged_eofs: bool = ...,
npn_protocols: Optional[Iterable[str]] = ...,
ciphers: Optional[str] = ...,
server_hostname: Optional[str] = ...,
_context: Optional[SSLContext] = ...,
_session: Optional[Any] = ...,
) -> None: ...
else:
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def __init__(
self,
sock: Optional[socket.socket] = ...,
keyfile: Optional[str] = ...,
certfile: Optional[str] = ...,
server_side: bool = ...,
cert_reqs: int = ...,
ssl_version: int = ...,
ca_certs: Optional[str] = ...,
do_handshake_on_connect: bool = ...,
family: int = ...,
type: int = ...,
proto: int = ...,
fileno: Optional[int] = ...,
suppress_ragged_eofs: bool = ...,
npn_protocols: Optional[Iterable[str]] = ...,
ciphers: Optional[str] = ...,
server_hostname: Optional[str] = ...,
_context: Optional[SSLContext] = ...,
_session: Optional[Any] = ...,
) -> None: ...
def connect(self, addr: Union[socket._Address, bytes]) -> None: ...
def connect_ex(self, addr: Union[socket._Address, bytes]) -> int: ...
def recv(self, buflen: int = ..., flags: int = ...) -> bytes: ...
@@ -293,8 +201,6 @@ 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 compression(self) -> Optional[str]: ...
def get_channel_binding(self, cb_type: str = ...) -> Optional[bytes]: ...
def selected_alpn_protocol(self) -> Optional[str]: ...
@@ -303,39 +209,16 @@ class SSLSocket(socket.socket):
def unwrap(self) -> socket.socket: ...
def version(self) -> Optional[str]: ...
def pending(self) -> int: ...
if sys.version_info >= (3, 8):
def verify_client_post_handshake(self) -> None: ...
if sys.version_info >= (3, 7):
class TLSVersion(enum.IntEnum):
MINIMUM_SUPPORTED: int
MAXIMUM_SUPPORTED: int
SSLv3: int
TLSv1: int
TLSv1_1: int
TLSv1_2: int
TLSv1_3: int
class SSLContext:
check_hostname: bool
if sys.version_info >= (3, 6):
options: Options
else:
options: int
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: ...
options: int
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] = ...
@@ -348,112 +231,19 @@ class SSLContext:
def set_default_verify_paths(self) -> None: ...
def set_ciphers(self, __cipherlist: str) -> None: ...
def set_alpn_protocols(self, alpn_protocols: Iterable[str]) -> None: ...
if sys.version_info >= (3, 7):
sni_callback: Optional[Callable[[SSLObject, str, SSLContext], Union[None, int]]]
sslobject_class: Type[SSLObject]
def set_npn_protocols(self, npn_protocols: Iterable[str]) -> None: ...
if sys.version_info >= (3, 7):
def set_servername_callback(self, server_name_callback: Optional[_SrvnmeCbType]) -> None: ...
else:
def set_servername_callback(self, __method: Optional[_SrvnmeCbType]) -> None: ...
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] = ...,
) -> SSLSocket: ...
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: ...
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
# TODO below documented in cpython but not in docs.python.org
# taken from python 3.4
@@ -469,8 +259,7 @@ SSL_ERROR_ZERO_RETURN: int
def get_protocol_name(protocol_code: int) -> str: ...
if sys.version_info < (3, 9):
AF_INET: int
AF_INET: int
PEM_FOOTER: str
PEM_HEADER: str
SOCK_STREAM: int

View File

@@ -6,33 +6,20 @@ 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, buffer, memoryview, mmap]
_WriteBufferType = Union[array[Any], bytearray, buffer, 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 calcsize(__format: _FmtType) -> int: ...
class Struct:
if sys.version_info >= (3, 7):
format: str
else:
format: bytes
format: bytes
size: int
def __init__(self, format: _FmtType) -> None: ...
def pack(self, *v: Any) -> bytes: ...
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, ...]]: ...

View File

@@ -20,23 +20,10 @@ 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]
_sunau_params = Tuple[int, int, int, int, str, 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 getfp(self) -> Optional[IO[bytes]]: ...
def rewind(self) -> None: ...
def close(self) -> None: ...
@@ -55,9 +42,6 @@ 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 setnchannels(self, nchannels: int) -> None: ...
def getnchannels(self) -> int: ...
def setsampwidth(self, sampwidth: int) -> None: ...
@@ -80,5 +64,4 @@ class Au_write:
# Returns a Au_read if mode is rb and Au_write if mode is wb
def open(f: _File, mode: Optional[str] = ...) -> Any: ...
if sys.version_info < (3, 9):
openfp = open
openfp = open

View File

@@ -13,8 +13,7 @@ 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 has_import_star(self) -> bool: ...
def get_identifiers(self) -> Sequence[str]: ...
def lookup(self, name: str) -> Symbol: ...
def get_symbols(self) -> List[Symbol]: ...
@@ -30,20 +29,13 @@ class Class(SymbolTable):
def get_methods(self) -> Tuple[str, ...]: ...
class Symbol(object):
if sys.version_info >= (3, 8):
def __init__(
self, name: str, flags: int, namespaces: Optional[Sequence[SymbolTable]] = ..., *, module_scope: bool = ...
) -> None: ...
else:
def __init__(self, name: str, flags: int, namespaces: Optional[Sequence[SymbolTable]] = ...) -> None: ...
def __init__(self, name: str, flags: int, namespaces: Optional[Sequence[SymbolTable]] = ...) -> None: ...
def get_name(self) -> str: ...
def is_referenced(self) -> bool: ...
def is_parameter(self) -> bool: ...
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_free(self) -> bool: ...
def is_imported(self) -> bool: ...
def is_assigned(self) -> bool: ...

View File

@@ -46,14 +46,10 @@ GNU_TYPES: Tuple[bytes, ...]
PAX_FIELDS: Tuple[str, ...]
PAX_NUMBER_FIELDS: Dict[str, type]
if sys.version_info >= (3,):
PAX_NAME_FIELDS: Set[str]
ENCODING: str
if sys.version_info < (3,):
TAR_PLAIN: int
TAR_GZIPPED: int
TAR_PLAIN: int
TAR_GZIPPED: int
def open(
name: Optional[AnyPath] = ...,
@@ -92,8 +88,7 @@ class TarFile(Iterable[TarInfo]):
debug: Optional[int]
errorlevel: Optional[int]
offset: int # undocumented
if sys.version_info < (3,):
posix: bool
posix: bool
def __init__(
self,
name: Optional[AnyPath] = ...,
@@ -204,23 +199,10 @@ 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 = ...) -> 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]] = ...) -> None: ...
def extract(self, member: Union[str, TarInfo], path: AnyPath = ...) -> 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,58 +210,28 @@ 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) -> 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):
def add(
self,
name: StrPath,
arcname: Optional[StrPath] = ...,
recursive: bool = ...,
*,
filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...,
) -> None: ...
elif sys.version_info >= (3,):
def add(
self,
name: StrPath,
arcname: Optional[StrPath] = ...,
recursive: bool = ...,
exclude: Optional[Callable[[str], bool]] = ...,
*,
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 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]] = ...
) -> TarInfo: ...
def close(self) -> None: ...
if sys.version_info >= (3, 9):
def is_tarfile(name: Union[AnyPath, IO[bytes]]) -> bool: ...
def is_tarfile(name: AnyPath) -> bool: ...
def filemode(mode: int) -> str: ... # undocumented
else:
def is_tarfile(name: AnyPath) -> bool: ...
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 TarFileCompat:
def __init__(self, filename: str, mode: str = ..., compression: int = ...) -> None: ...
class TarError(Exception): ...
class ReadError(TarError): ...
@@ -309,12 +261,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) -> TarInfo: ...
@classmethod
def fromtarfile(cls, tarfile: TarFile) -> TarInfo: ...
@property

View File

@@ -110,6 +110,3 @@ 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: ...

View File

@@ -11,31 +11,14 @@ _T = TypeVar("_T")
__all__: List[str]
def active_count() -> int: ...
if sys.version_info < (3,):
def activeCount() -> int: ...
def activeCount() -> int: ...
def current_thread() -> Thread: ...
def currentThread() -> Thread: ...
if sys.version_info >= (3,):
def get_ident() -> int: ...
def enumerate() -> List[Thread]: ...
if sys.version_info >= (3, 4):
def main_thread() -> Thread: ...
if sys.version_info >= (3, 8):
from _thread import get_native_id as get_native_id
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
class ThreadError(Exception): ...
class local(object):
@@ -47,37 +30,21 @@ 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[Text] = ...,
args: Iterable[Any] = ...,
kwargs: Optional[Mapping[Text, Any]] = ...,
) -> None: ...
def start(self) -> None: ...
def run(self) -> None: ...
def join(self, timeout: Optional[float] = ...) -> None: ...
def getName(self) -> str: ...
def setName(self, name: Text) -> None: ...
if sys.version_info >= (3, 8):
@property
def native_id(self) -> Optional[int]: ... # only available on some platforms
def is_alive(self) -> bool: ...
if sys.version_info < (3, 9):
def isAlive(self) -> bool: ...
def isAlive(self) -> bool: ...
def isDaemon(self) -> bool: ...
def setDaemon(self, daemonic: bool) -> None: ...
@@ -89,10 +56,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 = ...) -> bool: ...
def release(self) -> None: ...
def locked(self) -> bool: ...
@@ -102,10 +66,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 = ...) -> bool: ...
def release(self) -> None: ...
RLock = _RLock
@@ -116,14 +77,9 @@ 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 = ...) -> 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 notify(self, n: int = ...) -> None: ...
def notify_all(self) -> None: ...
def notifyAll(self) -> None: ...
@@ -133,56 +89,22 @@ 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: ...
if sys.version_info >= (3, 9):
def release(self, n: int = ...) -> None: ...
else:
def release(self) -> None: ...
def acquire(self, blocking: bool = ...) -> bool: ...
def __enter__(self, blocking: bool = ...) -> bool: ...
def release(self) -> None: ...
class BoundedSemaphore(Semaphore): ...
class Event:
def __init__(self) -> None: ...
def is_set(self) -> bool: ...
if sys.version_info < (3,):
def isSet(self) -> bool: ...
def isSet(self) -> bool: ...
def set(self) -> None: ...
def clear(self) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> bool: ...
if sys.version_info >= (3, 8):
from _thread import _excepthook, _ExceptHookArgs
excepthook = _excepthook
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: Iterable[Any] = ..., kwargs: 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): ...

View File

@@ -1,40 +1,14 @@
import sys
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
accept2dyear: bool
altzone: int
daylight: int
timezone: int
tzname: Tuple[str, str]
if sys.version_info >= (3, 7):
if sys.platform == "linux":
CLOCK_BOOTTIME: int
if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
CLOCK_PROF: int # FreeBSD, NetBSD, OpenBSD
CLOCK_UPTIME: int # FreeBSD, OpenBSD
if sys.version_info >= (3, 3) and sys.platform != "win32":
CLOCK_MONOTONIC: int
CLOCK_MONOTONIC_RAW: int
CLOCK_PROCESS_CPUTIME_ID: int
CLOCK_REALTIME: int
CLOCK_THREAD_CPUTIME_ID: int
if sys.platform != "linux" and sys.platform != "darwin":
CLOCK_HIGHRES: int # Solaris only
if sys.version_info >= (3, 8) and sys.platform == "darwin":
CLOCK_UPTIME_RAW: int
if sys.version_info >= (3, 9) and sys.platform == "linux":
CLOCK_TAI: int
class _struct_time(NamedTuple):
tm_year: int
tm_mon: int
@@ -52,42 +26,12 @@ 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: _TimeTuple, _arg: Any = ...) -> None: ...
def __new__(cls, o: _TimeTuple, _arg: Any = ...) -> struct_time: ...
def asctime(t: Union[_TimeTuple, struct_time] = ...) -> str: ...
if sys.version_info < (3, 8):
def clock() -> float: ...
def clock() -> float: ...
def ctime(secs: Optional[float] = ...) -> str: ...
def gmtime(secs: Optional[float] = ...) -> struct_time: ...
def localtime(secs: Optional[float] = ...) -> struct_time: ...
@@ -99,24 +43,3 @@ 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
if sys.version_info >= (3, 7):
if sys.platform != "win32":
def clock_gettime_ns(clock_id: int) -> int: ...
def clock_settime_ns(clock_id: int, time: int) -> int: ...
def monotonic_ns() -> int: ...
def perf_counter_ns() -> int: ...
def process_time_ns() -> int: ...
def time_ns() -> int: ...
def thread_time() -> float: ...
def thread_time_ns() -> int: ...

View File

@@ -8,36 +8,13 @@ _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 = ...) -> 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]: ...
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 = ...) -> float: ...
def repeat(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., repeat: int = ..., number: int = ...) -> List[float]: ...
_timerFunc = Callable[[], float]

View File

@@ -26,8 +26,7 @@ GREATER: int
EQUAL: int
DOT: int
PERCENT: int
if sys.version_info < (3,):
BACKQUOTE: int
BACKQUOTE: int
LBRACE: int
RBRACE: int
EQEQUAL: int
@@ -53,32 +52,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):
AWAIT: int
ASYNC: int
OP: int
ERRORTOKEN: int
N_TOKENS: int
NT_OFFSET: int
tok_name: Dict[int, str]
if sys.version_info >= (3, 7):
COMMENT: int
NL: int
ENCODING: int
if sys.version_info >= (3, 8):
TYPE_COMMENT: int
TYPE_IGNORE: int
COLONEQUAL: int
EXACT_TOKEN_TYPES: Dict[str, int]
def ISTERMINAL(x: int) -> bool: ...
def ISNONTERMINAL(x: int) -> bool: ...

View File

@@ -6,192 +6,24 @@ from typing import IO, Any, Dict, Generator, Iterable, Iterator, List, Mapping,
_PT = Tuple[str, int, str, Optional[str]]
def print_tb(tb: Optional[TracebackType], limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ...
if sys.version_info >= (3, 10):
def print_exception(
__exc: Optional[Type[BaseException]],
value: Optional[BaseException] = ...,
tb: Optional[TracebackType] = ...,
limit: Optional[int] = ...,
file: Optional[IO[str]] = ...,
chain: bool = ...,
) -> None: ...
elif sys.version_info >= (3,):
def print_exception(
etype: Optional[Type[BaseException]],
value: Optional[BaseException],
tb: Optional[TracebackType],
limit: Optional[int] = ...,
file: Optional[IO[str]] = ...,
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_exception(
etype: Optional[Type[BaseException]],
value: Optional[BaseException],
tb: Optional[TracebackType],
limit: Optional[int] = ...,
file: Optional[IO[str]] = ...,
) -> None: ...
def print_exc(limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ...
def print_last(limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ...
def print_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ...
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]: ...
if sys.version_info >= (3, 10):
def format_exception_only(__exc: Optional[Type[BaseException]], value: Optional[BaseException] = ...) -> List[str]: ...
else:
def format_exception_only(etype: Optional[Type[BaseException]], value: Optional[BaseException]) -> List[str]: ...
if sys.version_info >= (3, 10):
def format_exception(
__exc: Optional[Type[BaseException]],
value: Optional[BaseException] = ...,
tb: Optional[TracebackType] = ...,
limit: Optional[int] = ...,
chain: bool = ...,
) -> List[str]: ...
elif sys.version_info >= (3,):
def format_exception(
etype: Optional[Type[BaseException]],
value: Optional[BaseException],
tb: Optional[TracebackType],
limit: Optional[int] = ...,
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 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]: ...
def format_exception_only(etype: Optional[Type[BaseException]], value: Optional[BaseException]) -> List[str]: ...
def format_exception(
etype: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[TracebackType], limit: Optional[int] = ...
) -> List[str]: ...
def format_exc(limit: Optional[int] = ...) -> str: ...
def format_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[str]: ...
def format_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> List[str]: ...
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]]
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]: ...
def tb_lineno(tb: TracebackType) -> int: ...

View File

@@ -1,12 +1,9 @@
import sys
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
# 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
@@ -32,17 +29,6 @@ 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]: ...
class Terminator(Exception): ...
class TurtleGraphicsError(Exception): ...
@@ -102,9 +88,6 @@ 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
class TNavigator(object):
START_ORIENTATION: Dict[str, Vec2D] = ...
@@ -239,19 +222,6 @@ 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]: ...
def settiltangle(self, angle: float) -> None: ...
@overload
def tiltangle(self, angle: None = ...) -> float: ...
@@ -318,12 +288,6 @@ def write_docstringdict(filename: str = ...) -> None: ...
# 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]: ...
# Functions copied from TurtleScreen:
def clear() -> None: ...
@@ -375,10 +339,6 @@ 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
# Functions copied from _Screen:
def setup(width: float = ..., height: float = ..., startx: Optional[int] = ..., starty: Optional[int] = ...) -> None: ...
@@ -508,21 +468,6 @@ 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: ...
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]: ...
def settiltangle(angle: float) -> None: ...
@overload
def tiltangle(angle: None = ...) -> float: ...

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