apply black and isort (#4287)

* apply black and isort

* move some type ignores
This commit is contained in:
Jelle Zijlstra
2020-06-28 13:31:00 -07:00
committed by GitHub
parent fe58699ca5
commit 5d553c9584
800 changed files with 13875 additions and 10332 deletions

View File

@@ -1,9 +1,9 @@
# Stubs for OpenSSL.crypto (Python 2)
from datetime import datetime
from typing import Any, Callable, Iterable, List, Optional, Set, Text, Tuple, Union
from cryptography.hazmat.primitives.asymmetric import dsa, rsa
from datetime import datetime
FILETYPE_PEM: int
FILETYPE_ASN1: int
@@ -51,8 +51,9 @@ class X509Name:
def get_components(self) -> List[Tuple[str, str]]: ...
class X509Extension:
def __init__(self, type_name: bytes, critical: bool, value: bytes, subject: Optional[X509] = ...,
issuer: Optional[X509] = ...) -> None: ...
def __init__(
self, type_name: bytes, critical: bool, value: bytes, subject: Optional[X509] = ..., issuer: Optional[X509] = ...
) -> None: ...
def get_critical(self) -> bool: ...
def get_short_name(self) -> str: ...
def get_data(self) -> str: ...
@@ -128,8 +129,9 @@ class X509StoreContext:
def load_certificate(type: int, buffer: Union[str, unicode]) -> X509: ...
def dump_certificate(type: int, cert: X509) -> bytes: ...
def dump_publickey(type: int, pkey: PKey) -> bytes: ...
def dump_privatekey(type: int, pkey: PKey, cipher: Optional[str] = ...,
passphrase: Optional[Union[str, Callable[[int], int]]] = ...) -> bytes: ...
def dump_privatekey(
type: int, pkey: PKey, cipher: Optional[str] = ..., passphrase: Optional[Union[str, Callable[[int], int]]] = ...
) -> bytes: ...
class Revoked:
def __init__(self) -> None: ...

View File

@@ -1,18 +1,20 @@
import sys
from ._base import (
ALL_COMPLETED as ALL_COMPLETED,
FIRST_COMPLETED as FIRST_COMPLETED,
FIRST_EXCEPTION as FIRST_EXCEPTION,
ALL_COMPLETED as ALL_COMPLETED,
CancelledError as CancelledError,
TimeoutError as TimeoutError,
Future as Future,
Executor as Executor,
wait as wait,
Future as Future,
TimeoutError as TimeoutError,
as_completed as as_completed,
wait as wait,
)
from .process import ProcessPoolExecutor as ProcessPoolExecutor
from .thread import ThreadPoolExecutor as ThreadPoolExecutor
if sys.version_info >= (3, 8):
from ._base import InvalidStateError as InvalidStateError
if sys.version_info >= (3, 7):
from ._base import BrokenExecutor as BrokenExecutor
from .thread import ThreadPoolExecutor as ThreadPoolExecutor
from .process import ProcessPoolExecutor as ProcessPoolExecutor

View File

@@ -1,8 +1,8 @@
import sys
import threading
from logging import Logger
from typing import TypeVar, Generic, Any, Iterable, Iterator, Callable, Tuple, Optional, Set, List
from types import TracebackType
import sys
from typing import Any, Callable, Generic, Iterable, Iterator, List, Optional, Set, Tuple, TypeVar
FIRST_COMPLETED: str
FIRST_EXCEPTION: str
@@ -17,13 +17,14 @@ LOGGER: Logger
class Error(Exception): ...
class CancelledError(Error): ...
class TimeoutError(Error): ...
if sys.version_info >= (3, 8):
class InvalidStateError(Error): ...
if sys.version_info >= (3, 7):
class BrokenExecutor(RuntimeError): ...
_T = TypeVar('_T')
_T = TypeVar("_T")
class Future(Generic[_T]):
def __init__(self) -> None: ...
@@ -35,7 +36,6 @@ class Future(Generic[_T]):
def result(self, timeout: Optional[float] = ...) -> _T: ...
def set_running_or_notify_cancel(self) -> bool: ...
def set_result(self, result: _T) -> None: ...
if sys.version_info >= (3,):
def exception(self, timeout: Optional[float] = ...) -> Optional[BaseException]: ...
def set_exception(self, exception: Optional[BaseException]) -> None: ...
@@ -45,12 +45,12 @@ class Future(Generic[_T]):
def set_exception(self, exception: Any) -> None: ...
def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ...
class Executor:
def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
if sys.version_info >= (3, 5):
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...,
chunksize: int = ...) -> Iterator[_T]: ...
def map(
self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ...
) -> Iterator[_T]: ...
else:
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...,) -> Iterator[_T]: ...
def shutdown(self, wait: bool = ...) -> None: ...
@@ -58,9 +58,9 @@ class Executor:
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Optional[bool]: ...
def as_completed(fs: Iterable[Future[_T]], timeout: Optional[float] = ...) -> Iterator[Future[_T]]: ...
def wait(fs: Iterable[Future[_T]], timeout: Optional[float] = ..., return_when: str = ...) -> Tuple[Set[Future[_T]],
Set[Future[_T]]]: ...
def wait(
fs: Iterable[Future[_T]], timeout: Optional[float] = ..., return_when: str = ...
) -> Tuple[Set[Future[_T]], Set[Future[_T]]]: ...
class _Waiter:
event: threading.Event
@@ -70,7 +70,6 @@ class _Waiter:
def add_exception(self, future: Future[Any]) -> None: ...
def add_cancelled(self, future: Future[Any]) -> None: ...
class _AsCompletedWaiter(_Waiter):
lock: threading.Lock
def __init__(self) -> None: ...
@@ -78,13 +77,11 @@ class _AsCompletedWaiter(_Waiter):
def add_exception(self, future: Future[Any]) -> None: ...
def add_cancelled(self, future: Future[Any]) -> None: ...
class _FirstCompletedWaiter(_Waiter):
def add_result(self, future: Future[Any]) -> None: ...
def add_exception(self, future: Future[Any]) -> None: ...
def add_cancelled(self, future: Future[Any]) -> None: ...
class _AllCompletedWaiter(_Waiter):
num_pending_calls: int
stop_on_exception: bool
@@ -94,7 +91,6 @@ class _AllCompletedWaiter(_Waiter):
def add_exception(self, future: Future[Any]) -> None: ...
def add_cancelled(self, future: Future[Any]) -> None: ...
class _AcquireFutures:
futures: Iterable[Future[Any]]
def __init__(self, futures: Iterable[Future[Any]]) -> None: ...

