diff --git a/python/helpers/typeshed/stdlib/2and3/argparse.pyi b/python/helpers/typeshed/stdlib/2and3/argparse.pyi index 323ea463a5d9..c07906e0505e 100644 --- a/python/helpers/typeshed/stdlib/2and3/argparse.pyi +++ b/python/helpers/typeshed/stdlib/2and3/argparse.pyi @@ -1,4 +1,4 @@ -# Stubs for argparse (Python 3.4) +# Stubs for argparse (Python 2.7 and 3.4) from typing import ( Any, Callable, Iterable, List, IO, Optional, Sequence, Tuple, Type, Union, @@ -23,6 +23,20 @@ ZERO_OR_MORE = ... # type: str class ArgumentError(Exception): ... class ArgumentParser: + prog = ... # type: _Text + usage = ... # type: Optional[_Text] + description = ... # type: Optional[_Text] + epilog = ... # type: Optional[_Text] + formatter_class = ... # type: Type[HelpFormatter] + prefix_chars = ... # type: _Text + fromfile_prefix_chars = ... # type: Optional[_Text] + argument_default = ... # type: Optional[_Text] + conflict_handler = ... # type: _Text + add_help = ... # type: bool + + if sys.version_info >= (3, 5): + allow_abbrev = ... # type: bool + if sys.version_info >= (3, 5): def __init__(self, prog: Optional[str] = ..., diff --git a/python/helpers/typeshed/stdlib/2and3/array.pyi b/python/helpers/typeshed/stdlib/2and3/array.pyi new file mode 100644 index 000000000000..84e7e5ef443a --- /dev/null +++ b/python/helpers/typeshed/stdlib/2and3/array.pyi @@ -0,0 +1,73 @@ +# Stubs for array + +# Based on http://docs.python.org/3.6/library/array.html + +import sys +from typing import (Any, BinaryIO, Generic, Iterable, Iterator, List, MutableSequence, + overload, Text, Tuple, TypeVar, Union) + +_T = TypeVar('_T', int, float, Text) + +if sys.version_info >= (3,): + typecodes = ... # type: str + +class array(MutableSequence[_T], Generic[_T]): + typecode = ... # type: str + itemsize = ... # type: int + def __init__(self, typecode: str, + __initializer: Union[bytes, Iterable[_T]] = ...) -> None: ... + def append(self, x: _T) -> None: ... + def buffer_info(self) -> Tuple[int, int]: ... + def byteswap(self) -> None: ... + def count(self, x: Any) -> int: ... + def extend(self, iterable: Iterable[_T]) -> None: ... + if sys.version_info >= (3, 2): + def frombytes(self, s: bytes) -> None: ... + def fromfile(self, f: BinaryIO, n: int) -> None: ... + def fromlist(self, list: List[_T]) -> None: ... + def fromstring(self, s: bytes) -> None: ... + def fromunicode(self, s: str) -> None: ... + def index(self, x: _T) -> int: ... # type: ignore # Overrides Sequence + def insert(self, i: int, x: _T) -> None: ... + def pop(self, i: int = ...) -> _T: ... + if sys.version_info < (3,): + def read(self, f: BinaryIO, n: int) -> None: ... + def remove(self, x: Any) -> None: ... + def reverse(self) -> None: ... + if sys.version_info >= (3, 2): + def tobytes(self) -> bytes: ... + def tofile(self, f: BinaryIO) -> None: ... + def tolist(self) -> List[_T]: ... + def tostring(self) -> bytes: ... + def tounicode(self) -> str: ... + if sys.version_info < (3,): + def write(self, f: BinaryIO) -> None: ... + + def __len__(self) -> int: ... + + @overload + def __getitem__(self, i: int) -> _T: ... + @overload + def __getitem__(self, s: slice) -> array[_T]: ... + + @overload # type: ignore # Overrides MutableSequence + def __setitem__(self, i: int, o: _T) -> None: ... + @overload + def __setitem__(self, s: slice, o: array[_T]) -> None: ... + + def __delitem__(self, i: Union[int, slice]) -> None: ... + def __add__(self, x: array[_T]) -> array[_T]: ... + def __ge__(self, other: array[_T]) -> bool: ... + def __gt__(self, other: array[_T]) -> bool: ... + def __iadd__(self, x: array[_T]) -> array[_T]: ... # type: ignore # Overrides MutableSequence + def __imul__(self, n: int) -> array[_T]: ... + def __le__(self, other: array[_T]) -> bool: ... + def __lt__(self, other: array[_T]) -> bool: ... + def __mul__(self, n: int) -> array[_T]: ... + def __rmul__(self, n: int) -> array[_T]: ... + if sys.version_info < (3,): + def __delslice__(self, i: int, j: int) -> None: ... + def __getslice__(self, i: int, j: int) -> array[_T]: ... + def __setslice__(self, i: int, j: int, y: array[_T]) -> None: ... + +ArrayType = array diff --git a/python/helpers/typeshed/stdlib/2and3/distutils/cmd.pyi b/python/helpers/typeshed/stdlib/2and3/distutils/cmd.pyi index 126ef1599292..07e4989e683c 100644 --- a/python/helpers/typeshed/stdlib/2and3/distutils/cmd.pyi +++ b/python/helpers/typeshed/stdlib/2and3/distutils/cmd.pyi @@ -1,6 +1,6 @@ # Stubs for distutils.cmd -from typing import Callable, List, Tuple, Union +from typing import Callable, List, Tuple, Union, Optional, Iterable, Any, Text from abc import abstractmethod from distutils.dist import Distribution @@ -13,3 +13,28 @@ class Command: def finalize_options(self) -> None: ... @abstractmethod def run(self) -> None: ... + + def announce(self, msg: Text, level: int = ...) -> None: ... + def debug_print(self, msg: Text) -> None: ... + + def ensure_string(self, option: str, default: Optional[str] = ...) -> None: ... + def ensure_string_list(self, option: Union[str, List[str]]) -> None: ... + def ensure_filename(self, option: str) -> None: ... + def ensure_dirname(self, option: str) -> None: ... + + def get_command_name(self) -> str: ... + def set_undefined_options(self, src_cmd: Text, *option_pairs: Tuple[str, str]) -> None: ... + def get_finalized_command(self, command: Text, create: int = ...) -> Command: ... + def reinitialize_command(self, command: Union[Command, Text], reinit_subcommands: int = ...) -> Command: ... + def run_command(self, command: Text) -> None: ... + def get_sub_commands(self) -> List[str]: ... + + def warn(self, msg: Text) -> None: ... + def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: Optional[Text] = ..., level: int = ...) -> None: ... + def mkpath(self, name: str, mode: int = ...) -> None: ... + def copy_file(self, infile: str, outfile: str, preserve_mode: int = ..., preserve_times: int = ..., link: Optional[str] = ..., level: Any = ...) -> Tuple[str, bool]: ... # level is not used + def copy_tree(self, infile: str, outfile: str, preserve_mode: int = ..., preserve_times: int = ..., preserve_symlinks: int = ..., level: Any = ...) -> List[str]: ... # level is not used + def move_file(self, src: str, dest: str, level: Any = ...) -> str: ... # level is not used + def spawn(self, cmd: Iterable[str], search_path: int = ..., level: Any = ...) -> None: ... # level is not used + def make_archive(self, base_name: str, format: str, root_dir: Optional[str] = ..., base_dir: Optional[str] = ..., owner: Optional[str] = ..., group: Optional[str] = ...) -> str: ... + def make_file(self, infiles: Union[str, List[str], Tuple[str]], outfile: str, func: Callable[..., Any], args: List[Any], exec_msg: Optional[str] = ..., skip_msg: Optional[str] = ..., level: Any = ...) -> None: ... # level is not used diff --git a/python/helpers/typeshed/stdlib/2and3/distutils/log.pyi b/python/helpers/typeshed/stdlib/2and3/distutils/log.pyi index e69de29bb2d1..6c37cc503b30 100644 --- a/python/helpers/typeshed/stdlib/2and3/distutils/log.pyi +++ b/python/helpers/typeshed/stdlib/2and3/distutils/log.pyi @@ -0,0 +1,28 @@ +from typing import Any, Callable, Iterable, Text + +DEBUG: int +INFO: int +WARN: int +ERROR: int +FATAL: int + +class Log: + def __init__(self, threshold: int = ...) -> None: ... + def log(self, level: int, msg: Text, *args: Any) -> None: ... + def debug(self, msg: Text, *args: Any) -> None: ... + def info(self, msg: Text, *args: Any) -> None: ... + def warn(self, msg: Text, *args: Any) -> None: ... + def error(self, msg: Text, *args: Any) -> None: ... + def fatal(self, msg: Text, *args: Any) -> None: ... + +_LogFunc = Callable[[Text, Iterable[Any]], None] + +log: Callable[[int, Text, Iterable[Any]], None] +debug: _LogFunc +info: _LogFunc +warn: _LogFunc +error: _LogFunc +fatal: _LogFunc + +def set_threshold(level: int) -> int: ... +def set_verbosity(v: int) -> None: ... diff --git a/python/helpers/typeshed/stdlib/2and3/imaplib.pyi b/python/helpers/typeshed/stdlib/2and3/imaplib.pyi new file mode 100644 index 000000000000..4f53146ab1f5 --- /dev/null +++ b/python/helpers/typeshed/stdlib/2and3/imaplib.pyi @@ -0,0 +1,133 @@ +# Stubs for imaplib (Python 2) + +import imaplib +import subprocess +import sys +import time +from socket import socket as _socket +from ssl import SSLSocket +from typing import Any, Callable, Dict, IO, List, Optional, Pattern, Text, Tuple, Union + +CommandResults = Tuple[str, List[Any]] + + +class IMAP4: + error: Exception + abort: Exception + readonly: Exception + mustquote: Pattern[Text] = ... + debug: int = ... + state: str = ... + literal: Optional[Text] = ... + tagged_commands: Dict[str, str] = ... + untagged_responses: Dict[str, str] = ... + continuation_response: str = ... + is_readonly: bool = ... + tagnum: int = ... + tagpre: str = ... + tagre: Pattern[Text] = ... + welcome: bytes = ... + capabilities: Tuple[str] = ... + PROTOCOL_VERSION: str = ... + def __init__(self, host: str, port: int) -> None: ... + def __getattr__(self, attr: str) -> Any: ... + host: str = ... + port: int = ... + sock: _socket = ... + file: Union[IO[Text], IO[bytes]] = ... + def open(self, host: str = ..., port: int = ...) -> None: ... + def read(self, size: int) -> bytes: ... + def readline(self) -> bytes: ... + def send(self, data: bytes) -> None: ... + def shutdown(self) -> None: ... + def socket(self) -> _socket: ... + def recent(self) -> CommandResults: ... + def response(self, code: str) -> CommandResults: ... + def append(self, mailbox: str, flags: str, date_time: str, message: str) -> str: ... + def authenticate(self, mechanism: str, authobject: Callable) -> Tuple[str, str]: ... + def capability(self) -> CommandResults: ... + def check(self) -> CommandResults: ... + def close(self) -> CommandResults: ... + def copy(self, message_set: str, new_mailbox: str) -> CommandResults: ... + def create(self, mailbox: str) -> CommandResults: ... + def delete(self, mailbox: str) -> CommandResults: ... + def deleteacl(self, mailbox: str, who: str) -> CommandResults: ... + def expunge(self) -> CommandResults: ... + def fetch(self, message_set: str, message_parts: str) -> CommandResults: ... + def getacl(self, mailbox: str) -> CommandResults: ... + def getannotation(self, mailbox: str, entry: str, attribute: str) -> CommandResults: ... + def getquota(self, root: str) -> CommandResults: ... + def getquotaroot(self, mailbox: str) -> CommandResults: ... + def list(self, directory: str = ..., pattern: str = ...) -> CommandResults: ... + def login(self, user: str, password: str) -> CommandResults: ... + def login_cram_md5(self, user: str, password: str) -> CommandResults: ... + def logout(self) -> CommandResults: ... + def lsub(self, directory: str = ..., pattern: str = ...) -> CommandResults: ... + def myrights(self, mailbox: str) -> CommandResults: ... + def namespace(self) -> CommandResults: ... + def noop(self) -> CommandResults: ... + def partial(self, message_num: str, message_part: str, start: str, length: str) -> CommandResults: ... + def proxyauth(self, user: str) -> CommandResults: ... + def rename(self, oldmailbox: str, newmailbox: str) -> CommandResults: ... + def search(self, charset: str, *criteria: str) -> CommandResults: ... + def select(self, mailbox: str = ..., readonly: bool = ...) -> CommandResults: ... + def setacl(self, mailbox: str, who: str, what: str) -> CommandResults: ... + def setannotation(self, *args: List[str]) -> CommandResults: ... + def setquota(self, root: str, limits: str) -> CommandResults: ... + def sort(self, sort_criteria: str, charset: str, *search_criteria: List[str]) -> CommandResults: ... + if sys.version_info >= (3,): + def starttls(self, ssl_context: Optional[Any] = ...) -> CommandResults: ... + def status(self, mailbox: str, names: str) -> CommandResults: ... + def store(self, message_set: str, command: str, flags: str) -> CommandResults: ... + def subscribe(self, mailbox: str) -> CommandResults: ... + def thread(self, threading_algorithm: str, charset: str, *search_criteria: List[str]) -> CommandResults: ... + def uid(self, command: str, *args: List[str]) -> CommandResults: ... + def unsubscribe(self, mailbox: str) -> CommandResults: ... + def xatom(self, name: str, *args: List[str]) -> CommandResults: ... + def print_log(self) -> None: ... + +class IMAP4_SSL(IMAP4): + keyfile: str = ... + certfile: str = ... + def __init__(self, host: str = ..., port: int = ..., keyfile: Optional[str] = ..., certfile: Optional[str] = ...) -> None: ... + host: str = ... + port: int = ... + sock: _socket = ... + sslobj: SSLSocket = ... + file: IO[Any] = ... + def open(self, host: str = ..., port: Optional[int] = ...) -> None: ... + def read(self, size: int) -> bytes: ... + def readline(self) -> bytes: ... + def send(self, data: bytes) -> None: ... + def shutdown(self) -> None: ... + def socket(self) -> _socket: ... + def ssl(self) -> SSLSocket: ... + + +class IMAP4_stream(IMAP4): + command: str = ... + def __init__(self, command: str) -> None: ... + host: str = ... + port: int = ... + sock: _socket = ... + file: IO[Any] = ... + process: subprocess.Popen = ... + writefile: IO[Any] = ... + readfile: IO[Any] = ... + def open(self, host: str = ..., port: Optional[int] = ...) -> None: ... + def read(self, size: int) -> bytes: ... + def readline(self) -> bytes: ... + def send(self, data: bytes) -> None: ... + def shutdown(self) -> None: ... + +class _Authenticator: + mech: Callable = ... + def __init__(self, mechinst: Callable) -> None: ... + def process(self, data: str) -> str: ... + def encode(self, inp: bytes) -> str: ... + def decode(self, inp: str) -> bytes: ... + +def Internaldate2tuple(resp: str) -> time.struct_time: ... +def Int2AP(num: int) -> str: ... +def ParseFlags(resp: str) -> Tuple[str]: ... +def Time2Internaldate(date_time: Union[float, time.struct_time, str]) -> str: ... diff --git a/python/helpers/typeshed/stdlib/2and3/sre_compile.pyi b/python/helpers/typeshed/stdlib/2and3/sre_compile.pyi new file mode 100644 index 000000000000..c74bd85f31bd --- /dev/null +++ b/python/helpers/typeshed/stdlib/2and3/sre_compile.pyi @@ -0,0 +1,18 @@ +# Source: https://hg.python.org/cpython/file/2.7/Lib/sre_compile.py +# and https://github.com/python/cpython/blob/master/Lib/sre_compile.py + +import sys +from sre_parse import SubPattern +from typing import Any, List, Pattern, Tuple, Type, TypeVar, Union + +MAXCODE = ... # type: int +if sys.version_info < (3, 0): + STRING_TYPES: Tuple[Type[str], Type[unicode]] + _IsStringType = int +else: + from sre_constants import _NamedIntConstant + def dis(code: List[_NamedIntConstant]) -> None: ... + _IsStringType = bool + +def isstring(obj: Any) -> _IsStringType: ... +def compile(p: Union[str, bytes, SubPattern], flags: int = ...) -> Pattern: ... diff --git a/python/helpers/typeshed/stdlib/2and3/uuid.pyi b/python/helpers/typeshed/stdlib/2and3/uuid.pyi index f05ccf0c819a..354371a7c5c5 100644 --- a/python/helpers/typeshed/stdlib/2and3/uuid.pyi +++ b/python/helpers/typeshed/stdlib/2and3/uuid.pyi @@ -47,6 +47,8 @@ class UUID: @property def version(self) -> Optional[_Int]: ... + def __int__(self) -> _Int: ... + if sys.version_info >= (3,): def __eq__(self, other: Any) -> bool: ... def __lt__(self, other: Any) -> bool: ... diff --git a/python/helpers/typeshed/stdlib/3.4/enum.pyi b/python/helpers/typeshed/stdlib/3.4/enum.pyi index 1501be27450e..001f6e9f7990 100644 --- a/python/helpers/typeshed/stdlib/3.4/enum.pyi +++ b/python/helpers/typeshed/stdlib/3.4/enum.pyi @@ -2,7 +2,7 @@ import sys from typing import List, Any, TypeVar, Union, Iterable, Iterator, TypeVar, Generic, Type, Sized, Reversible, Container, Mapping from abc import ABCMeta -_T = TypeVar('_T', bound=Enum) +_T = TypeVar('_T') _S = TypeVar('_S', bound=Type[Enum]) # Note: EnumMeta actually subclasses type directly, not ABCMeta. diff --git a/python/helpers/typeshed/stdlib/3/_curses.pyi b/python/helpers/typeshed/stdlib/3/_curses.pyi index a6afa7bc771b..44cba0985949 100644 --- a/python/helpers/typeshed/stdlib/3/_curses.pyi +++ b/python/helpers/typeshed/stdlib/3/_curses.pyi @@ -234,7 +234,7 @@ def flash() -> None: ... def flushinp() -> None: ... def getmouse() -> Tuple[int, int, int, int, int]: ... def getsyx() -> Tuple[int, int]: ... -def getwin(f: BinaryIO): ... +def getwin(f: BinaryIO) -> _CursesWindow: ... def halfdelay(tenths: int) -> None: ... def has_colors() -> bool: ... def has_ic() -> bool: ... @@ -253,7 +253,7 @@ def meta(yes: bool) -> None: ... def mouseinterval(interval: int) -> None: ... def mousemask(mousemask: int) -> Tuple[int, int]: ... def napms(ms: int) -> int: ... -def newpad(nlines: int, ncols: int): ... +def newpad(nlines: int, ncols: int) -> _CursesWindow: ... def newwin(nlines: int, ncols: int, begin_y: int = ..., begin_x: int = ...) -> _CursesWindow: ... def nl(flag: bool = ...) -> None: ... def nocbreak() -> None: ... @@ -292,227 +292,156 @@ def use_env(flag: bool) -> None: ... class error(Exception): ... - class _CursesWindow: encoding = ... # type: str - @overload - def addch(self, ch: _chtype, attr: Optional[int]) -> None: ... - + def addch(self, ch: _chtype, attr: int = ...) -> None: ... @overload - def addch(self, y: int, x: int, ch: _chtype, attr: Optional[int]) -> None: ... - + def addch(self, y: int, x: int, ch: _chtype, attr: int = ...) -> None: ... @overload - def addnstr(self, str: str, n: int, attr: Optional[int]) -> None: ... - + def addnstr(self, str: str, n: int, attr: int = ...) -> None: ... @overload - def addnstr(self, y: int, x: int, str: str, n: int, attr: Optional[int]) -> None: ... - + def addnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ... @overload - def addstr(self, str: str, attr: Optional[int]) -> None: ... - + def addstr(self, str: str, attr: int = ...) -> None: ... @overload - def addstr(self, y: int, x: int, str: str, attr: Optional[int]) -> None: ... - + def addstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ... def attroff(self, attr: int) -> None: ... - def attron(self, attr: int) -> None: ... - def attrset(self, attr: int) -> None: ... - - def bkgd(self, ch: _chtype, attr: Optional[int]) -> None: ... - - def bkgset(self, ch: _chtype, attr: Optional[int]) -> None: ... - - def border(self, ls: Optional[int], rs: Optional[int], - ts: Optional[int], bs: Optional[int], - tl: Optional[int], tr: Optional[int], - bl: Optional[int], br: Optional[int]) -> None: ... - - def box(self, vertch: Optional[Tuple[int, int]], horch: Optional[Tuple[int, int]]) -> None: ... - + def bkgd(self, ch: _chtype, attr: int = ...) -> None: ... + def bkgset(self, ch: _chtype, attr: int = ...) -> None: ... + def border(self, ls: _chtype = ..., rs: _chtype = ..., ts: _chtype = ..., bs: _chtype = ..., tl: _chtype = ..., tr: _chtype = ..., bl: _chtype = ..., br: _chtype = ...) -> None: ... + @overload + def box(self) -> None: ... + @overload + def box(self, vertch: _chtype = ..., horch: _chtype = ...) -> None: ... @overload def chgat(self, attr: int) -> None: ... - @overload def chgat(self, num: int, attr: int) -> None: ... - @overload def chgat(self, y: int, x: int, attr: int) -> None: ... - @overload def chgat(self, y: int, x: int, num: int, attr: int) -> None: ... - def clear(self) -> None: ... - - def clearok(self, yes: int): ... - + def clearok(self, yes: int) -> None: ... def clrtobot(self) -> None: ... - def clrtoeol(self) -> None: ... - def cursyncup(self) -> None: ... - @overload def delch(self) -> None: ... - @overload def delch(self, y: int, x: int) -> None: ... - def deleteln(self) -> None: ... - @overload def derwin(self, begin_y: int, begin_x: int) -> '_CursesWindow': ... - @overload def derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> '_CursesWindow': ... - - def echochar(self, ch: _chtype, attr: Optional[int]) -> None: ... - + def echochar(self, ch: _chtype, attr: int = ...) -> None: ... def enclose(self, y: int, x: int) -> bool: ... - def erase(self) -> None: ... - def getbegyx(self) -> Tuple[int, int]: ... - def getbkgd(self) -> Tuple[int, int]: ... - - def getch(self, y: Optional[int], x: Optional[int]) -> _chtype: ... - - def get_wch(self, y: Optional[int], x: Optional[int]) -> _chtype: ... - - def getkey(self, y: Optional[int], x: Optional[int]) -> str: ... - - def getmaxyx(self) -> Tuple['_CursesWindow', int, int]: ... - + @overload + def getch(self) -> _chtype: ... + @overload + def getch(self, y: int, x: int) -> _chtype: ... + @overload + def get_wch(self) -> _chtype: ... + @overload + def get_wch(self, y: int, x: int) -> _chtype: ... + @overload + def getkey(self) -> str: ... + @overload + def getkey(self, y: int, x: int) -> str: ... + def getmaxyx(self) -> Tuple[int, int]: ... def getparyx(self) -> Tuple[int, int]: ... - - def getstr(self, y: Optional[int], x: Optional[int]) -> None: ... - - def getyx(self) -> Tuple['_CursesWindow', int, int]: ... - + @overload + def getstr(self) -> _chtype: ... + @overload + def getstr(self, n: int) -> _chtype: ... + @overload + def getstr(self, y: int, x: int) -> _chtype: ... + @overload + def getstr(self, y: int, x: int, n: int) -> _chtype: ... + def getyx(self) -> Tuple[int, int]: ... @overload def hline(self, ch: _chtype, n: int) -> None: ... - @overload def hline(self, y: int, x: int, ch: _chtype, n: int) -> None: ... - def idcok(self, flag: bool) -> None: ... - def idlok(self, yes: bool) -> None: ... - def immedok(self, flag: bool) -> None: ... - - def inch(self, y: Optional[int], x: Optional[int]) -> _chtype: ... - @overload - def insch(self, ch: _chtype, attr: Optional[int]) -> None: ... - + def inch(self) -> _chtype: ... @overload - def insch(self, y: int, x: int, ch: _chtype, attr: Optional[int]) -> None: ... - + def inch(self, y: int, x: int) -> _chtype: ... + @overload + def insch(self, ch: _chtype, attr: int = ...) -> None: ... + @overload + def insch(self, y: int, x: int, ch: _chtype, attr: int = ...) -> None: ... def insdelln(self, nlines: int) -> None: ... - def insertln(self) -> None: ... - @overload - def insnstr(self, str: str, n: int, attr: Optional[int]) -> None: ... - + def insnstr(self, str: str, n: int, attr: int = ...) -> None: ... @overload - def insnstr(self, y: int, x: int, str: str, n: int, attr: Optional[int]) -> None: ... - + def insnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ... @overload - def insstr(self, str: str, attr: Optional[int]) -> None: ... - + def insstr(self, str: str, attr: int = ...) -> None: ... @overload - def insstr(self, y: int, x: int, str: str, attr: Optional[int]) -> None: ... - + def insstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ... @overload - def instr(self, n: Optional[int]) -> str: ... - + def instr(self, n: int = ...) -> _chtype: ... @overload - def instr(self, y: int, x: int, n: Optional[int]) -> str: ... - + def instr(self, y: int, x: int, n: int = ...) -> _chtype: ... def is_linetouched(self, line: int) -> bool: ... - def is_wintouched(self) -> bool: ... - def keypad(self, yes: bool) -> None: ... - def leaveok(self, yes: bool) -> None: ... - def move(self, new_y: int, new_x: int) -> None: ... - def mvderwin(self, y: int, x: int) -> None: ... - def mvwin(self, new_y: int, new_x: int) -> None: ... - def nodelay(self, yes: bool) -> None: ... - def notimeout(self, yes: bool) -> None: ... - def noutrefresh(self) -> None: ... - - def overlay(self, destwin: '_CursesWindow', - sminrow: Optional[int], smincol: Optional[int], - dminrow: Optional[int], dmincol: Optional[int], - dmaxrow: Optional[int], dmaxcol: Optional[int]) -> None: ... - - def overwrite(self, destwin: '_CursesWindow', - sminrow: Optional[int], smincol: Optional[int], - dminrow: Optional[int], dmincol: Optional[int], - dmaxrow: Optional[int], dmaxcol: Optional[int]) -> None: ... - + @overload + def overlay(self, destwin: '_CursesWindow') -> None: ... + @overload + def overlay(self, destwin: '_CursesWindow', sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int) -> None: ... + @overload + def overwrite(self, destwin: '_CursesWindow') -> None: ... + @overload + def overwrite(self, destwin: '_CursesWindow', sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int) -> None: ... def putwin(self, file: IO[Any]) -> None: ... - def redrawln(self, beg: int, num: int) -> None: ... - def redrawwin(self) -> None: ... - - def refresh(self, pminrow: Optional[int], pmincol: Optional[int], - sminrow: Optional[int], smincol: Optional[int], - smaxrow: Optional[int], smaxcol: Optional[int]) -> None: ... - + @overload + def refresh(self) -> None: ... + @overload + def refresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ... def resize(self, nlines: int, ncols: int) -> None: ... - - def scroll(self, lines: int) -> None: ... - + def scroll(self, lines: int = ...) -> None: ... def scrollok(self, flag: bool) -> None: ... - def setscrreg(self, top: int, bottom: int) -> None: ... - def standend(self) -> None: ... - def standout(self) -> None: ... - @overload def subpad(self, begin_y: int, begin_x: int) -> '_CursesWindow': ... - @overload def subpad(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> '_CursesWindow': ... - @overload def subwin(self, begin_y: int, begin_x: int) -> '_CursesWindow': ... - @overload def subwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> '_CursesWindow': ... - def syncdown(self) -> None: ... - def syncok(self, flag: bool) -> None: ... - def syncup(self) -> None: ... - def timeout(self, delay: int) -> None: ... - - def touchline(self, start: int, count: int, changed: Optional[bool]) -> None: ... - + def touchline(self, start: int, count: int, changed: bool = ...) -> None: ... def touchwin(self) -> None: ... - def untouchwin(self) -> None: ... - @overload def vline(self, ch: _chtype, n: int) -> None: ... - @overload def vline(self, y: int, x: int, ch: _chtype, n: int) -> None: ... diff --git a/python/helpers/typeshed/stdlib/3/curses/__init__.pyi b/python/helpers/typeshed/stdlib/3/curses/__init__.pyi index ef9f4207d2d0..d79727aafbd8 100644 --- a/python/helpers/typeshed/stdlib/3/curses/__init__.pyi +++ b/python/helpers/typeshed/stdlib/3/curses/__init__.pyi @@ -1,9 +1,10 @@ import _curses from _curses import * # noqa: F403 +from typing import Callable, Any, Sequence, Mapping LINES: int COLS: int def initscr() -> _curses._CursesWindow: ... -def start_color(): ... -def wrapper(func, *args, **kwds): ... +def start_color() -> None: ... +def wrapper(func: Callable[..., Any], *arg: Any, **kwds: Any) -> None: ... diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/connection.pyi b/python/helpers/typeshed/stdlib/3/multiprocessing/connection.pyi new file mode 100644 index 000000000000..2bad309587c7 --- /dev/null +++ b/python/helpers/typeshed/stdlib/3/multiprocessing/connection.pyi @@ -0,0 +1,39 @@ +from typing import Any, Iterable, List, Optional, Tuple, Type, Union +import socket +import sys +import types + +# https://docs.python.org/3/library/multiprocessing.html#address-formats +_Address = Union[str, Tuple[str, int]] + +def deliver_challenge(connection: Connection, authkey: bytes) -> None: ... +def answer_challenge(connection: Connection, authkey: bytes) -> None: ... +if sys.version_info >= (3, 3): + def wait(object_list: Iterable[Union[Connection, socket.socket, int]], timeout: Optional[float] = ...) -> List[Union[Connection, socket.socket, int]]: ... +def Client(address: _Address, family: Optional[str] = ..., authkey: Optional[bytes] = ...) -> Connection: ... +def Pipe(duplex: bool = ...) -> Tuple[Connection, Connection]: ... + +class Listener: + def __init__(self, address: Optional[_Address] = ..., family: Optional[str] = ..., backlog: int = ..., authkey: Optional[bytes] = ...) -> None: ... + def accept(self) -> Connection: ... + def close(self) -> None: ... + @property + def address(self) -> _Address: ... + @property + def last_accepted(self) -> Optional[_Address]: ... + if sys.version_info >= (3, 3): + def __enter__(self) -> Listener: ... + def __exit__(self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], exc_tb: Optional[types.TracebackType]) -> None: ... + +class Connection: + def close(self) -> None: ... + def fileno(self) -> int: ... + def poll(self, timeout: float = ...) -> bool: ... + def recv(self) -> Any: ... + def recv_bytes(self, maxlength: Optional[int] = ...) -> bytes: ... + def recv_bytes_into(self, buf: Any, offset: int = ...) -> int: ... + def send(self, obj: Any) -> None: ... + def send_bytes(self, + buf: bytes, + offset: int = ..., + size: Optional[int] = ...) -> None: ... diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/synchronize.pyi b/python/helpers/typeshed/stdlib/3/multiprocessing/synchronize.pyi new file mode 100644 index 000000000000..3b8f0fd86a74 --- /dev/null +++ b/python/helpers/typeshed/stdlib/3/multiprocessing/synchronize.pyi @@ -0,0 +1,64 @@ +from typing import Callable, ContextManager, Optional, Union + +from multiprocessing.context import BaseContext +import threading +import sys + +_LockLike = Union[Lock, RLock] + +class Barrier(threading.Barrier): + def __init__(self, + parties: int, + action: Optional[Callable] = ..., + timeout: Optional[float] = ..., + * + ctx: BaseContext) -> None: ... + +class BoundedSemaphore(Semaphore): + def __init__(self, value: int = ..., *, ctx: BaseContext) -> None: ... + +class Condition(ContextManager[bool]): + def __init__(self, + lock: Optional[_LockLike] = ..., + *, + ctx: BaseContext) -> None: ... + if sys.version_info >= (3, 7): + def notify(self, n: int = ...) -> None: ... + else: + def notify(self) -> None: ... + def notify_all(self) -> None: ... + def wait(self, timeout: Optional[float] = ...) -> bool: ... + if sys.version_info >= (3, 3): + def wait_for(self, + predicate: Callable[[], bool], + timeout: Optional[float] = ...) -> bool: ... + def acquire(self, + block: bool = ..., + timeout: Optional[float] = ...) -> bool: ... + def release(self) -> None: ... + +class Event(ContextManager[bool]): + def __init__(self, + lock: Optional[_LockLike] = ..., + *, + ctx: BaseContext) -> None: ... + def is_set(self) -> bool: ... + def set(self) -> None: ... + def clear(self) -> None: ... + def wait(self, timeout: Optional[float] = ...) -> bool: ... + +class Lock(SemLock): + def __init__(self, *, ctx: BaseContext) -> None: ... + +class RLock(SemLock): + def __init__(self, *, ctx: BaseContext) -> None: ... + +class Semaphore(SemLock): + def __init__(self, value: int = ..., *, ctx: BaseContext) -> None: ... + +# Not part of public API +class SemLock(ContextManager[bool]): + def acquire(self, + block: bool = ..., + timeout: Optional[float] = ...) -> bool: ... + def release(self) -> None: ... diff --git a/python/helpers/typeshed/stdlib/3/typing.pyi b/python/helpers/typeshed/stdlib/3/typing.pyi index 83471acbea72..bea2450bf765 100644 --- a/python/helpers/typeshed/stdlib/3/typing.pyi +++ b/python/helpers/typeshed/stdlib/3/typing.pyi @@ -260,6 +260,7 @@ class MutableSequence(Sequence[_T], Generic[_T]): def __delitem__(self, i: slice) -> None: ... # Mixin methods def append(self, object: _T) -> None: ... + def clear(self) -> None: ... def extend(self, iterable: Iterable[_T]) -> None: ... def reverse(self) -> None: ... def pop(self, index: int = ...) -> _T: ... diff --git a/python/helpers/typeshed/third_party/2/werkzeug/wrappers.pyi b/python/helpers/typeshed/third_party/2/werkzeug/wrappers.pyi index 98b258241b28..e43aa703fef1 100644 --- a/python/helpers/typeshed/third_party/2/werkzeug/wrappers.pyi +++ b/python/helpers/typeshed/third_party/2/werkzeug/wrappers.pyi @@ -36,7 +36,8 @@ class BaseRequest: def stream(self): ... input_stream = ... # type: Any args = ... # type: ImmutableMultiDict - def data(self): ... + @property + def data(self) -> str: ... def get_data(self, cache: bool = ..., as_text: bool = ..., parse_form_data: bool = ...) -> str: ... form = ... # type: ImmutableMultiDict values = ... # type: CombinedMultiDict diff --git a/python/helpers/typeshed/third_party/2and3/croniter.pyi b/python/helpers/typeshed/third_party/2and3/croniter.pyi new file mode 100644 index 000000000000..0d01b7e0534d --- /dev/null +++ b/python/helpers/typeshed/third_party/2and3/croniter.pyi @@ -0,0 +1,41 @@ +import datetime +from typing import Any, Dict, Iterator, List, Optional, Text, Tuple, Type, TypeVar, Union + +_RetType = Union[Type[float], Type[datetime.datetime]] +_SelfT = TypeVar('_SelfT', bound=croniter) + +class CroniterError(ValueError): ... +class CroniterBadCronError(CroniterError): ... +class CroniterBadDateError(CroniterError): ... +class CroniterNotAlphaError(CroniterError): ... + +class croniter(Iterator[Any]): + MONTHS_IN_YEAR: int + RANGES: Tuple[Tuple[int, int], ...] + DAYS: Tuple[int, ...] + ALPHACONV: Tuple[Dict[str, Any], ...] + LOWMAP: Tuple[Dict[int, Any], ...] + bad_length: str + tzinfo: Optional[datetime.tzinfo] + cur: float + expanded: List[List[str]] + start_time: float + dst_start_time: float + nth_weekday_of_month: Dict[str, Any] + def __init__(self, expr_format: Text, start_time: Optional[Union[float, datetime.datetime]] = ..., ret_type: Optional[_RetType] = ...) -> None: ... + # Most return value depend on ret_type, which can be passed in both as a method argument and as + # a constructor argument. + def get_next(self, ret_type: Optional[_RetType] = ...) -> Any: ... + def get_prev(self, ret_type: Optional[_RetType] = ...) -> Any: ... + def get_current(self, ret_type: Optional[_RetType] = ...) -> Any: ... + def __iter__(self: _SelfT) -> _SelfT: ... + def __next__(self, ret_type: Optional[_RetType] = ...) -> Any: ... + def next(self, ret_type: Optional[_RetType] = ...) -> Any: ... + def all_next(self, ret_type: Optional[_RetType] = ...) -> Iterator[Any]: ... + def all_prev(self, ret_type: Optional[_RetType] = ...) -> Iterator[Any]: ... + def iter(self, ret_type: Optional[_RetType] = ...) -> Iterator[Any]: ... + def is_leap(self, year: int) -> bool: ... + @classmethod + def expand(cls, expr_format: Text) -> Tuple[List[List[str]], Dict[str, Any]]: ... + @classmethod + def is_valid(cls, expression: Text) -> bool: ... diff --git a/python/helpers/typeshed/third_party/2and3/jinja2/environment.pyi b/python/helpers/typeshed/third_party/2and3/jinja2/environment.pyi index 909211ca8400..44508616a465 100644 --- a/python/helpers/typeshed/third_party/2and3/jinja2/environment.pyi +++ b/python/helpers/typeshed/third_party/2and3/jinja2/environment.pyi @@ -79,6 +79,7 @@ class Environment: class Template: def __new__(cls, source, block_start_string: Any = ..., block_end_string: Any = ..., variable_start_string: Any = ..., variable_end_string: Any = ..., comment_start_string: Any = ..., comment_end_string: Any = ..., line_statement_prefix: Any = ..., line_comment_prefix: Any = ..., trim_blocks: Any = ..., lstrip_blocks: Any = ..., newline_sequence: Any = ..., keep_trailing_newline: Any = ..., extensions: Any = ..., optimized: bool = ..., undefined: Any = ..., finalize: Optional[Any] = ..., autoescape: bool = ...): ... + environment: Environment = ... @classmethod def from_code(cls, environment, code, globals, uptodate: Optional[Any] = ...): ... @classmethod diff --git a/python/helpers/typeshed/third_party/2and3/pynamodb/connection/__init__.pyi b/python/helpers/typeshed/third_party/2and3/pynamodb/connection/__init__.pyi index 8ecfdaf53fb4..1860736bae33 100644 --- a/python/helpers/typeshed/third_party/2and3/pynamodb/connection/__init__.pyi +++ b/python/helpers/typeshed/third_party/2and3/pynamodb/connection/__init__.pyi @@ -1,2 +1,2 @@ -from pynamodb.connection.base import Connection -from pynamodb.connection.table import TableConnection +from pynamodb.connection.base import Connection as Connection +from pynamodb.connection.table import TableConnection as TableConnection diff --git a/python/helpers/typeshed/third_party/2and3/requests/api.pyi b/python/helpers/typeshed/third_party/2and3/requests/api.pyi index 98fdc5acb666..0fe344ecfbba 100644 --- a/python/helpers/typeshed/third_party/2and3/requests/api.pyi +++ b/python/helpers/typeshed/third_party/2and3/requests/api.pyi @@ -1,26 +1,41 @@ # Stubs for requests.api (Python 3) +import sys from typing import Optional, Union, Any, Iterable, Mapping, MutableMapping, Tuple, IO, Text from .models import Response -_ParamsMappingValueType = Union[Text, bytes, int, float, Iterable[Union[Text, bytes, int, float]]] -_Data = Union[None, bytes, MutableMapping[Text, Text], Iterable[Tuple[Text, Text]], IO] +if sys.version_info >= (3,): + _Text = str +else: + _Text = Union[str, Text] + +_ParamsMappingValueType = Union[_Text, bytes, int, float, Iterable[Union[_Text, bytes, int, float]]] +_Data = Union[ + None, + bytes, + MutableMapping[str, str], + MutableMapping[str, Text], + MutableMapping[Text, str], + MutableMapping[Text, Text], + Iterable[Tuple[_Text, _Text]], + IO +] def request(method: str, url: str, **kwargs) -> Response: ... -def get(url: Union[Text, bytes], +def get(url: Union[_Text, bytes], params: Optional[ - Union[Mapping[Union[Text, bytes, int, float], _ParamsMappingValueType], - Union[Text, bytes], - Tuple[Union[Text, bytes, int, float], _ParamsMappingValueType], - Mapping[Text, _ParamsMappingValueType], + Union[Mapping[Union[_Text, bytes, int, float], _ParamsMappingValueType], + Union[_Text, bytes], + Tuple[Union[_Text, bytes, int, float], _ParamsMappingValueType], + Mapping[_Text, _ParamsMappingValueType], Mapping[bytes, _ParamsMappingValueType], Mapping[int, _ParamsMappingValueType], Mapping[float, _ParamsMappingValueType]]] = ..., **kwargs) -> Response: ... -def options(url: Union[str, Text], **kwargs) -> Response: ... -def head(url: Union[str, Text], **kwargs) -> Response: ... -def post(url: Union[str, Text], data: _Data=..., json=..., **kwargs) -> Response: ... -def put(url: Union[str, Text], data: _Data=..., json=..., **kwargs) -> Response: ... -def patch(url: Union[str, Text], data: _Data=..., json=..., **kwargs) -> Response: ... -def delete(url: Union[str, Text], **kwargs) -> Response: ... +def options(url: _Text, **kwargs) -> Response: ... +def head(url: _Text, **kwargs) -> Response: ... +def post(url: _Text, data: _Data=..., json=..., **kwargs) -> Response: ... +def put(url: _Text, data: _Data=..., json=..., **kwargs) -> Response: ... +def patch(url: _Text, data: _Data=..., json=..., **kwargs) -> Response: ... +def delete(url: _Text, **kwargs) -> Response: ... diff --git a/python/helpers/typeshed/third_party/2and3/requests/auth.pyi b/python/helpers/typeshed/third_party/2and3/requests/auth.pyi index b73aa7047ce1..09a6df76be19 100644 --- a/python/helpers/typeshed/third_party/2and3/requests/auth.pyi +++ b/python/helpers/typeshed/third_party/2and3/requests/auth.pyi @@ -3,6 +3,7 @@ from typing import Any, Text, Union from . import compat from . import cookies +from . import models from . import utils from . import status_codes @@ -17,7 +18,7 @@ CONTENT_TYPE_MULTI_PART = ... # type: Any def _basic_auth_str(username: Union[bytes, Text], password: Union[bytes, Text]) -> str: ... class AuthBase: - def __call__(self, r): ... + def __call__(self, r: models.Request) -> models.Request: ... class HTTPBasicAuth(AuthBase): username = ... # type: Any diff --git a/python/helpers/typeshed/third_party/2and3/requests/models.pyi b/python/helpers/typeshed/third_party/2and3/requests/models.pyi index b3f904008573..cdd8ab296ac2 100644 --- a/python/helpers/typeshed/third_party/2and3/requests/models.pyi +++ b/python/helpers/typeshed/third_party/2and3/requests/models.pyi @@ -1,6 +1,7 @@ # Stubs for requests.models (Python 3) -from typing import Any, List, MutableMapping, Iterator, Dict, Text +from typing import (Any, Dict, Iterator, List, MutableMapping, Optional, Text, + Union) import datetime import types @@ -18,7 +19,6 @@ from . import utils from . import compat from . import status_codes -from typing import Optional, Union default_hooks = hooks.default_hooks CaseInsensitiveDict = structures.CaseInsensitiveDict @@ -125,7 +125,7 @@ class Response: def is_permanent_redirect(self) -> bool: ... @property def apparent_encoding(self) -> str: ... - def iter_content(self, chunk_size: int = ..., + def iter_content(self, chunk_size: Optional[int] = ..., decode_unicode: bool = ...) -> Iterator[Any]: ... def iter_lines(self, chunk_size=..., decode_unicode=..., delimiter=...): ... @property diff --git a/python/helpers/typeshed/third_party/2and3/requests/sessions.pyi b/python/helpers/typeshed/third_party/2and3/requests/sessions.pyi index 9f5c0d8b4001..b2be8440bc56 100644 --- a/python/helpers/typeshed/third_party/2and3/requests/sessions.pyi +++ b/python/helpers/typeshed/third_party/2and3/requests/sessions.pyi @@ -2,7 +2,7 @@ from typing import Any, Union, MutableMapping, Text, Optional, IO, Tuple, Callable from . import adapters -from . import auth +from . import auth as _auth from . import compat from . import cookies from . import models @@ -61,12 +61,12 @@ _Hooks = MutableMapping[Text, Callable[[Response], Any]] class Session(SessionRedirectMixin): __attrs__ = ... # type: Any headers = ... # type: MutableMapping[Text, Text] - auth = ... # type: Union[None, Tuple[Text, Text], Callable[[Request], Request]] + auth = ... # type: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[Request], Request]] proxies = ... # type: MutableMapping[Text, Text] hooks = ... # type: _Hooks params = ... # type: Union[bytes, MutableMapping[Text, Text]] stream = ... # type: bool - verify = ... # type: bool + verify = ... # type: Union[None, bool, Text] cert = ... # type: Union[None, Text, Tuple[Text, Text]] max_redirects = ... # type: int trust_env = ... # type: bool @@ -83,13 +83,13 @@ class Session(SessionRedirectMixin): headers: Optional[MutableMapping[Text, Text]] = ..., cookies: Union[None, RequestsCookieJar, MutableMapping[Text, Text]] = ..., files: Optional[MutableMapping[Text, IO]] = ..., - auth: Union[None, Tuple[Text, Text], Callable[[Request], Request]] = ..., + auth: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[Request], Request]] = ..., timeout: Union[None, float, Tuple[float, float]] = ..., allow_redirects: Optional[bool] = ..., proxies: Optional[MutableMapping[Text, Text]] = ..., hooks: Optional[_Hooks] = ..., stream: Optional[bool] = ..., - verify: Optional[bool] = ..., + verify: Union[None, bool, Text] = ..., cert: Union[Text, Tuple[Text, Text], None] = ..., json: Optional[MutableMapping] = ..., ) -> Response: ... diff --git a/python/helpers/typeshed/third_party/2and3/thrift/Thrift.pyi b/python/helpers/typeshed/third_party/2and3/thrift/Thrift.pyi new file mode 100644 index 000000000000..7d5a28fa4f9e --- /dev/null +++ b/python/helpers/typeshed/third_party/2and3/thrift/Thrift.pyi @@ -0,0 +1,51 @@ +from typing import Any + +class TType: + STOP = ... # type: Any + VOID = ... # type: Any + BOOL = ... # type: Any + BYTE = ... # type: Any + I08 = ... # type: Any + DOUBLE = ... # type: Any + I16 = ... # type: Any + I32 = ... # type: Any + I64 = ... # type: Any + STRING = ... # type: Any + UTF7 = ... # type: Any + STRUCT = ... # type: Any + MAP = ... # type: Any + SET = ... # type: Any + LIST = ... # type: Any + UTF8 = ... # type: Any + UTF16 = ... # type: Any + +class TMessageType: + CALL = ... # type: Any + REPLY = ... # type: Any + EXCEPTION = ... # type: Any + ONEWAY = ... # type: Any + +class TProcessor: + def process(iprot, oprot): ... + +class TException(Exception): + message = ... # type: Any + def __init__(self, message=...) -> None: ... + +class TApplicationException(TException): + UNKNOWN = ... # type: Any + UNKNOWN_METHOD = ... # type: Any + INVALID_MESSAGE_TYPE = ... # type: Any + WRONG_METHOD_NAME = ... # type: Any + BAD_SEQUENCE_ID = ... # type: Any + MISSING_RESULT = ... # type: Any + INTERNAL_ERROR = ... # type: Any + PROTOCOL_ERROR = ... # type: Any + INVALID_TRANSFORM = ... # type: Any + INVALID_PROTOCOL = ... # type: Any + UNSUPPORTED_CLIENT_TYPE = ... # type: Any + type = ... # type: Any + def __init__(self, type=..., message=...) -> None: ... + message = ... # type: Any + def read(self, iprot): ... + def write(self, oprot): ... diff --git a/python/helpers/typeshed/third_party/2and3/thrift/__init__.pyi b/python/helpers/typeshed/third_party/2and3/thrift/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/typeshed/third_party/2and3/thrift/protocol/TBinaryProtocol.pyi b/python/helpers/typeshed/third_party/2and3/thrift/protocol/TBinaryProtocol.pyi new file mode 100644 index 000000000000..21a729daeaaa --- /dev/null +++ b/python/helpers/typeshed/third_party/2and3/thrift/protocol/TBinaryProtocol.pyi @@ -0,0 +1,62 @@ +from typing import Any + +from .TProtocol import TProtocolBase +from .TProtocol import * # noqa: F403 + +class TBinaryProtocol(TProtocolBase): + VERSION_MASK = ... # type: Any + VERSION_1 = ... # type: Any + TYPE_MASK = ... # type: Any + strictRead = ... # type: Any + strictWrite = ... # type: Any + def __init__(self, trans, strictRead=..., strictWrite=...) -> None: ... + def writeMessageBegin(self, name, type, seqid): ... + def writeMessageEnd(self): ... + def writeStructBegin(self, name): ... + def writeStructEnd(self): ... + def writeFieldBegin(self, name, type, id): ... + def writeFieldEnd(self): ... + def writeFieldStop(self): ... + def writeMapBegin(self, ktype, vtype, size): ... + def writeMapEnd(self): ... + def writeListBegin(self, etype, size): ... + def writeListEnd(self): ... + def writeSetBegin(self, etype, size): ... + def writeSetEnd(self): ... + def writeBool(self, bool): ... + def writeByte(self, byte): ... + def writeI16(self, i16): ... + def writeI32(self, i32): ... + def writeI64(self, i64): ... + def writeDouble(self, dub): ... + def writeString(self, str): ... + def readMessageBegin(self): ... + def readMessageEnd(self): ... + def readStructBegin(self): ... + def readStructEnd(self): ... + def readFieldBegin(self): ... + def readFieldEnd(self): ... + def readMapBegin(self): ... + def readMapEnd(self): ... + def readListBegin(self): ... + def readListEnd(self): ... + def readSetBegin(self): ... + def readSetEnd(self): ... + def readBool(self): ... + def readByte(self): ... + def readI16(self): ... + def readI32(self): ... + def readI64(self): ... + def readDouble(self): ... + def readString(self): ... + +class TBinaryProtocolFactory: + strictRead = ... # type: Any + strictWrite = ... # type: Any + def __init__(self, strictRead=..., strictWrite=...) -> None: ... + def getProtocol(self, trans): ... + +class TBinaryProtocolAccelerated(TBinaryProtocol): ... + +class TBinaryProtocolAcceleratedFactory: + def getProtocol(self, trans): ... diff --git a/python/helpers/typeshed/third_party/2and3/thrift/protocol/TProtocol.pyi b/python/helpers/typeshed/third_party/2and3/thrift/protocol/TProtocol.pyi new file mode 100644 index 000000000000..cf5d3565ebce --- /dev/null +++ b/python/helpers/typeshed/third_party/2and3/thrift/protocol/TProtocol.pyi @@ -0,0 +1,76 @@ +from typing import Any + +from thrift.Thrift import TException +from thrift.Thrift import * # noqa: F403 + +class TProtocolException(TException): + UNKNOWN = ... # type: Any + INVALID_DATA = ... # type: Any + NEGATIVE_SIZE = ... # type: Any + SIZE_LIMIT = ... # type: Any + BAD_VERSION = ... # type: Any + NOT_IMPLEMENTED = ... # type: Any + DEPTH_LIMIT = ... # type: Any + type = ... # type: Any + def __init__(self, type=..., message=...) -> None: ... + +class TProtocolBase: + trans = ... # type: Any + def __init__(self, trans) -> None: ... + def writeMessageBegin(self, name, ttype, seqid): ... + def writeMessageEnd(self): ... + def writeStructBegin(self, name): ... + def writeStructEnd(self): ... + def writeFieldBegin(self, name, ttype, fid): ... + def writeFieldEnd(self): ... + def writeFieldStop(self): ... + def writeMapBegin(self, ktype, vtype, size): ... + def writeMapEnd(self): ... + def writeListBegin(self, etype, size): ... + def writeListEnd(self): ... + def writeSetBegin(self, etype, size): ... + def writeSetEnd(self): ... + def writeBool(self, bool_val): ... + def writeByte(self, byte): ... + def writeI16(self, i16): ... + def writeI32(self, i32): ... + def writeI64(self, i64): ... + def writeDouble(self, dub): ... + def writeString(self, str_val): ... + def readMessageBegin(self): ... + def readMessageEnd(self): ... + def readStructBegin(self): ... + def readStructEnd(self): ... + def readFieldBegin(self): ... + def readFieldEnd(self): ... + def readMapBegin(self): ... + def readMapEnd(self): ... + def readListBegin(self): ... + def readListEnd(self): ... + def readSetBegin(self): ... + def readSetEnd(self): ... + def readBool(self): ... + def readByte(self): ... + def readI16(self): ... + def readI32(self): ... + def readI64(self): ... + def readDouble(self): ... + def readString(self): ... + def skip(self, ttype): ... + def readFieldByTType(self, ttype, spec): ... + def readContainerList(self, spec): ... + def readContainerSet(self, spec): ... + def readContainerStruct(self, spec): ... + def readContainerMap(self, spec): ... + def readStruct(self, obj, thrift_spec): ... + def writeContainerStruct(self, val, spec): ... + def writeContainerList(self, val, spec): ... + def writeContainerSet(self, val, spec): ... + def writeContainerMap(self, val, spec): ... + def writeStruct(self, obj, thrift_spec): ... + def writeFieldByTType(self, ttype, val, spec): ... + +def checkIntegerLimits(i, bits): ... + +class TProtocolFactory: + def getProtocol(self, trans): ... diff --git a/python/helpers/typeshed/third_party/2and3/thrift/protocol/__init__.pyi b/python/helpers/typeshed/third_party/2and3/thrift/protocol/__init__.pyi new file mode 100644 index 000000000000..4a5b650bed70 --- /dev/null +++ b/python/helpers/typeshed/third_party/2and3/thrift/protocol/__init__.pyi @@ -0,0 +1,7 @@ +# Names in __all__ with no definition: +# TBase +# TBinaryProtocol +# TCompactProtocol +# TJSONProtocol +# TProtocol +# fastbinary diff --git a/python/helpers/typeshed/third_party/2and3/thrift/transport/TSocket.pyi b/python/helpers/typeshed/third_party/2and3/thrift/transport/TSocket.pyi new file mode 100644 index 000000000000..9e0fef47c599 --- /dev/null +++ b/python/helpers/typeshed/third_party/2and3/thrift/transport/TSocket.pyi @@ -0,0 +1,29 @@ +from typing import Any + +from .TTransport import TTransportBase, TServerTransportBase +from .TTransport import * # noqa: F403 + +class TSocketBase(TTransportBase): + handle = ... # type: Any + def close(self): ... + +class TSocket(TSocketBase): + host = ... # type: Any + port = ... # type: Any + handle = ... # type: Any + def __init__(self, host=..., port=..., unix_socket=..., socket_family=...) -> None: ... + def setHandle(self, h): ... + def isOpen(self): ... + def setTimeout(self, ms): ... + def open(self): ... + def read(self, sz): ... + def write(self, buff): ... + def flush(self): ... + +class TServerSocket(TSocketBase, TServerTransportBase): + host = ... # type: Any + port = ... # type: Any + handle = ... # type: Any + def __init__(self, host=..., port=..., unix_socket=..., socket_family=...) -> None: ... + def listen(self): ... + def accept(self): ... diff --git a/python/helpers/typeshed/third_party/2and3/thrift/transport/TTransport.pyi b/python/helpers/typeshed/third_party/2and3/thrift/transport/TTransport.pyi new file mode 100644 index 000000000000..18d2eab0f77f --- /dev/null +++ b/python/helpers/typeshed/third_party/2and3/thrift/transport/TTransport.pyi @@ -0,0 +1,107 @@ +from typing import Any +from thrift.Thrift import TException + +class TTransportException(TException): + UNKNOWN = ... # type: Any + NOT_OPEN = ... # type: Any + ALREADY_OPEN = ... # type: Any + TIMED_OUT = ... # type: Any + END_OF_FILE = ... # type: Any + type = ... # type: Any + def __init__(self, type=..., message=...) -> None: ... + +class TTransportBase: + def isOpen(self): ... + def open(self): ... + def close(self): ... + def read(self, sz): ... + def readAll(self, sz): ... + def write(self, buf): ... + def flush(self): ... + +class CReadableTransport: + @property + def cstringio_buf(self): ... + def cstringio_refill(self, partialread, reqlen): ... + +class TServerTransportBase: + def listen(self): ... + def accept(self): ... + def close(self): ... + +class TTransportFactoryBase: + def getTransport(self, trans): ... + +class TBufferedTransportFactory: + def getTransport(self, trans): ... + +class TBufferedTransport(TTransportBase, CReadableTransport): + DEFAULT_BUFFER = ... # type: Any + def __init__(self, trans, rbuf_size=...) -> None: ... + def isOpen(self): ... + def open(self): ... + def close(self): ... + def read(self, sz): ... + def write(self, buf): ... + def flush(self): ... + @property + def cstringio_buf(self): ... + def cstringio_refill(self, partialread, reqlen): ... + +class TMemoryBuffer(TTransportBase, CReadableTransport): + def __init__(self, value=...) -> None: ... + def isOpen(self): ... + def open(self): ... + def close(self): ... + def read(self, sz): ... + def write(self, buf): ... + def flush(self): ... + def getvalue(self): ... + @property + def cstringio_buf(self): ... + def cstringio_refill(self, partialread, reqlen): ... + +class TFramedTransportFactory: + def getTransport(self, trans): ... + +class TFramedTransport(TTransportBase, CReadableTransport): + def __init__(self, trans) -> None: ... + def isOpen(self): ... + def open(self): ... + def close(self): ... + def read(self, sz): ... + def readFrame(self): ... + def write(self, buf): ... + def flush(self): ... + @property + def cstringio_buf(self): ... + def cstringio_refill(self, prefix, reqlen): ... + +class TFileObjectTransport(TTransportBase): + fileobj = ... # type: Any + def __init__(self, fileobj) -> None: ... + def isOpen(self): ... + def close(self): ... + def read(self, sz): ... + def write(self, buf): ... + def flush(self): ... + +class TSaslClientTransport(TTransportBase, CReadableTransport): + START = ... # type: Any + OK = ... # type: Any + BAD = ... # type: Any + ERROR = ... # type: Any + COMPLETE = ... # type: Any + transport = ... # type: Any + sasl = ... # type: Any + def __init__(self, transport, host, service, mechanism=..., **sasl_kwargs) -> None: ... + def open(self): ... + def send_sasl_msg(self, status, body): ... + def recv_sasl_msg(self): ... + def write(self, data): ... + def flush(self): ... + def read(self, sz): ... + def close(self): ... + @property + def cstringio_buf(self): ... + def cstringio_refill(self, prefix, reqlen): ... diff --git a/python/helpers/typeshed/third_party/2and3/thrift/transport/__init__.pyi b/python/helpers/typeshed/third_party/2and3/thrift/transport/__init__.pyi new file mode 100644 index 000000000000..fd3f5f5a2b58 --- /dev/null +++ b/python/helpers/typeshed/third_party/2and3/thrift/transport/__init__.pyi @@ -0,0 +1,5 @@ +# Names in __all__ with no definition: +# THttpClient +# TSocket +# TTransport +# TZlibTransport diff --git a/python/helpers/typeshed/third_party/3/werkzeug/wrappers.pyi b/python/helpers/typeshed/third_party/3/werkzeug/wrappers.pyi index 676d1be4c1e9..4d31a9100c1b 100644 --- a/python/helpers/typeshed/third_party/3/werkzeug/wrappers.pyi +++ b/python/helpers/typeshed/third_party/3/werkzeug/wrappers.pyi @@ -36,7 +36,8 @@ class BaseRequest: def stream(self): ... input_stream = ... # type: Any args = ... # type: ImmutableMultiDict - def data(self): ... + @property + def data(self) -> bytes: ... def get_data(self, cache: bool = ..., as_text: bool = ..., parse_form_data: bool = ...) -> bytes: ... form = ... # type: ImmutableMultiDict values = ... # type: CombinedMultiDict