Re-organize directory structure (#4971)

See discussion in #2491

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
This commit is contained in:
Ivan Levkivskyi
2021-01-27 12:00:39 +00:00
committed by GitHub
parent 869238e587
commit 16ae4c6120
1399 changed files with 601 additions and 97 deletions

View File

@@ -0,0 +1,41 @@
import mimetools
import SocketServer
from typing import Any, BinaryIO, Callable, Mapping, Optional, Tuple, Union
class HTTPServer(SocketServer.TCPServer):
server_name: str
server_port: int
def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ...
class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
client_address: Tuple[str, int]
server: SocketServer.BaseServer
close_connection: bool
command: str
path: str
request_version: str
headers: mimetools.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]]
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 send_error(self, code: int, message: Optional[str] = ...) -> None: ...
def send_response(self, code: int, message: Optional[str] = ...) -> None: ...
def send_header(self, keyword: str, value: 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: ...

View File

@@ -0,0 +1,6 @@
import SimpleHTTPServer
from typing import List
class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
cgi_directories: List[str]
def do_POST(self) -> None: ...

View File

@@ -0,0 +1,97 @@
from _typeshed import SupportsNoArgReadline
from typing import IO, Any, Dict, List, Optional, Sequence, Tuple, Union
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 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: SupportsNoArgReadline[str], 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: ...

View File

@@ -0,0 +1,40 @@
from typing import Any, Dict, Optional
class CookieError(Exception): ...
class Morsel(Dict[Any, Any]):
key: Any
def __init__(self): ...
def __setitem__(self, K, V): ...
def isReservedKey(self, K): ...
value: Any
coded_value: Any
def set(self, key, val, coded_val, LegalChars=..., idmap=..., translate=...): ...
def output(self, attrs: Optional[Any] = ..., header=...): ...
def js_output(self, attrs: Optional[Any] = ...): ...
def OutputString(self, attrs: Optional[Any] = ...): ...
class BaseCookie(Dict[Any, Any]):
def value_decode(self, val): ...
def value_encode(self, val): ...
def __init__(self, input: Optional[Any] = ...): ...
def __setitem__(self, key, value): ...
def output(self, attrs: Optional[Any] = ..., header=..., sep=...): ...
def js_output(self, attrs: Optional[Any] = ...): ...
def load(self, rawdata): ...
class SimpleCookie(BaseCookie):
def value_decode(self, val): ...
def value_encode(self, val): ...
class SerialCookie(BaseCookie):
def __init__(self, input: Optional[Any] = ...): ...
def value_decode(self, val): ...
def value_encode(self, val): ...
class SmartCookie(BaseCookie):
def __init__(self, input: Optional[Any] = ...): ...
def value_decode(self, val): ...
def value_encode(self, val): ...
Cookie: Any

View File

@@ -0,0 +1,28 @@
from typing import AnyStr, List, Tuple
from markupbase import ParserBase
class HTMLParser(ParserBase):
def __init__(self) -> None: ...
def feed(self, feed: AnyStr) -> None: ...
def close(self) -> None: ...
def reset(self) -> None: ...
def get_starttag_text(self) -> AnyStr: ...
def set_cdata_mode(self, AnyStr) -> None: ...
def clear_cdata_mode(self) -> None: ...
def handle_startendtag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ...
def handle_starttag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ...
def handle_endtag(self, tag: AnyStr): ...
def handle_charref(self, name: AnyStr): ...
def handle_entityref(self, name: AnyStr): ...
def handle_data(self, data: AnyStr): ...
def handle_comment(self, data: AnyStr): ...
def handle_decl(self, decl: AnyStr): ...
def handle_pi(self, data: AnyStr): ...
def unknown_decl(self, data: AnyStr): ...
def unescape(self, s: AnyStr) -> AnyStr: ...
class HTMLParseError(Exception):
msg: str
lineno: int
offset: int

29
stdlib/@python2/Queue.pyi Normal file
View File

@@ -0,0 +1,29 @@
from collections import deque
from typing import Any, Deque, Generic, Optional, TypeVar
_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]): ...

View File

@@ -0,0 +1,14 @@
import BaseHTTPServer
from StringIO import StringIO
from typing import IO, Any, AnyStr, Mapping, Optional, Union
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
server_version: str
def do_GET(self) -> None: ...
def do_HEAD(self) -> None: ...
def send_head(self) -> Optional[IO[str]]: ...
def list_directory(self, path: Union[str, unicode]) -> Optional[StringIO[Any]]: ...
def translate_path(self, path: AnyStr) -> AnyStr: ...
def copyfile(self, source: IO[AnyStr], outputfile: IO[AnyStr]): ...
def guess_type(self, path: Union[str, unicode]) -> str: ...
extensions_map: Mapping[str, str]

View File