View File

@@ -1,23 +1,28 @@
from typing import Any, Callable, Optional, Tuple
from ._base import Executor
import sys
from typing import Any, Callable, Optional, Tuple
from ._base import Executor
EXTRA_QUEUED_CALLS: Any
if sys.version_info >= (3, 7):
from ._base import BrokenExecutor
class BrokenProcessPool(BrokenExecutor): ...
elif sys.version_info >= (3,):
class BrokenProcessPool(RuntimeError): ...
if sys.version_info >= (3, 7):
from multiprocessing.context import BaseContext
class ProcessPoolExecutor(Executor):
def __init__(self, max_workers: Optional[int] = ...,
mp_context: Optional[BaseContext] = ...,
initializer: Optional[Callable[..., None]] = ...,
initargs: Tuple[Any, ...] = ...) -> None: ...
def __init__(
self,
max_workers: Optional[int] = ...,
mp_context: Optional[BaseContext] = ...,
initializer: Optional[Callable[..., None]] = ...,
initargs: Tuple[Any, ...] = ...,
) -> None: ...
else:
class ProcessPoolExecutor(Executor):
def __init__(self, max_workers: Optional[int] = ...) -> None: ...

View File

@@ -1,26 +1,28 @@
from typing import Any, Callable, Iterable, Mapping, Optional, Tuple, TypeVar, Generic
from ._base import Executor, Future
import sys
from typing import Any, Callable, Generic, Iterable, Mapping, Optional, Tuple, TypeVar
from ._base import Executor, Future
if sys.version_info >= (3, 7):
from ._base import BrokenExecutor
class BrokenThreadPool(BrokenExecutor): ...
_S = TypeVar('_S')
_S = TypeVar("_S")
class ThreadPoolExecutor(Executor):
if sys.version_info >= (3, 7):
def __init__(self, max_workers: Optional[int] = ...,
thread_name_prefix: str = ...,
initializer: Optional[Callable[..., None]] = ...,
initargs: Tuple[Any, ...] = ...) -> None: ...
def __init__(
self,
max_workers: Optional[int] = ...,
thread_name_prefix: str = ...,
initializer: Optional[Callable[..., None]] = ...,
initargs: Tuple[Any, ...] = ...,
) -> None: ...
elif sys.version_info >= (3, 6) or sys.version_info < (3,):
def __init__(self, max_workers: Optional[int] = ...,
thread_name_prefix: str = ...) -> None: ...
def __init__(self, max_workers: Optional[int] = ..., thread_name_prefix: str = ...) -> None: ...
else:
def __init__(self, max_workers: Optional[int] = ...) -> None: ...
class _WorkItem(Generic[_S]):
future: Future[_S]
fn: Callable[..., _S]

