mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Enable pyi-stubs for several modules and packages and make white-list case insensitive
_codecs, _thread, audioop, cmath, configparser, Crypto, csv, dbm, decimal, gflags, http, json, pickle, pyexpat, turtle GitOrigin-RevId: c36ac241d91d81bbaaa4164554ce03bd1a37840e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
35ba0742ca
commit
1946a270a6
@@ -0,0 +1,99 @@
|
||||
from typing import Any, IO, Sequence, Tuple, Union, List, Dict, Protocol, Optional
|
||||
|
||||
DEFAULTSECT: str
|
||||
MAX_INTERPOLATION_DEPTH: int
|
||||
|
||||
class Error(Exception):
|
||||
message: Any
|
||||
def __init__(self, msg: str = ...) -> None: ...
|
||||
def _get_message(self) -> None: ...
|
||||
def _set_message(self, value: str) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
class NoSectionError(Error):
|
||||
section: str
|
||||
def __init__(self, section: str) -> None: ...
|
||||
|
||||
class DuplicateSectionError(Error):
|
||||
section: str
|
||||
def __init__(self, section: str) -> None: ...
|
||||
|
||||
class NoOptionError(Error):
|
||||
section: str
|
||||
option: str
|
||||
def __init__(self, option: str, section: str) -> None: ...
|
||||
|
||||
class InterpolationError(Error):
|
||||
section: str
|
||||
option: str
|
||||
msg: str
|
||||
def __init__(self, option: str, section: str, msg: str) -> None: ...
|
||||
|
||||
class InterpolationMissingOptionError(InterpolationError):
|
||||
reference: str
|
||||
def __init__(self, option: str, section: str, rawval: str, reference: str) -> None: ...
|
||||
|
||||
class InterpolationSyntaxError(InterpolationError): ...
|
||||
|
||||
class InterpolationDepthError(InterpolationError):
|
||||
def __init__(self, option: str, section: str, rawval: str) -> None: ...
|
||||
|
||||
class ParsingError(Error):
|
||||
filename: str
|
||||
errors: List[Tuple[Any, Any]]
|
||||
def __init__(self, filename: str) -> None: ...
|
||||
def append(self, lineno: Any, line: Any) -> None: ...
|
||||
|
||||
class MissingSectionHeaderError(ParsingError):
|
||||
lineno: Any
|
||||
line: Any
|
||||
def __init__(self, filename: str, lineno: Any, line: Any) -> None: ...
|
||||
|
||||
class _Readable(Protocol):
|
||||
def readline(self) -> str: ...
|
||||
|
||||
class RawConfigParser:
|
||||
_dict: Any
|
||||
_sections: Dict[Any, Any]
|
||||
_defaults: Dict[Any, Any]
|
||||
_optcre: Any
|
||||
SECTCRE: Any
|
||||
OPTCRE: Any
|
||||
OPTCRE_NV: Any
|
||||
def __init__(self, defaults: Dict[Any, Any] = ..., dict_type: Any = ..., allow_no_value: bool = ...) -> None: ...
|
||||
def defaults(self) -> Dict[Any, Any]: ...
|
||||
def sections(self) -> List[str]: ...
|
||||
def add_section(self, section: str) -> None: ...
|
||||
def has_section(self, section: str) -> bool: ...
|
||||
def options(self, section: str) -> List[str]: ...
|
||||
def read(self, filenames: Union[str, Sequence[str]]) -> List[str]: ...
|
||||
def readfp(self, fp: _Readable, filename: str = ...) -> None: ...
|
||||
def get(self, section: str, option: str) -> str: ...
|
||||
def items(self, section: str) -> List[Tuple[Any, Any]]: ...
|
||||
def _get(self, section: str, conv: type, option: str) -> Any: ...
|
||||
def getint(self, section: str, option: str) -> int: ...
|
||||
def getfloat(self, section: str, option: str) -> float: ...
|
||||
_boolean_states: Dict[str, bool]
|
||||
def getboolean(self, section: str, option: str) -> bool: ...
|
||||
def optionxform(self, optionstr: str) -> str: ...
|
||||
def has_option(self, section: str, option: str) -> bool: ...
|
||||
def set(self, section: str, option: str, value: Any = ...) -> None: ...
|
||||
def write(self, fp: IO[str]) -> None: ...
|
||||
def remove_option(self, section: str, option: Any) -> bool: ...
|
||||
def remove_section(self, section: str) -> bool: ...
|
||||
def _read(self, fp: IO[str], fpname: str) -> None: ...
|
||||
|
||||
class ConfigParser(RawConfigParser):
|
||||
_KEYCRE: Any
|
||||
def get(self, section: str, option: str, raw: bool = ..., vars: Optional[Dict[Any, Any]] = ...) -> Any: ...
|
||||
def items(self, section: str, raw: bool = ..., vars: Optional[Dict[Any, Any]] = ...) -> List[Tuple[str, Any]]: ...
|
||||
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
|
||||
def _interpolation_replace(self, match: Any) -> str: ...
|
||||
|
||||
class SafeConfigParser(ConfigParser):
|
||||
_interpvar_re: Any
|
||||
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
|
||||
def _interpolate_some(
|
||||
self, option: str, accum: List[Any], rest: str, section: str, map: Dict[Any, Any], depth: int,
|
||||
) -> None: ...
|
||||
@@ -0,0 +1,31 @@
|
||||
# Stubs for Queue (Python 2)
|
||||
|
||||
from collections import deque
|
||||
from typing import Any, Deque, TypeVar, Generic, Optional
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class Empty(Exception): ...
|
||||
class Full(Exception): ...
|
||||
|
||||
class Queue(Generic[_T]):
|
||||
maxsize: Any
|
||||
mutex: Any
|
||||
not_empty: Any
|
||||
not_full: Any
|
||||
all_tasks_done: Any
|
||||
unfinished_tasks: Any
|
||||
queue: Deque[Any] # undocumented
|
||||
def __init__(self, maxsize: int = ...) -> None: ...
|
||||
def task_done(self) -> None: ...
|
||||
def join(self) -> None: ...
|
||||
def qsize(self) -> int: ...
|
||||
def empty(self) -> bool: ...
|
||||
def full(self) -> bool: ...
|
||||
def put(self, item: _T, block: bool = ..., timeout: Optional[float] = ...) -> None: ...
|
||||
def put_nowait(self, item: _T) -> None: ...
|
||||
def get(self, block: bool = ..., timeout: Optional[float] = ...) -> _T: ...
|
||||
def get_nowait(self) -> _T: ...
|
||||
|
||||
class PriorityQueue(Queue[_T]): ...
|
||||
class LifoQueue(Queue[_T]): ...
|
||||
@@ -0,0 +1,96 @@
|
||||
from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Text, Protocol, Type
|
||||
|
||||
class JSONDecodeError(ValueError):
|
||||
def dumps(self, obj: Any) -> str: ...
|
||||
def dump(self, obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ...
|
||||
def loads(self, s: str) -> Any: ...
|
||||
def load(self, fp: IO[str]) -> Any: ...
|
||||
|
||||
def dumps(obj: Any,
|
||||
skipkeys: bool = ...,
|
||||
ensure_ascii: bool = ...,
|
||||
check_circular: bool = ...,
|
||||
allow_nan: bool = ...,
|
||||
cls: Optional[Type[JSONEncoder]] = ...,
|
||||
indent: Optional[int] = ...,
|
||||
separators: Optional[Tuple[str, str]] = ...,
|
||||
encoding: str = ...,
|
||||
default: Optional[Callable[[Any], Any]] = ...,
|
||||
sort_keys: bool = ...,
|
||||
**kwds: Any) -> str: ...
|
||||
|
||||
def dump(obj: Any,
|
||||
fp: Union[IO[str], IO[Text]],
|
||||
skipkeys: bool = ...,
|
||||
ensure_ascii: bool = ...,
|
||||
check_circular: bool = ...,
|
||||
allow_nan: bool = ...,
|
||||
cls: Optional[Type[JSONEncoder]] = ...,
|
||||
indent: Optional[int] = ...,
|
||||
separators: Optional[Tuple[str, str]] = ...,
|
||||
encoding: str = ...,
|
||||
default: Optional[Callable[[Any], Any]] = ...,
|
||||
sort_keys: bool = ...,
|
||||
**kwds: Any) -> None: ...
|
||||
|
||||
def loads(s: Union[Text, bytes],
|
||||
encoding: Any = ...,
|
||||
cls: Optional[Type[JSONDecoder]] = ...,
|
||||
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
|
||||
parse_float: Optional[Callable[[str], Any]] = ...,
|
||||
parse_int: Optional[Callable[[str], Any]] = ...,
|
||||
parse_constant: Optional[Callable[[str], Any]] = ...,
|
||||
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
|
||||
**kwds: Any) -> Any: ...
|
||||
|
||||
class _Reader(Protocol):
|
||||
def read(self) -> Union[Text, bytes]: ...
|
||||
|
||||
def load(fp: _Reader,
|
||||
encoding: Optional[str] = ...,
|
||||
cls: Optional[Type[JSONDecoder]] = ...,
|
||||
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
|
||||
parse_float: Optional[Callable[[str], Any]] = ...,
|
||||
parse_int: Optional[Callable[[str], Any]] = ...,
|
||||
parse_constant: Optional[Callable[[str], Any]] = ...,
|
||||
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
|
||||
**kwds: Any) -> Any: ...
|
||||
|
||||
class JSONDecoder(object):
|
||||
def __init__(self,
|
||||
encoding: Union[Text, bytes] = ...,
|
||||
object_hook: Callable[..., Any] = ...,
|
||||
parse_float: Callable[[str], float] = ...,
|
||||
parse_int: Callable[[str], int] = ...,
|
||||
parse_constant: Callable[[str], Any] = ...,
|
||||
strict: bool = ...,
|
||||
object_pairs_hook: Callable[..., Any] = ...) -> None: ...
|
||||
def decode(self, s: Union[Text, bytes], _w: Any = ...) -> Any: ...
|
||||
def raw_decode(self, s: Union[Text, bytes], idx: int = ...) -> Tuple[Any, Any]: ...
|
||||
|
||||
class JSONEncoder(object):
|
||||
item_separator: str
|
||||
key_separator: str
|
||||
skipkeys: bool
|
||||
ensure_ascii: bool
|
||||
check_circular: bool
|
||||
allow_nan: bool
|
||||
sort_keys: bool
|
||||
indent: Optional[int]
|
||||
|
||||
def __init__(self,
|
||||
skipkeys: bool = ...,
|
||||
ensure_ascii: bool = ...,
|
||||
check_circular: bool = ...,
|
||||
allow_nan: bool = ...,
|
||||
sort_keys: bool = ...,
|
||||
indent: Optional[int] = ...,
|
||||
separators: Tuple[Union[Text, bytes], Union[Text, bytes]] = ...,
|
||||
encoding: Union[Text, bytes] = ...,
|
||||
default: Callable[..., Any] = ...) -> None: ...
|
||||
|
||||
def default(self, o: Any) -> Any: ...
|
||||
|
||||
def encode(self, o: Any) -> str: ...
|
||||
|
||||
def iterencode(self, o: Any, _one_shot: bool = ...) -> str: ...
|
||||
@@ -0,0 +1,76 @@
|
||||
"""Stub file for the '_codecs' module."""
|
||||
|
||||
import sys
|
||||
from typing import Any, Callable, Tuple, Optional, Dict, Text, Union
|
||||
|
||||
import codecs
|
||||
|
||||
# For convenience:
|
||||
_Handler = Callable[[Exception], Tuple[Text, int]]
|
||||
_String = Union[bytes, str]
|
||||
_Errors = Union[str, Text, None]
|
||||
if sys.version_info < (3, 0):
|
||||
_Decodable = Union[bytes, Text]
|
||||
_Encodable = Union[bytes, Text]
|
||||
else:
|
||||
_Decodable = bytes
|
||||
_Encodable = str
|
||||
|
||||
# This type is not exposed; it is defined in unicodeobject.c
|
||||
class _EncodingMap(object):
|
||||
def size(self) -> int: ...
|
||||
_MapT = Union[Dict[int, int], _EncodingMap]
|
||||
|
||||
def register(__search_function: Callable[[str], Any]) -> None: ...
|
||||
def register_error(__errors: Union[str, Text], __handler: _Handler) -> None: ...
|
||||
def lookup(__encoding: Union[str, Text]) -> codecs.CodecInfo: ...
|
||||
def lookup_error(__name: Union[str, Text]) -> _Handler: ...
|
||||
def decode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) -> Any: ...
|
||||
def encode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) -> Any: ...
|
||||
def charmap_build(__map: Text) -> _MapT: ...
|
||||
|
||||
def ascii_decode(__data: _Decodable, __errors: _Errors = ...) -> Tuple[Text, int]: ...
|
||||
def ascii_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
if sys.version_info < (3, 2):
|
||||
def charbuffer_encode(__data: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def charmap_decode(__data: _Decodable, __errors: _Errors = ..., __mapping: Optional[_MapT] = ...) -> Tuple[Text, int]: ...
|
||||
def charmap_encode(__str: _Encodable, __errors: _Errors = ..., __mapping: Optional[_MapT] = ...) -> Tuple[bytes, int]: ...
|
||||
def escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[str, int]: ...
|
||||
def escape_encode(__data: bytes, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def latin_1_decode(__data: _Decodable, __errors: _Errors = ...) -> Tuple[Text, int]: ...
|
||||
def latin_1_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def raw_unicode_escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ...
|
||||
def raw_unicode_escape_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
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 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]: ...
|
||||
def utf_16_encode(__str: _Encodable, __errors: _Errors = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_16_ex_decode(__data: _Decodable, __errors: _Errors = ..., __byteorder: int = ..., __final: int = ...) -> Tuple[Text, int, int]: ...
|
||||
def utf_16_le_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_16_le_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_32_be_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_32_be_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_32_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_32_encode(__str: _Encodable, __errors: _Errors = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_32_ex_decode(__data: _Decodable, __errors: _Errors = ..., __byteorder: int = ..., __final: int = ...) -> Tuple[Text, int, int]: ...
|
||||
def utf_32_le_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_32_le_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_7_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_7_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_8_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
|
||||
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 oem_decode(__data: bytes, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
|
||||
def code_page_decode(codepage: int, __data: bytes, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
|
||||
def oem_encode(str: Text, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def code_page_encode(code_page: int, str: Text, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
@@ -0,0 +1,42 @@
|
||||
from typing import Any, Optional, Tuple
|
||||
|
||||
AdpcmState = Tuple[int, int]
|
||||
RatecvState = Tuple[int, Tuple[Tuple[int, int], ...]]
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
def add(__fragment1: bytes, __fragment2: bytes, __width: int) -> bytes: ...
|
||||
def adpcm2lin(__fragment: bytes, __width: int, __state: Optional[AdpcmState]) -> Tuple[bytes, AdpcmState]: ...
|
||||
def alaw2lin(__fragment: bytes, __width: int) -> bytes: ...
|
||||
def avg(__fragment: bytes, __width: int) -> int: ...
|
||||
def avgpp(__fragment: bytes, __width: int) -> int: ...
|
||||
def bias(__fragment: bytes, __width: int, __bias: int) -> bytes: ...
|
||||
def byteswap(__fragment: bytes, __width: int) -> bytes: ...
|
||||
def cross(__fragment: bytes, __width: int) -> int: ...
|
||||
def findfactor(__fragment: bytes, __reference: bytes) -> float: ...
|
||||
def findfit(__fragment: bytes, __reference: bytes) -> Tuple[int, float]: ...
|
||||
def findmax(__fragment: bytes, __length: int) -> int: ...
|
||||
def getsample(__fragment: bytes, __width: int, __index: int) -> int: ...
|
||||
def lin2adpcm(__fragment: bytes, __width: int, __state: Optional[AdpcmState]) -> Tuple[bytes, AdpcmState]: ...
|
||||
def lin2alaw(__fragment: bytes, __width: int) -> bytes: ...
|
||||
def lin2lin(__fragment: bytes, __width: int, __newwidth: int) -> bytes: ...
|
||||
def lin2ulaw(__fragment: bytes, __width: int) -> bytes: ...
|
||||
def max(__fragment: bytes, __width: int) -> int: ...
|
||||
def maxpp(__fragment: bytes, __width: int) -> int: ...
|
||||
def minmax(__fragment: bytes, __width: int) -> Tuple[int, int]: ...
|
||||
def mul(__fragment: bytes, __width: int, __factor: float) -> bytes: ...
|
||||
def ratecv(
|
||||
__fragment: bytes,
|
||||
__width: int,
|
||||
__nchannels: int,
|
||||
__inrate: int,
|
||||
__outrate: int,
|
||||
__state: Optional[RatecvState],
|
||||
__weightA: int = ...,
|
||||
__weightB: int = ...,
|
||||
) -> Tuple[bytes, RatecvState]: ...
|
||||
def reverse(__fragment: bytes, __width: int) -> bytes: ...
|
||||
def rms(__fragment: bytes, __width: int) -> int: ...
|
||||
def tomono(__fragment: bytes, __width: int, __lfactor: float, __rfactor: float) -> bytes: ...
|
||||
def tostereo(__fragment: bytes, __width: int, __lfactor: float, __rfactor: float) -> bytes: ...
|
||||
def ulaw2lin(__fragment: bytes, __width: int) -> bytes: ...
|
||||
@@ -0,0 +1,42 @@
|
||||
"""Stub file for the 'cmath' module."""
|
||||
|
||||
import sys
|
||||
from typing import SupportsComplex, SupportsFloat, Tuple, Union
|
||||
|
||||
e: float
|
||||
pi: float
|
||||
if sys.version_info >= (3, 6):
|
||||
inf: float
|
||||
infj: complex
|
||||
nan: float
|
||||
nanj: complex
|
||||
tau: float
|
||||
|
||||
_C = Union[SupportsFloat, SupportsComplex]
|
||||
|
||||
def acos(__z: _C) -> complex: ...
|
||||
def acosh(__z: _C) -> complex: ...
|
||||
def asin(__z: _C) -> complex: ...
|
||||
def asinh(__z: _C) -> complex: ...
|
||||
def atan(__z: _C) -> complex: ...
|
||||
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: ...
|
||||
def log10(__z: _C) -> complex: ...
|
||||
def phase(__z: _C) -> float: ...
|
||||
def polar(__z: _C) -> Tuple[float, float]: ...
|
||||
def rect(__r: float, __phi: float) -> complex: ...
|
||||
def sin(__z: _C) -> complex: ...
|
||||
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: ...
|
||||
@@ -0,0 +1,101 @@
|
||||
import sys
|
||||
from _csv import (
|
||||
QUOTE_ALL as QUOTE_ALL,
|
||||
QUOTE_MINIMAL as QUOTE_MINIMAL,
|
||||
QUOTE_NONE as QUOTE_NONE,
|
||||
QUOTE_NONNUMERIC as QUOTE_NONNUMERIC,
|
||||
Dialect as Dialect,
|
||||
Error as Error,
|
||||
_DialectLike,
|
||||
_reader,
|
||||
_writer,
|
||||
field_size_limit as field_size_limit,
|
||||
get_dialect as get_dialect,
|
||||
list_dialects as list_dialects,
|
||||
reader as reader,
|
||||
register_dialect as register_dialect,
|
||||
unregister_dialect as unregister_dialect,
|
||||
writer as writer,
|
||||
)
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Text, Type, Union
|
||||
|
||||
_DictRow = Mapping[str, Any]
|
||||
|
||||
class excel(Dialect):
|
||||
delimiter: str
|
||||
quotechar: str
|
||||
doublequote: bool
|
||||
skipinitialspace: bool
|
||||
lineterminator: str
|
||||
quoting: int
|
||||
|
||||
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
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
_DRMapping = Dict[str, str]
|
||||
elif sys.version_info >= (3, 6):
|
||||
_DRMapping = OrderedDict[str, str]
|
||||
else:
|
||||
_DRMapping = Dict[str, str]
|
||||
|
||||
class DictReader(Iterator[_DRMapping]):
|
||||
restkey: Optional[str]
|
||||
restval: Optional[str]
|
||||
reader: _reader
|
||||
dialect: _DialectLike
|
||||
line_num: int
|
||||
fieldnames: Sequence[str]
|
||||
def __init__(
|
||||
self,
|
||||
f: Iterable[Text],
|
||||
fieldnames: Optional[Sequence[str]] = ...,
|
||||
restkey: Optional[str] = ...,
|
||||
restval: Optional[str] = ...,
|
||||
dialect: _DialectLike = ...,
|
||||
*args: Any,
|
||||
**kwds: Any,
|
||||
) -> None: ...
|
||||
def __iter__(self) -> DictReader: ...
|
||||
if sys.version_info >= (3,):
|
||||
def __next__(self) -> _DRMapping: ...
|
||||
else:
|
||||
def next(self) -> _DRMapping: ...
|
||||
|
||||
class DictWriter(object):
|
||||
fieldnames: Sequence[str]
|
||||
restval: Optional[Any]
|
||||
extrasaction: str
|
||||
writer: _writer
|
||||
def __init__(
|
||||
self,
|
||||
f: Any,
|
||||
fieldnames: Iterable[str],
|
||||
restval: Optional[Any] = ...,
|
||||
extrasaction: str = ...,
|
||||
dialect: _DialectLike = ...,
|
||||
*args: Any,
|
||||
**kwds: Any,
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def writeheader(self) -> Any: ...
|
||||
else:
|
||||
def writeheader(self) -> None: ...
|
||||
def writerow(self, rowdict: _DictRow) -> Any: ...
|
||||
def writerows(self, rowdicts: Iterable[_DictRow]) -> None: ...
|
||||
|
||||
class Sniffer(object):
|
||||
preferred: List[str]
|
||||
def __init__(self) -> None: ...
|
||||
def sniff(self, sample: str, delimiters: Optional[str] = ...) -> Type[Dialect]: ...
|
||||
def has_header(self, sample: str) -> bool: ...
|
||||
@@ -0,0 +1,345 @@
|
||||
import numbers
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
Any, Container, Dict, List, NamedTuple, Optional, overload, Sequence, Text, Tuple, Type, TypeVar, Union,
|
||||
)
|
||||
|
||||
_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]
|
||||
_DecimalT = TypeVar('_DecimalT', bound=Decimal)
|
||||
|
||||
class DecimalTuple(NamedTuple):
|
||||
sign: int
|
||||
digits: Tuple[int, ...]
|
||||
exponent: int
|
||||
|
||||
ROUND_DOWN: str
|
||||
ROUND_HALF_UP: str
|
||||
ROUND_HALF_EVEN: str
|
||||
ROUND_CEILING: str
|
||||
ROUND_FLOOR: str
|
||||
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):
|
||||
def handle(self, context: Context, *args: Any) -> Optional[Decimal]: ...
|
||||
|
||||
class Clamped(DecimalException): ...
|
||||
|
||||
class InvalidOperation(DecimalException): ...
|
||||
|
||||
class ConversionSyntax(InvalidOperation): ...
|
||||
|
||||
class DivisionByZero(DecimalException, ZeroDivisionError): ...
|
||||
|
||||
class DivisionImpossible(InvalidOperation): ...
|
||||
|
||||
class DivisionUndefined(InvalidOperation, ZeroDivisionError): ...
|
||||
|
||||
class Inexact(DecimalException): ...
|
||||
|
||||
class InvalidContext(InvalidOperation): ...
|
||||
|
||||
class Rounded(DecimalException): ...
|
||||
|
||||
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: ...
|
||||
|
||||
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 compare(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def as_tuple(self) -> DecimalTuple: ...
|
||||
if sys.version_info >= (3,):
|
||||
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 remainder_near(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
|
||||
def __float__(self) -> float: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __trunc__(self) -> int: ...
|
||||
@property
|
||||
def real(self) -> Decimal: ...
|
||||
@property
|
||||
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 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 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: ...
|
||||
def sqrt(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
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 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 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 exp(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def is_canonical(self) -> bool: ...
|
||||
def is_finite(self) -> bool: ...
|
||||
def is_infinite(self) -> bool: ...
|
||||
def is_nan(self) -> bool: ...
|
||||
def is_normal(self, context: Optional[Context] = ...) -> bool: ...
|
||||
def is_qnan(self) -> bool: ...
|
||||
def is_signed(self) -> bool: ...
|
||||
def is_snan(self) -> bool: ...
|
||||
def is_subnormal(self, context: Optional[Context] = ...) -> bool: ...
|
||||
def is_zero(self) -> bool: ...
|
||||
def ln(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def log10(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def logb(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def logical_and(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def logical_invert(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def logical_or(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def logical_xor(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def max_mag(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def min_mag(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def next_minus(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def next_plus(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def next_toward(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def number_class(self, context: Optional[Context] = ...) -> str: ...
|
||||
def radix(self) -> Decimal: ...
|
||||
def rotate(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def scaleb(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def shift(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def __reduce__(self) -> Tuple[Type[Decimal], Tuple[str]]: ...
|
||||
def __copy__(self) -> Decimal: ...
|
||||
def __deepcopy__(self, memo: Any) -> Decimal: ...
|
||||
def __format__(self, specifier: str, context: Optional[Context] = ...) -> str: ...
|
||||
|
||||
class _ContextManager(object):
|
||||
new_context: Context
|
||||
saved_context: Context
|
||||
def __init__(self, new_context: Context) -> None: ...
|
||||
def __enter__(self) -> Context: ...
|
||||
def __exit__(self, t: Optional[Type[BaseException]], v: Optional[BaseException], tb: Optional[TracebackType]) -> None: ...
|
||||
|
||||
_TrapType = Type[DecimalException]
|
||||
|
||||
class Context(object):
|
||||
prec: int
|
||||
rounding: str
|
||||
Emin: int
|
||||
Emax: int
|
||||
capitals: int
|
||||
if sys.version_info >= (3,):
|
||||
clamp: int
|
||||
else:
|
||||
_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 clear_flags(self) -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
def clear_traps(self) -> None: ...
|
||||
def copy(self) -> Context: ...
|
||||
def __copy__(self) -> Context: ...
|
||||
__hash__: Any = ...
|
||||
def Etiny(self) -> int: ...
|
||||
def Etop(self) -> int: ...
|
||||
def create_decimal(self, __num: _DecimalNew = ...) -> Decimal: ...
|
||||
def create_decimal_from_float(self, __f: float) -> Decimal: ...
|
||||
def abs(self, __x: _Decimal) -> Decimal: ...
|
||||
def add(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def canonical(self, __x: Decimal) -> Decimal: ...
|
||||
def compare(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def compare_signal(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def compare_total(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def compare_total_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def copy_abs(self, __x: _Decimal) -> Decimal: ...
|
||||
def copy_decimal(self, __x: _Decimal) -> Decimal: ...
|
||||
def copy_negate(self, __x: _Decimal) -> Decimal: ...
|
||||
def copy_sign(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def divide(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def divide_int(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def divmod(self, __x: _Decimal, __y: _Decimal) -> Tuple[Decimal, Decimal]: ...
|
||||
def exp(self, __x: _Decimal) -> Decimal: ...
|
||||
def fma(self, __x: _Decimal, __y: _Decimal, __z: _Decimal) -> Decimal: ...
|
||||
def is_canonical(self, __x: _Decimal) -> bool: ...
|
||||
def is_finite(self, __x: _Decimal) -> bool: ...
|
||||
def is_infinite(self, __x: _Decimal) -> bool: ...
|
||||
def is_nan(self, __x: _Decimal) -> bool: ...
|
||||
def is_normal(self, __x: _Decimal) -> bool: ...
|
||||
def is_qnan(self, __x: _Decimal) -> bool: ...
|
||||
def is_signed(self, __x: _Decimal) -> bool: ...
|
||||
def is_snan(self, __x: _Decimal) -> bool: ...
|
||||
def is_subnormal(self, __x: _Decimal) -> bool: ...
|
||||
def is_zero(self, __x: _Decimal) -> bool: ...
|
||||
def ln(self, __x: _Decimal) -> Decimal: ...
|
||||
def log10(self, __x: _Decimal) -> Decimal: ...
|
||||
def logb(self, __x: _Decimal) -> Decimal: ...
|
||||
def logical_and(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def logical_invert(self, __x: _Decimal) -> Decimal: ...
|
||||
def logical_or(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def logical_xor(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def max(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def max_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def min(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def min_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def minus(self, __x: _Decimal) -> Decimal: ...
|
||||
def multiply(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def next_minus(self, __x: _Decimal) -> Decimal: ...
|
||||
def next_plus(self, __x: _Decimal) -> Decimal: ...
|
||||
def next_toward(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def normalize(self, __x: _Decimal) -> Decimal: ...
|
||||
def number_class(self, __x: _Decimal) -> str: ...
|
||||
def plus(self, __x: _Decimal) -> Decimal: ...
|
||||
def power(self, a: _Decimal, b: _Decimal, modulo: Optional[_Decimal] = ...) -> Decimal: ...
|
||||
def quantize(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def radix(self) -> Decimal: ...
|
||||
def remainder(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def remainder_near(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def rotate(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def same_quantum(self, __x: _Decimal, __y: _Decimal) -> bool: ...
|
||||
def scaleb(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def shift(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def sqrt(self, __x: _Decimal) -> Decimal: ...
|
||||
def subtract(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def to_eng_string(self, __x: _Decimal) -> str: ...
|
||||
def to_sci_string(self, __x: _Decimal) -> str: ...
|
||||
def to_integral_exact(self, __x: _Decimal) -> Decimal: ...
|
||||
def to_integral_value(self, __x: _Decimal) -> Decimal: ...
|
||||
def to_integral(self, __x: _Decimal) -> Decimal: ...
|
||||
|
||||
DefaultContext: Context
|
||||
BasicContext: Context
|
||||
ExtendedContext: Context
|
||||
@@ -0,0 +1,179 @@
|
||||
import sys
|
||||
from typing import Any, IO, Mapping, Union, Tuple, Callable, Optional, Iterable, Iterator
|
||||
|
||||
HIGHEST_PROTOCOL: int
|
||||
if sys.version_info >= (3, 0):
|
||||
DEFAULT_PROTOCOL: int
|
||||
|
||||
|
||||
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: ...
|
||||
|
||||
class PickleError(Exception): ...
|
||||
class PicklingError(PickleError): ...
|
||||
class UnpicklingError(PickleError): ...
|
||||
|
||||
_reducedtype = Union[str,
|
||||
Tuple[Callable[..., Any], Tuple[Any, ...]],
|
||||
Tuple[Callable[..., Any], Tuple[Any, ...], Any],
|
||||
Tuple[Callable[..., Any], Tuple[Any, ...], Any,
|
||||
Optional[Iterator]],
|
||||
Tuple[Callable[..., Any], Tuple[Any, ...], Any,
|
||||
Optional[Iterator], Optional[Iterator]]]
|
||||
|
||||
|
||||
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 dump(self, obj: Any) -> None: ...
|
||||
def clear_memo(self) -> None: ...
|
||||
def persistent_id(self, obj: Any) -> Any: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def reducer_override(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 load(self) -> Any: ...
|
||||
def find_class(self, module: str, name: str) -> Any: ...
|
||||
if sys.version_info >= (3, 0):
|
||||
def persistent_load(self, pid: Any) -> Any: ...
|
||||
|
||||
MARK: bytes
|
||||
STOP: bytes
|
||||
POP: bytes
|
||||
POP_MARK: bytes
|
||||
DUP: bytes
|
||||
FLOAT: bytes
|
||||
INT: bytes
|
||||
BININT: bytes
|
||||
BININT1: bytes
|
||||
LONG: bytes
|
||||
BININT2: bytes
|
||||
NONE: bytes
|
||||
PERSID: bytes
|
||||
BINPERSID: bytes
|
||||
REDUCE: bytes
|
||||
STRING: bytes
|
||||
BINSTRING: bytes
|
||||
SHORT_BINSTRING: bytes
|
||||
UNICODE: bytes
|
||||
BINUNICODE: bytes
|
||||
APPEND: bytes
|
||||
BUILD: bytes
|
||||
GLOBAL: bytes
|
||||
DICT: bytes
|
||||
EMPTY_DICT: bytes
|
||||
APPENDS: bytes
|
||||
GET: bytes
|
||||
BINGET: bytes
|
||||
INST: bytes
|
||||
LONG_BINGET: bytes
|
||||
LIST: bytes
|
||||
EMPTY_LIST: bytes
|
||||
OBJ: bytes
|
||||
PUT: bytes
|
||||
BINPUT: bytes
|
||||
LONG_BINPUT: bytes
|
||||
SETITEM: bytes
|
||||
TUPLE: bytes
|
||||
EMPTY_TUPLE: bytes
|
||||
SETITEMS: bytes
|
||||
BINFLOAT: bytes
|
||||
|
||||
TRUE: bytes
|
||||
FALSE: bytes
|
||||
|
||||
# protocol 2
|
||||
PROTO: bytes
|
||||
NEWOBJ: bytes
|
||||
EXT1: bytes
|
||||
EXT2: bytes
|
||||
EXT4: bytes
|
||||
TUPLE1: bytes
|
||||
TUPLE2: bytes
|
||||
TUPLE3: bytes
|
||||
NEWTRUE: bytes
|
||||
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
|
||||
@@ -0,0 +1,76 @@
|
||||
from typing import List, Tuple, Optional, Callable, Any, Protocol, Union, Dict, Text
|
||||
|
||||
import pyexpat.errors as errors
|
||||
import pyexpat.model as model
|
||||
|
||||
EXPAT_VERSION: str # undocumented
|
||||
version_info: Tuple[int, int, int] # undocumented
|
||||
native_encoding: str # undocumented
|
||||
features: List[Tuple[str, int]] # undocumented
|
||||
|
||||
class ExpatError(Exception):
|
||||
code: int
|
||||
lineno: int
|
||||
offset: int
|
||||
|
||||
error = ExpatError
|
||||
|
||||
class _Reader(Protocol):
|
||||
def read(self, length: int) -> bytes: ...
|
||||
|
||||
XML_PARAM_ENTITY_PARSING_NEVER: int
|
||||
XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE: int
|
||||
XML_PARAM_ENTITY_PARSING_ALWAYS: int
|
||||
|
||||
_Model = Tuple[int, int, Optional[str], tuple]
|
||||
|
||||
class XMLParserType(object):
|
||||
def Parse(self, __data: Union[Text, bytes], __isfinal: bool = ...) -> int: ...
|
||||
def ParseFile(self, __file: _Reader) -> int: ...
|
||||
def SetBase(self, __base: Text) -> None: ...
|
||||
def GetBase(self) -> Optional[str]: ...
|
||||
def GetInputContext(self) -> Optional[bytes]: ...
|
||||
def ExternalEntityParserCreate(self, __context: Optional[Text], __encoding: Text = ...) -> XMLParserType: ...
|
||||
def SetParamEntityParsing(self, __flag: int) -> int: ...
|
||||
def UseForeignDTD(self, __flag: bool = ...) -> None: ...
|
||||
buffer_size: int
|
||||
buffer_text: bool
|
||||
buffer_used: int
|
||||
namespace_prefixes: bool # undocumented
|
||||
ordered_attributes: bool
|
||||
specified_attributes: bool
|
||||
ErrorByteIndex: int
|
||||
ErrorCode: int
|
||||
ErrorColumnNumber: int
|
||||
ErrorLineNumber: int
|
||||
CurrentByteIndex: int
|
||||
CurrentColumnNumber: int
|
||||
CurrentLineNumber: int
|
||||
XmlDeclHandler: Optional[Callable[[str, Optional[str], int], Any]]
|
||||
StartDoctypeDeclHandler: Optional[Callable[[str, Optional[str], Optional[str], bool], Any]]
|
||||
EndDoctypeDeclHandler: Optional[Callable[[], Any]]
|
||||
ElementDeclHandler: Optional[Callable[[str, _Model], Any]]
|
||||
AttlistDeclHandler: Optional[Callable[[str, str, str, Optional[str], bool], Any]]
|
||||
StartElementHandler: Optional[Union[
|
||||
Callable[[str, Dict[str, str]], Any],
|
||||
Callable[[str, List[str]], Any],
|
||||
Callable[[str, Union[Dict[str, str]], List[str]], Any]]]
|
||||
EndElementHandler: Optional[Callable[[str], Any]]
|
||||
ProcessingInstructionHandler: Optional[Callable[[str, str], Any]]
|
||||
CharacterDataHandler: Optional[Callable[[str], Any]]
|
||||
UnparsedEntityDeclHandler: Optional[Callable[[str, Optional[str], str, Optional[str], str], Any]]
|
||||
EntityDeclHandler: Optional[Callable[[str, bool, Optional[str], Optional[str], str, Optional[str], Optional[str]], Any]]
|
||||
NotationDeclHandler: Optional[Callable[[str, Optional[str], str, Optional[str]], Any]]
|
||||
StartNamespaceDeclHandler: Optional[Callable[[str, str], Any]]
|
||||
EndNamespaceDeclHandler: Optional[Callable[[str], Any]]
|
||||
CommentHandler: Optional[Callable[[str], Any]]
|
||||
StartCdataSectionHandler: Optional[Callable[[], Any]]
|
||||
EndCdataSectionHandler: Optional[Callable[[], Any]]
|
||||
DefaultHandler: Optional[Callable[[str], Any]]
|
||||
DefaultHandlerExpand: Optional[Callable[[str], Any]]
|
||||
NotStandaloneHandler: Optional[Callable[[], int]]
|
||||
ExternalEntityRefHandler: Optional[Callable[[str, Optional[str], Optional[str], Optional[str]], int]]
|
||||
|
||||
def ErrorString(__code: int) -> str: ...
|
||||
# intern is undocumented
|
||||
def ParserCreate(encoding: Optional[Text] = ..., namespace_separator: Optional[Text] = ..., intern: Optional[Dict[str, Any]] = ...) -> XMLParserType: ...
|
||||
@@ -0,0 +1,44 @@
|
||||
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
|
||||
XML_ERROR_BAD_CHAR_REF: str
|
||||
XML_ERROR_BINARY_ENTITY_REF: str
|
||||
XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING: str
|
||||
XML_ERROR_DUPLICATE_ATTRIBUTE: str
|
||||
XML_ERROR_ENTITY_DECLARED_IN_PE: str
|
||||
XML_ERROR_EXTERNAL_ENTITY_HANDLING: str
|
||||
XML_ERROR_FEATURE_REQUIRES_XML_DTD: str
|
||||
XML_ERROR_FINISHED: str
|
||||
XML_ERROR_INCOMPLETE_PE: str
|
||||
XML_ERROR_INCORRECT_ENCODING: str
|
||||
XML_ERROR_INVALID_TOKEN: str
|
||||
XML_ERROR_JUNK_AFTER_DOC_ELEMENT: str
|
||||
XML_ERROR_MISPLACED_XML_PI: str
|
||||
XML_ERROR_NOT_STANDALONE: str
|
||||
XML_ERROR_NOT_SUSPENDED: str
|
||||
XML_ERROR_NO_ELEMENTS: str
|
||||
XML_ERROR_NO_MEMORY: str
|
||||
XML_ERROR_PARAM_ENTITY_REF: str
|
||||
XML_ERROR_PARTIAL_CHAR: str
|
||||
XML_ERROR_PUBLICID: str
|
||||
XML_ERROR_RECURSIVE_ENTITY_REF: str
|
||||
XML_ERROR_SUSPENDED: str
|
||||
XML_ERROR_SUSPEND_PE: str
|
||||
XML_ERROR_SYNTAX: str
|
||||
XML_ERROR_TAG_MISMATCH: str
|
||||
XML_ERROR_TEXT_DECL: str
|
||||
XML_ERROR_UNBOUND_PREFIX: str
|
||||
XML_ERROR_UNCLOSED_CDATA_SECTION: str
|
||||
XML_ERROR_UNCLOSED_TOKEN: str
|
||||
XML_ERROR_UNDECLARING_PREFIX: str
|
||||
XML_ERROR_UNDEFINED_ENTITY: str
|
||||
XML_ERROR_UNEXPECTED_STATE: str
|
||||
XML_ERROR_UNKNOWN_ENCODING: str
|
||||
XML_ERROR_XML_DECL: str
|
||||
@@ -0,0 +1,11 @@
|
||||
XML_CTYPE_ANY: int
|
||||
XML_CTYPE_CHOICE: int
|
||||
XML_CTYPE_EMPTY: int
|
||||
XML_CTYPE_MIXED: int
|
||||
XML_CTYPE_NAME: int
|
||||
XML_CTYPE_SEQ: int
|
||||
|
||||
XML_CQUANT_NONE: int
|
||||
XML_CQUANT_OPT: int
|
||||
XML_CQUANT_PLUS: int
|
||||
XML_CQUANT_REP: int
|
||||
@@ -0,0 +1,509 @@
|
||||
from typing import Tuple, overload, Optional, Union, Dict, Any, Sequence, TypeVar, List, Callable, Text
|
||||
import sys
|
||||
if sys.version_info >= (3,):
|
||||
from tkinter import Canvas, PhotoImage
|
||||
else:
|
||||
# TODO: Replace these aliases once we have Python 2 stubs for the Tkinter module.
|
||||
Canvas = Any
|
||||
PhotoImage = Any
|
||||
|
||||
# Note: '_Color' is the alias we use for arguments and _AnyColor is the
|
||||
# alias we use for return types. Really, these two aliases should be the
|
||||
# same, but as per the "no union returns" typeshed policy, we'll return
|
||||
# Any instead.
|
||||
_Color = Union[Text, Tuple[float, float, float]]
|
||||
_AnyColor = Any
|
||||
|
||||
# TODO: Replace this with a TypedDict once it becomes standardized.
|
||||
_PenState = Dict[str, Any]
|
||||
|
||||
_Speed = Union[str, float]
|
||||
_PolygonCoords = Sequence[Tuple[float, float]]
|
||||
|
||||
# TODO: Type this more accurately
|
||||
# Vec2D is actually a custom subclass of 'tuple'.
|
||||
Vec2D = Tuple[float, float]
|
||||
|
||||
class TurtleScreenBase(object):
|
||||
cv: Canvas = ...
|
||||
canvwidth: int = ...
|
||||
canvheight: int = ...
|
||||
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): ...
|
||||
|
||||
class Shape(object):
|
||||
def __init__(self, type_: str, data: Union[_PolygonCoords, PhotoImage, None] = ...) -> None: ...
|
||||
def addcomponent(self, poly: _PolygonCoords, fill: _Color, outline: Optional[_Color] = ...) -> None: ...
|
||||
|
||||
class TurtleScreen(TurtleScreenBase):
|
||||
def __init__(self, cv: Canvas, mode: str = ..., colormode: float = ..., delay: int = ...) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
@overload
|
||||
def mode(self, mode: None = ...) -> str: ...
|
||||
@overload
|
||||
def mode(self, mode: str) -> None: ...
|
||||
def setworldcoordinates(self, llx: float, lly: float, urx: float, ury: float) -> None: ...
|
||||
def register_shape(self, name: str, shape: Union[_PolygonCoords, Shape, None] = ...) -> None: ...
|
||||
@overload
|
||||
def colormode(self, cmode: None = ...) -> float: ...
|
||||
@overload
|
||||
def colormode(self, cmode: float) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def turtles(self) -> List[Turtle]: ...
|
||||
@overload
|
||||
def bgcolor(self) -> _AnyColor: ...
|
||||
@overload
|
||||
def bgcolor(self, color: _Color) -> None: ...
|
||||
@overload
|
||||
def bgcolor(self, r: float, g: float, b: float) -> None: ...
|
||||
@overload
|
||||
def tracer(self, n: None = ...) -> int: ...
|
||||
@overload
|
||||
def tracer(self, n: int, delay: Optional[int] = ...) -> None: ...
|
||||
@overload
|
||||
def delay(self, delay: None = ...) -> int: ...
|
||||
@overload
|
||||
def delay(self, delay: int) -> None: ...
|
||||
def update(self) -> None: ...
|
||||
def window_width(self) -> int: ...
|
||||
def window_height(self) -> int: ...
|
||||
def getcanvas(self) -> Canvas: ...
|
||||
def getshapes(self) -> List[str]: ...
|
||||
def onclick(self, fun: Callable[[float, float], Any], btn: int = ..., add: Optional[Any] = ...) -> None: ...
|
||||
def onkey(self, fun: Callable[[], Any], key: str) -> None: ...
|
||||
def listen(self, xdummy: Optional[float] = ..., ydummy: Optional[float] = ...) -> None: ...
|
||||
def ontimer(self, fun: Callable[[], Any], t: int = ...) -> None: ...
|
||||
@overload
|
||||
def bgpic(self, picname: None = ...) -> str: ...
|
||||
@overload
|
||||
def bgpic(self, picname: str) -> None: ...
|
||||
@overload
|
||||
def screensize(self, canvwidth: None = ..., canvheight: None = ..., bg: None = ...) -> Tuple[int, int]: ...
|
||||
# Looks like if self.cv is not a ScrolledCanvas, this could return a tuple as well
|
||||
@overload
|
||||
def screensize(self, canvwidth: int, canvheight: int, bg: Optional[_Color] = ...) -> None: ...
|
||||
onscreenclick = onclick
|
||||
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] = ...
|
||||
DEFAULT_MODE: str = ...
|
||||
DEFAULT_ANGLEOFFSET: int = ...
|
||||
DEFAULT_ANGLEORIENT: int = ...
|
||||
def __init__(self, mode: str = ...) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def degrees(self, fullcircle: float = ...) -> None: ...
|
||||
def radians(self) -> None: ...
|
||||
def forward(self, distance: float) -> None: ...
|
||||
def back(self, distance: float) -> None: ...
|
||||
def right(self, angle: float) -> None: ...
|
||||
def left(self, angle: float) -> None: ...
|
||||
def pos(self) -> Vec2D: ...
|
||||
def xcor(self) -> float: ...
|
||||
def ycor(self) -> float: ...
|
||||
@overload
|
||||
def goto(self, x: Tuple[float, float], y: None = ...) -> None: ...
|
||||
@overload
|
||||
def goto(self, x: float, y: float) -> None: ...
|
||||
def home(self) -> None: ...
|
||||
def setx(self, x: float) -> None: ...
|
||||
def sety(self, y: float) -> None: ...
|
||||
@overload
|
||||
def distance(self, x: Union[TNavigator, Tuple[float, float]], y: None = ...) -> float: ...
|
||||
@overload
|
||||
def distance(self, x: float, y: float) -> float: ...
|
||||
@overload
|
||||
def towards(self, x: Union[TNavigator, Tuple[float, float]], y: None = ...) -> float: ...
|
||||
@overload
|
||||
def towards(self, x: float, y: float) -> float: ...
|
||||
def heading(self) -> float: ...
|
||||
def setheading(self, to_angle: float) -> None: ...
|
||||
def circle(self, radius: float, extent: Optional[float] = ..., steps: Optional[int] = ...) -> None: ...
|
||||
fd = forward
|
||||
bk = back
|
||||
backward = back
|
||||
rt = right
|
||||
lt = left
|
||||
position = pos
|
||||
setpos = goto
|
||||
setposition = goto
|
||||
seth = setheading
|
||||
|
||||
|
||||
class TPen(object):
|
||||
def __init__(self, resizemode: str = ...) -> None: ...
|
||||
@overload
|
||||
def resizemode(self, rmode: None = ...) -> str: ...
|
||||
@overload
|
||||
def resizemode(self, rmode: str) -> None: ...
|
||||
@overload
|
||||
def pensize(self, width: None = ...) -> int: ...
|
||||
@overload
|
||||
def pensize(self, width: int) -> None: ...
|
||||
def penup(self) -> None: ...
|
||||
def pendown(self) -> None: ...
|
||||
def isdown(self) -> bool: ...
|
||||
@overload
|
||||
def speed(self, speed: None = ...) -> int: ...
|
||||
@overload
|
||||
def speed(self, speed: _Speed) -> None: ...
|
||||
@overload
|
||||
def pencolor(self) -> _AnyColor: ...
|
||||
@overload
|
||||
def pencolor(self, color: _Color) -> None: ...
|
||||
@overload
|
||||
def pencolor(self, r: float, g: float, b: float) -> None: ...
|
||||
@overload
|
||||
def fillcolor(self) -> _AnyColor: ...
|
||||
@overload
|
||||
def fillcolor(self, color: _Color) -> None: ...
|
||||
@overload
|
||||
def fillcolor(self, r: float, g: float, b: float) -> None: ...
|
||||
@overload
|
||||
def color(self) -> Tuple[_AnyColor, _AnyColor]: ...
|
||||
@overload
|
||||
def color(self, color: _Color) -> None: ...
|
||||
@overload
|
||||
def color(self, r: float, g: float, b: float) -> None: ...
|
||||
@overload
|
||||
def color(self, color1: _Color, color2: _Color) -> None: ...
|
||||
def showturtle(self) -> None: ...
|
||||
def hideturtle(self) -> None: ...
|
||||
def isvisible(self) -> bool: ...
|
||||
# Note: signatures 1 and 2 overlap unsafely when no arguments are provided
|
||||
@overload
|
||||
def pen(self) -> _PenState: ... # type: ignore
|
||||
@overload
|
||||
def pen(self, pen: Optional[_PenState] = ..., *,
|
||||
shown: bool = ..., pendown: bool = ..., pencolor: _Color = ..., fillcolor: _Color = ...,
|
||||
pensize: int = ..., speed: int = ..., resizemode: str = ..., stretchfactor: Tuple[float, float] = ...,
|
||||
outline: int = ..., tilt: float = ...) -> None: ...
|
||||
width = pensize
|
||||
up = penup
|
||||
pu = penup
|
||||
pd = pendown
|
||||
down = pendown
|
||||
st = showturtle
|
||||
ht = hideturtle
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class RawTurtle(TPen, TNavigator):
|
||||
def __init__(self, canvas: Union[Canvas, TurtleScreen, None] = ..., shape: str = ..., undobuffersize: int = ..., visible: bool = ...) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def setundobuffer(self, size: Optional[int]) -> None: ...
|
||||
def undobufferentries(self) -> int: ...
|
||||
def clear(self) -> None: ...
|
||||
def clone(self: _T) -> _T: ...
|
||||
@overload
|
||||
def shape(self, name: None = ...) -> str: ...
|
||||
@overload
|
||||
def shape(self, name: str) -> None: ...
|
||||
# Unsafely overlaps when no arguments are provided
|
||||
@overload
|
||||
def shapesize(self) -> Tuple[float, float, float]: ... # type: ignore
|
||||
@overload
|
||||
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: ...
|
||||
@overload
|
||||
def tiltangle(self, angle: float) -> None: ...
|
||||
def tilt(self, angle: float) -> None: ...
|
||||
# Can return either 'int' or Tuple[int, ...] based on if the stamp is
|
||||
# a compound stamp or not. So, as per the "no Union return" policy,
|
||||
# we return Any.
|
||||
def stamp(self) -> Any: ...
|
||||
def clearstamp(self, stampid: Union[int, Tuple[int, ...]]) -> None: ...
|
||||
def clearstamps(self, n: Optional[int] = ...) -> None: ...
|
||||
def filling(self) -> bool: ...
|
||||
def begin_fill(self) -> None: ...
|
||||
def end_fill(self) -> None: ...
|
||||
def dot(self, size: Optional[int] = ..., *color: _Color) -> None: ...
|
||||
def write(self, arg: object, move: bool = ..., align: str = ..., font: Tuple[str, int, str] = ...) -> None: ...
|
||||
def begin_poly(self) -> None: ...
|
||||
def end_poly(self) -> None: ...
|
||||
def get_poly(self) -> Optional[_PolygonCoords]: ...
|
||||
def getscreen(self) -> TurtleScreen: ...
|
||||
def getturtle(self: _T) -> _T: ...
|
||||
getpen = getturtle
|
||||
def onclick(self, fun: Callable[[float, float], Any], btn: int = ..., add: Optional[bool] = ...) -> None: ...
|
||||
def onrelease(self, fun: Callable[[float, float], Any], btn: int = ..., add: Optional[bool] = ...) -> None: ...
|
||||
def ondrag(self, fun: Callable[[float, float], Any], btn: int = ..., add: Optional[bool] = ...) -> None: ...
|
||||
def undo(self) -> None: ...
|
||||
turtlesize = shapesize
|
||||
|
||||
class _Screen(TurtleScreen):
|
||||
def __init__(self) -> None: ...
|
||||
# Note int and float are interpreted differently, hence the Union instead of just float
|
||||
def setup(
|
||||
self,
|
||||
width: Union[int, float] = ...,
|
||||
height: Union[int, float] = ...,
|
||||
startx: Optional[int] = ...,
|
||||
starty: Optional[int] = ...
|
||||
) -> None: ...
|
||||
def title(self, titlestring: str) -> None: ...
|
||||
def bye(self) -> None: ...
|
||||
def exitonclick(self) -> None: ...
|
||||
|
||||
def Screen() -> _Screen: ...
|
||||
|
||||
class Turtle(RawTurtle):
|
||||
def __init__(self, shape: str = ..., undobuffersize: int = ..., visible: bool = ...) -> None: ...
|
||||
|
||||
RawPen = RawTurtle
|
||||
Pen = Turtle
|
||||
|
||||
def write_docstringdict(filename: str = ...) -> None: ...
|
||||
|
||||
# Note: it's somewhat unfortunate that we have to copy the function signatures.
|
||||
# It would be nice if we could partially reduce the redundancy by doing something
|
||||
# like the following:
|
||||
#
|
||||
# _screen: Screen
|
||||
# clear = _screen.clear
|
||||
#
|
||||
# However, it seems pytype does not support this type of syntax in pyi files.
|
||||
|
||||
# Functions copied from TurtleScreenBase:
|
||||
|
||||
# Note: mainloop() was always present in the global scope, but was added to
|
||||
# TurtleScreenBase in Python 3.0
|
||||
def mainloop() -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
def textinput(title: str, prompt: str) -> Optional[str]: ...
|
||||
def numinput(title: str, prompt: str, default: Optional[float] = ..., minval: Optional[float] = ..., maxval: Optional[float] = ...) -> Optional[float]: ...
|
||||
|
||||
# Functions copied from TurtleScreen:
|
||||
|
||||
def clear() -> None: ...
|
||||
@overload
|
||||
def mode(mode: None = ...) -> str: ...
|
||||
@overload
|
||||
def mode(mode: str) -> None: ...
|
||||
def setworldcoordinates(llx: float, lly: float, urx: float, ury: float) -> None: ...
|
||||
def register_shape(name: str, shape: Union[_PolygonCoords, Shape, None] = ...) -> None: ...
|
||||
@overload
|
||||
def colormode(cmode: None = ...) -> float: ...
|
||||
@overload
|
||||
def colormode(cmode: float) -> None: ...
|
||||
def reset() -> None: ...
|
||||
def turtles() -> List[Turtle]: ...
|
||||
@overload
|
||||
def bgcolor() -> _AnyColor: ...
|
||||
@overload
|
||||
def bgcolor(color: _Color) -> None: ...
|
||||
@overload
|
||||
def bgcolor(r: float, g: float, b: float) -> None: ...
|
||||
@overload
|
||||
def tracer(n: None = ...) -> int: ...
|
||||
@overload
|
||||
def tracer(n: int, delay: Optional[int] = ...) -> None: ...
|
||||
@overload
|
||||
def delay(delay: None = ...) -> int: ...
|
||||
@overload
|
||||
def delay(delay: int) -> None: ...
|
||||
def update() -> None: ...
|
||||
def window_width() -> int: ...
|
||||
def window_height() -> int: ...
|
||||
def getcanvas() -> Canvas: ...
|
||||
def getshapes() -> List[str]: ...
|
||||
def onclick(fun: Callable[[float, float], Any], btn: int = ..., add: Optional[Any] = ...) -> None: ...
|
||||
def onkey(fun: Callable[[], Any], key: str) -> None: ...
|
||||
def listen(xdummy: Optional[float] = ..., ydummy: Optional[float] = ...) -> None: ...
|
||||
def ontimer(fun: Callable[[], Any], t: int = ...) -> None: ...
|
||||
@overload
|
||||
def bgpic(picname: None = ...) -> str: ...
|
||||
@overload
|
||||
def bgpic(picname: str) -> None: ...
|
||||
@overload
|
||||
def screensize(canvwidth: None = ..., canvheight: None = ..., bg: None = ...) -> Tuple[int, int]: ...
|
||||
@overload
|
||||
def screensize(canvwidth: int, canvheight: int, bg: Optional[_Color] = ...) -> None: ...
|
||||
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 TNavigator:
|
||||
|
||||
def degrees(fullcircle: float = ...) -> None: ...
|
||||
def radians() -> None: ...
|
||||
def forward(distance: float) -> None: ...
|
||||
def back(distance: float) -> None: ...
|
||||
def right(angle: float) -> None: ...
|
||||
def left(angle: float) -> None: ...
|
||||
def pos() -> Vec2D: ...
|
||||
def xcor() -> float: ...
|
||||
def ycor() -> float: ...
|
||||
@overload
|
||||
def goto(x: Tuple[float, float], y: None = ...) -> None: ...
|
||||
@overload
|
||||
def goto(x: float, y: float) -> None: ...
|
||||
def home() -> None: ...
|
||||
def setx(x: float) -> None: ...
|
||||
def sety(y: float) -> None: ...
|
||||
@overload
|
||||
def distance(x: Union[TNavigator, Tuple[float, float]], y: None = ...) -> float: ...
|
||||
@overload
|
||||
def distance(x: float, y: float) -> float: ...
|
||||
@overload
|
||||
def towards(x: Union[TNavigator, Tuple[float, float]], y: None = ...) -> float: ...
|
||||
@overload
|
||||
def towards(x: float, y: float) -> float: ...
|
||||
def heading() -> float: ...
|
||||
def setheading(to_angle: float) -> None: ...
|
||||
def circle(radius: float, extent: Optional[float] = ..., steps: Optional[int] = ...) -> None: ...
|
||||
fd = forward
|
||||
bk = back
|
||||
backward = back
|
||||
rt = right
|
||||
lt = left
|
||||
position = pos
|
||||
setpos = goto
|
||||
setposition = goto
|
||||
seth = setheading
|
||||
|
||||
# Functions copied from TPen:
|
||||
|
||||
@overload
|
||||
def resizemode(rmode: None = ...) -> str: ...
|
||||
@overload
|
||||
def resizemode(rmode: str) -> None: ...
|
||||
@overload
|
||||
def pensize(width: None = ...) -> int: ...
|
||||
@overload
|
||||
def pensize(width: int) -> None: ...
|
||||
def penup() -> None: ...
|
||||
def pendown() -> None: ...
|
||||
def isdown() -> bool: ...
|
||||
@overload
|
||||
def speed(speed: None = ...) -> int: ...
|
||||
@overload
|
||||
def speed(speed: _Speed) -> None: ...
|
||||
@overload
|
||||
def pencolor() -> _AnyColor: ...
|
||||
@overload
|
||||
def pencolor(color: _Color) -> None: ...
|
||||
@overload
|
||||
def pencolor(r: float, g: float, b: float) -> None: ...
|
||||
@overload
|
||||
def fillcolor() -> _AnyColor: ...
|
||||
@overload
|
||||
def fillcolor(color: _Color) -> None: ...
|
||||
@overload
|
||||
def fillcolor(r: float, g: float, b: float) -> None: ...
|
||||
@overload
|
||||
def color() -> Tuple[_AnyColor, _AnyColor]: ...
|
||||
@overload
|
||||
def color(color: _Color) -> None: ...
|
||||
@overload
|
||||
def color(r: float, g: float, b: float) -> None: ...
|
||||
@overload
|
||||
def color(color1: _Color, color2: _Color) -> None: ...
|
||||
def showturtle() -> None: ...
|
||||
def hideturtle() -> None: ...
|
||||
def isvisible() -> bool: ...
|
||||
# Note: signatures 1 and 2 overlap unsafely when no arguments are provided
|
||||
@overload
|
||||
def pen() -> _PenState: ... # type: ignore
|
||||
@overload
|
||||
def pen(pen: Optional[_PenState] = ..., *,
|
||||
shown: bool = ..., pendown: bool = ..., pencolor: _Color = ..., fillcolor: _Color = ...,
|
||||
pensize: int = ..., speed: int = ..., resizemode: str = ..., stretchfactor: Tuple[float, float] = ...,
|
||||
outline: int = ..., tilt: float = ...) -> None: ...
|
||||
width = pensize
|
||||
up = penup
|
||||
pu = penup
|
||||
pd = pendown
|
||||
down = pendown
|
||||
st = showturtle
|
||||
ht = hideturtle
|
||||
|
||||
# Functions copied from RawTurtle:
|
||||
|
||||
def setundobuffer(size: Optional[int]) -> None: ...
|
||||
def undobufferentries() -> int: ...
|
||||
@overload
|
||||
def shape(name: None = ...) -> str: ...
|
||||
@overload
|
||||
def shape(name: str) -> None: ...
|
||||
# Unsafely overlaps when no arguments are provided
|
||||
@overload
|
||||
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: ...
|
||||
@overload
|
||||
def tiltangle(angle: float) -> None: ...
|
||||
def tilt(angle: float) -> None: ...
|
||||
# Can return either 'int' or Tuple[int, ...] based on if the stamp is
|
||||
# a compound stamp or not. So, as per the "no Union return" policy,
|
||||
# we return Any.
|
||||
def stamp() -> Any: ...
|
||||
def clearstamp(stampid: Union[int, Tuple[int, ...]]) -> None: ...
|
||||
def clearstamps(n: Optional[int] = ...) -> None: ...
|
||||
def filling() -> bool: ...
|
||||
def begin_fill() -> None: ...
|
||||
def end_fill() -> None: ...
|
||||
def dot(size: Optional[int] = ..., *color: _Color) -> None: ...
|
||||
def write(arg: object, move: bool = ..., align: str = ..., font: Tuple[str, int, str] = ...) -> None: ...
|
||||
def begin_poly() -> None: ...
|
||||
def end_poly() -> None: ...
|
||||
def get_poly() -> Optional[_PolygonCoords]: ...
|
||||
def getscreen() -> TurtleScreen: ...
|
||||
def getturtle() -> Turtle: ...
|
||||
getpen = getturtle
|
||||
def onrelease(fun: Callable[[float, float], Any], btn: int = ..., add: Optional[Any] = ...) -> None: ...
|
||||
def ondrag(fun: Callable[[float, float], Any], btn: int = ..., add: Optional[Any] = ...) -> None: ...
|
||||
def undo() -> None: ...
|
||||
turtlesize = shapesize
|
||||
|
||||
# Functions copied from RawTurtle with a few tweaks:
|
||||
|
||||
def clone() -> Turtle: ...
|
||||
|
||||
# Extra functions present only in the global scope:
|
||||
|
||||
done = mainloop
|
||||
@@ -0,0 +1,44 @@
|
||||
# Stubs for _thread
|
||||
|
||||
import sys
|
||||
from threading import Thread
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, Dict, NamedTuple, NoReturn, Optional, Tuple, Type
|
||||
|
||||
error = RuntimeError
|
||||
|
||||
def _count() -> int: ...
|
||||
|
||||
_dangling: Any
|
||||
|
||||
class LockType:
|
||||
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
def locked(self) -> bool: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self,
|
||||
type: Optional[Type[BaseException]],
|
||||
value: Optional[BaseException],
|
||||
traceback: Optional[TracebackType],
|
||||
) -> None: ...
|
||||
|
||||
def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> int: ...
|
||||
def interrupt_main() -> None: ...
|
||||
def exit() -> NoReturn: ...
|
||||
def allocate_lock() -> LockType: ...
|
||||
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(NamedTuple):
|
||||
exc_type: Type[BaseException]
|
||||
exc_value: Optional[BaseException]
|
||||
exc_traceback: Optional[TracebackType]
|
||||
thread: Optional[Thread]
|
||||
def _ExceptHookArgs(args) -> ExceptHookArgs: ...
|
||||
_excepthook: Callable[[ExceptHookArgs], Any]
|
||||
@@ -0,0 +1,239 @@
|
||||
# Based on http://docs.python.org/3.5/library/configparser.html and on
|
||||
# reading configparser.py.
|
||||
|
||||
import sys
|
||||
from typing import (AbstractSet, MutableMapping, Mapping, Dict, Sequence, List,
|
||||
Union, Iterable, Iterator, Callable, Any, IO, overload,
|
||||
Optional, Pattern, Type, TypeVar, ClassVar)
|
||||
# Types only used in type comments only
|
||||
from typing import Optional, Tuple # noqa
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from os import PathLike
|
||||
|
||||
# Internal type aliases
|
||||
_section = Mapping[str, str]
|
||||
_parser = MutableMapping[str, _section]
|
||||
_converter = Callable[[str], Any]
|
||||
_converters = Dict[str, _converter]
|
||||
_T = TypeVar('_T')
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
_Path = Union[str, bytes, PathLike[str]]
|
||||
elif sys.version_info >= (3, 6):
|
||||
_Path = Union[str, PathLike[str]]
|
||||
else:
|
||||
_Path = str
|
||||
|
||||
DEFAULTSECT: str
|
||||
MAX_INTERPOLATION_DEPTH: int
|
||||
|
||||
class Interpolation:
|
||||
def before_get(self, parser: _parser,
|
||||
section: str,
|
||||
option: str,
|
||||
value: str,
|
||||
defaults: _section) -> str: ...
|
||||
|
||||
def before_set(self, parser: _parser,
|
||||
section: str,
|
||||
option: str,
|
||||
value: str) -> str: ...
|
||||
|
||||
def before_read(self, parser: _parser,
|
||||
section: str,
|
||||
option: str,
|
||||
value: str) -> str: ...
|
||||
|
||||
def before_write(self, parser: _parser,
|
||||
section: str,
|
||||
option: str,
|
||||
value: str) -> str: ...
|
||||
|
||||
|
||||
class BasicInterpolation(Interpolation): ...
|
||||
class ExtendedInterpolation(Interpolation): ...
|
||||
class LegacyInterpolation(Interpolation): ...
|
||||
|
||||
|
||||
class RawConfigParser(_parser):
|
||||
BOOLEAN_STATES: ClassVar[Mapping[str, bool]] = ... # Undocumented
|
||||
def __init__(self,
|
||||
defaults: Optional[_section] = ...,
|
||||
dict_type: Type[Mapping[str, str]] = ...,
|
||||
allow_no_value: bool = ...,
|
||||
*,
|
||||
delimiters: Sequence[str] = ...,
|
||||
comment_prefixes: Sequence[str] = ...,
|
||||
inline_comment_prefixes: Optional[Sequence[str]] = ...,
|
||||
strict: bool = ...,
|
||||
empty_lines_in_values: bool = ...,
|
||||
default_section: str = ...,
|
||||
interpolation: Optional[Interpolation] = ...,
|
||||
converters: _converters = ...) -> None: ...
|
||||
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
def __getitem__(self, section: str) -> SectionProxy: ...
|
||||
|
||||
def __setitem__(self, section: str, options: _section) -> None: ...
|
||||
|
||||
def __delitem__(self, section: str) -> None: ...
|
||||
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
|
||||
def defaults(self) -> _section: ...
|
||||
|
||||
def sections(self) -> List[str]: ...
|
||||
|
||||
def add_section(self, section: str) -> None: ...
|
||||
|
||||
def has_section(self, section: str) -> bool: ...
|
||||
|
||||
def options(self, section: str) -> List[str]: ...
|
||||
|
||||
def has_option(self, section: str, option: str) -> bool: ...
|
||||
|
||||
def read(self, filenames: Union[_Path, Iterable[_Path]],
|
||||
encoding: Optional[str] = ...) -> List[str]: ...
|
||||
def read_file(self, f: Iterable[str], source: Optional[str] = ...) -> None: ...
|
||||
def read_string(self, string: str, source: str = ...) -> None: ...
|
||||
def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]],
|
||||
source: str = ...) -> None: ...
|
||||
def readfp(self, fp: Iterable[str], filename: Optional[str] = ...) -> None: ...
|
||||
|
||||
# These get* methods are partially applied (with the same names) in
|
||||
# SectionProxy; the stubs should be kept updated together
|
||||
|
||||
@overload
|
||||
def getint(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ...) -> int: ...
|
||||
@overload
|
||||
def getint(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> Union[int, _T]: ...
|
||||
@overload
|
||||
def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ...) -> float: ...
|
||||
@overload
|
||||
def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> Union[float, _T]: ...
|
||||
@overload
|
||||
def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ...) -> bool: ...
|
||||
@overload
|
||||
def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> Union[bool, _T]: ...
|
||||
|
||||
def _get_conv(self, section: str, option: str, conv: Callable[[str], _T], *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> _T: ...
|
||||
|
||||
# This is incompatible with MutableMapping so we ignore the type
|
||||
@overload # type: ignore
|
||||
def get(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ...) -> str: ...
|
||||
|
||||
@overload
|
||||
def get(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T) -> Union[str, _T]: ...
|
||||
|
||||
@overload
|
||||
def items(self, *, raw: bool = ..., vars: Optional[_section] = ...) -> AbstractSet[Tuple[str, SectionProxy]]: ...
|
||||
|
||||
@overload
|
||||
def items(self, section: str, raw: bool = ..., vars: Optional[_section] = ...) -> List[Tuple[str, str]]: ...
|
||||
|
||||
def set(self, section: str, option: str, value: Optional[str] = ...) -> None: ...
|
||||
|
||||
def write(self, fp: IO[str], space_around_delimiters: bool = ...) -> None: ...
|
||||
|
||||
def remove_option(self, section: str, option: str) -> bool: ...
|
||||
|
||||
def remove_section(self, section: str) -> bool: ...
|
||||
|
||||
def optionxform(self, optionstr: str) -> str: ...
|
||||
|
||||
|
||||
class ConfigParser(RawConfigParser): ...
|
||||
|
||||
class SafeConfigParser(ConfigParser): ...
|
||||
|
||||
class SectionProxy(MutableMapping[str, str]):
|
||||
def __init__(self, parser: RawConfigParser, name: str) -> None: ...
|
||||
def __getitem__(self, key: str) -> str: ...
|
||||
def __setitem__(self, key: str, value: str) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def __contains__(self, key: object) -> bool: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
@property
|
||||
def parser(self) -> RawConfigParser: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
def get(self, option: str, fallback: Optional[str] = ..., *, raw: bool = ..., vars: Optional[_section] = ..., **kwargs: Any) -> str: ... # type: ignore
|
||||
|
||||
# These are partially-applied version of the methods with the same names in
|
||||
# RawConfigParser; the stubs should be kept updated together
|
||||
@overload
|
||||
def getint(self, option: str, *, raw: bool = ..., vars: Optional[_section] = ...) -> int: ...
|
||||
@overload
|
||||
def getint(self, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> Union[int, _T]: ...
|
||||
@overload
|
||||
def getfloat(self, option: str, *, raw: bool = ..., vars: Optional[_section] = ...) -> float: ...
|
||||
@overload
|
||||
def getfloat(self, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> Union[float, _T]: ...
|
||||
@overload
|
||||
def getboolean(self, option: str, *, raw: bool = ..., vars: Optional[_section] = ...) -> bool: ...
|
||||
@overload
|
||||
def getboolean(self, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> Union[bool, _T]: ...
|
||||
|
||||
# SectionProxy can have arbitrary attributes when custon converters are used
|
||||
def __getattr__(self, key: str) -> Callable[..., Any]: ...
|
||||
|
||||
class ConverterMapping(MutableMapping[str, Optional[_converter]]):
|
||||
GETTERCRE: Pattern[Any]
|
||||
def __init__(self, parser: RawConfigParser) -> None: ...
|
||||
def __getitem__(self, key: str) -> _converter: ...
|
||||
def __setitem__(self, key: str, value: Optional[_converter]) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
|
||||
class NoSectionError(Error): ...
|
||||
|
||||
|
||||
class DuplicateSectionError(Error):
|
||||
section: str
|
||||
source: Optional[str]
|
||||
lineno: Optional[int]
|
||||
|
||||
|
||||
class DuplicateOptionError(Error):
|
||||
section: str
|
||||
option: str
|
||||
source: Optional[str]
|
||||
lineno: Optional[int]
|
||||
|
||||
|
||||
class NoOptionError(Error):
|
||||
section: str
|
||||
option: str
|
||||
|
||||
|
||||
class InterpolationError(Error):
|
||||
section: str
|
||||
option: str
|
||||
|
||||
|
||||
class InterpolationDepthError(InterpolationError): ...
|
||||
|
||||
|
||||
class InterpolationMissingOptionError(InterpolationError):
|
||||
reference: str
|
||||
|
||||
|
||||
class InterpolationSyntaxError(InterpolationError): ...
|
||||
|
||||
|
||||
class ParsingError(Error):
|
||||
source: str
|
||||
errors: Sequence[Tuple[int, str]]
|
||||
|
||||
|
||||
class MissingSectionHeaderError(ParsingError):
|
||||
lineno: int
|
||||
line: str
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
from typing import Union, MutableMapping
|
||||
|
||||
_KeyType = Union[str, bytes]
|
||||
_ValueType = Union[str, bytes]
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
def whichdb(filename: str) -> str: ...
|
||||
|
||||
def open(file: str, flag: str = ..., mode: int = ...) -> MutableMapping[_KeyType, _ValueType]: ...
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
import sys
|
||||
from typing import Union, MutableMapping, Iterator, Optional, Type
|
||||
from types import TracebackType
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Final
|
||||
else:
|
||||
from typing_extensions import Final
|
||||
|
||||
_KeyType = Union[str, bytes]
|
||||
_ValueType = Union[str, bytes]
|
||||
|
||||
error = OSError
|
||||
|
||||
class _Database(MutableMapping[_KeyType, bytes]):
|
||||
|
||||
def __init__(self, filebasename: str, mode: str, flag: str = ...) -> None: ...
|
||||
def sync(self) -> None: ...
|
||||
def iterkeys(self) -> Iterator[bytes]: ... # undocumented
|
||||
def close(self) -> None: ...
|
||||
def __getitem__(self, key: _KeyType) -> bytes: ...
|
||||
def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ...
|
||||
def __delitem__(self, key: _KeyType) -> None: ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self) -> _Database: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
|
||||
|
||||
def open(file: str, flag: str = ..., mode: int = ...) -> _Database: ...
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
from typing import Union, Optional, Type, Iterator, overload, List, TypeVar, Generic
|
||||
from types import TracebackType
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_KeyType = Union[str, bytes]
|
||||
_ValueType = Union[str, bytes]
|
||||
|
||||
class error(OSError): ...
|
||||
|
||||
# Actual typename gdbm, not exposed by the implementation
|
||||
class _gdbm:
|
||||
def firstkey(self) -> Optional[bytes]: ...
|
||||
def nextkey(self, key: _KeyType) -> Optional[bytes]: ...
|
||||
def reorganize(self) -> None: ...
|
||||
def sync(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def __getitem__(self, item: _KeyType) -> bytes: ...
|
||||
def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ...
|
||||
def __delitem__(self, key: _KeyType) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __enter__(self) -> _gdbm: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
|
||||
|
||||
@overload
|
||||
def get(self, k: _KeyType) -> Optional[bytes]: ...
|
||||
@overload
|
||||
def get(self, k: _KeyType, default: Union[bytes, _T]) -> Union[bytes, _T]: ...
|
||||
def keys(self) -> List[bytes]: ...
|
||||
def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ...
|
||||
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore
|
||||
__init__: None # type: ignore
|
||||
|
||||
def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _gdbm: ...
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
from typing import Generic, Union, Iterator, Optional, Type, TypeVar, overload, List
|
||||
from types import TracebackType
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_KeyType = Union[str, bytes]
|
||||
_ValueType = Union[str, bytes]
|
||||
|
||||
class error(OSError): ...
|
||||
|
||||
library: str = ...
|
||||
|
||||
# Actual typename dbm, not exposed by the implementation
|
||||
class _dbm:
|
||||
|
||||
def close(self) -> None: ...
|
||||
def __getitem__(self, item: _KeyType) -> bytes: ...
|
||||
def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ...
|
||||
def __delitem__(self, key: _KeyType) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self) -> _dbm: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
|
||||
|
||||
@overload
|
||||
def get(self, k: _KeyType) -> Optional[bytes]: ...
|
||||
@overload
|
||||
def get(self, k: _KeyType, default: Union[bytes, _T]) -> Union[bytes, _T]: ...
|
||||
def keys(self) -> List[bytes]: ...
|
||||
def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ...
|
||||
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore
|
||||
__init__: None # type: ignore
|
||||
|
||||
def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _dbm: ...
|
||||
@@ -0,0 +1,69 @@
|
||||
import sys
|
||||
from enum import IntEnum
|
||||
|
||||
class HTTPStatus(IntEnum):
|
||||
@property
|
||||
def phrase(self) -> str: ...
|
||||
@property
|
||||
def description(self) -> str: ...
|
||||
CONTINUE: int
|
||||
SWITCHING_PROTOCOLS: int
|
||||
PROCESSING: int
|
||||
OK: int
|
||||
CREATED: int
|
||||
ACCEPTED: int
|
||||
NON_AUTHORITATIVE_INFORMATION: int
|
||||
NO_CONTENT: int
|
||||
RESET_CONTENT: int
|
||||
PARTIAL_CONTENT: int
|
||||
MULTI_STATUS: int
|
||||
ALREADY_REPORTED: int
|
||||
IM_USED: int
|
||||
MULTIPLE_CHOICES: int
|
||||
MOVED_PERMANENTLY: int
|
||||
FOUND: int
|
||||
SEE_OTHER: int
|
||||
NOT_MODIFIED: int
|
||||
USE_PROXY: int
|
||||
TEMPORARY_REDIRECT: int
|
||||
PERMANENT_REDIRECT: int
|
||||
BAD_REQUEST: int
|
||||
UNAUTHORIZED: int
|
||||
PAYMENT_REQUIRED: int
|
||||
FORBIDDEN: int
|
||||
NOT_FOUND: int
|
||||
METHOD_NOT_ALLOWED: int
|
||||
NOT_ACCEPTABLE: int
|
||||
PROXY_AUTHENTICATION_REQUIRED: int
|
||||
REQUEST_TIMEOUT: int
|
||||
CONFLICT: int
|
||||
GONE: int
|
||||
LENGTH_REQUIRED: int
|
||||
PRECONDITION_FAILED: int
|
||||
REQUEST_ENTITY_TOO_LARGE: int
|
||||
REQUEST_URI_TOO_LONG: int
|
||||
UNSUPPORTED_MEDIA_TYPE: int
|
||||
REQUESTED_RANGE_NOT_SATISFIABLE: int
|
||||
EXPECTATION_FAILED: int
|
||||
UNPROCESSABLE_ENTITY: int
|
||||
LOCKED: int
|
||||
FAILED_DEPENDENCY: int
|
||||
UPGRADE_REQUIRED: int
|
||||
PRECONDITION_REQUIRED: int
|
||||
TOO_MANY_REQUESTS: int
|
||||
REQUEST_HEADER_FIELDS_TOO_LARGE: int
|
||||
INTERNAL_SERVER_ERROR: int
|
||||
NOT_IMPLEMENTED: int
|
||||
BAD_GATEWAY: int
|
||||
SERVICE_UNAVAILABLE: int
|
||||
GATEWAY_TIMEOUT: int
|
||||
HTTP_VERSION_NOT_SUPPORTED: int
|
||||
VARIANT_ALSO_NEGOTIATES: int
|
||||
INSUFFICIENT_STORAGE: int
|
||||
LOOP_DETECTED: int
|
||||
NOT_EXTENDED: int
|
||||
NETWORK_AUTHENTICATION_REQUIRED: int
|
||||
if sys.version_info >= (3, 7):
|
||||
MISDIRECTED_REQUEST: int
|
||||
if sys.version_info >= (3, 8):
|
||||
UNAVAILABLE_FOR_LEGAL_REASONS: int
|
||||
@@ -0,0 +1,200 @@
|
||||
from typing import (
|
||||
Any, Dict, IO, Iterable, List, Iterator, Mapping, Optional,
|
||||
Protocol, Tuple, Type, TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
BinaryIO,
|
||||
)
|
||||
import email.message
|
||||
import io
|
||||
from socket import socket
|
||||
import sys
|
||||
import ssl
|
||||
import types
|
||||
|
||||
_DataType = Union[bytes, IO[Any], Iterable[bytes], str]
|
||||
_T = TypeVar('_T')
|
||||
|
||||
HTTP_PORT: int
|
||||
HTTPS_PORT: int
|
||||
|
||||
CONTINUE: int
|
||||
SWITCHING_PROTOCOLS: int
|
||||
PROCESSING: int
|
||||
|
||||
OK: int
|
||||
CREATED: int
|
||||
ACCEPTED: int
|
||||
NON_AUTHORITATIVE_INFORMATION: int
|
||||
NO_CONTENT: int
|
||||
RESET_CONTENT: int
|
||||
PARTIAL_CONTENT: int
|
||||
MULTI_STATUS: int
|
||||
IM_USED: int
|
||||
|
||||
MULTIPLE_CHOICES: int
|
||||
MOVED_PERMANENTLY: int
|
||||
FOUND: int
|
||||
SEE_OTHER: int
|
||||
NOT_MODIFIED: int
|
||||
USE_PROXY: int
|
||||
TEMPORARY_REDIRECT: int
|
||||
|
||||
BAD_REQUEST: int
|
||||
UNAUTHORIZED: int
|
||||
PAYMENT_REQUIRED: int
|
||||
FORBIDDEN: int
|
||||
NOT_FOUND: int
|
||||
METHOD_NOT_ALLOWED: int
|
||||
NOT_ACCEPTABLE: int
|
||||
PROXY_AUTHENTICATION_REQUIRED: int
|
||||
REQUEST_TIMEOUT: int
|
||||
CONFLICT: int
|
||||
GONE: int
|
||||
LENGTH_REQUIRED: int
|
||||
PRECONDITION_FAILED: int
|
||||
REQUEST_ENTITY_TOO_LARGE: int
|
||||
REQUEST_URI_TOO_LONG: int
|
||||
UNSUPPORTED_MEDIA_TYPE: int
|
||||
REQUESTED_RANGE_NOT_SATISFIABLE: int
|
||||
EXPECTATION_FAILED: int
|
||||
UNPROCESSABLE_ENTITY: int
|
||||
LOCKED: int
|
||||
FAILED_DEPENDENCY: int
|
||||
UPGRADE_REQUIRED: int
|
||||
PRECONDITION_REQUIRED: int
|
||||
TOO_MANY_REQUESTS: int
|
||||
REQUEST_HEADER_FIELDS_TOO_LARGE: int
|
||||
|
||||
INTERNAL_SERVER_ERROR: int
|
||||
NOT_IMPLEMENTED: int
|
||||
BAD_GATEWAY: int
|
||||
SERVICE_UNAVAILABLE: int
|
||||
GATEWAY_TIMEOUT: int
|
||||
HTTP_VERSION_NOT_SUPPORTED: int
|
||||
INSUFFICIENT_STORAGE: int
|
||||
NOT_EXTENDED: int
|
||||
NETWORK_AUTHENTICATION_REQUIRED: int
|
||||
|
||||
responses: Dict[int, str]
|
||||
|
||||
class HTTPMessage(email.message.Message): ...
|
||||
|
||||
class HTTPResponse(io.BufferedIOBase, BinaryIO):
|
||||
msg: HTTPMessage
|
||||
headers: HTTPMessage
|
||||
version: int
|
||||
debuglevel: int
|
||||
closed: bool
|
||||
status: int
|
||||
reason: str
|
||||
def __init__(self, sock: socket, debuglevel: int = ...,
|
||||
method: Optional[str] = ..., url: Optional[str] = ...) -> None: ...
|
||||
def read(self, amt: Optional[int] = ...) -> bytes: ...
|
||||
@overload
|
||||
def getheader(self, name: str) -> Optional[str]: ...
|
||||
@overload
|
||||
def getheader(self, name: str, default: _T) -> Union[str, _T]: ...
|
||||
def getheaders(self) -> List[Tuple[str, str]]: ...
|
||||
def fileno(self) -> int: ...
|
||||
def isclosed(self) -> bool: ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
def __enter__(self) -> HTTPResponse: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]],
|
||||
exc_val: Optional[BaseException],
|
||||
exc_tb: Optional[types.TracebackType]) -> Optional[bool]: ...
|
||||
def info(self) -> email.message.Message: ...
|
||||
def geturl(self) -> str: ...
|
||||
def getcode(self) -> int: ...
|
||||
def begin(self) -> None: ...
|
||||
|
||||
# This is an API stub only for the class below, not a class itself.
|
||||
# urllib.request uses it for a parameter.
|
||||
class _HTTPConnectionProtocol(Protocol):
|
||||
if sys.version_info >= (3, 7):
|
||||
def __call__(
|
||||
self,
|
||||
host: str,
|
||||
port: Optional[int] = ...,
|
||||
timeout: float = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...,
|
||||
blocksize: int = ...,
|
||||
) -> HTTPConnection: ...
|
||||
else:
|
||||
def __call__(
|
||||
self, host: str, port: Optional[int] = ..., timeout: float = ..., source_address: Optional[Tuple[str, int]] = ...,
|
||||
) -> HTTPConnection: ...
|
||||
|
||||
class HTTPConnection:
|
||||
timeout: Optional[float]
|
||||
host: str
|
||||
port: int
|
||||
sock: Any
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(
|
||||
self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
timeout: Optional[float] = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ..., blocksize: int = ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
timeout: Optional[float] = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def request(self, method: str, url: str,
|
||||
body: Optional[_DataType] = ...,
|
||||
headers: Mapping[str, str] = ...,
|
||||
*, encode_chunked: bool = ...) -> None: ...
|
||||
else:
|
||||
def request(self, method: str, url: str,
|
||||
body: Optional[_DataType] = ...,
|
||||
headers: Mapping[str, str] = ...) -> None: ...
|
||||
def getresponse(self) -> HTTPResponse: ...
|
||||
def set_debuglevel(self, level: int) -> None: ...
|
||||
def set_tunnel(self, host: str, port: Optional[int] = ...,
|
||||
headers: Optional[Mapping[str, str]] = ...) -> None: ...
|
||||
def connect(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def putrequest(self, method: str, url: str, skip_host: bool = ...,
|
||||
skip_accept_encoding: bool = ...) -> None: ...
|
||||
def putheader(self, header: str, *argument: str) -> None: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def endheaders(self, message_body: Optional[_DataType] = ...,
|
||||
*, encode_chunked: bool = ...) -> None: ...
|
||||
else:
|
||||
def endheaders(self, message_body: Optional[_DataType] = ...) -> None: ...
|
||||
def send(self, data: _DataType) -> None: ...
|
||||
|
||||
class HTTPSConnection(HTTPConnection):
|
||||
def __init__(self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
key_file: Optional[str] = ...,
|
||||
cert_file: Optional[str] = ...,
|
||||
timeout: Optional[float] = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...,
|
||||
*, context: Optional[ssl.SSLContext] = ...,
|
||||
check_hostname: Optional[bool] = ...) -> None: ...
|
||||
|
||||
class HTTPException(Exception): ...
|
||||
error = HTTPException
|
||||
|
||||
class NotConnected(HTTPException): ...
|
||||
class InvalidURL(HTTPException): ...
|
||||
class UnknownProtocol(HTTPException): ...
|
||||
class UnknownTransferEncoding(HTTPException): ...
|
||||
class UnimplementedFileMode(HTTPException): ...
|
||||
class IncompleteRead(HTTPException): ...
|
||||
|
||||
class ImproperConnectionState(HTTPException): ...
|
||||
class CannotSendRequest(ImproperConnectionState): ...
|
||||
class CannotSendHeader(ImproperConnectionState): ...
|
||||
class ResponseNotReady(ImproperConnectionState): ...
|
||||
|
||||
class BadStatusLine(HTTPException): ...
|
||||
class LineTooLong(HTTPException): ...
|
||||
|
||||
class RemoteDisconnected(ConnectionResetError, BadStatusLine): ...
|
||||
@@ -0,0 +1,123 @@
|
||||
import sys
|
||||
from typing import Dict, Iterable, Iterator, Optional, Sequence, Tuple, TypeVar, Union, overload
|
||||
from http.client import HTTPResponse
|
||||
from urllib.request import Request
|
||||
if sys.version_info >= (3, 6):
|
||||
from os import PathLike
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class LoadError(OSError): ...
|
||||
|
||||
|
||||
class CookieJar(Iterable[Cookie]):
|
||||
def __init__(self, policy: Optional[CookiePolicy] = ...) -> None: ...
|
||||
def add_cookie_header(self, request: Request) -> None: ...
|
||||
def extract_cookies(self, response: HTTPResponse,
|
||||
request: Request) -> None: ...
|
||||
def set_policy(self, policy: CookiePolicy) -> None: ...
|
||||
def make_cookies(self, response: HTTPResponse,
|
||||
request: Request) -> Sequence[Cookie]: ...
|
||||
def set_cookie(self, cookie: Cookie) -> None: ...
|
||||
def set_cookie_if_ok(self, cookie: Cookie,
|
||||
request: Request) -> None: ...
|
||||
def clear(self, domain: str = ..., path: str = ...,
|
||||
name: str = ...) -> None: ...
|
||||
def clear_session_cookies(self) -> None: ...
|
||||
def __iter__(self) -> Iterator[Cookie]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class FileCookieJar(CookieJar):
|
||||
filename: str
|
||||
delayload: bool
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(self, filename: Union[str, PathLike[str]] = ..., delayload: bool = ...,
|
||||
policy: Optional[CookiePolicy] = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, filename: str = ..., delayload: bool = ...,
|
||||
policy: Optional[CookiePolicy] = ...) -> None: ...
|
||||
def save(self, filename: Optional[str] = ..., ignore_discard: bool = ...,
|
||||
ignore_expires: bool = ...) -> None: ...
|
||||
def load(self, filename: Optional[str] = ..., ignore_discard: bool = ...,
|
||||
ignore_expires: bool = ...) -> None: ...
|
||||
def revert(self, filename: Optional[str] = ..., ignore_discard: bool = ...,
|
||||
ignore_expires: bool = ...) -> None: ...
|
||||
|
||||
class MozillaCookieJar(FileCookieJar): ...
|
||||
|
||||
class LWPCookieJar(FileCookieJar):
|
||||
def as_lwp_str(self, ignore_discard: bool = ..., ignore_expires: bool = ...) -> str: ... # undocumented
|
||||
|
||||
class CookiePolicy:
|
||||
netscape: bool
|
||||
rfc2965: bool
|
||||
hide_cookie2: bool
|
||||
def set_ok(self, cookie: Cookie, request: Request) -> bool: ...
|
||||
def return_ok(self, cookie: Cookie, request: Request) -> bool: ...
|
||||
def domain_return_ok(self, domain: str, request: Request) -> bool: ...
|
||||
def path_return_ok(self, path: str, request: Request) -> bool: ...
|
||||
|
||||
|
||||
class DefaultCookiePolicy(CookiePolicy):
|
||||
rfc2109_as_netscape: bool
|
||||
strict_domain: bool
|
||||
strict_rfc2965_unverifiable: bool
|
||||
strict_ns_unverifiable: bool
|
||||
strict_ns_domain: int
|
||||
strict_ns_set_initial_dollar: bool
|
||||
strict_ns_set_path: bool
|
||||
DomainStrictNoDots: int
|
||||
DomainStrictNonDomain: int
|
||||
DomainRFC2965Match: int
|
||||
DomainLiberal: int
|
||||
DomainStrict: int
|
||||
def __init__(self, blocked_domains: Optional[Sequence[str]] = ...,
|
||||
allowed_domains: Optional[Sequence[str]] = ...,
|
||||
netscape: bool = ...,
|
||||
rfc2965: bool = ...,
|
||||
rfc2109_as_netscape: Optional[bool] = ...,
|
||||
hide_cookie2: bool = ..., strict_domain: bool = ...,
|
||||
strict_rfc2965_unverifiable: bool = ...,
|
||||
strict_ns_unverifiable: bool = ...,
|
||||
strict_ns_domain: int = ...,
|
||||
strict_ns_set_initial_dollar: bool = ...,
|
||||
strict_ns_set_path: bool = ...) -> None: ...
|
||||
def blocked_domains(self) -> Tuple[str, ...]: ...
|
||||
def set_blocked_domains(self, blocked_domains: Sequence[str]) -> None: ...
|
||||
def is_blocked(self, domain: str) -> bool: ...
|
||||
def allowed_domains(self) -> Optional[Tuple[str, ...]]: ...
|
||||
def set_allowed_domains(self, allowed_domains: Optional[Sequence[str]]) -> None: ...
|
||||
def is_not_allowed(self, domain: str) -> bool: ...
|
||||
|
||||
|
||||
class Cookie:
|
||||
version: Optional[int]
|
||||
name: str
|
||||
value: Optional[str]
|
||||
port: Optional[str]
|
||||
path: str
|
||||
secure: bool
|
||||
expires: Optional[int]
|
||||
discard: bool
|
||||
comment: Optional[str]
|
||||
comment_url: Optional[str]
|
||||
rfc2109: bool
|
||||
port_specified: bool
|
||||
domain: str # undocumented
|
||||
domain_specified: bool
|
||||
domain_initial_dot: bool
|
||||
def __init__(self, version: Optional[int], name: str, value: Optional[str], # undocumented
|
||||
port: Optional[str], port_specified: bool,
|
||||
domain: str, domain_specified: bool, domain_initial_dot: bool,
|
||||
path: str, path_specified: bool,
|
||||
secure: bool, expires: Optional[int], discard: bool,
|
||||
comment: Optional[str], comment_url: Optional[str],
|
||||
rest: Dict[str, str],
|
||||
rfc2109: bool = ...) -> None: ...
|
||||
def has_nonstandard_attr(self, name: str) -> bool: ...
|
||||
@overload
|
||||
def get_nonstandard_attr(self, name: str) -> Optional[str]: ...
|
||||
@overload
|
||||
def get_nonstandard_attr(self, name: str, default: _T = ...) -> Union[str, _T]: ...
|
||||
def set_nonstandard_attr(self, name: str, value: str) -> None: ...
|
||||
def is_expired(self, now: int = ...) -> bool: ...
|
||||
@@ -0,0 +1,35 @@
|
||||
# Stubs for http.cookies (Python 3.5)
|
||||
|
||||
import sys
|
||||
from typing import Generic, Dict, List, Mapping, Optional, TypeVar, Union, Any
|
||||
|
||||
_DataType = Union[str, Mapping[str, Union[str, Morsel[Any]]]]
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class CookieError(Exception): ...
|
||||
|
||||
class Morsel(Dict[str, Any], Generic[_T]):
|
||||
value: str
|
||||
coded_value: _T
|
||||
key: str
|
||||
if sys.version_info >= (3, 7):
|
||||
def set(self, key: str, val: str, coded_val: _T) -> None: ...
|
||||
else:
|
||||
def set(self, key: str, val: str, coded_val: _T, LegalChars: str = ...) -> None: ...
|
||||
def isReservedKey(self, K: str) -> bool: ...
|
||||
def output(self, attrs: Optional[List[str]] = ...,
|
||||
header: str = ...) -> str: ...
|
||||
def js_output(self, attrs: Optional[List[str]] = ...) -> str: ...
|
||||
def OutputString(self, attrs: Optional[List[str]] = ...) -> str: ...
|
||||
|
||||
class BaseCookie(Dict[str, Morsel[_T]], Generic[_T]):
|
||||
def __init__(self, input: Optional[_DataType] = ...) -> None: ...
|
||||
def value_decode(self, val: str) -> _T: ...
|
||||
def value_encode(self, val: _T) -> str: ...
|
||||
def output(self, attrs: Optional[List[str]] = ..., header: str = ...,
|
||||
sep: str = ...) -> str: ...
|
||||
def js_output(self, attrs: Optional[List[str]] = ...) -> str: ...
|
||||
def load(self, rawdata: _DataType) -> None: ...
|
||||
def __setitem__(self, key: str, value: Union[str, Morsel[_T]]) -> None: ...
|
||||
|
||||
class SimpleCookie(BaseCookie[_T], Generic[_T]): ...
|
||||
@@ -0,0 +1,78 @@
|
||||
# Stubs for http.server (Python 3.4)
|
||||
|
||||
import sys
|
||||
from typing import Any, BinaryIO, Callable, ClassVar, Dict, List, Mapping, Optional, Sequence, Tuple, Union
|
||||
import socketserver
|
||||
import email.message
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from builtins import _PathLike
|
||||
|
||||
class HTTPServer(socketserver.TCPServer):
|
||||
server_name: str
|
||||
server_port: int
|
||||
def __init__(self, server_address: Tuple[str, int],
|
||||
RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
class ThreadingHTTPServer(socketserver.ThreadingMixIn, HTTPServer):
|
||||
daemon_threads: bool # undocumented
|
||||
|
||||
class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
|
||||
client_address: Tuple[str, int]
|
||||
server: socketserver.BaseServer
|
||||
close_connection: bool
|
||||
requestline: str
|
||||
command: str
|
||||
path: str
|
||||
request_version: str
|
||||
headers: email.message.Message
|
||||
rfile: BinaryIO
|
||||
wfile: BinaryIO
|
||||
server_version: str
|
||||
sys_version: str
|
||||
error_message_format: str
|
||||
error_content_type: str
|
||||
protocol_version: str
|
||||
MessageClass: type
|
||||
responses: Mapping[int, Tuple[str, str]]
|
||||
weekdayname: ClassVar[Sequence[str]] = ... # Undocumented
|
||||
monthname: ClassVar[Sequence[Optional[str]]] = ... # Undocumented
|
||||
def __init__(self, request: bytes, client_address: Tuple[str, int],
|
||||
server: socketserver.BaseServer) -> None: ...
|
||||
def handle(self) -> None: ...
|
||||
def handle_one_request(self) -> None: ...
|
||||
def handle_expect_100(self) -> bool: ...
|
||||
def send_error(self, code: int, message: Optional[str] = ...,
|
||||
explain: Optional[str] = ...) -> None: ...
|
||||
def send_response(self, code: int,
|
||||
message: Optional[str] = ...) -> None: ...
|
||||
def send_header(self, keyword: str, value: str) -> None: ...
|
||||
def send_response_only(self, code: int,
|
||||
message: Optional[str] = ...) -> None: ...
|
||||
def end_headers(self) -> None: ...
|
||||
def flush_headers(self) -> None: ...
|
||||
def log_request(self, code: Union[int, str] = ...,
|
||||
size: Union[int, str] = ...) -> None: ...
|
||||
def log_error(self, format: str, *args: Any) -> None: ...
|
||||
def log_message(self, format: str, *args: Any) -> None: ...
|
||||
def version_string(self) -> str: ...
|
||||
def date_time_string(self, timestamp: Optional[int] = ...) -> str: ...
|
||||
def log_date_time_string(self) -> str: ...
|
||||
def address_string(self) -> str: ...
|
||||
def parse_request(self) -> bool: ... # Undocumented
|
||||
|
||||
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
|
||||
extensions_map: Dict[str, str]
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(self, request: bytes, client_address: Tuple[str, int],
|
||||
server: socketserver.BaseServer, directory: Optional[Union[str, _PathLike[str]]]) -> None: ...
|
||||
else:
|
||||
def __init__(self, request: bytes, client_address: Tuple[str, int],
|
||||
server: socketserver.BaseServer) -> None: ...
|
||||
def do_GET(self) -> None: ...
|
||||
def do_HEAD(self) -> None: ...
|
||||
|
||||
class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
|
||||
cgi_directories: List[str]
|
||||
def do_POST(self) -> None: ...
|
||||
@@ -0,0 +1,57 @@
|
||||
import sys
|
||||
from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Protocol, Type
|
||||
|
||||
from .decoder import JSONDecoder as JSONDecoder
|
||||
from .encoder import JSONEncoder as JSONEncoder
|
||||
from .decoder import JSONDecodeError as JSONDecodeError
|
||||
|
||||
def dumps(obj: Any,
|
||||
skipkeys: bool = ...,
|
||||
ensure_ascii: bool = ...,
|
||||
check_circular: bool = ...,
|
||||
allow_nan: bool = ...,
|
||||
cls: Optional[Type[JSONEncoder]] = ...,
|
||||
indent: Union[None, int, str] = ...,
|
||||
separators: Optional[Tuple[str, str]] = ...,
|
||||
default: Optional[Callable[[Any], Any]] = ...,
|
||||
sort_keys: bool = ...,
|
||||
**kwds: Any) -> str: ...
|
||||
|
||||
def dump(obj: Any,
|
||||
fp: IO[str],
|
||||
skipkeys: bool = ...,
|
||||
ensure_ascii: bool = ...,
|
||||
check_circular: bool = ...,
|
||||
allow_nan: bool = ...,
|
||||
cls: Optional[Type[JSONEncoder]] = ...,
|
||||
indent: Union[None, int, str] = ...,
|
||||
separators: Optional[Tuple[str, str]] = ...,
|
||||
default: Optional[Callable[[Any], Any]] = ...,
|
||||
sort_keys: bool = ...,
|
||||
**kwds: Any) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_LoadsString = Union[str, bytes, bytearray]
|
||||
else:
|
||||
_LoadsString = str
|
||||
def loads(s: _LoadsString,
|
||||
encoding: Any = ..., # ignored and deprecated
|
||||
cls: Optional[Type[JSONDecoder]] = ...,
|
||||
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
|
||||
parse_float: Optional[Callable[[str], Any]] = ...,
|
||||
parse_int: Optional[Callable[[str], Any]] = ...,
|
||||
parse_constant: Optional[Callable[[str], Any]] = ...,
|
||||
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
|
||||
**kwds: Any) -> Any: ...
|
||||
|
||||
class _Reader(Protocol):
|
||||
def read(self) -> _LoadsString: ...
|
||||
|
||||
def load(fp: _Reader,
|
||||
cls: Optional[Type[JSONDecoder]] = ...,
|
||||
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
|
||||
parse_float: Optional[Callable[[str], Any]] = ...,
|
||||
parse_int: Optional[Callable[[str], Any]] = ...,
|
||||
parse_constant: Optional[Callable[[str], Any]] = ...,
|
||||
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
|
||||
**kwds: Any) -> Any: ...
|
||||
@@ -0,0 +1,42 @@
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple
|
||||
|
||||
class JSONDecodeError(ValueError):
|
||||
msg: str
|
||||
doc: str
|
||||
pos: int
|
||||
lineno: int
|
||||
colno: int
|
||||
def __init__(self, msg: str, doc: str, pos: int) -> None: ...
|
||||
|
||||
class JSONDecoder:
|
||||
object_hook: Callable[[Dict[str, Any]], Any]
|
||||
parse_float: Callable[[str], Any]
|
||||
parse_int: Callable[[str], Any]
|
||||
parse_constant = ... # Callable[[str], Any]
|
||||
strict: bool
|
||||
object_pairs_hook: Callable[[List[Tuple[str, Any]]], Any]
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
object_hook: Optional[Callable[[Dict[str, Any]], Any]] = ...,
|
||||
parse_float: Optional[Callable[[str], Any]] = ...,
|
||||
parse_int: Optional[Callable[[str], Any]] = ...,
|
||||
parse_constant: Optional[Callable[[str], Any]] = ...,
|
||||
strict: bool = ...,
|
||||
object_pairs_hook: Optional[Callable[[List[Tuple[str, Any]]], Any]] = ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
object_hook: Optional[Callable[[Dict[str, Any]], Any]] = ...,
|
||||
parse_float: Optional[Callable[[str], Any]] = ...,
|
||||
parse_int: Optional[Callable[[str], Any]] = ...,
|
||||
parse_constant: Optional[Callable[[str], Any]] = ...,
|
||||
strict: bool = ...,
|
||||
object_pairs_hook: Optional[Callable[[List[Tuple[str, Any]]], Any]] = ...,
|
||||
) -> None: ...
|
||||
def decode(self, s: str, _w: Callable[..., Any] = ...) -> Any: ... # _w is undocumented
|
||||
def raw_decode(self, s: str, idx: int = ...) -> Tuple[Any, int]: ...
|
||||
@@ -0,0 +1,42 @@
|
||||
import sys
|
||||
from typing import Any, Callable, Iterator, Optional, Tuple
|
||||
|
||||
class JSONEncoder:
|
||||
item_separator: str
|
||||
key_separator: str
|
||||
|
||||
skipkeys: bool
|
||||
ensure_ascii: bool
|
||||
check_circular: bool
|
||||
allow_nan: bool
|
||||
sort_keys: bool
|
||||
indent: int
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
skipkeys: bool = ...,
|
||||
ensure_ascii: bool = ...,
|
||||
check_circular: bool = ...,
|
||||
allow_nan: bool = ...,
|
||||
sort_keys: bool = ...,
|
||||
indent: Optional[int] = ...,
|
||||
separators: Optional[Tuple[str, str]] = ...,
|
||||
default: Optional[Callable[..., Any]] = ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
skipkeys: bool = ...,
|
||||
ensure_ascii: bool = ...,
|
||||
check_circular: bool = ...,
|
||||
allow_nan: bool = ...,
|
||||
sort_keys: bool = ...,
|
||||
indent: Optional[int] = ...,
|
||||
separators: Optional[Tuple[str, str]] = ...,
|
||||
default: Optional[Callable[..., Any]] = ...,
|
||||
) -> None: ...
|
||||
def default(self, o: Any) -> Any: ...
|
||||
def encode(self, o: Any) -> str: ...
|
||||
def iterencode(self, o: Any, _one_shot: bool = ...) -> Iterator[str]: ...
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
from typing import Any, Callable, Dict, Iterable, IO, List, Optional, Sequence, Union
|
||||
from types import ModuleType
|
||||
|
||||
class Error(Exception): ...
|
||||
FlagsError = Error
|
||||
|
||||
class DuplicateFlag(FlagsError): ...
|
||||
|
||||
class CantOpenFlagFileError(FlagsError): ...
|
||||
|
||||
class DuplicateFlagCannotPropagateNoneToSwig(DuplicateFlag): ...
|
||||
|
||||
class DuplicateFlagError(DuplicateFlag):
|
||||
def __init__(self, flagname: str, flag_values: FlagValues, other_flag_values: FlagValues = ...) -> None: ...
|
||||
|
||||
class IllegalFlagValueError(FlagsError): ...
|
||||
IllegalFlagValue = IllegalFlagValueError
|
||||
|
||||
class UnrecognizedFlag(FlagsError): ...
|
||||
|
||||
class UnrecognizedFlagError(UnrecognizedFlag):
|
||||
def __init__(self, flagname: str, flagvalue: str = ...) -> None: ...
|
||||
|
||||
def get_help_width() -> int: ...
|
||||
GetHelpWidth = get_help_width
|
||||
def CutCommonSpacePrefix(text) -> str: ...
|
||||
def text_wrap(text: str, length: int = ..., indent: str = ..., firstline_indent: str = ..., tabs: str = ...) -> str: ...
|
||||
TextWrap = text_wrap
|
||||
def doc_to_help(doc: str) -> str: ...
|
||||
DocToHelp = doc_to_help
|
||||
|
||||
class FlagValues:
|
||||
def __init__(self) -> None: ...
|
||||
def UseGnuGetOpt(self, use_gnu_getopt: bool = ...) -> None: ...
|
||||
def is_gnu_getopt(self) -> bool: ...
|
||||
IsGnuGetOpt = is_gnu_getopt
|
||||
# TODO dict type
|
||||
def FlagDict(self) -> Dict[Any, Any]: ...
|
||||
def flags_by_module_dict(self) -> Dict[str, List[Flag]]: ...
|
||||
FlagsByModuleDict = flags_by_module_dict
|
||||
def flags_by_module_id_dict(self) -> Dict[int, List[Flag]]: ...
|
||||
FlagsByModuleIdDict = flags_by_module_id_dict
|
||||
def key_flags_by_module_dict(self) -> Dict[str, List[Flag]]: ...
|
||||
KeyFlagsByModuleDict = key_flags_by_module_dict
|
||||
def find_module_defining_flag(self, flagname: str, default: str = ...) -> str: ...
|
||||
FindModuleDefiningFlag = find_module_defining_flag
|
||||
def find_module_id_defining_flag(self, flagname: str, default: int = ...) -> int: ...
|
||||
FindModuleIdDefiningFlag = find_module_id_defining_flag
|
||||
def append_flag_values(self, flag_values: FlagValues) -> None: ...
|
||||
AppendFlagValues = append_flag_values
|
||||
def remove_flag_values(self, flag_values: FlagValues) -> None: ...
|
||||
RemoveFlagValues = remove_flag_values
|
||||
def __setitem__(self, name: str, flag: Flag) -> None: ...
|
||||
def __getitem__(self, name: str) -> Flag: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
def __setattr__(self, name: str, value: Any): ...
|
||||
def __delattr__(self, flag_name: str) -> None: ...
|
||||
def set_default(self, name: str, value: Any) -> None: ...
|
||||
SetDefault = set_default
|
||||
def __contains__(self, name: str) -> bool: ...
|
||||
has_key = __contains__
|
||||
def __iter__(self) -> Iterable[str]: ...
|
||||
def __call__(self, argv: List[str], known_only: bool = ...) -> List[str]: ...
|
||||
def reset(self) -> None: ...
|
||||
Reset = reset
|
||||
def RegisteredFlags(self) -> List[str]: ...
|
||||
def flag_values_dict(self) -> Dict[str, Any]: ...
|
||||
FlagValuesDict = flag_values_dict
|
||||
def __str__(self) -> str: ...
|
||||
def GetHelp(self, prefix: str = ...) -> str: ...
|
||||
def module_help(self, module: Union[ModuleType, str]) -> str: ...
|
||||
ModuleHelp = module_help
|
||||
def main_module_help(self) -> str: ...
|
||||
MainModuleHelp = main_module_help
|
||||
def get(self, name: str, default: Any) -> Any: ...
|
||||
def ShortestUniquePrefixes(self, fl: Dict[str, Flag]) -> Dict[str, str]: ...
|
||||
def ExtractFilename(self, flagfile_str: str) -> str: ...
|
||||
def read_flags_from_files(self, argv: List[str], force_gnu: bool = ...) -> List[str]: ...
|
||||
ReadFlagsFromFiles = read_flags_from_files
|
||||
def flags_into_string(self) -> str: ...
|
||||
FlagsIntoString = flags_into_string
|
||||
def append_flags_into_file(self, filename: str) -> None: ...
|
||||
AppendFlagsIntoFile = append_flags_into_file
|
||||
def write_help_in_xml_format(self, outfile: IO[str] = ...) -> None: ...
|
||||
WriteHelpInXMLFormat = write_help_in_xml_format
|
||||
# TODO validator: gflags_validators.Validator
|
||||
def AddValidator(self, validator: Any) -> None: ...
|
||||
def is_parsed(self) -> bool: ...
|
||||
IsParsed = is_parsed
|
||||
|
||||
FLAGS: FlagValues
|
||||
|
||||
class Flag:
|
||||
name: str
|
||||
default: Any
|
||||
default_as_str: str
|
||||
value: Any
|
||||
help: str
|
||||
short_name: str
|
||||
boolean = False
|
||||
present = False
|
||||
parser: ArgumentParser
|
||||
serializer: ArgumentSerializer
|
||||
allow_override = False
|
||||
|
||||
def __init__(self, parser: ArgumentParser, serializer: ArgumentSerializer, name: str,
|
||||
default: Optional[str], help_string: str, short_name: str = ..., boolean: bool = ...,
|
||||
allow_override: bool = ...) -> None: ...
|
||||
def Parse(self, argument: Any) -> Any: ...
|
||||
def Unparse(self) -> None: ...
|
||||
def Serialize(self) -> str: ...
|
||||
def SetDefault(self, value: Any) -> None: ...
|
||||
def Type(self) -> str: ...
|
||||
def WriteInfoInXMLFormat(self, outfile: IO[str], module_name: str, is_key: bool = ..., indent: str = ...) -> None: ...
|
||||
|
||||
class ArgumentParser(object):
|
||||
syntactic_help: str
|
||||
# TODO what is this
|
||||
def parse(self, argument: Any) -> Any: ...
|
||||
Parser = parse
|
||||
def flag_type(self) -> str: ...
|
||||
Type = flag_type
|
||||
def WriteCustomInfoInXMLFormat(self, outfile: IO[str], indent: str) -> None: ...
|
||||
|
||||
class ArgumentSerializer:
|
||||
def Serialize(self, value: Any) -> unicode: ...
|
||||
|
||||
class ListSerializer(ArgumentSerializer):
|
||||
def __init__(self, list_sep: str) -> None: ...
|
||||
def Serialize(self, value: List[Any]) -> str: ...
|
||||
|
||||
def register_validator(flag_name: str,
|
||||
checker: Callable[[Any], bool],
|
||||
message: str = ...,
|
||||
flag_values: FlagValues = ...) -> None: ...
|
||||
RegisterValidator = register_validator
|
||||
def mark_flag_as_required(flag_name: str, flag_values: FlagValues = ...) -> None: ...
|
||||
MarkFlagAsRequired = mark_flag_as_required
|
||||
|
||||
def DEFINE(parser: ArgumentParser, name: str, default: Any, help: str,
|
||||
flag_values: FlagValues = ..., serializer: ArgumentSerializer = ..., **args: Any) -> None: ...
|
||||
def DEFINE_flag(flag: Flag, flag_values: FlagValues = ...) -> None: ...
|
||||
def declare_key_flag(flag_name: str, flag_values: FlagValues = ...) -> None: ...
|
||||
DECLARE_key_flag = declare_key_flag
|
||||
def adopt_module_key_flags(module: ModuleType, flag_values: FlagValues = ...) -> None: ...
|
||||
ADOPT_module_key_flags = adopt_module_key_flags
|
||||
def DEFINE_string(name: str, default: Optional[str], help: str, flag_values: FlagValues = ..., **args: Any): ...
|
||||
|
||||
class BooleanParser(ArgumentParser):
|
||||
def Convert(self, argument: Any) -> bool: ...
|
||||
def Parse(self, argument: Any) -> bool: ...
|
||||
|
||||
class BooleanFlag(Flag):
|
||||
def __init__(self, name: str, default: Optional[bool], help: str, short_name=..., **args: Any) -> None: ...
|
||||
|
||||
def DEFINE_boolean(name: str, default: Optional[bool], help: str, flag_values: FlagValues = ..., **args: Any) -> None: ...
|
||||
|
||||
DEFINE_bool = DEFINE_boolean
|
||||
|
||||
class HelpFlag(BooleanFlag):
|
||||
def __init__(self) -> None: ...
|
||||
def Parse(self, arg: Any) -> None: ...
|
||||
|
||||
class HelpXMLFlag(BooleanFlag):
|
||||
def __init__(self) -> None: ...
|
||||
def Parse(self, arg: Any) -> None: ...
|
||||
|
||||
class HelpshortFlag(BooleanFlag):
|
||||
def __init__(self) -> None: ...
|
||||
def Parse(self, arg: Any) -> None: ...
|
||||
|
||||
class NumericParser(ArgumentParser):
|
||||
def IsOutsideBounds(self, val: float) -> bool: ...
|
||||
def Parse(self, argument: Any) -> float: ...
|
||||
def WriteCustomInfoInXMLFormat(self, outfile: IO[str], indent: str) -> None: ...
|
||||
def Convert(self, argument: Any) -> Any: ...
|
||||
|
||||
class FloatParser(NumericParser):
|
||||
number_article: str
|
||||
number_name: str
|
||||
syntactic_help: str
|
||||
def __init__(self, lower_bound: float = ..., upper_bound: float = ...) -> None: ...
|
||||
def Convert(self, argument: Any) -> float: ...
|
||||
|
||||
def DEFINE_float(name: str, default: Optional[float], help: str, lower_bound: float = ...,
|
||||
upper_bound: float = ..., flag_values: FlagValues = ..., **args: Any) -> None: ...
|
||||
|
||||
class IntegerParser(NumericParser):
|
||||
number_article: str
|
||||
number_name: str
|
||||
syntactic_help: str
|
||||
def __init__(self, lower_bound: int = ..., upper_bound: int = ...) -> None: ...
|
||||
def Convert(self, argument: Any) -> int: ...
|
||||
|
||||
def DEFINE_integer(name: str, default: Optional[int], help: str, lower_bound: int = ...,
|
||||
upper_bound: int = ..., flag_values: FlagValues = ..., **args: Any) -> None: ...
|
||||
|
||||
class EnumParser(ArgumentParser):
|
||||
def __init__(self, enum_values: List[str]) -> None: ...
|
||||
def Parse(self, argument: Any) -> Any: ...
|
||||
|
||||
class EnumFlag(Flag):
|
||||
def __init__(self, name: str, default: Optional[str], help: str, enum_values: List[str],
|
||||
short_name: str, **args: Any) -> None: ...
|
||||
|
||||
def DEFINE_enum(name: str, default: Optional[str], enum_values: List[str], help: str,
|
||||
flag_values: FlagValues = ..., **args: Any) -> None: ...
|
||||
|
||||
class BaseListParser(ArgumentParser):
|
||||
def __init__(self, token: str = ..., name: str = ...) -> None: ...
|
||||
def Parse(self, argument: Any) -> List[Any]: ...
|
||||
|
||||
class ListParser(BaseListParser):
|
||||
def __init__(self) -> None: ...
|
||||
def WriteCustomInfoInXMLFormat(self, outfile: IO[str], indent: str): ...
|
||||
|
||||
class WhitespaceSeparatedListParser(BaseListParser):
|
||||
def __init__(self) -> None: ...
|
||||
def WriteCustomInfoInXMLFormat(self, outfile: IO[str], indent: str): ...
|
||||
|
||||
def DEFINE_list(name: str, default: Optional[List[str]], help: str, flag_values: FlagValues = ..., **args: Any) -> None: ...
|
||||
def DEFINE_spaceseplist(name: str, default: Optional[List[str]], help: str, flag_values: FlagValues = ...,
|
||||
**args: Any) -> None: ...
|
||||
|
||||
class MultiFlag(Flag):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def Parse(self, arguments: Any) -> None: ...
|
||||
def Serialize(self) -> str: ...
|
||||
|
||||
def DEFINE_multi_string(name: str, default: Optional[Union[str, List[str]]], help: str,
|
||||
flag_values: FlagValues = ..., **args: Any) -> None: ...
|
||||
DEFINE_multistring = DEFINE_multi_string
|
||||
|
||||
def DEFINE_multi_integer(name: str, default: Optional[Union[int, List[int]]], help: str, lower_bound: int = ...,
|
||||
upper_bound: int = ..., flag_values: FlagValues = ..., **args: Any) -> None: ...
|
||||
DEFINE_multi_int = DEFINE_multi_integer
|
||||
|
||||
def DEFINE_multi_float(name: str, default: Optional[Union[float, List[float]]], help: str,
|
||||
lower_bound: float = ..., upper_bound: float = ...,
|
||||
flag_values: FlagValues = ..., **args: Any) -> None: ...
|
||||
|
||||
def DEFINE_multi_enum(name: str, default: Optional[Union[Sequence[str], str]],
|
||||
enum_values: Sequence[str], help: str,
|
||||
flag_values: FlagValues = ..., case_sensitive: bool = ..., **args: Any): ...
|
||||
@@ -0,0 +1,19 @@
|
||||
from typing import Any, Union, Text
|
||||
from .blockalgo import BlockAlgo
|
||||
|
||||
__revision__: str
|
||||
|
||||
class AESCipher(BlockAlgo):
|
||||
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
|
||||
|
||||
def new(key: Union[bytes, Text], *args, **kwargs) -> AESCipher: ...
|
||||
|
||||
MODE_ECB: int
|
||||
MODE_CBC: int
|
||||
MODE_CFB: int
|
||||
MODE_PGP: int
|
||||
MODE_OFB: int
|
||||
MODE_CTR: int
|
||||
MODE_OPENPGP: int
|
||||
block_size: int
|
||||
key_size: int
|
||||
@@ -0,0 +1,19 @@
|
||||
from typing import Any, Union, Text
|
||||
from .blockalgo import BlockAlgo
|
||||
|
||||
__revision__: str
|
||||
|
||||
class RC2Cipher(BlockAlgo):
|
||||
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
|
||||
|
||||
def new(key: Union[bytes, Text], *args, **kwargs) -> RC2Cipher: ...
|
||||
|
||||
MODE_ECB: int
|
||||
MODE_CBC: int
|
||||
MODE_CFB: int
|
||||
MODE_PGP: int
|
||||
MODE_OFB: int
|
||||
MODE_CTR: int
|
||||
MODE_OPENPGP: int
|
||||
block_size: int
|
||||
key_size: int
|
||||
@@ -0,0 +1,15 @@
|
||||
from typing import Any, Union, Text
|
||||
|
||||
__revision__: str
|
||||
|
||||
class ARC4Cipher:
|
||||
block_size: int
|
||||
key_size: int
|
||||
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
|
||||
def encrypt(self, plaintext): ...
|
||||
def decrypt(self, ciphertext): ...
|
||||
|
||||
def new(key: Union[bytes, Text], *args, **kwargs) -> ARC4Cipher: ...
|
||||
|
||||
block_size: int
|
||||
key_size: int
|
||||
@@ -0,0 +1,19 @@
|
||||
from typing import Any, Union, Text
|
||||
from .blockalgo import BlockAlgo
|
||||
|
||||
__revision__: str
|
||||
|
||||
class BlowfishCipher(BlockAlgo):
|
||||
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
|
||||
|
||||
def new(key: Union[bytes, Text], *args, **kwargs) -> BlowfishCipher: ...
|
||||
|
||||
MODE_ECB: int
|
||||
MODE_CBC: int
|
||||
MODE_CFB: int
|
||||
MODE_PGP: int
|
||||
MODE_OFB: int
|
||||
MODE_CTR: int
|
||||
MODE_OPENPGP: int
|
||||
block_size: int
|
||||
key_size: Any
|
||||
@@ -0,0 +1,19 @@
|
||||
from typing import Any, Union, Text
|
||||
from .blockalgo import BlockAlgo
|
||||
|
||||
__revision__: str
|
||||
|
||||
class CAST128Cipher(BlockAlgo):
|
||||
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
|
||||
|
||||
def new(key: Union[bytes, Text], *args, **kwargs) -> CAST128Cipher: ...
|
||||
|
||||
MODE_ECB: int
|
||||
MODE_CBC: int
|
||||
MODE_CFB: int
|
||||
MODE_PGP: int
|
||||
MODE_OFB: int
|
||||
MODE_CTR: int
|
||||
MODE_OPENPGP: int
|
||||
block_size: int
|
||||
key_size: Any
|
||||
@@ -0,0 +1,19 @@
|
||||
from typing import Any, Union, Text
|
||||
from .blockalgo import BlockAlgo
|
||||
|
||||
__revision__: str
|
||||
|
||||
class DESCipher(BlockAlgo):
|
||||
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
|
||||
|
||||
def new(key: Union[bytes, Text], *args, **kwargs) -> DESCipher: ...
|
||||
|
||||
MODE_ECB: int
|
||||
MODE_CBC: int
|
||||
MODE_CFB: int
|
||||
MODE_PGP: int
|
||||
MODE_OFB: int
|
||||
MODE_CTR: int
|
||||
MODE_OPENPGP: int
|
||||
block_size: int
|
||||
key_size: int
|
||||
@@ -0,0 +1,20 @@
|
||||
from typing import Any, Union, Text
|
||||
|
||||
from .blockalgo import BlockAlgo
|
||||
|
||||
__revision__: str
|
||||
|
||||
class DES3Cipher(BlockAlgo):
|
||||
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
|
||||
|
||||
def new(key: Union[bytes, Text], *args, **kwargs) -> DES3Cipher: ...
|
||||
|
||||
MODE_ECB: int
|
||||
MODE_CBC: int
|
||||
MODE_CFB: int
|
||||
MODE_PGP: int
|
||||
MODE_OFB: int
|
||||
MODE_CTR: int
|
||||
MODE_OPENPGP: int
|
||||
block_size: int
|
||||
key_size: Any
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Optional, Union, Text
|
||||
|
||||
from Crypto.PublicKey.RSA import _RSAobj
|
||||
|
||||
class PKCS1OAEP_Cipher:
|
||||
def __init__(self, key: _RSAobj, hashAlgo: Any, mgfunc: Any, label: Any) -> None: ...
|
||||
def can_encrypt(self): ...
|
||||
def can_decrypt(self): ...
|
||||
def encrypt(self, message: Union[bytes, Text]) -> bytes: ...
|
||||
def decrypt(self, ct: bytes) -> bytes: ...
|
||||
|
||||
|
||||
def new(key: _RSAobj, hashAlgo: Optional[Any] = ..., mgfunc: Optional[Any] = ..., label: Any = ...) -> PKCS1OAEP_Cipher: ...
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Union, Text
|
||||
|
||||
from Crypto.PublicKey.RSA import _RSAobj
|
||||
|
||||
class PKCS115_Cipher:
|
||||
def __init__(self, key: _RSAobj) -> None: ...
|
||||
def can_encrypt(self) -> bool: ...
|
||||
def can_decrypt(self) -> bool: ...
|
||||
rf: Any
|
||||
def encrypt(self, message: Union[bytes, Text]) -> bytes: ...
|
||||
def decrypt(self, ct: bytes, sentinel: Any) -> bytes: ...
|
||||
|
||||
def new(key: _RSAobj) -> PKCS115_Cipher: ...
|
||||
@@ -0,0 +1,16 @@
|
||||
from typing import Any, Union, Text
|
||||
|
||||
__revision__: str
|
||||
|
||||
class XORCipher:
|
||||
block_size: int
|
||||
key_size: int
|
||||
def __init__(self, key: Union[bytes, Text], *args, **kwargs) -> None: ...
|
||||
def encrypt(self, plaintext: Union[bytes, Text]) -> bytes: ...
|
||||
def decrypt(self, ciphertext: bytes) -> bytes: ...
|
||||
|
||||
|
||||
def new(key: Union[bytes, Text], *args, **kwargs) -> XORCipher: ...
|
||||
|
||||
block_size: int
|
||||
key_size: int
|
||||
@@ -0,0 +1,11 @@
|
||||
# Names in __all__ with no definition:
|
||||
# AES
|
||||
# ARC2
|
||||
# ARC4
|
||||
# Blowfish
|
||||
# CAST
|
||||
# DES
|
||||
# DES3
|
||||
# PKCS1_OAEP
|
||||
# PKCS1_v1_5
|
||||
# XOR
|
||||
@@ -0,0 +1,17 @@
|
||||
from typing import Any, Union, Text
|
||||
|
||||
MODE_ECB: int
|
||||
MODE_CBC: int
|
||||
MODE_CFB: int
|
||||
MODE_PGP: int
|
||||
MODE_OFB: int
|
||||
MODE_CTR: int
|
||||
MODE_OPENPGP: int
|
||||
|
||||
class BlockAlgo:
|
||||
mode: int
|
||||
block_size: int
|
||||
IV: Any
|
||||
def __init__(self, factory: Any, key: Union[bytes, Text], *args, **kwargs) -> None: ...
|
||||
def encrypt(self, plaintext: Union[bytes, Text]) -> bytes: ...
|
||||
def decrypt(self, ciphertext: bytes) -> bytes: ...
|
||||
@@ -0,0 +1,16 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
digest_size: Any
|
||||
|
||||
class HMAC:
|
||||
digest_size: Any
|
||||
digestmod: Any
|
||||
outer: Any
|
||||
inner: Any
|
||||
def __init__(self, key, msg: Optional[Any] = ..., digestmod: Optional[Any] = ...) -> None: ...
|
||||
def update(self, msg): ...
|
||||
def copy(self): ...
|
||||
def digest(self): ...
|
||||
def hexdigest(self): ...
|
||||
|
||||
def new(key, msg: Optional[Any] = ..., digestmod: Optional[Any] = ...): ...
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Optional
|
||||
from Crypto.Hash.hashalgo import HashAlgo
|
||||
|
||||
class MD2Hash(HashAlgo):
|
||||
oid: Any
|
||||
digest_size: int
|
||||
block_size: int
|
||||
def __init__(self, data: Optional[Any] = ...) -> None: ...
|
||||
def new(self, data: Optional[Any] = ...): ...
|
||||
|
||||
def new(data: Optional[Any] = ...): ...
|
||||
|
||||
digest_size: Any
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Optional
|
||||
from Crypto.Hash.hashalgo import HashAlgo
|
||||
|
||||
class MD4Hash(HashAlgo):
|
||||
oid: Any
|
||||
digest_size: int
|
||||
block_size: int
|
||||
def __init__(self, data: Optional[Any] = ...) -> None: ...
|
||||
def new(self, data: Optional[Any] = ...): ...
|
||||
|
||||
def new(data: Optional[Any] = ...): ...
|
||||
|
||||
digest_size: Any
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Optional
|
||||
from Crypto.Hash.hashalgo import HashAlgo
|
||||
|
||||
class MD5Hash(HashAlgo):
|
||||
oid: Any
|
||||
digest_size: int
|
||||
block_size: int
|
||||
def __init__(self, data: Optional[Any] = ...) -> None: ...
|
||||
def new(self, data: Optional[Any] = ...): ...
|
||||
|
||||
def new(data: Optional[Any] = ...): ...
|
||||
|
||||
digest_size: Any
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Optional
|
||||
from Crypto.Hash.hashalgo import HashAlgo
|
||||
|
||||
class RIPEMD160Hash(HashAlgo):
|
||||
oid: Any
|
||||
digest_size: int
|
||||
block_size: int
|
||||
def __init__(self, data: Optional[Any] = ...) -> None: ...
|
||||
def new(self, data: Optional[Any] = ...): ...
|
||||
|
||||
def new(data: Optional[Any] = ...): ...
|
||||
|
||||
digest_size: Any
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Optional
|
||||
from Crypto.Hash.hashalgo import HashAlgo
|
||||
|
||||
class SHA1Hash(HashAlgo):
|
||||
oid: Any
|
||||
digest_size: int
|
||||
block_size: int
|
||||
def __init__(self, data: Optional[Any] = ...) -> None: ...
|
||||
def new(self, data: Optional[Any] = ...): ...
|
||||
|
||||
def new(data: Optional[Any] = ...): ...
|
||||
|
||||
digest_size: Any
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Optional
|
||||
from Crypto.Hash.hashalgo import HashAlgo
|
||||
|
||||
class SHA224Hash(HashAlgo):
|
||||
oid: Any
|
||||
digest_size: int
|
||||
block_size: int
|
||||
def __init__(self, data: Optional[Any] = ...) -> None: ...
|
||||
def new(self, data: Optional[Any] = ...): ...
|
||||
|
||||
def new(data: Optional[Any] = ...): ...
|
||||
|
||||
digest_size: Any
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Optional
|
||||
from Crypto.Hash.hashalgo import HashAlgo
|
||||
|
||||
class SHA256Hash(HashAlgo):
|
||||
oid: Any
|
||||
digest_size: int
|
||||
block_size: int
|
||||
def __init__(self, data: Optional[Any] = ...) -> None: ...
|
||||
def new(self, data: Optional[Any] = ...): ...
|
||||
|
||||
def new(data: Optional[Any] = ...): ...
|
||||
|
||||
digest_size: Any
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Optional
|
||||
from Crypto.Hash.hashalgo import HashAlgo
|
||||
|
||||
class SHA384Hash(HashAlgo):
|
||||
oid: Any
|
||||
digest_size: int
|
||||
block_size: int
|
||||
def __init__(self, data: Optional[Any] = ...) -> None: ...
|
||||
def new(self, data: Optional[Any] = ...): ...
|
||||
|
||||
def new(data: Optional[Any] = ...): ...
|
||||
|
||||
digest_size: Any
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Optional
|
||||
from Crypto.Hash.hashalgo import HashAlgo
|
||||
|
||||
class SHA512Hash(HashAlgo):
|
||||
oid: Any
|
||||
digest_size: int
|
||||
block_size: int
|
||||
def __init__(self, data: Optional[Any] = ...) -> None: ...
|
||||
def new(self, data: Optional[Any] = ...): ...
|
||||
|
||||
def new(data: Optional[Any] = ...): ...
|
||||
|
||||
digest_size: Any
|
||||
@@ -0,0 +1,11 @@
|
||||
# Names in __all__ with no definition:
|
||||
# HMAC
|
||||
# MD2
|
||||
# MD4
|
||||
# MD5
|
||||
# RIPEMD
|
||||
# SHA
|
||||
# SHA224
|
||||
# SHA256
|
||||
# SHA384
|
||||
# SHA512
|
||||
@@ -0,0 +1,11 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
class HashAlgo:
|
||||
digest_size: Any
|
||||
block_size: Any
|
||||
def __init__(self, hashFactory, data: Optional[Any] = ...) -> None: ...
|
||||
def update(self, data): ...
|
||||
def digest(self): ...
|
||||
def hexdigest(self): ...
|
||||
def copy(self): ...
|
||||
def new(self, data: Optional[Any] = ...): ...
|
||||
@@ -0,0 +1,10 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
__revision__: str
|
||||
|
||||
def isInt(x): ...
|
||||
|
||||
class AllOrNothing:
|
||||
def __init__(self, ciphermodule, mode: Optional[Any] = ..., IV: Optional[Any] = ...) -> None: ...
|
||||
def digest(self, text): ...
|
||||
def undigest(self, blocks): ...
|
||||
@@ -0,0 +1,5 @@
|
||||
__revision__: str
|
||||
|
||||
class Chaff:
|
||||
def __init__(self, factor: float = ..., blocksper: int = ...) -> None: ...
|
||||
def chaff(self, blocks): ...
|
||||
@@ -0,0 +1,7 @@
|
||||
from typing import Any, Optional
|
||||
from Crypto.Hash import SHA as SHA1
|
||||
|
||||
__revision__: str
|
||||
|
||||
def PBKDF1(password, salt, dkLen, count: int = ..., hashAlgo: Optional[Any] = ...): ...
|
||||
def PBKDF2(password, salt, dkLen: int = ..., count: int = ..., prf: Optional[Any] = ...): ...
|
||||
@@ -0,0 +1,4 @@
|
||||
# Names in __all__ with no definition:
|
||||
# AllOrNothing
|
||||
# Chaffing
|
||||
# KDF
|
||||
@@ -0,0 +1,27 @@
|
||||
from typing import Any, Optional
|
||||
from .pubkey import pubkey
|
||||
|
||||
class _DSAobj(pubkey):
|
||||
keydata: Any
|
||||
implementation: Any
|
||||
key: Any
|
||||
def __init__(self, implementation, key) -> None: ...
|
||||
def __getattr__(self, attrname): ...
|
||||
def sign(self, M, K): ...
|
||||
def verify(self, M, signature): ...
|
||||
def has_private(self): ...
|
||||
def size(self): ...
|
||||
def can_blind(self): ...
|
||||
def can_encrypt(self): ...
|
||||
def can_sign(self): ...
|
||||
def publickey(self): ...
|
||||
|
||||
class DSAImplementation:
|
||||
error: Any
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
def generate(self, bits, randfunc: Optional[Any] = ..., progress_func: Optional[Any] = ...): ...
|
||||
def construct(self, tup): ...
|
||||
|
||||
generate: Any
|
||||
construct: Any
|
||||
error: Any
|
||||
@@ -0,0 +1,19 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
from Crypto.PublicKey.pubkey import pubkey
|
||||
from Crypto.PublicKey.pubkey import * # noqa: F403
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
def generate(bits, randfunc, progress_func: Optional[Any] = ...): ...
|
||||
def construct(tup): ...
|
||||
|
||||
class ElGamalobj(pubkey):
|
||||
keydata: Any
|
||||
def encrypt(self, plaintext, K): ...
|
||||
def decrypt(self, ciphertext): ...
|
||||
def sign(self, M, K): ...
|
||||
def verify(self, M, signature): ...
|
||||
def size(self): ...
|
||||
def has_private(self): ...
|
||||
def publickey(self): ...
|
||||
@@ -0,0 +1,32 @@
|
||||
from typing import Any, Optional, Union, Text
|
||||
from .pubkey import pubkey
|
||||
|
||||
class _RSAobj(pubkey):
|
||||
keydata: Any
|
||||
implementation: Any
|
||||
key: Any
|
||||
def __init__(self, implementation, key, randfunc: Optional[Any] = ...) -> None: ...
|
||||
def __getattr__(self, attrname): ...
|
||||
def encrypt(self, plaintext, K): ...
|
||||
def decrypt(self, ciphertext): ...
|
||||
def sign(self, M, K): ...
|
||||
def verify(self, M, signature): ...
|
||||
def has_private(self): ...
|
||||
def size(self): ...
|
||||
def can_blind(self): ...
|
||||
def can_encrypt(self): ...
|
||||
def can_sign(self): ...
|
||||
def publickey(self): ...
|
||||
def exportKey(self, format: str = ..., passphrase: Optional[Any] = ..., pkcs: int = ...): ...
|
||||
|
||||
class RSAImplementation:
|
||||
error: Any
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
def generate(self, bits, randfunc: Optional[Any] = ..., progress_func: Optional[Any] = ..., e: int = ...): ...
|
||||
def construct(self, tup): ...
|
||||
def importKey(self, externKey: Any, passphrase: Union[None, bytes, Text] = ...) -> _RSAobj: ...
|
||||
|
||||
generate: Any
|
||||
construct: Any
|
||||
importKey: Any
|
||||
error: Any
|
||||
@@ -0,0 +1,4 @@
|
||||
# Names in __all__ with no definition:
|
||||
# DSA
|
||||
# ElGamal
|
||||
# RSA
|
||||
@@ -0,0 +1,21 @@
|
||||
from Crypto.Util.number import * # noqa: F403
|
||||
|
||||
__revision__: str
|
||||
|
||||
class pubkey:
|
||||
def __init__(self) -> None: ...
|
||||
def encrypt(self, plaintext, K): ...
|
||||
def decrypt(self, ciphertext): ...
|
||||
def sign(self, M, K): ...
|
||||
def verify(self, M, signature): ...
|
||||
def validate(self, M, signature): ...
|
||||
def blind(self, M, B): ...
|
||||
def unblind(self, M, B): ...
|
||||
def can_sign(self): ...
|
||||
def can_encrypt(self): ...
|
||||
def can_blind(self): ...
|
||||
def size(self): ...
|
||||
def has_private(self): ...
|
||||
def publickey(self): ...
|
||||
def __eq__(self, other): ...
|
||||
def __ne__(self, other): ...
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
from typing import Any
|
||||
|
||||
__revision__: str
|
||||
|
||||
class FortunaPool:
|
||||
digest_size: Any
|
||||
def __init__(self) -> None: ...
|
||||
def append(self, data): ...
|
||||
def digest(self): ...
|
||||
def hexdigest(self): ...
|
||||
length: int
|
||||
def reset(self): ...
|
||||
|
||||
def which_pools(r): ...
|
||||
|
||||
class FortunaAccumulator:
|
||||
min_pool_size: int
|
||||
reseed_interval: float
|
||||
reseed_count: int
|
||||
generator: Any
|
||||
last_reseed: Any
|
||||
pools: Any
|
||||
def __init__(self) -> None: ...
|
||||
def random_data(self, bytes): ...
|
||||
def add_random_event(self, source_number, pool_number, data): ...
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
from typing import Any
|
||||
|
||||
__revision__: str
|
||||
|
||||
class AESGenerator:
|
||||
block_size: Any
|
||||
key_size: int
|
||||
max_blocks_per_request: Any
|
||||
counter: Any
|
||||
key: Any
|
||||
block_size_shift: Any
|
||||
blocks_per_key: Any
|
||||
max_bytes_per_request: Any
|
||||
def __init__(self) -> None: ...
|
||||
def reseed(self, seed): ...
|
||||
def pseudo_random_data(self, bytes): ...
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
class _SHAd256:
|
||||
digest_size: Any
|
||||
def __init__(self, internal_api_check, sha256_hash_obj) -> None: ...
|
||||
def copy(self): ...
|
||||
def digest(self): ...
|
||||
def hexdigest(self): ...
|
||||
def update(self, data): ...
|
||||
|
||||
digest_size: Any
|
||||
|
||||
def new(data: Optional[Any] = ...): ...
|
||||
@@ -0,0 +1 @@
|
||||
__revision__: str
|
||||
@@ -0,0 +1,5 @@
|
||||
from .rng_base import BaseRNG
|
||||
|
||||
class PythonOSURandomRNG(BaseRNG):
|
||||
name: str
|
||||
def __init__(self) -> None: ...
|
||||
@@ -0,0 +1,6 @@
|
||||
from typing import Any, Optional
|
||||
from .rng_base import BaseRNG
|
||||
|
||||
class DevURandomRNG(BaseRNG):
|
||||
name: str
|
||||
def __init__(self, devname: Optional[Any] = ...) -> None: ...
|
||||
@@ -0,0 +1,11 @@
|
||||
__revision__: str
|
||||
|
||||
class BaseRNG:
|
||||
closed: bool
|
||||
def __init__(self) -> None: ...
|
||||
def __del__(self): ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self): ...
|
||||
def close(self): ...
|
||||
def flush(self): ...
|
||||
def read(self, N: int = ...): ...
|
||||
@@ -0,0 +1,5 @@
|
||||
from typing import Any
|
||||
|
||||
def new(*args: Any, **kwargs: Any): ...
|
||||
def atfork() -> None: ...
|
||||
def get_random_bytes(n: int) -> bytes: ...
|
||||
@@ -0,0 +1,19 @@
|
||||
from typing import Any, List, Optional, Sequence, TypeVar
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class StrongRandom:
|
||||
def __init__(self, rng: Optional[Any] = ..., randfunc: Optional[Any] = ...) -> None: ...
|
||||
def getrandbits(self, k: int) -> int: ...
|
||||
def randrange(self, start: int, stop: int = ..., step: int = ...) -> int: ...
|
||||
def randint(self, a: int, b: int) -> int: ...
|
||||
def choice(self, seq: Sequence[_T]) -> _T: ...
|
||||
def shuffle(self, x: Sequence[Any]): ...
|
||||
def sample(self, population: Sequence[_T], k: int) -> List[_T]: ...
|
||||
|
||||
def getrandbits(k: int) -> int: ...
|
||||
def randrange(start: int, stop: int = ..., step: int = ...) -> int: ...
|
||||
def randint(a: int, b: int) -> int: ...
|
||||
def choice(seq: Sequence[_T]) -> _T: ...
|
||||
def shuffle(x: Sequence[Any]): ...
|
||||
def sample(population: Sequence[_T], k: int) -> List[_T]: ...
|
||||
@@ -0,0 +1,9 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
class PSS_SigScheme:
|
||||
def __init__(self, key, mgfunc, saltLen) -> None: ...
|
||||
def can_sign(self): ...
|
||||
def sign(self, mhash): ...
|
||||
def verify(self, mhash, S): ...
|
||||
|
||||
def new(key, mgfunc: Optional[Any] = ..., saltLen: Optional[Any] = ...): ...
|
||||
@@ -0,0 +1,7 @@
|
||||
class PKCS115_SigScheme:
|
||||
def __init__(self, key) -> None: ...
|
||||
def can_sign(self): ...
|
||||
def sign(self, mhash): ...
|
||||
def verify(self, mhash, S): ...
|
||||
|
||||
def new(key): ...
|
||||
@@ -0,0 +1,3 @@
|
||||
# Names in __all__ with no definition:
|
||||
# PKCS1_PSS
|
||||
# PKCS1_v1_5
|
||||
@@ -0,0 +1,3 @@
|
||||
from typing import Any
|
||||
|
||||
def new(nbits, prefix: Any = ..., suffix: Any = ..., initial_value: int = ..., overflow: int = ..., little_endian: bool = ..., allow_wraparound: bool = ..., disable_shortcut: bool = ...): ...
|
||||
@@ -0,0 +1,9 @@
|
||||
from typing import Any
|
||||
|
||||
__revision__: str
|
||||
binary: Any
|
||||
|
||||
def key_to_english(key): ...
|
||||
def english_to_key(s): ...
|
||||
|
||||
wordlist: Any
|
||||
@@ -0,0 +1,6 @@
|
||||
# Names in __all__ with no definition:
|
||||
# RFC1751
|
||||
# asn1
|
||||
# number
|
||||
# randpool
|
||||
# strxor
|
||||
@@ -0,0 +1,45 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
class DerObject:
|
||||
typeTags: Any
|
||||
typeTag: Any
|
||||
payload: Any
|
||||
def __init__(self, ASN1Type: Optional[Any] = ..., payload: Any = ...) -> None: ...
|
||||
def isType(self, ASN1Type): ...
|
||||
def encode(self): ...
|
||||
def decode(self, derEle, noLeftOvers: int = ...): ...
|
||||
|
||||
class DerInteger(DerObject):
|
||||
value: Any
|
||||
def __init__(self, value: int = ...) -> None: ...
|
||||
payload: Any
|
||||
def encode(self): ...
|
||||
def decode(self, derEle, noLeftOvers: int = ...): ...
|
||||
|
||||
class DerSequence(DerObject):
|
||||
def __init__(self, startSeq: Optional[Any] = ...) -> None: ...
|
||||
def __delitem__(self, n): ...
|
||||
def __getitem__(self, n): ...
|
||||
def __setitem__(self, key, value): ...
|
||||
def __setslice__(self, i, j, sequence): ...
|
||||
def __delslice__(self, i, j): ...
|
||||
def __getslice__(self, i, j): ...
|
||||
def __len__(self): ...
|
||||
def append(self, item): ...
|
||||
def hasInts(self): ...
|
||||
def hasOnlyInts(self): ...
|
||||
payload: Any
|
||||
def encode(self): ...
|
||||
def decode(self, derEle, noLeftOvers: int = ...): ...
|
||||
|
||||
class DerOctetString(DerObject):
|
||||
payload: Any
|
||||
def __init__(self, value: Any = ...) -> None: ...
|
||||
def decode(self, derEle, noLeftOvers: int = ...): ...
|
||||
|
||||
class DerNull(DerObject):
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class DerObjectId(DerObject):
|
||||
def __init__(self) -> None: ...
|
||||
def decode(self, derEle, noLeftOvers: int = ...): ...
|
||||
@@ -0,0 +1,22 @@
|
||||
from typing import Any, Optional
|
||||
from warnings import warn as _warn
|
||||
|
||||
__revision__: str
|
||||
bignum: Any
|
||||
|
||||
def size(N): ...
|
||||
def getRandomNumber(N, randfunc: Optional[Any] = ...): ...
|
||||
def getRandomInteger(N, randfunc: Optional[Any] = ...): ...
|
||||
def getRandomRange(a, b, randfunc: Optional[Any] = ...): ...
|
||||
def getRandomNBitInteger(N, randfunc: Optional[Any] = ...): ...
|
||||
def GCD(x, y): ...
|
||||
def inverse(u, v): ...
|
||||
def getPrime(N, randfunc: Optional[Any] = ...): ...
|
||||
def getStrongPrime(N, e: int = ..., false_positive_prob: float = ..., randfunc: Optional[Any] = ...): ...
|
||||
def isPrime(N, false_positive_prob: float = ..., randfunc: Optional[Any] = ...): ...
|
||||
def long_to_bytes(n, blocksize: int = ...): ...
|
||||
def bytes_to_long(s): ...
|
||||
def long2str(n, blocksize: int = ...): ...
|
||||
def str2long(s): ...
|
||||
|
||||
sieve_base: Any
|
||||
@@ -0,0 +1,16 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
__revision__: str
|
||||
|
||||
class RandomPool:
|
||||
bytes: Any
|
||||
bits: Any
|
||||
entropy: Any
|
||||
def __init__(self, numbytes: int = ..., cipher: Optional[Any] = ..., hash: Optional[Any] = ..., file: Optional[Any] = ...) -> None: ...
|
||||
def get_bytes(self, N): ...
|
||||
def randomize(self, N: int = ...): ...
|
||||
def stir(self, s: str = ...): ...
|
||||
def stir_n(self, N: int = ...): ...
|
||||
def add_event(self, s: str = ...): ...
|
||||
def getBytes(self, N): ...
|
||||
def addEvent(self, event, s: str = ...): ...
|
||||
@@ -0,0 +1,2 @@
|
||||
def strxor(*args, **kwargs): ...
|
||||
def strxor_c(*args, **kwargs): ...
|
||||
@@ -0,0 +1,7 @@
|
||||
# Names in __all__ with no definition:
|
||||
# Cipher
|
||||
# Hash
|
||||
# Protocol
|
||||
# PublicKey
|
||||
# Signature
|
||||
# Util
|
||||
@@ -0,0 +1,7 @@
|
||||
class CryptoWarning(Warning): ...
|
||||
class CryptoDeprecationWarning(DeprecationWarning, CryptoWarning): ...
|
||||
class CryptoRuntimeWarning(RuntimeWarning, CryptoWarning): ...
|
||||
class RandomPool_DeprecationWarning(CryptoDeprecationWarning): ...
|
||||
class ClockRewindWarning(CryptoRuntimeWarning): ...
|
||||
class GetRandomNumber_DeprecationWarning(CryptoDeprecationWarning): ...
|
||||
class PowmInsecureWarning(CryptoRuntimeWarning): ...
|
||||
@@ -24,29 +24,41 @@ println("Bundled: ${bundled.abs()}")
|
||||
println("Syncing")
|
||||
sync(repo, bundled)
|
||||
|
||||
val whiteList = setOf(
|
||||
val whiteList = sequenceOf(
|
||||
"__builtin__",
|
||||
"__future__",
|
||||
"_codecs",
|
||||
"_importlib_modulespec",
|
||||
"_io",
|
||||
"_thread",
|
||||
"abc",
|
||||
"argparse",
|
||||
"asyncio",
|
||||
"attr",
|
||||
"audioop",
|
||||
"builtins",
|
||||
"cmath",
|
||||
"collections",
|
||||
"concurrent",
|
||||
"configparser",
|
||||
"contextvars",
|
||||
"cPickle",
|
||||
"crypt",
|
||||
"Crypto",
|
||||
"csv",
|
||||
"ctypes",
|
||||
"datetime",
|
||||
"dbm",
|
||||
"decimal",
|
||||
"email",
|
||||
"exceptions",
|
||||
"functools",
|
||||
"genericpath",
|
||||
"gflags",
|
||||
"http",
|
||||
"io",
|
||||
"itertools",
|
||||
"json",
|
||||
"logging",
|
||||
"macpath",
|
||||
"math",
|
||||
@@ -54,12 +66,14 @@ val whiteList = setOf(
|
||||
"multiprocessing",
|
||||
"ntpath",
|
||||
"numbers",
|
||||
"pathlib",
|
||||
"queue",
|
||||
"os",
|
||||
"os2emxpath",
|
||||
"pathlib",
|
||||
"pickle",
|
||||
"posix",
|
||||
"posixpath",
|
||||
"pyexpat",
|
||||
"queue",
|
||||
"re",
|
||||
"shutil",
|
||||
"signal",
|
||||
@@ -71,6 +85,7 @@ val whiteList = setOf(
|
||||
"sys",
|
||||
"threading",
|
||||
"time",
|
||||
"turtle",
|
||||
"types",
|
||||
"typing",
|
||||
"typing_extensions",
|
||||
@@ -79,7 +94,7 @@ val whiteList = setOf(
|
||||
"uuid",
|
||||
"werkzeug",
|
||||
"xml"
|
||||
)
|
||||
).mapTo(hashSetOf()) { it.toLowerCase() }
|
||||
|
||||
println("Cleaning")
|
||||
cleanTopLevelPackages(bundled, whiteList)
|
||||
@@ -127,7 +142,7 @@ fun cleanTopLevelPackages(typeshed: Path, whiteList: Set<String>) {
|
||||
.flatMap { sequenceOf(it.resolve("stdlib"), it.resolve("third_party")) }
|
||||
.flatMap { Files.newDirectoryStream(it).asSequence() }
|
||||
.flatMap { Files.newDirectoryStream(it).asSequence() }
|
||||
.filter { it.nameWithoutExtension() !in whiteList }
|
||||
.filter { it.nameWithoutExtension().toLowerCase() !in whiteList }
|
||||
.forEach { it.delete() }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user