@@ -0,0 +1,115 @@
import sys
import types
from socket import SocketType
from typing import Any, BinaryIO, Callable, ClassVar, List, Optional, Text, Tuple, Type, Union
class BaseServer:
address_family: int
RequestHandlerClass: Callable[..., BaseRequestHandler]
server_address: Tuple[str, int]
socket: SocketType
allow_reuse_address: bool
request_queue_size: int
socket_type: int
timeout: Optional[float]
def __init__(self, server_address: Any, RequestHandlerClass: Callable[..., BaseRequestHandler]) -> None: ...
def fileno(self) -> int: ...
def handle_request(self) -> None: ...
def serve_forever(self, poll_interval: float = ...) -> None: ...
def shutdown(self) -> None: ...
def server_close(self) -> None: ...
def finish_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def get_request(self) -> Tuple[SocketType, Tuple[str, int]]: ...
def handle_error(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def handle_timeout(self) -> None: ...
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def server_activate(self) -> None: ...
def server_bind(self) -> None: ...
def verify_request(self, request: bytes, client_address: Tuple[str, int]) -> bool: ...
class TCPServer(BaseServer):
def __init__(
self,
server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
class UDPServer(BaseServer):
def __init__(
self,
server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
if sys.platform != "win32":
class UnixStreamServer(BaseServer):
def __init__(
self,
server_address: Union[Text, bytes],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
class UnixDatagramServer(BaseServer):
def __init__(
self,
server_address: Union[Text, bytes],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
if sys.platform != "win32":
class ForkingMixIn:
timeout: Optional[float] # undocumented
active_children: Optional[List[int]] # undocumented
max_children: int # undocumented
def collect_children(self) -> None: ... # undocumented
def handle_timeout(self) -> None: ... # undocumented
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
class ThreadingMixIn:
daemon_threads: bool
def process_request_thread(self, request: bytes, client_address: Tuple[str, int]) -> None: ... # undocumented
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
if sys.platform != "win32":
class ForkingTCPServer(ForkingMixIn, TCPServer): ...
class ForkingUDPServer(ForkingMixIn, UDPServer): ...
class ThreadingTCPServer(ThreadingMixIn, TCPServer): ...
class ThreadingUDPServer(ThreadingMixIn, UDPServer): ...
if sys.platform != "win32":
class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): ...
class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): ...
class BaseRequestHandler:
# Those are technically of types, respectively:
# * Union[SocketType, Tuple[bytes, SocketType]]
# * Union[Tuple[str, int], str]
# But there are some concerns that having unions here would cause
# too much inconvenience to people using it (see
# https://github.com/python/typeshed/pull/384#issuecomment-234649696)
request: Any
client_address: Any
server: BaseServer
def __init__(self, request: Any, client_address: Any, server: BaseServer) -> None: ...
def setup(self) -> None: ...
def handle(self) -> None: ...
def finish(self) -> None: ...
class StreamRequestHandler(BaseRequestHandler):
rbufsize: ClassVar[int] # Undocumented
wbufsize: ClassVar[int] # Undocumented
timeout: ClassVar[Optional[float]] # Undocumented
disable_nagle_algorithm: ClassVar[bool] # Undocumented
connection: SocketType # Undocumented
rfile: BinaryIO
wfile: BinaryIO
class DatagramRequestHandler(BaseRequestHandler):
packet: SocketType # Undocumented
socket: SocketType # Undocumented
rfile: BinaryIO
wfile: BinaryIO

View File

@@ -0,0 +1,28 @@
from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, List, Optional
class StringIO(IO[AnyStr], Generic[AnyStr]):
closed: bool
softspace: int
len: int
name: str
def __init__(self, buf: AnyStr = ...) -> None: ...
def __iter__(self) -> Iterator[AnyStr]: ...
def next(self) -> AnyStr: ...
def close(self) -> None: ...
def isatty(self) -> bool: ...
def seek(self, pos: int, mode: int = ...) -> int: ...
def tell(self) -> int: ...
def read(self, n: int = ...) -> AnyStr: ...
def readline(self, length: int = ...) -> AnyStr: ...
def readlines(self, sizehint: int = ...) -> List[AnyStr]: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def write(self, s: AnyStr) -> int: ...
def writelines(self, iterable: Iterable[AnyStr]) -> None: ...
def flush(self) -> None: ...
def getvalue(self) -> AnyStr: ...
def __enter__(self) -> Any: ...
def __exit__(self, type: Any, value: Any, traceback: Any) -> Any: ...
def fileno(self) -> int: ...
def readable(self) -> bool: ...
def seekable(self) -> bool: ...
def writable(self) -> bool: ...

View File

@@ -0,0 +1,53 @@
from typing import (
Any,
Container,
Dict,
Generic,
Iterable,
Iterator,
List,
Mapping,
Optional,
Sized,
Tuple,
TypeVar,
Union,
overload,
)
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_T = TypeVar("_T")
class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]):
data: Dict[_KT, _VT]
def __init__(self, initialdata: Mapping[_KT, _VT] = ...) -> None: ...
# TODO: __iter__ is not available for UserDict
class IterableUserDict(UserDict[_KT, _VT], Generic[_KT, _VT]): ...
class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]):
def has_key(self, key: _KT) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_KT]: ...
# From typing.Mapping[_KT, _VT]
# (can't inherit because of keys())
@overload
def get(self, k: _KT) -> Optional[_VT]: ...
@overload
def get(self, k: _KT, default: Union[_VT, _T]) -> Union[_VT, _T]: ...
def values(self) -> List[_VT]: ...
def items(self) -> List[Tuple[_KT, _VT]]: ...
def iterkeys(self) -> Iterator[_KT]: ...
def itervalues(self) -> Iterator[_VT]: ...
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
def __contains__(self, o: Any) -> bool: ...
# From typing.MutableMapping[_KT, _VT]
def clear(self) -> None: ...
def pop(self, k: _KT, default: _VT = ...) -> _VT: ...
def popitem(self) -> Tuple[_KT, _VT]: ...
def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...
@overload
def update(self, m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
@overload
def update(self, m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...

View File

@@ -0,0 +1,19 @@
from typing import Iterable, List, MutableSequence, TypeVar, Union, overload
_T = TypeVar("_T")
_S = TypeVar("_S")
class UserList(MutableSequence[_T]):
data: List[_T]
def insert(self, index: int, object: _T) -> None: ...
@overload
def __setitem__(self, i: int, o: _T) -> None: ...
@overload
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __len__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> _T: ...
@overload
def __getitem__(self: _S, s: slice) -> _S: ...
def sort(self) -> None: ...

View File

@@ -0,0 +1,75 @@
import collections
from typing import Any, Iterable, List, MutableSequence, Optional, Sequence, Text, Tuple, TypeVar, Union, overload
_UST = TypeVar("_UST", bound=UserString)
_MST = TypeVar("_MST", bound=MutableString)
class UserString(Sequence[UserString]):
data: unicode
def __init__(self, seq: object) -> None: ...
def __int__(self) -> int: ...
def __long__(self) -> long: ...
def __float__(self) -> float: ...
def __complex__(self) -> complex: ...
def __hash__(self) -> int: ...
def __len__(self) -> int: ...
@overload
def __getitem__(self: _UST, i: int) -> _UST: ...
@overload
def __getitem__(self: _UST, s: slice) -> _UST: ...
def __add__(self: _UST, other: Any) -> _UST: ...
def __radd__(self: _UST, other: Any) -> _UST: ...
def __mul__(self: _UST, other: int) -> _UST: ...
def __rmul__(self: _UST, other: int) -> _UST: ...
def __mod__(self: _UST, args: Any) -> _UST: ...
def capitalize(self: _UST) -> _UST: ...
def center(self: _UST, width: int, *args: Any) -> _UST: ...
def count(self, sub: int, start: int = ..., end: int = ...) -> int: ...
def decode(self: _UST, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UST: ...
def encode(self: _UST, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UST: ...
def endswith(self, suffix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ...
def expandtabs(self: _UST, tabsize: int = ...) -> _UST: ...
def find(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def index(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def isalpha(self) -> bool: ...
def isalnum(self) -> bool: ...
def isdecimal(self) -> bool: ...
def isdigit(self) -> bool: ...
def islower(self) -> bool: ...
def isnumeric(self) -> bool: ...
def isspace(self) -> bool: ...
def istitle(self) -> bool: ...
def isupper(self) -> bool: ...
def join(self, seq: Iterable[Text]) -> Text: ...
def ljust(self: _UST, width: int, *args: Any) -> _UST: ...
def lower(self: _UST) -> _UST: ...
def lstrip(self: _UST, chars: Optional[Text] = ...) -> _UST: ...
def partition(self, sep: Text) -> Tuple[Text, Text, Text]: ...
def replace(self: _UST, old: Text, new: Text, maxsplit: int = ...) -> _UST: ...
def rfind(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def rindex(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def rjust(self: _UST, width: int, *args: Any) -> _UST: ...
def rpartition(self, sep: Text) -> Tuple[Text, Text, Text]: ...
def rstrip(self: _UST, chars: Optional[Text] = ...) -> _UST: ...
def split(self, sep: Optional[Text] = ..., maxsplit: int = ...) -> List[Text]: ...
def rsplit(self, sep: Optional[Text] = ..., maxsplit: int = ...) -> List[Text]: ...
def splitlines(self, keepends: int = ...) -> List[Text]: ...
def startswith(self, prefix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ...
def strip(self: _UST, chars: Optional[Text] = ...) -> _UST: ...
def swapcase(self: _UST) -> _UST: ...
def title(self: _UST) -> _UST: ...
def translate(self: _UST, *args: Any) -> _UST: ...
def upper(self: _UST) -> _UST: ...
def zfill(self: _UST, width: int) -> _UST: ...
class MutableString(UserString, MutableSequence[MutableString]):
@overload
def __getitem__(self: _MST, i: int) -> _MST: ...
@overload
def __getitem__(self: _MST, s: slice) -> _MST: ...
def __setitem__(self, index: Union[int, slice], sub: Any) -> None: ...
def __delitem__(self, index: Union[int, slice]) -> None: ...
def immutable(self) -> UserString: ...
def __iadd__(self: _MST, other: Any) -> _MST: ...
def __imul__(self, n: int) -> _MST: ...
def insert(self, index: int, value: Any) -> None: ...

File diff suppressed because it is too large Load Diff

303
stdlib/@python2/_ast.pyi Normal file
View File

@@ -0,0 +1,303 @@
import typing
from typing import Optional
__version__: str
PyCF_ONLY_AST: int
_identifier = str
class AST:
_attributes: typing.Tuple[str, ...]
_fields: typing.Tuple[str, ...]
def __init__(self, *args, **kwargs) -> None: ...
class mod(AST): ...
class Module(mod):
body: typing.List[stmt]
class Interactive(mod):
body: typing.List[stmt]
class Expression(mod):
body: expr
class Suite(mod):
body: typing.List[stmt]
class stmt(AST):
lineno: int
col_offset: int
class FunctionDef(stmt):
name: _identifier
args: arguments
body: typing.List[stmt]
decorator_list: typing.List[expr]
class ClassDef(stmt):
name: _identifier
bases: typing.List[expr]
body: typing.List[stmt]
decorator_list: typing.List[expr]
class Return(stmt):
value: Optional[expr]
class Delete(stmt):
targets: typing.List[expr]
class Assign(stmt):
targets: typing.List[expr]
value: expr
class AugAssign(stmt):
target: expr
op: operator
value: expr
class Print(stmt):
dest: Optional[expr]
values: typing.List[expr]
nl: bool
class For(stmt):
target: expr
iter: expr
body: typing.List[stmt]
orelse: typing.List[stmt]
class While(stmt):
test: expr
body: typing.List[stmt]
orelse: typing.List[stmt]
class If(stmt):
test: expr
body: typing.List[stmt]
orelse: typing.List[stmt]
class With(stmt):
context_expr: expr
optional_vars: Optional[expr]
body: typing.List[stmt]
class Raise(stmt):
type: Optional[expr]
inst: Optional[expr]
tback: Optional[expr]
class TryExcept(stmt):
body: typing.List[stmt]
handlers: typing.List[ExceptHandler]
orelse: typing.List[stmt]
class TryFinally(stmt):
body: typing.List[stmt]
finalbody: typing.List[stmt]
class Assert(stmt):
test: expr
msg: Optional[expr]
class Import(stmt):
names: typing.List[alias]
class ImportFrom(stmt):
module: Optional[_identifier]
names: typing.List[alias]
level: Optional[int]
class Exec(stmt):
body: expr
globals: Optional[expr]
locals: Optional[expr]
class Global(stmt):
names: typing.List[_identifier]
class Expr(stmt):
value: expr
class Pass(stmt): ...
class Break(stmt): ...
class Continue(stmt): ...
class slice(AST): ...
_slice = slice # this lets us type the variable named 'slice' below
class Slice(slice):
lower: Optional[expr]
upper: Optional[expr]
step: Optional[expr]
class ExtSlice(slice):
dims: typing.List[slice]
class Index(slice):
value: expr
class Ellipsis(slice): ...
class expr(AST):
lineno: int
col_offset: int
class BoolOp(expr):
op: boolop
values: typing.List[expr]
class BinOp(expr):
left: expr
op: operator
right: expr
class UnaryOp(expr):
op: unaryop
operand: expr
class Lambda(expr):
args: arguments
body: expr
class IfExp(expr):
test: expr
body: expr
orelse: expr
class Dict(expr):
keys: typing.List[expr]
values: typing.List[expr]
class Set(expr):
elts: typing.List[expr]
class ListComp(expr):
elt: expr
generators: typing.List[comprehension]
class SetComp(expr):
elt: expr
generators: typing.List[comprehension]
class DictComp(expr):
key: expr
value: expr
generators: typing.List[comprehension]
class GeneratorExp(expr):
elt: expr
generators: typing.List[comprehension]
class Yield(expr):
value: Optional[expr]
class Compare(expr):
left: expr
ops: typing.List[cmpop]
comparators: typing.List[expr]
class Call(expr):
func: expr
args: typing.List[expr]
keywords: typing.List[keyword]
starargs: Optional[expr]
kwargs: Optional[expr]
class Repr(expr):
value: expr
class Num(expr):
n: float
class Str(expr):
s: str
class Attribute(expr):
value: expr
attr: _identifier
ctx: expr_context
class Subscript(expr):
value: expr
slice: _slice
ctx: expr_context
class Name(expr):
id: _identifier
ctx: expr_context
class List(expr):
elts: typing.List[expr]
ctx: expr_context
class Tuple(expr):
elts: typing.List[expr]
ctx: expr_context
class expr_context(AST): ...
class AugLoad(expr_context): ...
class AugStore(expr_context): ...
class Del(expr_context): ...
class Load(expr_context): ...
class Param(expr_context): ...
class Store(expr_context): ...
class boolop(AST): ...
class And(boolop): ...
class Or(boolop): ...
class operator(AST): ...
class Add(operator): ...
class BitAnd(operator): ...
class BitOr(operator): ...
class BitXor(operator): ...
class Div(operator): ...
class FloorDiv(operator): ...
class LShift(operator): ...
class Mod(operator): ...
class Mult(operator): ...
class Pow(operator): ...
class RShift(operator): ...
class Sub(operator): ...
class unaryop(AST): ...
class Invert(unaryop): ...
class Not(unaryop): ...
class UAdd(unaryop): ...
class USub(unaryop): ...
class cmpop(AST): ...
class Eq(cmpop): ...
class Gt(cmpop): ...
class GtE(cmpop): ...
class In(cmpop): ...
class Is(cmpop): ...
class IsNot(cmpop): ...
class Lt(cmpop): ...
class LtE(cmpop): ...
class NotEq(cmpop): ...
class NotIn(cmpop): ...
class comprehension(AST):
target: expr
iter: expr
ifs: typing.List[expr]
class excepthandler(AST): ...
class ExceptHandler(excepthandler):
type: Optional[expr]
name: Optional[expr]
body: typing.List[stmt]
lineno: int
col_offset: int
class arguments(AST):
args: typing.List[expr]
vararg: Optional[_identifier]
kwarg: Optional[_identifier]
defaults: typing.List[expr]
class keyword(AST):
arg: _identifier
value: expr
class alias(AST):
name: _identifier
asname: Optional[_identifier]

View File

@@ -0,0 +1,36 @@
from typing import Any, Callable, Dict, Generic, Iterator, Optional, TypeVar, Union
_K = TypeVar("_K")
_V = TypeVar("_V")
_T = TypeVar("_T")
_T2 = TypeVar("_T2")
class defaultdict(Dict[_K, _V]):
default_factory: None
def __init__(self, __default_factory: Callable[[], _V] = ..., init: Any = ...) -> None: ...
def __missing__(self, key: _K) -> _V: ...
def __copy__(self: _T) -> _T: ...
def copy(self: _T) -> _T: ...
class deque(Generic[_T]):
maxlen: Optional[int]
def __init__(self, iterable: Iterator[_T] = ..., maxlen: int = ...) -> None: ...
def append(self, x: _T) -> None: ...
def appendleft(self, x: _T) -> None: ...
def clear(self) -> None: ...
def count(self, x: Any) -> int: ...
def extend(self, iterable: Iterator[_T]) -> None: ...
def extendleft(self, iterable: Iterator[_T]) -> None: ...
def pop(self) -> _T: ...
def popleft(self) -> _T: ...
def remove(self, value: _T) -> None: ...
def reverse(self) -> None: ...
def rotate(self, n: int = ...) -> None: ...
def __contains__(self, o: Any) -> bool: ...
def __copy__(self) -> deque[_T]: ...
def __getitem__(self, i: int) -> _T: ...
def __iadd__(self, other: deque[_T2]) -> deque[Union[_T, _T2]]: ...
def __iter__(self) -> Iterator[_T]: ...
def __len__(self) -> int: ...
def __reversed__(self) -> Iterator[_T]: ...
def __setitem__(self, i: int, x: _T) -> None: ...

View File

@@ -0,0 +1,15 @@
from typing import Any, Callable, Dict, Iterable, Optional, Tuple, TypeVar, overload
_T = TypeVar("_T")
_S = TypeVar("_S")
@overload
def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T]) -> _T: ...
@overload
def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T) -> _T: ...
class partial(object):
func: Callable[..., Any]
args: Tuple[Any, ...]
keywords: Dict[str, Any]
def __init__(self, func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...

View File

@@ -0,0 +1,19 @@
from typing import Any, Dict, Generic, List, Tuple
def coverage(a: str) -> Any: ...
def logreader(a: str) -> LogReaderType: ...
def profiler(a: str, *args, **kwargs) -> Any: ...
def resolution() -> Tuple[Any, ...]: ...
class LogReaderType(object):
def close(self) -> None: ...
def fileno(self) -> int: ...
class ProfilerType(object):
def addinfo(self, a: str, b: str) -> None: ...
def close(self) -> None: ...
def fileno(self) -> int: ...
def runcall(self, *args, **kwargs) -> Any: ...
def runcode(self, a, b, *args, **kwargs) -> Any: ...
def start(self) -> None: ...
def stop(self) -> None: ...

184
stdlib/@python2/_io.pyi Normal file
View File

@@ -0,0 +1,184 @@
from mmap import mmap
from types import TracebackType
from typing import IO, Any, AnyStr, BinaryIO, Iterable, Iterator, List, Optional, Text, TextIO, Tuple, Type, TypeVar, Union
_bytearray_like = Union[bytearray, mmap]
DEFAULT_BUFFER_SIZE: int
class BlockingIOError(IOError):
characters_written: int
class UnsupportedOperation(ValueError, IOError): ...
_T = TypeVar("_T")
class _IOBase(BinaryIO):
@property
def closed(self) -> bool: ...
def _checkClosed(self, msg: Optional[str] = ...) -> None: ... # undocumented
def _checkReadable(self) -> None: ...
def _checkSeekable(self) -> None: ...
def _checkWritable(self) -> None: ...
# All these methods are concrete here (you can instantiate this)
def close(self) -> None: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def readable(self) -> bool: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def writable(self) -> bool: ...
def __enter__(self: _T) -> _T: ...
def __exit__(
self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]
) -> Optional[bool]: ...
def __iter__(self: _T) -> _T: ...
# The parameter type of writelines[s]() is determined by that of write():
def writelines(self, lines: Iterable[bytes]) -> None: ...
# The return type of readline[s]() and next() is determined by that of read():
def readline(self, limit: int = ...) -> bytes: ...
def readlines(self, hint: int = ...) -> List[bytes]: ...
def next(self) -> bytes: ...
# These don't actually exist but we need to pretend that it does
# so that this class is concrete.
def write(self, s: bytes) -> int: ...
def read(self, n: int = ...) -> bytes: ...
class _BufferedIOBase(_IOBase):
def read1(self, n: int) -> bytes: ...
def read(self, size: int = ...) -> bytes: ...
def readinto(self, buffer: _bytearray_like) -> int: ...
def write(self, s: bytes) -> int: ...
def detach(self) -> _IOBase: ...
class BufferedRWPair(_BufferedIOBase):
def __init__(self, reader: _RawIOBase, writer: _RawIOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...
def peek(self, n: int = ...) -> bytes: ...
def __enter__(self) -> BufferedRWPair: ...
class BufferedRandom(_BufferedIOBase):
mode: str
name: str
raw: _IOBase
def __init__(self, raw: _IOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...
def peek(self, n: int = ...) -> bytes: ...
class BufferedReader(_BufferedIOBase):
mode: str
name: str
raw: _IOBase
def __init__(self, raw: _IOBase, buffer_size: int = ...) -> None: ...
def peek(self, n: int = ...) -> bytes: ...
class BufferedWriter(_BufferedIOBase):
name: str
raw: _IOBase
mode: str
def __init__(self, raw: _IOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...
class BytesIO(_BufferedIOBase):
def __init__(self, initial_bytes: bytes = ...) -> None: ...
def __setstate__(self, state: Tuple[Any, ...]) -> None: ...
def __getstate__(self) -> Tuple[Any, ...]: ...
# BytesIO does not contain a "name" field. This workaround is necessary
# to allow BytesIO sub-classes to add this field, as it is defined
# as a read-only property on IO[].
name: Any
def getvalue(self) -> bytes: ...
def write(self, s: bytes) -> int: ...
def writelines(self, lines: Iterable[bytes]) -> None: ...
def read1(self, size: int) -> bytes: ...
def next(self) -> bytes: ...
class _RawIOBase(_IOBase):
def readall(self) -> str: ...
def read(self, n: int = ...) -> str: ...
class FileIO(_RawIOBase, BytesIO):
mode: str
closefd: bool
def __init__(self, file: Union[str, int], mode: str = ..., closefd: bool = ...) -> None: ...
def readinto(self, buffer: _bytearray_like) -> int: ...
def write(self, pbuf: str) -> int: ...
class IncrementalNewlineDecoder(object):
newlines: Union[str, unicode]
def __init__(self, decoder, translate, z=...) -> None: ...
def decode(self, input, final) -> Any: ...
def getstate(self) -> Tuple[Any, int]: ...
def setstate(self, state: Tuple[Any, int]) -> None: ...
def reset(self) -> None: ...
# Note: In the actual _io.py, _TextIOBase inherits from _IOBase.
class _TextIOBase(TextIO):
errors: Optional[str]
# TODO: On _TextIOBase, this is always None. But it's unicode/bytes in subclasses.
newlines: Union[None, unicode, bytes]
encoding: str
@property
def closed(self) -> bool: ...
def _checkClosed(self) -> None: ...
def _checkReadable(self) -> None: ...
def _checkSeekable(self) -> None: ...
def _checkWritable(self) -> None: ...
def close(self) -> None: ...
def detach(self) -> IO[Any]: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def next(self) -> unicode: ...
def read(self, size: int = ...) -> unicode: ...
def readable(self) -> bool: ...
def readline(self, limit: int = ...) -> unicode: ...
def readlines(self, hint: int = ...) -> list[unicode]: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def writable(self) -> bool: ...
def write(self, pbuf: unicode) -> int: ...
def writelines(self, lines: Iterable[unicode]) -> None: ...
def __enter__(self: _T) -> _T: ...
def __exit__(
self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]
) -> Optional[bool]: ...
def __iter__(self: _T) -> _T: ...
class StringIO(_TextIOBase):
line_buffering: bool
def __init__(self, initial_value: Optional[unicode] = ..., newline: Optional[unicode] = ...) -> None: ...
def __setstate__(self, state: Tuple[Any, ...]) -> None: ...
def __getstate__(self) -> Tuple[Any, ...]: ...
# StringIO does not contain a "name" field. This workaround is necessary
# to allow StringIO sub-classes to add this field, as it is defined
# as a read-only property on IO[].
name: Any
def getvalue(self) -> unicode: ...
class TextIOWrapper(_TextIOBase):
name: str
line_buffering: bool
buffer: BinaryIO
_CHUNK_SIZE: int
def __init__(
self,
buffer: IO[Any],
encoding: Optional[Text] = ...,
errors: Optional[Text] = ...,
newline: Optional[Text] = ...,
line_buffering: bool = ...,
write_through: bool = ...,
) -> None: ...
def open(
file: Union[str, unicode, int],
mode: Text = ...,
buffering: int = ...,
encoding: Optional[Text] = ...,
errors: Optional[Text] = ...,
newline: Optional[Text] = ...,
closefd: bool = ...,
) -> IO[Any]: ...

View File

@@ -0,0 +1,7 @@
from typing import Any, Dict, Generic, List, Tuple
def encode_basestring_ascii(*args, **kwargs) -> str: ...
def scanstring(a, b, *args, **kwargs) -> Tuple[Any, ...]: ...
class Encoder(object): ...
class Scanner(object): ...

13
stdlib/@python2/_md5.pyi Normal file
View File

@@ -0,0 +1,13 @@
blocksize: int
digest_size: int
class MD5Type(object):
name: str
block_size: int
digest_size: int
def copy(self) -> MD5Type: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def update(self, arg: str) -> None: ...
def new(arg: str = ...) -> MD5Type: ...

15
stdlib/@python2/_sha.pyi Normal file
View File

@@ -0,0 +1,15 @@
blocksize: int
block_size: int
digest_size: int
class sha(object): # not actually exposed
name: str
block_size: int
digest_size: int
digestsize: int
def copy(self) -> sha: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def update(self, arg: str) -> None: ...
def new(arg: str = ...) -> sha: ...

View File

@@ -0,0 +1,23 @@
from typing import Optional
class sha224(object):
name: str
block_size: int
digest_size: int
digestsize: int
def __init__(self, init: Optional[str]) -> None: ...
def copy(self) -> sha224: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def update(self, arg: str) -> None: ...
class sha256(object):
name: str
block_size: int
digest_size: int
digestsize: int
def __init__(self, init: Optional[str]) -> None: ...
def copy(self) -> sha256: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def update(self, arg: str) -> None: ...

View File

@@ -0,0 +1,23 @@
from typing import Optional
class sha384(object):
name: str
block_size: int
digest_size: int
digestsize: int
def __init__(self, init: Optional[str]) -> None: ...
def copy(self) -> sha384: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def update(self, arg: str) -> None: ...
class sha512(object):
name: str
block_size: int
digest_size: int
digestsize: int
def __init__(self, init: Optional[str]) -> None: ...
def copy(self) -> sha512: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def update(self, arg: str) -> None: ...

281
stdlib/@python2/_socket.pyi Normal file
View File

@@ -0,0 +1,281 @@
from typing import IO, Any, Optional, Tuple, Union, overload
AF_APPLETALK: int
AF_ASH: int
AF_ATMPVC: int
AF_ATMSVC: int
AF_AX25: int
AF_BLUETOOTH: int
AF_BRIDGE: int
AF_DECnet: int
AF_ECONET: int
AF_INET: int
AF_INET6: int
AF_IPX: int
AF_IRDA: int
AF_KEY: int
AF_LLC: int
AF_NETBEUI: int
AF_NETLINK: int
AF_NETROM: int
AF_PACKET: int
AF_PPPOX: int
AF_ROSE: int
AF_ROUTE: int
AF_SECURITY: int
AF_SNA: int
AF_TIPC: int
AF_UNIX: int
AF_UNSPEC: int
AF_WANPIPE: int
AF_X25: int
AI_ADDRCONFIG: int
AI_ALL: int
AI_CANONNAME: int
AI_NUMERICHOST: int
AI_NUMERICSERV: int
AI_PASSIVE: int
AI_V4MAPPED: int
BDADDR_ANY: str
BDADDR_LOCAL: str
BTPROTO_HCI: int
BTPROTO_L2CAP: int
BTPROTO_RFCOMM: int
BTPROTO_SCO: int
EAI_ADDRFAMILY: int
EAI_AGAIN: int
EAI_BADFLAGS: int
EAI_FAIL: int
EAI_FAMILY: int
EAI_MEMORY: int
EAI_NODATA: int
EAI_NONAME: int
EAI_OVERFLOW: int
EAI_SERVICE: int
EAI_SOCKTYPE: int
EAI_SYSTEM: int
EBADF: int
EINTR: int
HCI_DATA_DIR: int
HCI_FILTER: int
HCI_TIME_STAMP: int
INADDR_ALLHOSTS_GROUP: int
INADDR_ANY: int
INADDR_BROADCAST: int
INADDR_LOOPBACK: int
INADDR_MAX_LOCAL_GROUP: int
INADDR_NONE: int
INADDR_UNSPEC_GROUP: int
IPPORT_RESERVED: int
IPPORT_USERRESERVED: int
IPPROTO_AH: int
IPPROTO_DSTOPTS: int
IPPROTO_EGP: int
IPPROTO_ESP: int
IPPROTO_FRAGMENT: int
IPPROTO_GRE: int
IPPROTO_HOPOPTS: int
IPPROTO_ICMP: int
IPPROTO_ICMPV6: int
IPPROTO_IDP: int
IPPROTO_IGMP: int
IPPROTO_IP: int
IPPROTO_IPIP: int
IPPROTO_IPV6: int
IPPROTO_NONE: int
IPPROTO_PIM: int
IPPROTO_PUP: int
IPPROTO_RAW: int
IPPROTO_ROUTING: int
IPPROTO_RSVP: int
IPPROTO_TCP: int
IPPROTO_TP: int
IPPROTO_UDP: int
IPV6_CHECKSUM: int
IPV6_DSTOPTS: int
IPV6_HOPLIMIT: int
IPV6_HOPOPTS: int
IPV6_JOIN_GROUP: int
IPV6_LEAVE_GROUP: int
IPV6_MULTICAST_HOPS: int
IPV6_MULTICAST_IF: int
IPV6_MULTICAST_LOOP: int
IPV6_NEXTHOP: int
IPV6_PKTINFO: int
IPV6_RECVDSTOPTS: int
IPV6_RECVHOPLIMIT: int
IPV6_RECVHOPOPTS: int
IPV6_RECVPKTINFO: int
IPV6_RECVRTHDR: int
IPV6_RECVTCLASS: int
IPV6_RTHDR: int
IPV6_RTHDRDSTOPTS: int
IPV6_RTHDR_TYPE_0: int
IPV6_TCLASS: int
IPV6_UNICAST_HOPS: int
IPV6_V6ONLY: int
IP_ADD_MEMBERSHIP: int
IP_DEFAULT_MULTICAST_LOOP: int
IP_DEFAULT_MULTICAST_TTL: int
IP_DROP_MEMBERSHIP: int
IP_HDRINCL: int
IP_MAX_MEMBERSHIPS: int
IP_MULTICAST_IF: int
IP_MULTICAST_LOOP: int
IP_MULTICAST_TTL: int
IP_OPTIONS: int
IP_RECVOPTS: int
IP_RECVRETOPTS: int
IP_RETOPTS: int
IP_TOS: int
IP_TTL: int
MSG_CTRUNC: int
MSG_DONTROUTE: int
MSG_DONTWAIT: int
MSG_EOR: int
MSG_OOB: int
MSG_PEEK: int
MSG_TRUNC: int
MSG_WAITALL: int
MethodType: type
NETLINK_DNRTMSG: int
NETLINK_FIREWALL: int
NETLINK_IP6_FW: int
NETLINK_NFLOG: int
NETLINK_ROUTE: int
NETLINK_USERSOCK: int
NETLINK_XFRM: int
NI_DGRAM: int
NI_MAXHOST: int
NI_MAXSERV: int
NI_NAMEREQD: int
NI_NOFQDN: int
NI_NUMERICHOST: int
NI_NUMERICSERV: int
PACKET_BROADCAST: int
PACKET_FASTROUTE: int
PACKET_HOST: int
PACKET_LOOPBACK: int
PACKET_MULTICAST: int
PACKET_OTHERHOST: int
PACKET_OUTGOING: int
PF_PACKET: int
SHUT_RD: int
SHUT_RDWR: int
SHUT_WR: int
SOCK_DGRAM: int
SOCK_RAW: int
SOCK_RDM: int
SOCK_SEQPACKET: int
SOCK_STREAM: int
SOL_HCI: int
SOL_IP: int
SOL_SOCKET: int
SOL_TCP: int
SOL_TIPC: int
SOL_UDP: int
SOMAXCONN: int
SO_ACCEPTCONN: int
SO_BROADCAST: int
SO_DEBUG: int
SO_DONTROUTE: int
SO_ERROR: int
SO_KEEPALIVE: int
SO_LINGER: int
SO_OOBINLINE: int
SO_RCVBUF: int
SO_RCVLOWAT: int
SO_RCVTIMEO: int
SO_REUSEADDR: int
SO_REUSEPORT: int
SO_SNDBUF: int
SO_SNDLOWAT: int
SO_SNDTIMEO: int
SO_TYPE: int
SSL_ERROR_EOF: int
SSL_ERROR_INVALID_ERROR_CODE: int
SSL_ERROR_SSL: int
SSL_ERROR_SYSCALL: int
SSL_ERROR_WANT_CONNECT: int
SSL_ERROR_WANT_READ: int
SSL_ERROR_WANT_WRITE: int
SSL_ERROR_WANT_X509_LOOKUP: int
SSL_ERROR_ZERO_RETURN: int
TCP_CORK: int
TCP_DEFER_ACCEPT: int
TCP_INFO: int
TCP_KEEPCNT: int
TCP_KEEPIDLE: int
TCP_KEEPINTVL: int
TCP_LINGER2: int
TCP_MAXSEG: int
TCP_NODELAY: int
TCP_QUICKACK: int
TCP_SYNCNT: int
TCP_WINDOW_CLAMP: int
TIPC_ADDR_ID: int
TIPC_ADDR_NAME: int
TIPC_ADDR_NAMESEQ: int
TIPC_CFG_SRV: int
TIPC_CLUSTER_SCOPE: int
TIPC_CONN_TIMEOUT: int
TIPC_CRITICAL_IMPORTANCE: int
TIPC_DEST_DROPPABLE: int
TIPC_HIGH_IMPORTANCE: int
TIPC_IMPORTANCE: int
TIPC_LOW_IMPORTANCE: int
TIPC_MEDIUM_IMPORTANCE: int
TIPC_NODE_SCOPE: int
TIPC_PUBLISHED: int
TIPC_SRC_DROPPABLE: int
TIPC_SUBSCR_TIMEOUT: int
TIPC_SUB_CANCEL: int
TIPC_SUB_PORTS: int
TIPC_SUB_SERVICE: int
TIPC_TOP_SRV: int
TIPC_WAIT_FOREVER: int
TIPC_WITHDRAWN: int
TIPC_ZONE_SCOPE: int
# PyCapsule
CAPI: Any
has_ipv6: bool
class error(IOError): ...
class gaierror(error): ...
class timeout(error): ...
class SocketType(object):
family: int
type: int
proto: int
timeout: float
def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ...
def accept(self) -> Tuple[SocketType, Tuple[Any, ...]]: ...
def bind(self, address: Tuple[Any, ...]) -> None: ...
def close(self) -> None: ...
def connect(self, address: Tuple[Any, ...]) -> None: ...
def connect_ex(self, address: Tuple[Any, ...]) -> int: ...
def dup(self) -> SocketType: ...
def fileno(self) -> int: ...
def getpeername(self) -> Tuple[Any, ...]: ...
def getsockname(self) -> Tuple[Any, ...]: ...
def getsockopt(self, level: int, option: int, buffersize: int = ...) -> str: ...
def gettimeout(self) -> float: ...
def listen(self, backlog: int) -> None: ...
def makefile(self, mode: str = ..., buffersize: int = ...) -> IO[Any]: ...
def recv(self, buffersize: int, flags: int = ...) -> str: ...
def recv_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ...
def recvfrom(self, buffersize: int, flags: int = ...) -> Tuple[Any, ...]: ...
def recvfrom_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ...
def send(self, data: str, flags: int = ...) -> int: ...
def sendall(self, data: str, flags: int = ...) -> None: ...
@overload
def sendto(self, data: str, address: Tuple[Any, ...]) -> int: ...
@overload
def sendto(self, data: str, flags: int, address: Tuple[Any, ...]) -> int: ...
def setblocking(self, flag: bool) -> None: ...
def setsockopt(self, level: int, option: int, value: Union[int, str]) -> None: ...
def settimeout(self, value: Optional[float]) -> None: ...
def shutdown(self, flag: int) -> None: ...

51
stdlib/@python2/_sre.pyi Normal file
View File

@@ -0,0 +1,51 @@
from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union, overload
CODESIZE: int
MAGIC: int
MAXREPEAT: long
copyright: str
class SRE_Match(object):
def start(self, group: int = ...) -> int: ...
def end(self, group: int = ...) -> int: ...
def expand(self, s: str) -> Any: ...
@overload
def group(self) -> str: ...
@overload
def group(self, group: int = ...) -> Optional[str]: ...
def groupdict(self) -> Dict[int, Optional[str]]: ...
def groups(self) -> Tuple[Optional[str], ...]: ...
def span(self) -> Tuple[int, int]: ...
@property
def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented
class SRE_Scanner(object):
pattern: str
def match(self) -> SRE_Match: ...
def search(self) -> SRE_Match: ...
class SRE_Pattern(object):
pattern: str
flags: int
groups: int
groupindex: Mapping[str, int]
indexgroup: Sequence[int]
def findall(self, source: str, pos: int = ..., endpos: int = ...) -> List[Union[Tuple[Any, ...], str]]: ...
def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[Union[Tuple[Any, ...], str]]: ...
def match(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ...
def scanner(self, s: str, start: int = ..., end: int = ...) -> SRE_Scanner: ...
def search(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ...
def split(self, source: str, maxsplit: int = ...) -> List[Optional[str]]: ...
def sub(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ...
def subn(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ...
def compile(
pattern: str,
flags: int,
code: List[int],
groups: int = ...,
groupindex: Mapping[str, int] = ...,
indexgroup: Sequence[int] = ...,
) -> SRE_Pattern: ...
def getcodesize() -> int: ...
def getlower(a: int, b: int) -> int: ...

View File

@@ -0,0 +1,19 @@
from typing import Any, AnyStr, Tuple
class error(Exception): ...
class Struct(object):
size: int
format: str
def __init__(self, fmt: str) -> None: ...
def pack_into(self, buffer: bytearray, offset: int, obj: Any) -> None: ...
def pack(self, *args) -> str: ...
def unpack(self, s: str) -> Tuple[Any, ...]: ...
def unpack_from(self, buffer: bytearray, offset: int = ...) -> Tuple[Any, ...]: ...
def _clearcache() -> None: ...
def calcsize(fmt: str) -> int: ...
def pack(fmt: AnyStr, obj: Any) -> str: ...
def pack_into(fmt: AnyStr, buffer: bytearray, offset: int, obj: Any) -> None: ...
def unpack(fmt: AnyStr, data: str) -> Tuple[Any, ...]: ...
def unpack_from(fmt: AnyStr, buffer: bytearray, offset: int = ...) -> Tuple[Any, ...]: ...

View File

@@ -0,0 +1,37 @@
from typing import Dict, List
CELL: int
DEF_BOUND: int
DEF_FREE: int
DEF_FREE_CLASS: int
DEF_GLOBAL: int
DEF_IMPORT: int
DEF_LOCAL: int
DEF_PARAM: int
FREE: int
GLOBAL_EXPLICIT: int
GLOBAL_IMPLICIT: int
LOCAL: int
OPT_BARE_EXEC: int
OPT_EXEC: int
OPT_IMPORT_STAR: int
SCOPE_MASK: int
SCOPE_OFF: int
TYPE_CLASS: int
TYPE_FUNCTION: int
TYPE_MODULE: int
USE: int
class _symtable_entry(object): ...
class symtable(object):
children: List[_symtable_entry]
id: int
lineno: int
name: str
nested: int
optimized: int
symbols: Dict[str, int]
type: int
varnames: List[str]
def __init__(self, src: str, filename: str, startstr: str) -> None: ...

View File

@@ -0,0 +1,11 @@
from typing import Any
class _localbase(object): ...
class local(_localbase):
def __getattribute__(self, name: str) -> Any: ...
def __setattr__(self, name: str, value: Any) -> None: ...
def __delattr__(self, name: str) -> None: ...
def __del__(self) -> None: ...
def _patch(self: local) -> None: ...

View File

@@ -0,0 +1,97 @@
import sys
from types import TracebackType
from typing import Any, Optional, Tuple, Type, Union
_KeyType = Union[HKEYType, int]
def CloseKey(__hkey: _KeyType) -> None: ...
def ConnectRegistry(__computer_name: Optional[str], __key: _KeyType) -> HKEYType: ...
def CreateKey(__key: _KeyType, __sub_key: Optional[str]) -> HKEYType: ...
def CreateKeyEx(key: _KeyType, sub_key: Optional[str], reserved: int = ..., access: int = ...) -> HKEYType: ...
def DeleteKey(__key: _KeyType, __sub_key: str) -> None: ...
def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = ..., reserved: int = ...) -> None: ...
def DeleteValue(__key: _KeyType, __value: str) -> None: ...
def EnumKey(__key: _KeyType, __index: int) -> str: ...
def EnumValue(__key: _KeyType, __index: int) -> Tuple[str, Any, int]: ...
def ExpandEnvironmentStrings(__str: str) -> str: ...
def FlushKey(__key: _KeyType) -> None: ...
def LoadKey(__key: _KeyType, __sub_key: str, __file_name: str) -> None: ...
def OpenKey(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ...
def OpenKeyEx(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ...
def QueryInfoKey(__key: _KeyType) -> Tuple[int, int, int]: ...
def QueryValue(__key: _KeyType, __sub_key: Optional[str]) -> str: ...
def QueryValueEx(__key: _KeyType, __name: str) -> Tuple[Any, int]: ...
def SaveKey(__key: _KeyType, __file_name: str) -> None: ...
def SetValue(__key: _KeyType, __sub_key: str, __type: int, __value: str) -> None: ...
def SetValueEx(
__key: _KeyType, __value_name: Optional[str], __reserved: Any, __type: int, __value: Union[str, int]
) -> None: ... # reserved is ignored
def DisableReflectionKey(__key: _KeyType) -> None: ...
def EnableReflectionKey(__key: _KeyType) -> None: ...
def QueryReflectionKey(__key: _KeyType) -> bool: ...
HKEY_CLASSES_ROOT: int
HKEY_CURRENT_USER: int
HKEY_LOCAL_MACHINE: int
HKEY_USERS: int
HKEY_PERFORMANCE_DATA: int
HKEY_CURRENT_CONFIG: int
HKEY_DYN_DATA: int
KEY_ALL_ACCESS: int
KEY_WRITE: int
KEY_READ: int
KEY_EXECUTE: int
KEY_QUERY_VALUE: int
KEY_SET_VALUE: int
KEY_CREATE_SUB_KEY: int
KEY_ENUMERATE_SUB_KEYS: int
KEY_NOTIFY: int
KEY_CREATE_LINK: int
KEY_WOW64_64KEY: int
KEY_WOW64_32KEY: int
REG_BINARY: int
REG_DWORD: int
REG_DWORD_LITTLE_ENDIAN: int
REG_DWORD_BIG_ENDIAN: int
REG_EXPAND_SZ: int
REG_LINK: int
REG_MULTI_SZ: int
REG_NONE: int
REG_RESOURCE_LIST: int
REG_FULL_RESOURCE_DESCRIPTOR: int
REG_RESOURCE_REQUIREMENTS_LIST: int
REG_SZ: int
REG_CREATED_NEW_KEY: int # undocumented
REG_LEGAL_CHANGE_FILTER: int # undocumented
REG_LEGAL_OPTION: int # undocumented
REG_NOTIFY_CHANGE_ATTRIBUTES: int # undocumented
REG_NOTIFY_CHANGE_LAST_SET: int # undocumented
REG_NOTIFY_CHANGE_NAME: int # undocumented
REG_NOTIFY_CHANGE_SECURITY: int # undocumented
REG_NO_LAZY_FLUSH: int # undocumented
REG_OPENED_EXISTING_KEY: int # undocumented
REG_OPTION_BACKUP_RESTORE: int # undocumented
REG_OPTION_CREATE_LINK: int # undocumented
REG_OPTION_NON_VOLATILE: int # undocumented
REG_OPTION_OPEN_LINK: int # undocumented
REG_OPTION_RESERVED: int # undocumented
REG_OPTION_VOLATILE: int # undocumented
REG_REFRESH_HIVE: int # undocumented
REG_WHOLE_HIVE_VOLATILE: int # undocumented
error = OSError
# Though this class has a __name__ of PyHKEY, it's exposed as HKEYType for some reason
class HKEYType:
def __bool__(self) -> bool: ...
def __int__(self) -> int: ...
def __enter__(self) -> HKEYType: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
def Close(self) -> None: ...
def Detach(self) -> int: ...

31
stdlib/@python2/abc.pyi Normal file
View File

@@ -0,0 +1,31 @@
import _weakrefset
from typing import Any, Callable, Dict, Set, Tuple, Type, TypeVar
_FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
# NOTE: mypy has special processing for ABCMeta and abstractmethod.
def abstractmethod(funcobj: _FuncT) -> _FuncT: ...
class ABCMeta(type):
# TODO: FrozenSet
__abstractmethods__: Set[Any]
_abc_cache: _weakrefset.WeakSet[Any]
_abc_invalidation_counter: int
_abc_negative_cache: _weakrefset.WeakSet[Any]
_abc_negative_cache_version: int
_abc_registry: _weakrefset.WeakSet[Any]
def __init__(self, name: str, bases: Tuple[type, ...], namespace: Dict[Any, Any]) -> None: ...
def __instancecheck__(cls: ABCMeta, instance: Any) -> Any: ...
def __subclasscheck__(cls: ABCMeta, subclass: Any) -> Any: ...
def _dump_registry(cls: ABCMeta, *args: Any, **kwargs: Any) -> None: ...
def register(cls: ABCMeta, subclass: Type[Any]) -> None: ...
# TODO: The real abc.abstractproperty inherits from "property".
class abstractproperty(object):
def __new__(cls, func: Any) -> Any: ...
__isabstractmethod__: bool
doc: Any
fdel: Any
fget: Any
fset: Any

28
stdlib/@python2/ast.pyi Normal file
View File

@@ -0,0 +1,28 @@
# Python 2.7 ast
# Rename typing to _typing, as not to conflict with typing imported
# from _ast below when loaded in an unorthodox way by the Dropbox
# internal Bazel integration.
import typing as _typing
from typing import Any, Iterator, Optional, Union
from _ast import *
from _ast import AST, Module
def parse(source: Union[str, unicode], filename: Union[str, unicode] = ..., mode: Union[str, unicode] = ...) -> Module: ...
def copy_location(new_node: AST, old_node: AST) -> AST: ...
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ...
def fix_missing_locations(node: AST) -> AST: ...
def get_docstring(node: AST, clean: bool = ...) -> str: ...
def increment_lineno(node: AST, n: int = ...) -> AST: ...
def iter_child_nodes(node: AST) -> Iterator[AST]: ...
def iter_fields(node: AST) -> Iterator[_typing.Tuple[str, Any]]: ...
def literal_eval(node_or_string: Union[str, unicode, AST]) -> Any: ...
def walk(node: AST) -> Iterator[AST]: ...
class NodeVisitor:
def visit(self, node: AST) -> Any: ...
def generic_visit(self, node: AST) -> Any: ...
class NodeTransformer(NodeVisitor):
def generic_visit(self, node: AST) -> Optional[AST]: ...

View File

@@ -0,0 +1,5 @@
from typing import Any, TypeVar
_FT = TypeVar("_FT")
def register(func: _FT, *args: Any, **kargs: Any) -> _FT: ...

1203
stdlib/@python2/builtins.pyi Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
from typing import IO, Any, List
HIGHEST_PROTOCOL: int
compatible_formats: List[str]
format_version: str
class Pickler:
def __init__(self, file: IO[str], protocol: int = ...) -> None: ...
def dump(self, obj: Any) -> None: ...
def clear_memo(self) -> None: ...
class Unpickler:
def __init__(self, file: IO[str]) -> None: ...
def load(self) -> Any: ...
def noload(self) -> Any: ...
def dump(obj: Any, file: IO[str], protocol: int = ...) -> None: ...
def dumps(obj: Any, protocol: int = ...) -> str: ...
def load(file: IO[str]) -> Any: ...
def loads(str: str) -> Any: ...
class PickleError(Exception): ...
class UnpicklingError(PickleError): ...
class BadPickleGet(UnpicklingError): ...
class PicklingError(PickleError): ...
class UnpickleableError(PicklingError): ...

View File

@@ -0,0 +1,48 @@
from abc import ABCMeta
from types import TracebackType
from typing import IO, Iterable, Iterator, List, Optional, Union, overload
# This class isn't actually abstract, but you can't instantiate it
# directly, so we might as well treat it as abstract in the stub.
class InputType(IO[str], Iterator[str], metaclass=ABCMeta):
def getvalue(self) -> str: ...
def close(self) -> None: ...
@property
def closed(self) -> bool: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def read(self, size: int = ...) -> str: ...
def readline(self, size: int = ...) -> str: ...
def readlines(self, hint: int = ...) -> List[str]: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def __iter__(self) -> InputType: ...
def next(self) -> str: ...
def reset(self) -> None: ...
class OutputType(IO[str], Iterator[str], metaclass=ABCMeta):
@property
def softspace(self) -> int: ...
def getvalue(self) -> str: ...
def close(self) -> None: ...
@property
def closed(self) -> bool: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def read(self, size: int = ...) -> str: ...
def readline(self, size: int = ...) -> str: ...
def readlines(self, hint: int = ...) -> List[str]: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def __iter__(self) -> OutputType: ...
def next(self) -> str: ...
def reset(self) -> None: ...
def write(self, b: Union[str, unicode]) -> int: ...
def writelines(self, lines: Iterable[Union[str, unicode]]) -> None: ...
@overload
def StringIO() -> OutputType: ...
@overload
def StringIO(s: str) -> InputType: ...

View File

@@ -0,0 +1,129 @@
from typing import (
AbstractSet,
Any,
Callable as Callable,
Container as Container,
Dict,
Generic,
Hashable as Hashable,
ItemsView as ItemsView,
Iterable as Iterable,
Iterator as Iterator,
KeysView as KeysView,
List,
Mapping as Mapping,
MappingView as MappingView,
MutableMapping as MutableMapping,
MutableSequence as MutableSequence,
MutableSet as MutableSet,
Optional,
Reversible,
Sequence as Sequence,
Sized as Sized,
Tuple,
Type,
TypeVar,
Union,
ValuesView as ValuesView,
overload,
)
Set = AbstractSet
_S = TypeVar("_S")
_T = TypeVar("_T")
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
# namedtuple is special-cased in the type checker; the initializer is ignored.
def namedtuple(
typename: Union[str, unicode],
field_names: Union[str, unicode, Iterable[Union[str, unicode]]],
verbose: bool = ...,
rename: bool = ...,
) -> Type[Tuple[Any, ...]]: ...
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ..., maxlen: int = ...) -> None: ...
@property
def maxlen(self) -> Optional[int]: ...
def append(self, x: _T) -> None: ...
def appendleft(self, x: _T) -> None: ...
def clear(self) -> None: ...
def count(self, x: _T) -> int: ...
def extend(self, iterable: Iterable[_T]) -> None: ...
def extendleft(self, iterable: Iterable[_T]) -> None: ...
def pop(self) -> _T: ...
def popleft(self) -> _T: ...
def remove(self, value: _T) -> None: ...
def reverse(self) -> None: ...
def rotate(self, n: int = ...) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __hash__(self) -> int: ...
def __getitem__(self, i: int) -> _T: ...
def __setitem__(self, i: int, x: _T) -> None: ...
def __contains__(self, o: _T) -> bool: ...
def __reversed__(self) -> Iterator[_T]: ...
def __iadd__(self: _S, iterable: Iterable[_T]) -> _S: ...
class Counter(Dict[_T, int], Generic[_T]):
@overload
def __init__(self, **kwargs: int) -> None: ...
@overload
def __init__(self, mapping: Mapping[_T, int]) -> None: ...
@overload
def __init__(self, iterable: Iterable[_T]) -> None: ...
def copy(self: _S) -> _S: ...
def elements(self) -> Iterator[_T]: ...
def most_common(self, n: Optional[int] = ...) -> List[Tuple[_T, int]]: ...
@overload
def subtract(self, __mapping: Mapping[_T, int]) -> None: ...
@overload
def subtract(self, iterable: Iterable[_T]) -> None: ...
# The Iterable[Tuple[...]] argument type is not actually desirable
# (the tuples will be added as keys, breaking type safety) but
# it's included so that the signature is compatible with
# Dict.update. Not sure if we should use '# type: ignore' instead
# and omit the type from the union.
@overload
def update(self, __m: Mapping[_T, int], **kwargs: int) -> None: ...
@overload
def update(self, __m: Union[Iterable[_T], Iterable[Tuple[_T, int]]], **kwargs: int) -> None: ...
@overload
def update(self, **kwargs: int) -> None: ...
def __add__(self, other: Counter[_T]) -> Counter[_T]: ...
def __sub__(self, other: Counter[_T]) -> Counter[_T]: ...
def __and__(self, other: Counter[_T]) -> Counter[_T]: ...
def __or__(self, other: Counter[_T]) -> Counter[_T]: ...
def __iadd__(self, other: Counter[_T]) -> Counter[_T]: ...
def __isub__(self, other: Counter[_T]) -> Counter[_T]: ...
def __iand__(self, other: Counter[_T]) -> Counter[_T]: ...
def __ior__(self, other: Counter[_T]) -> Counter[_T]: ...
class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ...
def copy(self: _S) -> _S: ...
def __reversed__(self) -> Iterator[_KT]: ...
class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
default_factory: Callable[[], _VT]
@overload
def __init__(self, **kwargs: _VT) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]]) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], **kwargs: _VT) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT]) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
@overload
def __init__(
self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT
) -> None: ...
def __missing__(self, key: _KT) -> _VT: ...
def copy(self: _S) -> _S: ...

View File

@@ -0,0 +1,10 @@
from typing import AnyStr, Text, Tuple, overload
def getstatus(file: Text) -> str: ...
def getoutput(cmd: Text) -> str: ...
def getstatusoutput(cmd: Text) -> Tuple[int, str]: ...
@overload
def mk2arg(head: bytes, x: bytes) -> bytes: ...
@overload
def mk2arg(head: Text, x: Text) -> Text: ...
def mkarg(x: AnyStr) -> AnyStr: ...

View File

@@ -0,0 +1,16 @@
from _typeshed import AnyPath
from typing import Any, Optional, Pattern
# rx can be any object with a 'search' method; once we have Protocols we can change the type
def compile_dir(
dir: AnyPath,
maxlevels: int = ...,
ddir: Optional[AnyPath] = ...,
force: bool = ...,
rx: Optional[Pattern[Any]] = ...,
quiet: int = ...,
) -> int: ...
def compile_file(
fullname: AnyPath, ddir: Optional[AnyPath] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...
) -> int: ...
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ...

View File

@@ -0,0 +1,142 @@
from typing import Any, Optional
class Cookie:
version: Any
name: Any
value: Any
port: Any
port_specified: Any
domain: Any
domain_specified: Any
domain_initial_dot: Any
path: Any
path_specified: Any
secure: Any
expires: Any
discard: Any
comment: Any
comment_url: Any
rfc2109: Any
def __init__(
self,
version,
name,
value,
port,
port_specified,
domain,
domain_specified,
domain_initial_dot,
path,
path_specified,
secure,
expires,
discard,
comment,
comment_url,
rest,
rfc2109: bool = ...,
): ...
def has_nonstandard_attr(self, name): ...
def get_nonstandard_attr(self, name, default: Optional[Any] = ...): ...
def set_nonstandard_attr(self, name, value): ...
def is_expired(self, now: Optional[Any] = ...): ...
class CookiePolicy:
def set_ok(self, cookie, request): ...
def return_ok(self, cookie, request): ...
def domain_return_ok(self, domain, request): ...
def path_return_ok(self, path, request): ...
class DefaultCookiePolicy(CookiePolicy):
DomainStrictNoDots: Any
DomainStrictNonDomain: Any
DomainRFC2965Match: Any
DomainLiberal: Any
DomainStrict: Any
netscape: Any
rfc2965: Any
rfc2109_as_netscape: Any
hide_cookie2: Any
strict_domain: Any
strict_rfc2965_unverifiable: Any
strict_ns_unverifiable: Any
strict_ns_domain: Any
strict_ns_set_initial_dollar: Any
strict_ns_set_path: Any
def __init__(
self,
blocked_domains: Optional[Any] = ...,
allowed_domains: Optional[Any] = ...,
netscape: bool = ...,
rfc2965: bool = ...,
rfc2109_as_netscape: Optional[Any] = ...,
hide_cookie2: bool = ...,
strict_domain: bool = ...,
strict_rfc2965_unverifiable: bool = ...,
strict_ns_unverifiable: bool = ...,
strict_ns_domain=...,
strict_ns_set_initial_dollar: bool = ...,
strict_ns_set_path: bool = ...,
): ...
def blocked_domains(self): ...
def set_blocked_domains(self, blocked_domains): ...
def is_blocked(self, domain): ...
def allowed_domains(self): ...
def set_allowed_domains(self, allowed_domains): ...
def is_not_allowed(self, domain): ...
def set_ok(self, cookie, request): ...
def set_ok_version(self, cookie, request): ...
def set_ok_verifiability(self, cookie, request): ...
def set_ok_name(self, cookie, request): ...
def set_ok_path(self, cookie, request): ...
def set_ok_domain(self, cookie, request): ...
def set_ok_port(self, cookie, request): ...
def return_ok(self, cookie, request): ...
def return_ok_version(self, cookie, request): ...
def return_ok_verifiability(self, cookie, request): ...
def return_ok_secure(self, cookie, request): ...
def return_ok_expires(self, cookie, request): ...
def return_ok_port(self, cookie, request): ...
def return_ok_domain(self, cookie, request): ...
def domain_return_ok(self, domain, request): ...
def path_return_ok(self, path, request): ...
class Absent: ...
class CookieJar:
non_word_re: Any
quote_re: Any
strict_domain_re: Any
domain_re: Any
dots_re: Any
magic_re: Any
def __init__(self, policy: Optional[Any] = ...): ...
def set_policy(self, policy): ...
def add_cookie_header(self, request): ...
def make_cookies(self, response, request): ...
def set_cookie_if_ok(self, cookie, request): ...
def set_cookie(self, cookie): ...
def extract_cookies(self, response, request): ...
def clear(self, domain: Optional[Any] = ..., path: Optional[Any] = ..., name: Optional[Any] = ...): ...
def clear_session_cookies(self): ...
def clear_expired_cookies(self): ...
def __iter__(self): ...
def __len__(self): ...
class LoadError(IOError): ...
class FileCookieJar(CookieJar):
filename: Any
delayload: Any
def __init__(self, filename: Optional[Any] = ..., delayload: bool = ..., policy: Optional[Any] = ...): ...
def save(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
def load(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
def revert(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
class LWPCookieJar(FileCookieJar):
def as_lwp_str(self, ignore_discard: bool = ..., ignore_expires: bool = ...) -> str: ... # undocumented
MozillaCookieJar = FileCookieJar
def lwp_cookie_str(cookie: Cookie) -> str: ...

View File

@@ -0,0 +1,16 @@
from typing import Any, Callable, Hashable, List, Optional, SupportsInt, Tuple, TypeVar, Union
_TypeT = TypeVar("_TypeT", bound=type)
_Reduce = Union[Tuple[Callable[..., _TypeT], Tuple[Any, ...]], Tuple[Callable[..., _TypeT], Tuple[Any, ...], Optional[Any]]]
__all__: List[str]
def pickle(
ob_type: _TypeT,
pickle_function: Callable[[_TypeT], Union[str, _Reduce[_TypeT]]],
constructor_ob: Optional[Callable[[_Reduce[_TypeT]], _TypeT]] = ...,
) -> None: ...
def constructor(object: Callable[[_Reduce[_TypeT]], _TypeT]) -> None: ...
def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ...
def remove_extension(module: Hashable, name: Hashable, code: int) -> None: ...
def clear_extension_cache() -> None: ...

View File

@@ -0,0 +1,8 @@
from typing import List, MutableSequence, Text, Union
def reset() -> None: ...
def listdir(path: Text) -> List[str]: ...
opendir = listdir
def annotate(head: Text, list: Union[MutableSequence[str], MutableSequence[Text], MutableSequence[Union[str, Text]]]) -> None: ...

View File

View File

@@ -0,0 +1,12 @@
from typing import Optional
def make_archive(
base_name: str,
format: str,
root_dir: Optional[str] = ...,
base_dir: Optional[str] = ...,
verbose: int = ...,
dry_run: int = ...,
) -> str: ...
def make_tarball(base_name: str, base_dir: str, compress: Optional[str] = ..., verbose: int = ..., dry_run: int = ...) -> str: ...
def make_zipfile(base_name: str, base_dir: str, verbose: int = ..., dry_run: int = ...) -> str: ...

View File

@@ -0,0 +1,3 @@
from distutils.ccompiler import CCompiler
class BCPPCompiler(CCompiler): ...

View File

@@ -0,0 +1,150 @@
from typing import Any, Callable, List, Optional, Tuple, Union
_Macro = Union[Tuple[str], Tuple[str, Optional[str]]]
def gen_lib_options(
compiler: CCompiler, library_dirs: List[str], runtime_library_dirs: List[str], libraries: List[str]
) -> List[str]: ...
def gen_preprocess_options(macros: List[_Macro], include_dirs: List[str]) -> List[str]: ...
def get_default_compiler(osname: Optional[str] = ..., platform: Optional[str] = ...) -> str: ...
def new_compiler(
plat: Optional[str] = ..., compiler: Optional[str] = ..., verbose: int = ..., dry_run: int = ..., force: int = ...
) -> CCompiler: ...
def show_compilers() -> None: ...
class CCompiler:
dry_run: bool
force: bool
verbose: bool
output_dir: Optional[str]
macros: List[_Macro]
include_dirs: List[str]
libraries: List[str]
library_dirs: List[str]
runtime_library_dirs: List[str]
objects: List[str]
def __init__(self, verbose: int = ..., dry_run: int = ..., force: int = ...) -> None: ...
def add_include_dir(self, dir: str) -> None: ...
def set_include_dirs(self, dirs: List[str]) -> None: ...
def add_library(self, libname: str) -> None: ...
def set_libraries(self, libnames: List[str]) -> None: ...
def add_library_dir(self, dir: str) -> None: ...
def set_library_dirs(self, dirs: List[str]) -> None: ...
def add_runtime_library_dir(self, dir: str) -> None: ...
def set_runtime_library_dirs(self, dirs: List[str]) -> None: ...
def define_macro(self, name: str, value: Optional[str] = ...) -> None: ...
def undefine_macro(self, name: str) -> None: ...
def add_link_object(self, object: str) -> None: ...
def set_link_objects(self, objects: List[str]) -> None: ...
def detect_language(self, sources: Union[str, List[str]]) -> Optional[str]: ...
def find_library_file(self, dirs: List[str], lib: str, debug: bool = ...) -> Optional[str]: ...
def has_function(
self,
funcname: str,
includes: Optional[List[str]] = ...,
include_dirs: Optional[List[str]] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
) -> bool: ...
def library_dir_option(self, dir: str) -> str: ...
def library_option(self, lib: str) -> str: ...
def runtime_library_dir_option(self, dir: str) -> str: ...
def set_executables(self, **args: str) -> None: ...
def compile(
self,
sources: List[str],
output_dir: Optional[str] = ...,
macros: Optional[_Macro] = ...,
include_dirs: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
depends: Optional[List[str]] = ...,
) -> List[str]: ...
def create_static_lib(
self,
objects: List[str],
output_libname: str,
output_dir: Optional[str] = ...,
debug: bool = ...,
target_lang: Optional[str] = ...,
) -> None: ...
def link(
self,
target_desc: str,
objects: List[str],
output_filename: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...,
) -> None: ...
def link_executable(
self,
objects: List[str],
output_progname: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
target_lang: Optional[str] = ...,
) -> None: ...
def link_shared_lib(
self,
objects: List[str],
output_libname: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...,
) -> None: ...
def link_shared_object(
self,
objects: List[str],
output_filename: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...,
) -> None: ...
def preprocess(
self,
source: str,
output_file: Optional[str] = ...,
macros: Optional[List[_Macro]] = ...,
include_dirs: Optional[List[str]] = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
) -> None: ...
def executable_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ...
def library_filename(self, libname: str, lib_type: str = ..., strip_dir: int = ..., output_dir: str = ...) -> str: ...
def object_filenames(self, source_filenames: List[str], strip_dir: int = ..., output_dir: str = ...) -> List[str]: ...
def shared_object_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ...
def execute(self, func: Callable[..., None], args: Tuple[Any, ...], msg: Optional[str] = ..., level: int = ...) -> None: ...
def spawn(self, cmd: List[str]) -> None: ...
def mkpath(self, name: str, mode: int = ...) -> None: ...
def move_file(self, src: str, dst: str) -> str: ...
def announce(self, msg: str, level: int = ...) -> None: ...
def warn(self, msg: str) -> None: ...
def debug_print(self, msg: str) -> None: ...

View File

@@ -0,0 +1,67 @@
from abc import abstractmethod
from distutils.dist import Distribution
from typing import Any, Callable, Iterable, List, Optional, Text, Tuple, Union
class Command:
sub_commands: List[Tuple[str, Optional[Callable[[Command], bool]]]]
def __init__(self, dist: Distribution) -> None: ...
@abstractmethod
def initialize_options(self) -> None: ...
@abstractmethod
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, dst: 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

View File

@@ -0,0 +1,6 @@
from distutils.cmd import Command
class bdist_msi(Command):
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...

View File

@@ -0,0 +1,6 @@
from distutils.cmd import Command
class build_py(Command):
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...

View File

@@ -0,0 +1,87 @@
from distutils import log as log
from distutils.ccompiler import CCompiler
from distutils.core import Command as Command
from distutils.errors import DistutilsExecError as DistutilsExecError
from distutils.sysconfig import customize_compiler as customize_compiler
from typing import Dict, List, Optional, Pattern, Sequence, Tuple, Union
LANG_EXT: Dict[str, str]
class config(Command):
description: str = ...
# Tuple is full name, short name, description
user_options: Sequence[Tuple[str, Optional[str], str]] = ...
compiler: Optional[Union[str, CCompiler]] = ...
cc: Optional[str] = ...
include_dirs: Optional[Sequence[str]] = ...
libraries: Optional[Sequence[str]] = ...
library_dirs: Optional[Sequence[str]] = ...
noisy: int = ...
dump_source: int = ...
temp_files: Sequence[str] = ...
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...
def try_cpp(
self,
body: Optional[str] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def search_cpp(
self,
pattern: Union[Pattern[str], str],
body: Optional[str] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def try_compile(
self, body: str, headers: Optional[Sequence[str]] = ..., include_dirs: Optional[Sequence[str]] = ..., lang: str = ...
) -> bool: ...
def try_link(
self,
body: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def try_run(
self,
body: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def check_func(
self,
func: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
decl: int = ...,
call: int = ...,
) -> bool: ...
def check_lib(
self,
library: str,
library_dirs: Optional[Sequence[str]] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
other_libraries: List[str] = ...,
) -> bool: ...
def check_header(
self,
header: str,
include_dirs: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def dump_file(filename: str, head: Optional[str] = ...) -> None: ...

View File

@@ -0,0 +1,12 @@
from distutils.cmd import Command
from typing import Optional, Text
class install(Command):
user: bool
prefix: Optional[Text]
home: Optional[Text]
root: Optional[Text]
install_lib: Optional[Text]
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...

View File

@@ -0,0 +1,10 @@
from distutils.cmd import Command
from typing import ClassVar, List, Optional, Tuple
class install_egg_info(Command):
description: ClassVar[str]
user_options: ClassVar[List[Tuple[str, Optional[str], str]]]
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...
def get_outputs(self) -> List[str]: ...

View File

@@ -0,0 +1,8 @@
from distutils.config import PyPIRCCommand
from typing import ClassVar, List, Optional, Tuple
class upload(PyPIRCCommand):
description: ClassVar[str]
boolean_options: ClassVar[List[str]]
def run(self) -> None: ...
def upload_file(self, command, pyversion, filename) -> None: ...

View File

@@ -0,0 +1,17 @@
from abc import abstractmethod
from distutils.cmd import Command
from typing import ClassVar, List, Optional, Tuple
DEFAULT_PYPIRC: str
class PyPIRCCommand(Command):
DEFAULT_REPOSITORY: ClassVar[str]
DEFAULT_REALM: ClassVar[str]
repository: None
realm: None
user_options: ClassVar[List[Tuple[str, Optional[str], str]]]
boolean_options: ClassVar[List[str]]
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
@abstractmethod
def run(self) -> None: ...

View File

@@ -0,0 +1,48 @@
from distutils.cmd import Command as Command
from distutils.dist import Distribution as Distribution
from distutils.extension import Extension as Extension
from typing import Any, List, Mapping, Optional, Tuple, Type, Union
def setup(
*,
name: str = ...,
version: str = ...,
description: str = ...,
long_description: str = ...,
author: str = ...,
author_email: str = ...,
maintainer: str = ...,
maintainer_email: str = ...,
url: str = ...,
download_url: str = ...,
packages: List[str] = ...,
py_modules: List[str] = ...,
scripts: List[str] = ...,
ext_modules: List[Extension] = ...,
classifiers: List[str] = ...,
distclass: Type[Distribution] = ...,
script_name: str = ...,
script_args: List[str] = ...,
options: Mapping[str, Any] = ...,
license: str = ...,
keywords: Union[List[str], str] = ...,
platforms: Union[List[str], str] = ...,
cmdclass: Mapping[str, Type[Command]] = ...,
data_files: List[Tuple[str, List[str]]] = ...,
package_dir: Mapping[str, str] = ...,
obsoletes: List[str] = ...,
provides: List[str] = ...,
requires: List[str] = ...,
command_packages: List[str] = ...,
command_options: Mapping[str, Mapping[str, Tuple[Any, Any]]] = ...,
package_data: Mapping[str, List[str]] = ...,
include_package_data: bool = ...,
libraries: List[str] = ...,
headers: List[str] = ...,
ext_package: str = ...,
include_dirs: List[str] = ...,
password: str = ...,
fullname: str = ...,
**attrs: Any,
) -> None: ...
def run_setup(script_name: str, script_args: Optional[List[str]] = ..., stop_after: str = ...) -> Distribution: ...

View File

@@ -0,0 +1,4 @@
from distutils.unixccompiler import UnixCCompiler
class CygwinCCompiler(UnixCCompiler): ...
class Mingw32CCompiler(CygwinCCompiler): ...

View File

@@ -0,0 +1 @@
DEBUG: bool

View File

@@ -0,0 +1,5 @@
from typing import List, Tuple
def newer(source: str, target: str) -> bool: ...
def newer_pairwise(sources: List[str], targets: List[str]) -> List[Tuple[str, str]]: ...
def newer_group(sources: List[str], target: str, missing: str = ...) -> bool: ...

View File

@@ -0,0 +1,15 @@
from typing import List
def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> List[str]: ...
def create_tree(base_dir: str, files: List[str], mode: int = ..., verbose: int = ..., dry_run: int = ...) -> None: ...
def copy_tree(
src: str,
dst: str,
preserve_mode: int = ...,
preserve_times: int = ...,
preserve_symlinks: int = ...,
update: int = ...,
verbose: int = ...,
dry_run: int = ...,
) -> List[str]: ...
def remove_tree(directory: str, verbose: int = ..., dry_run: int = ...) -> None: ...

View File

@@ -0,0 +1,9 @@
from distutils.cmd import Command
from typing import Any, Dict, Iterable, Mapping, Optional, Text, Tuple, Type
class Distribution:
cmdclass: Dict[str, Type[Command]]
def __init__(self, attrs: Optional[Mapping[str, Any]] = ...) -> None: ...
def get_option_dict(self, command: str) -> Dict[str, Tuple[str, Text]]: ...
def parse_config_files(self, filenames: Optional[Iterable[Text]] = ...) -> None: ...
def get_command_obj(self, command: str, create: bool = ...) -> Optional[Command]: ...

View File

@@ -0,0 +1,3 @@
from distutils.unixccompiler import UnixCCompiler
class EMXCCompiler(UnixCCompiler): ...

View File

@@ -0,0 +1,19 @@
class DistutilsError(Exception): ...
class DistutilsModuleError(DistutilsError): ...
class DistutilsClassError(DistutilsError): ...
class DistutilsGetoptError(DistutilsError): ...
class DistutilsArgError(DistutilsError): ...
class DistutilsFileError(DistutilsError): ...
class DistutilsOptionError(DistutilsError): ...
class DistutilsSetupError(DistutilsError): ...
class DistutilsPlatformError(DistutilsError): ...
class DistutilsExecError(DistutilsError): ...
class DistutilsInternalError(DistutilsError): ...
class DistutilsTemplateError(DistutilsError): ...
class DistutilsByteCompileError(DistutilsError): ...
class CCompilerError(Exception): ...
class PreprocessError(CCompilerError): ...
class CompileError(CCompilerError): ...
class LibError(CCompilerError): ...
class LinkError(CCompilerError): ...
class UnknownFileError(CCompilerError): ...

View File

@@ -0,0 +1,21 @@
from typing import List, Optional, Tuple
class Extension:
def __init__(
self,
name: str,
sources: List[str],
include_dirs: List[str] = ...,
define_macros: List[Tuple[str, Optional[str]]] = ...,
undef_macros: List[str] = ...,
library_dirs: List[str] = ...,
libraries: List[str] = ...,
runtime_library_dirs: List[str] = ...,
extra_objects: List[str] = ...,
extra_compile_args: List[str] = ...,
extra_link_args: List[str] = ...,
export_symbols: List[str] = ...,
swig_opts: Optional[str] = ..., # undocumented
depends: List[str] = ...,
language: str = ...,
) -> None: ...

View File

@@ -0,0 +1,21 @@
from typing import Any, List, Mapping, Optional, Tuple, Union, overload
_Option = Tuple[str, Optional[str], str]
_GR = Tuple[List[str], OptionDummy]
def fancy_getopt(
options: List[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: Optional[List[str]]
) -> Union[List[str], _GR]: ...
def wrap_text(text: str, width: int) -> List[str]: ...
class FancyGetopt:
def __init__(self, option_table: Optional[List[_Option]] = ...) -> None: ...
# TODO kinda wrong, `getopt(object=object())` is invalid
@overload
def getopt(self, args: Optional[List[str]] = ...) -> _GR: ...
@overload
def getopt(self, args: Optional[List[str]], object: Any) -> List[str]: ...
def get_option_order(self) -> List[Tuple[str, str]]: ...
def generate_help(self, header: Optional[str] = ...) -> List[str]: ...
class OptionDummy: ...

View File

@@ -0,0 +1,14 @@
from typing import Optional, Sequence, Tuple
def copy_file(
src: str,
dst: str,
preserve_mode: bool = ...,
preserve_times: bool = ...,
update: bool = ...,
link: Optional[str] = ...,
verbose: bool = ...,
dry_run: bool = ...,
) -> Tuple[str, str]: ...
def move_file(src: str, dst: str, verbose: bool = ..., dry_run: bool = ...) -> str: ...
def write_file(filename: str, contents: Sequence[str]) -> None: ...

View File

@@ -0,0 +1 @@
class FileList: ...

View File

@@ -0,0 +1,25 @@
from typing import Any, 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: ...
def log(level: int, msg: Text, *args: Any) -> None: ...
def debug(msg: Text, *args: Any) -> None: ...
def info(msg: Text, *args: Any) -> None: ...
def warn(msg: Text, *args: Any) -> None: ...
def error(msg: Text, *args: Any) -> None: ...
def fatal(msg: Text, *args: Any) -> None: ...
def set_threshold(level: int) -> int: ...
def set_verbosity(v: int) -> None: ...

View File

@@ -0,0 +1,3 @@
from distutils.ccompiler import CCompiler
class MSVCCompiler(CCompiler): ...

View File

@@ -0,0 +1,4 @@
from typing import List, Optional
def spawn(cmd: List[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ...
def find_executable(executable: str, path: Optional[str] = ...) -> Optional[str]: ...

View File

@@ -0,0 +1,14 @@
from distutils.ccompiler import CCompiler
from typing import Mapping, Optional, Union
PREFIX: str
EXEC_PREFIX: str
def get_config_var(name: str) -> Union[int, str, None]: ...
def get_config_vars(*args: str) -> Mapping[str, Union[int, str]]: ...
def get_config_h_filename() -> str: ...
def get_makefile_filename() -> str: ...
def get_python_inc(plat_specific: bool = ..., prefix: Optional[str] = ...) -> str: ...
def get_python_lib(plat_specific: bool = ..., standard_lib: bool = ..., prefix: Optional[str] = ...) -> str: ...
def customize_compiler(compiler: CCompiler) -> None: ...
def set_python_build() -> None: ...

View File

@@ -0,0 +1,21 @@
from typing import IO, List, Optional, Tuple, Union
class TextFile:
def __init__(
self,
filename: Optional[str] = ...,
file: Optional[IO[str]] = ...,
*,
strip_comments: bool = ...,
lstrip_ws: bool = ...,
rstrip_ws: bool = ...,
skip_blanks: bool = ...,
join_lines: bool = ...,
collapse_join: bool = ...,
) -> None: ...
def open(self, filename: str) -> None: ...
def close(self) -> None: ...
def warn(self, msg: str, line: Union[List[int], Tuple[int, int], int] = ...) -> None: ...
def readline(self) -> Optional[str]: ...
def readlines(self) -> List[str]: ...
def unreadline(self, line: str) -> str: ...

View File

@@ -0,0 +1,3 @@
from distutils.ccompiler import CCompiler
class UnixCCompiler(CCompiler): ...

View File

@@ -0,0 +1,23 @@
from typing import Any, Callable, List, Mapping, Optional, Tuple
def get_platform() -> str: ...
def convert_path(pathname: str) -> str: ...
def change_root(new_root: str, pathname: str) -> str: ...
def check_environ() -> None: ...
def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ...
def split_quoted(s: str) -> List[str]: ...
def execute(
func: Callable[..., None], args: Tuple[Any, ...], msg: Optional[str] = ..., verbose: bool = ..., dry_run: bool = ...
) -> None: ...
def strtobool(val: str) -> bool: ...
def byte_compile(
py_files: List[str],
optimize: int = ...,
force: bool = ...,
prefix: Optional[str] = ...,
base_dir: Optional[str] = ...,
verbose: bool = ...,
dry_run: bool = ...,
direct: Optional[bool] = ...,
) -> None: ...
def rfc822_escape(header: str) -> str: ...

View File

@@ -0,0 +1,33 @@
from abc import abstractmethod
from typing import Optional, Pattern, Text, Tuple, TypeVar, Union
_T = TypeVar("_T", bound=Version)
class Version:
def __repr__(self) -> str: ...
@abstractmethod
def __init__(self, vstring: Optional[Text] = ...) -> None: ...
@abstractmethod
def parse(self: _T, vstring: Text) -> _T: ...
@abstractmethod
def __str__(self) -> str: ...
@abstractmethod
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
class StrictVersion(Version):
version_re: Pattern[str]
version: Tuple[int, int, int]
prerelease: Optional[Tuple[Text, int]]
def __init__(self, vstring: Optional[Text] = ...) -> None: ...
def parse(self: _T, vstring: Text) -> _T: ...
def __str__(self) -> str: ...
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
class LooseVersion(Version):
component_re: Pattern[str]
vstring: Text
version: Tuple[Union[Text, int], ...]
def __init__(self, vstring: Optional[Text] = ...) -> None: ...
def parse(self: _T, vstring: Text) -> _T: ...
def __str__(self) -> str: ...
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...

View File

@@ -0,0 +1,21 @@
from typing import Any, Callable, Dict, NoReturn, Optional, Tuple
class error(Exception):
def __init__(self, *args: Any) -> None: ...
def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> None: ...
def exit() -> NoReturn: ...
def get_ident() -> int: ...
def allocate_lock() -> LockType: ...
def stack_size(size: Optional[int] = ...) -> int: ...
class LockType(object):
locked_status: bool
def __init__(self) -> None: ...
def acquire(self, waitflag: Optional[bool] = ...) -> bool: ...
def __enter__(self, waitflag: Optional[bool] = ...) -> bool: ...
def __exit__(self, typ: Any, val: Any, tb: Any) -> None: ...
def release(self) -> bool: ...
def locked(self) -> bool: ...
def interrupt_main() -> None: ...

View File

@@ -0,0 +1,4 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEText(MIMENonMultipart):
def __init__(self, _text, _subtype=..., _charset=...) -> None: ...

View File

@@ -0,0 +1,6 @@
from typing import IO, Any, AnyStr
def message_from_string(s: AnyStr, *args, **kwargs): ...
def message_from_bytes(s: str, *args, **kwargs): ...
def message_from_file(fp: IO[AnyStr], *args, **kwargs): ...
def message_from_binary_file(fp: IO[str], *args, **kwargs): ...

View File

@@ -0,0 +1,40 @@
from typing import Any, Optional
def parsedate_tz(data): ...
def parsedate(data): ...
def mktime_tz(data): ...
def quote(str): ...
class AddrlistClass:
specials: Any
pos: Any
LWS: Any
CR: Any
FWS: Any
atomends: Any
phraseends: Any
field: Any
commentlist: Any
def __init__(self, field): ...
def gotonext(self): ...
def getaddrlist(self): ...
def getaddress(self): ...
def getrouteaddr(self): ...
def getaddrspec(self): ...
def getdomain(self): ...
def getdelimited(self, beginchar, endchars, allowcomments: bool = ...): ...
def getquote(self): ...
def getcomment(self): ...
def getdomainliteral(self): ...
def getatom(self, atomends: Optional[Any] = ...): ...
def getphraselist(self): ...
class AddressList(AddrlistClass):
addresslist: Any
def __init__(self, field): ...
def __len__(self): ...
def __add__(self, other): ...
def __iadd__(self, other): ...
def __sub__(self, other): ...
def __isub__(self, other): ...
def __getitem__(self, index): ...

View File

@@ -0,0 +1,11 @@
def base64_len(s: bytes) -> int: ...
def header_encode(header, charset=..., keep_eols=..., maxlinelen=..., eol=...): ...
def encode(s, binary=..., maxlinelen=..., eol=...): ...
body_encode = encode
encodestring = encode
def decode(s, convert_eols=...): ...
body_decode = decode
decodestring = decode

View File

@@ -0,0 +1,26 @@
def add_charset(charset, header_enc=..., body_enc=..., output_charset=...) -> None: ...
def add_alias(alias, canonical) -> None: ...
def add_codec(charset, codecname) -> None: ...
QP: int # undocumented
BASE64: int # undocumented
SHORTEST: int # undocumented
class Charset:
input_charset = ...
header_encoding = ...
body_encoding = ...
output_charset = ...
input_codec = ...
output_codec = ...
def __init__(self, input_charset=...) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def get_body_encoding(self): ...
def convert(self, s): ...
def to_splittable(self, s): ...
def from_splittable(self, ustr, to_output: bool = ...): ...
def get_output_charset(self): ...
def encoded_header_len(self, s): ...
def header_encode(self, s, convert: bool = ...): ...
def body_encode(self, s, convert: bool = ...): ...

View File

@@ -0,0 +1,4 @@
def encode_base64(msg) -> None: ...
def encode_quopri(msg) -> None: ...
def encode_7or8bit(msg) -> None: ...
def encode_noop(msg) -> None: ...

View File

@@ -0,0 +1,17 @@
class BufferedSubFile:
def __init__(self) -> None: ...
def push_eof_matcher(self, pred) -> None: ...
def pop_eof_matcher(self): ...
def close(self) -> None: ...
def readline(self): ...
def unreadline(self, line) -> None: ...
def push(self, data): ...
def pushlines(self, lines) -> None: ...
def is_closed(self): ...
def __iter__(self): ...
def next(self): ...
class FeedParser:
def __init__(self, _factory=...) -> None: ...
def feed(self, data) -> None: ...
def close(self): ...

View File

@@ -0,0 +1,8 @@
class Generator:
def __init__(self, outfp, mangle_from_: bool = ..., maxheaderlen: int = ...) -> None: ...
def write(self, s) -> None: ...
def flatten(self, msg, unixfrom: bool = ...) -> None: ...
def clone(self, fp): ...
class DecodedGenerator(Generator):
def __init__(self, outfp, mangle_from_: bool = ..., maxheaderlen: int = ..., fmt=...) -> None: ...

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