View File

@@ -1,10 +1,10 @@
# NB: third_party/2/enum.pyi and stdlib/3.4/enum.pyi must remain consistent!
import sys
from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar, Union
from abc import ABCMeta
from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar, Union
_T = TypeVar('_T')
_S = TypeVar('_S', bound=Type[Enum])
_T = TypeVar("_T")
_S = TypeVar("_S", bound=Type[Enum])
# Note: EnumMeta actually subclasses type directly, not ABCMeta.
# This is a temporary workaround to allow multiple creation of enums with builtins
@@ -56,7 +56,6 @@ if sys.version_info >= (3, 6):
# subclassing IntFlag so it picks up all implemented base functions, best modeling behavior of enum.auto()
class auto(IntFlag):
value: Any
class Flag(Enum):
def __contains__(self: _T, other: _T) -> bool: ...
def __repr__(self) -> str: ...
@@ -66,7 +65,6 @@ if sys.version_info >= (3, 6):
def __and__(self: _T, other: _T) -> _T: ...
def __xor__(self: _T, other: _T) -> _T: ...
def __invert__(self: _T) -> _T: ...
class IntFlag(int, Flag):
def __or__(self: _T, other: Union[int, _T]) -> _T: ...
def __and__(self: _T, other: Union[int, _T]) -> _T: ...

View File

@@ -1,4 +1,5 @@
from typing import Any
from thrift.Thrift import TProcessor # type: ignore
fastbinary: Any

View File

@@ -1,7 +1,5 @@
from typing import (Any, Container, Generic, Iterable, Iterator, Optional,
overload, SupportsInt, Text, Tuple, TypeVar)
import sys
from typing import Any, Container, Generic, Iterable, Iterator, Optional, SupportsInt, Text, Tuple, TypeVar, overload
# Undocumented length constants
IPV4LENGTH: int

View File

@@ -34,8 +34,21 @@ class KazooClient:
SetPartitioner: Any
Semaphore: Any
ShallowParty: Any
def __init__(self, hosts=..., timeout=..., client_id=..., handler=..., default_acl=..., auth_data=..., read_only=...,
randomize_hosts=..., connection_retry=..., command_retry=..., logger=..., **kwargs) -> None: ...
def __init__(
self,
hosts=...,
timeout=...,
client_id=...,
handler=...,
default_acl=...,
auth_data=...,
read_only=...,
randomize_hosts=...,
connection_retry=...,
command_retry=...,
logger=...,
**kwargs,
) -> None: ...
@property
def client_state(self): ...
@property
@@ -93,5 +106,4 @@ class TransactionRequest:
def __enter__(self): ...
def __exit__(self, exc_type, exc_value, exc_tb): ...
class KazooState:
...
class KazooState: ...

View File

@@ -1,11 +1,11 @@
from _typeshed import OpenBinaryMode, OpenTextMode
from typing import (Any, BinaryIO, Generator, IO, List, Optional, Sequence,
TextIO, Tuple, Type, TypeVar, Union, overload)
from types import TracebackType
import os
import sys
from types import TracebackType
from typing import IO, Any, BinaryIO, Generator, List, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union, overload
_P = TypeVar('_P', bound=PurePath)
from _typeshed import OpenBinaryMode, OpenTextMode
_P = TypeVar("_P", bound=PurePath)
if sys.version_info >= (3, 6):
_PurePathBase = os.PathLike[str]
@@ -60,7 +60,6 @@ class PurePath(_PurePathBase):
def joinpath(self: _P, *other: Union[str, PurePath]) -> _P: ...
else:
def joinpath(self: _P, *other: Union[str, os.PathLike[str]]) -> _P: ...
@property
def parents(self: _P) -> Sequence[_P]: ...
@property
@@ -71,9 +70,9 @@ class PureWindowsPath(PurePath): ...
class Path(PurePath):
def __enter__(self) -> Path: ...
def __exit__(self, exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[TracebackType]) -> Optional[bool]: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType]
) -> Optional[bool]: ...
@classmethod
def cwd(cls: Type[_P]) -> _P: ...
def stat(self) -> os.stat_result: ...
@@ -94,20 +93,31 @@ class Path(PurePath):
def lchmod(self, mode: int) -> None: ...
def lstat(self) -> os.stat_result: ...
if sys.version_info < (3, 5):
def mkdir(self, mode: int = ...,
parents: bool = ...) -> None: ...
def mkdir(self, mode: int = ..., parents: bool = ...) -> None: ...
else:
def mkdir(self, mode: int = ..., parents: bool = ...,
exist_ok: bool = ...) -> None: ...
def mkdir(self, mode: int = ..., parents: bool = ..., exist_ok: bool = ...) -> None: ...
@overload
def open(self, mode: OpenTextMode = ..., buffering: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ...,
newline: Optional[str] = ...) -> TextIO: ...
def open(
self,
mode: OpenTextMode = ...,
buffering: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
) -> TextIO: ...
@overload
def open(self, mode: OpenBinaryMode, buffering: int = ..., encoding: None = ..., errors: None = ...,
newline: None = ...) -> BinaryIO: ...
def open(
self, mode: OpenBinaryMode, buffering: int = ..., encoding: None = ..., errors: None = ..., newline: None = ...
) -> BinaryIO: ...
@overload
def open(self, mode: str, buffering: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ...,
newline: Optional[str] = ...) -> IO[Any]: ...
def open(
self,
mode: str,
buffering: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
) -> IO[Any]: ...
def owner(self) -> str: ...
if sys.version_info >= (3, 9):
def readlink(self: _P) -> _P: ...
@@ -123,36 +133,28 @@ class Path(PurePath):
def resolve(self: _P, strict: bool = ...) -> _P: ...
def rglob(self, pattern: str) -> Generator[Path, None, None]: ...
def rmdir(self) -> None: ...
def symlink_to(self, target: Union[str, Path],
target_is_directory: bool = ...) -> None: ...
def symlink_to(self, target: Union[str, Path], target_is_directory: bool = ...) -> None: ...
def touch(self, mode: int = ..., exist_ok: bool = ...) -> None: ...
if sys.version_info >= (3, 8):
def unlink(self, missing_ok: bool = ...) -> None: ...
else:
def unlink(self) -> None: ...
if sys.version_info >= (3, 5):
@classmethod
def home(cls: Type[_P]) -> _P: ...
if sys.version_info < (3, 6):
def __new__(cls: Type[_P], *args: Union[str, PurePath],
**kwargs: Any) -> _P: ...
def __new__(cls: Type[_P], *args: Union[str, PurePath], **kwargs: Any) -> _P: ...
else:
def __new__(cls: Type[_P], *args: Union[str, os.PathLike[str]],
**kwargs: Any) -> _P: ...
def __new__(cls: Type[_P], *args: Union[str, os.PathLike[str]], **kwargs: Any) -> _P: ...
def absolute(self: _P) -> _P: ...
def expanduser(self: _P) -> _P: ...
def read_bytes(self) -> bytes: ...
def read_text(self, encoding: Optional[str] = ...,
errors: Optional[str] = ...) -> str: ...
def read_text(self, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> str: ...
def samefile(self, other_path: Union[str, bytes, int, Path]) -> bool: ...
def write_bytes(self, data: bytes) -> int: ...
def write_text(self, data: str, encoding: Optional[str] = ...,
errors: Optional[str] = ...) -> int: ...
def write_text(self, data: str, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> int: ...
if sys.version_info >= (3, 8):
def link_to(self, target: Union[str, bytes, os.PathLike[str]]) -> None: ...
class PosixPath(Path, PurePosixPath): ...
class WindowsPath(Path, PureWindowsPath): ...

View File

@@ -1,13 +1,11 @@
from datetime import datetime, date, time
from typing import Any, Dict, Tuple, Iterable, List, Optional, Union, Sequence
from datetime import date, datetime, time
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
Scalar = Union[int, float, str, datetime, date, time]
Result = Union[Tuple[Scalar, ...], Dict[str, Scalar]]
class Connection(object):
def __init__(self, user, password, host, database, timeout,
login_timeout, charset, as_dict) -> None: ...
def __init__(self, user, password, host, database, timeout, login_timeout, charset, as_dict) -> None: ...
def autocommit(self, status: bool) -> None: ...
def close(self) -> None: ...
def commit(self) -> None: ...
@@ -20,29 +18,27 @@ class Cursor(object):
def __next__(self) -> Any: ...
def callproc(self, procname: str, **kwargs) -> None: ...
def close(self) -> None: ...
def execute(self, stmt: str,
params: Optional[Union[Scalar, Tuple[Scalar, ...],
Dict[str, Scalar]]]) -> None: ...
def executemany(self, stmt: str,
params: Optional[Sequence[Tuple[Scalar, ...]]]) -> None: ...
def execute(self, stmt: str, params: Optional[Union[Scalar, Tuple[Scalar, ...], Dict[str, Scalar]]]) -> None: ...
def executemany(self, stmt: str, params: Optional[Sequence[Tuple[Scalar, ...]]]) -> None: ...
def fetchall(self) -> List[Result]: ...
def fetchmany(self, size: Optional[int]) -> List[Result]: ...
def fetchone(self) -> Result: ...
def connect(server: Optional[str],
user: Optional[str],
password: Optional[str],
database: Optional[str],
timeout: Optional[int],
login_timeout: Optional[int],
charset: Optional[str],
as_dict: Optional[bool],
host: Optional[str],
appname: Optional[str],
port: Optional[str],
conn_properties: Optional[Union[str, Sequence[str]]],
autocommit: Optional[bool],
tds_version: Optional[str]) -> Connection: ...
def connect(
server: Optional[str],
user: Optional[str],
password: Optional[str],
database: Optional[str],
timeout: Optional[int],
login_timeout: Optional[int],
charset: Optional[str],
as_dict: Optional[bool],
host: Optional[str],
appname: Optional[str],
port: Optional[str],
conn_properties: Optional[Union[str, Sequence[str]]],
autocommit: Optional[bool],
tds_version: Optional[str],
) -> Connection: ...
def get_max_connections() -> int: ...
def set_max_connections(n: int) -> None: ...

View File

@@ -1,5 +1,4 @@
from . import mapper
from . import util
from . import mapper, util
class _RequestConfig:
def __getattr__(self, name): ...

View File

@@ -7,8 +7,18 @@ def strip_slashes(name): ...
class SubMapperParent:
def submapper(self, **kargs): ...
def collection(self, collection_name, resource_name, path_prefix=..., member_prefix=..., controller=...,
collection_actions=..., member_actions=..., member_options=..., **kwargs): ...
def collection(
self,
collection_name,
resource_name,
path_prefix=...,
member_prefix=...,
controller=...,
collection_actions=...,
member_actions=...,
member_options=...,
**kwargs,
): ...
class SubMapper(SubMapperParent):
kwargs: Any

View File

@@ -1,9 +1,10 @@
from typing import Any
import fb303.FacebookService
from .ttypes import * # noqa: F403
from thrift.Thrift import TProcessor # type: ignore # We don't have thrift stubs in typeshed
from .ttypes import * # noqa: F403
class Iface(fb303.FacebookService.Iface):
def Log(self, messages): ...

View File

@@ -1,22 +1,37 @@
from __future__ import print_function
import types
from typing import (
Any, AnyStr, Callable, Dict, Iterable, Mapping, NoReturn, Optional,
Pattern, Text, Tuple, Type, TypeVar, Union, overload, ValuesView, KeysView, ItemsView,
)
import typing
import unittest
from __builtin__ import unichr as unichr
from StringIO import StringIO as StringIO, StringIO as BytesIO
from functools import wraps as wraps
from StringIO import StringIO as BytesIO
from typing import (
Any,
AnyStr,
Callable,
Dict,
ItemsView,
Iterable,
KeysView,
Mapping,
NoReturn,
Optional,
Pattern,
Text,
Tuple,
Type,
TypeVar,
Union,
ValuesView,
overload,
)
from . import moves
_T = TypeVar('_T')
_K = TypeVar('_K')
_V = TypeVar('_V')
_T = TypeVar("_T")
_K = TypeVar("_K")
_V = TypeVar("_V")
__version__: str
@@ -35,10 +50,10 @@ binary_type = str
MAXSIZE: int
def advance_iterator(it: typing.Iterator[_T]) -> _T: ...
next = advance_iterator
def callable(obj: object) -> bool: ...
def get_unbound_function(unbound: types.MethodType) -> types.FunctionType: ...
def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ...
def create_unbound_method(func: types.FunctionType, cls: Union[type, types.ClassType]) -> types.MethodType: ...
@@ -52,33 +67,34 @@ def get_function_closure(fun: types.FunctionType) -> Optional[Tuple[types._Cell,
def get_function_code(fun: types.FunctionType) -> types.CodeType: ...
def get_function_defaults(fun: types.FunctionType) -> Optional[Tuple[Any, ...]]: ...
def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ...
def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ...
def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ...
def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ...
# def iterlists
def viewkeys(d: Mapping[_K, _V]) -> KeysView[_K]: ...
def viewvalues(d: Mapping[_K, _V]) -> ValuesView[_V]: ...
def viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ...
def b(s: str) -> binary_type: ...
def u(s: str) -> text_type: ...
int2byte = chr
def byte2int(bs: binary_type) -> int: ...
def indexbytes(buf: binary_type, i: int) -> int: ...
def iterbytes(buf: binary_type) -> typing.Iterator[int]: ...
def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: str = ...) -> None: ...
@overload
def assertRaisesRegex(self: unittest.TestCase, msg: str = ...) -> Any: ...
@overload
def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...
def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]],
msg: str = ...) -> None: ...
def reraise(tp: Optional[Type[BaseException]], value: Optional[BaseException],
tb: Optional[types.TracebackType] = ...) -> NoReturn: ...
def assertRegex(
self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: str = ...
) -> None: ...
def reraise(
tp: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType] = ...
) -> NoReturn: ...
def exec_(_code_: Union[unicode, types.CodeType], _globs_: Dict[str, Any] = ..., _locs_: Dict[str, Any] = ...): ...
def raise_from(value: Union[BaseException, Type[BaseException]], from_value: Optional[BaseException]) -> NoReturn: ...
@@ -104,7 +120,9 @@ class MovedModule(_LazyDescriptor):
class MovedAttribute(_LazyDescriptor):
mod: str
attr: str
def __init__(self, name: str, old_mod: str, new_mod: str, old_attr: Optional[str] = ..., new_attr: Optional[str] = ...) -> None: ...
def __init__(
self, name: str, old_mod: str, new_mod: str, old_attr: Optional[str] = ..., new_attr: Optional[str] = ...
) -> None: ...
def add_move(move: Union[MovedModule, MovedAttribute]) -> None: ...
def remove_move(name: str) -> None: ...

View File

@@ -2,47 +2,17 @@
#
# Note: Commented out items means they weren't implemented at the time.
# Uncomment them when the modules have been added to the typeshed.
import __builtin__ as builtins
from __builtin__ import intern as intern, raw_input as input, reduce as reduce, reload as reload_module, xrange as xrange
from cStringIO import StringIO as cStringIO
from itertools import ifilter as filter
from itertools import ifilterfalse as filterfalse
from __builtin__ import raw_input as input
from __builtin__ import intern as intern
from itertools import imap as map
from os import getcwdu as getcwd
from os import getcwd as getcwdb
from __builtin__ import xrange as range
from __builtin__ import reload as reload_module
from __builtin__ import reduce as reduce
from itertools import ifilter as filter, ifilterfalse as filterfalse, imap as map, izip as zip, izip_longest as zip_longest
from os import getcwd as getcwdb, getcwdu as getcwd
from pipes import quote as shlex_quote
from StringIO import StringIO as StringIO
from UserDict import UserDict as UserDict
from UserList import UserList as UserList
from UserString import UserString as UserString
from __builtin__ import xrange as xrange
from itertools import izip as zip
from itertools import izip_longest as zip_longest
import __builtin__ as builtins
from . import configparser
# import copy_reg as copyreg
# import gdbm as dbm_gnu
from . import _dummy_thread
from . import http_cookiejar
from . import http_cookies
from . import html_entities
from . import html_parser
from . import http_client
# import email.MIMEMultipart as email_mime_multipart
# import email.MIMENonMultipart as email_mime_nonmultipart
from . import email_mime_text
# import email.MIMEBase as email_mime_base
from . import BaseHTTPServer
from . import CGIHTTPServer
from . import SimpleHTTPServer
from . import cPickle
from . import queue
from . import reprlib
from . import socketserver
from . import _thread
# import Tkinter as tkinter
# import Dialog as tkinter_dialog
# import FileDialog as tkinter_filedialog
@@ -58,9 +28,33 @@ from . import _thread
# import tkFont as tkinter_font
# import tkMessageBox as tkinter_messagebox
# import tkSimpleDialog as tkinter_tksimpledialog
from . import urllib_parse
from . import urllib_error
from . import urllib
from . import urllib_robotparser
from . import xmlrpc_client
# import email.MIMEBase as email_mime_base
# import email.MIMEMultipart as email_mime_multipart
# import email.MIMENonMultipart as email_mime_nonmultipart
# import copy_reg as copyreg
# import gdbm as dbm_gnu
from . import (
BaseHTTPServer,
CGIHTTPServer,
SimpleHTTPServer,
_dummy_thread,
_thread,
configparser,
cPickle,
email_mime_text,
html_entities,
html_parser,
http_client,
http_cookiejar,
http_cookies,
queue,
reprlib,
socketserver,
urllib,
urllib_error,
urllib_parse,
urllib_robotparser,
xmlrpc_client,
)
# import SimpleXMLRPCServer as xmlrpc_server

View File

@@ -1,3 +1,2 @@
from urllib2 import URLError as URLError
from urllib2 import HTTPError as HTTPError
from urllib import ContentTooShortError as ContentTooShortError
from urllib2 import HTTPError as HTTPError, URLError as URLError

View File

@@ -1,25 +1,28 @@
# Stubs for six.moves.urllib.parse
from urlparse import ParseResult as ParseResult
from urlparse import SplitResult as SplitResult
from urlparse import parse_qs as parse_qs
from urlparse import parse_qsl as parse_qsl
from urlparse import urldefrag as urldefrag
from urlparse import urljoin as urljoin
from urlparse import urlparse as urlparse
from urlparse import urlsplit as urlsplit
from urlparse import urlunparse as urlunparse
from urlparse import urlunsplit as urlunsplit
from urllib import quote as quote
from urllib import quote_plus as quote_plus
from urllib import unquote as unquote
from urllib import unquote as unquote_to_bytes
from urllib import unquote_plus as unquote_plus
from urllib import urlencode as urlencode
from urllib import splitquery as splitquery
from urllib import splittag as splittag
from urllib import splituser as splituser
from urlparse import uses_fragment as uses_fragment
from urlparse import uses_netloc as uses_netloc
from urlparse import uses_params as uses_params
from urlparse import uses_query as uses_query
from urlparse import uses_relative as uses_relative
from urllib import (
quote as quote,
quote_plus as quote_plus,
splitquery as splitquery,
splittag as splittag,
splituser as splituser,
unquote as unquote_to_bytes,
unquote_plus as unquote_plus,
urlencode as urlencode,
)
from urlparse import (
ParseResult as ParseResult,
SplitResult as SplitResult,
parse_qs as parse_qs,
parse_qsl as parse_qsl,
urldefrag as urldefrag,
urljoin as urljoin,
urlparse as urlparse,
urlsplit as urlsplit,
urlunparse as urlunparse,
urlunsplit as urlunsplit,
uses_fragment as uses_fragment,
uses_netloc as uses_netloc,
uses_params as uses_params,
uses_query as uses_query,
uses_relative as uses_relative,
)

View File

@@ -1,36 +1,40 @@
# Stubs for six.moves.urllib.request
from urllib2 import urlopen as urlopen
from urllib2 import install_opener as install_opener
from urllib2 import build_opener as build_opener
from urllib import pathname2url as pathname2url
from urllib import url2pathname as url2pathname
from urllib import getproxies as getproxies
from urllib2 import Request as Request
from urllib2 import OpenerDirector as OpenerDirector
from urllib2 import HTTPDefaultErrorHandler as HTTPDefaultErrorHandler
from urllib2 import HTTPRedirectHandler as HTTPRedirectHandler
from urllib2 import HTTPCookieProcessor as HTTPCookieProcessor
from urllib2 import ProxyHandler as ProxyHandler
from urllib2 import BaseHandler as BaseHandler
from urllib2 import HTTPPasswordMgr as HTTPPasswordMgr
from urllib2 import HTTPPasswordMgrWithDefaultRealm as HTTPPasswordMgrWithDefaultRealm
from urllib2 import AbstractBasicAuthHandler as AbstractBasicAuthHandler
from urllib2 import HTTPBasicAuthHandler as HTTPBasicAuthHandler
from urllib2 import ProxyBasicAuthHandler as ProxyBasicAuthHandler
from urllib2 import AbstractDigestAuthHandler as AbstractDigestAuthHandler
from urllib2 import HTTPDigestAuthHandler as HTTPDigestAuthHandler
from urllib2 import ProxyDigestAuthHandler as ProxyDigestAuthHandler
from urllib2 import HTTPHandler as HTTPHandler
from urllib2 import HTTPSHandler as HTTPSHandler
from urllib2 import FileHandler as FileHandler
from urllib2 import FTPHandler as FTPHandler
from urllib2 import CacheFTPHandler as CacheFTPHandler
from urllib2 import UnknownHandler as UnknownHandler
from urllib2 import HTTPErrorProcessor as HTTPErrorProcessor
from urllib import urlretrieve as urlretrieve
from urllib import urlcleanup as urlcleanup
from urllib import URLopener as URLopener
from urllib import FancyURLopener as FancyURLopener
from urllib import proxy_bypass as proxy_bypass
from urllib2 import parse_http_list as parse_http_list
from urllib2 import parse_keqv_list as parse_keqv_list
from urllib import (
FancyURLopener as FancyURLopener,
URLopener as URLopener,
getproxies as getproxies,
pathname2url as pathname2url,
proxy_bypass as proxy_bypass,
url2pathname as url2pathname,
urlcleanup as urlcleanup,
urlretrieve as urlretrieve,
)
from urllib2 import (
AbstractBasicAuthHandler as AbstractBasicAuthHandler,
AbstractDigestAuthHandler as AbstractDigestAuthHandler,
BaseHandler as BaseHandler,
CacheFTPHandler as CacheFTPHandler,
FileHandler as FileHandler,
FTPHandler as FTPHandler,
HTTPBasicAuthHandler as HTTPBasicAuthHandler,
HTTPCookieProcessor as HTTPCookieProcessor,
HTTPDefaultErrorHandler as HTTPDefaultErrorHandler,
HTTPDigestAuthHandler as HTTPDigestAuthHandler,
HTTPErrorProcessor as HTTPErrorProcessor,
HTTPHandler as HTTPHandler,
HTTPPasswordMgr as HTTPPasswordMgr,
HTTPPasswordMgrWithDefaultRealm as HTTPPasswordMgrWithDefaultRealm,
HTTPRedirectHandler as HTTPRedirectHandler,
HTTPSHandler as HTTPSHandler,
OpenerDirector as OpenerDirector,
ProxyBasicAuthHandler as ProxyBasicAuthHandler,
ProxyDigestAuthHandler as ProxyDigestAuthHandler,
ProxyHandler as ProxyHandler,
Request as Request,
UnknownHandler as UnknownHandler,
build_opener as build_opener,
install_opener as install_opener,
parse_http_list as parse_http_list,
parse_keqv_list as parse_keqv_list,
urlopen as urlopen,
)

View File

@@ -1,5 +1,2 @@
# Stubs for six.moves.urllib.response
from urllib import addbase as addbase
from urllib import addclosehook as addclosehook
from urllib import addinfo as addinfo
from urllib import addinfourl as addinfourl
from urllib import addbase as addbase, addclosehook as addclosehook, addinfo as addinfo, addinfourl as addinfourl