mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Fix some errors with --disallow-any-generics (#3276)
See #3267. Covers all of stdlib/2and3.
This commit is contained in:
@@ -53,30 +53,30 @@ class object:
|
||||
def __getattribute__(self, name: str) -> Any: ...
|
||||
def __delattr__(self, name: str) -> None: ...
|
||||
def __sizeof__(self) -> int: ...
|
||||
def __reduce__(self) -> tuple: ...
|
||||
def __reduce_ex__(self, protocol: int) -> tuple: ...
|
||||
def __reduce__(self) -> Tuple[Any, ...]: ...
|
||||
def __reduce_ex__(self, protocol: int) -> Tuple[Any, ...]: ...
|
||||
if sys.version_info >= (3,):
|
||||
def __dir__(self) -> Iterable[str]: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def __init_subclass__(cls) -> None: ...
|
||||
|
||||
class staticmethod(object): # Special, only valid as a decorator.
|
||||
__func__: Callable
|
||||
__func__: Callable[..., Any]
|
||||
if sys.version_info >= (3,):
|
||||
__isabstractmethod__: bool
|
||||
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __init__(self, f: Callable[..., Any]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
|
||||
|
||||
class classmethod(object): # Special, only valid as a decorator.
|
||||
__func__: Callable
|
||||
__func__: Callable[..., Any]
|
||||
if sys.version_info >= (3,):
|
||||
__isabstractmethod__: bool
|
||||
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __init__(self, f: Callable[..., Any]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
|
||||
|
||||
class type(object):
|
||||
__base__: type
|
||||
@@ -1130,7 +1130,7 @@ if sys.version_info >= (3, 6):
|
||||
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
|
||||
class _PathLike(Generic[AnyStr]):
|
||||
def __fspath__(self) -> AnyStr: ...
|
||||
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike[Any]], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
elif sys.version_info >= (3,):
|
||||
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
else:
|
||||
@@ -1187,8 +1187,8 @@ else:
|
||||
def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
@overload
|
||||
def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ...
|
||||
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
|
||||
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
|
||||
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
|
||||
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
|
||||
def len(__o: Sized) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
def license() -> None: ...
|
||||
@@ -1324,7 +1324,7 @@ def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
|
||||
def oct(__i: Union[int, _SupportsIndex]) -> str: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
|
||||
def open(file: Union[str, bytes, int, _PathLike[Any]], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...,
|
||||
opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ...
|
||||
elif sys.version_info >= (3,):
|
||||
|
||||
@@ -2,7 +2,7 @@ from typing import Iterator, Any, Iterable, MutableSet, Optional, TypeVar, Gener
|
||||
|
||||
_S = TypeVar('_S')
|
||||
_T = TypeVar('_T')
|
||||
_SelfT = TypeVar('_SelfT', bound=WeakSet)
|
||||
_SelfT = TypeVar('_SelfT', bound=WeakSet[Any])
|
||||
|
||||
class WeakSet(MutableSet[_T], Generic[_T]):
|
||||
def __init__(self, data: Optional[Iterable[_T]] = ...) -> None: ...
|
||||
|
||||
@@ -50,8 +50,8 @@ class dispatcher:
|
||||
def readable(self) -> bool: ...
|
||||
def writable(self) -> bool: ...
|
||||
def listen(self, backlog: int) -> None: ...
|
||||
def bind(self, address: Union[tuple, str]) -> None: ...
|
||||
def connect(self, address: Union[tuple, str]) -> None: ...
|
||||
def bind(self, address: Union[Tuple[Any, ...], str]) -> None: ...
|
||||
def connect(self, address: Union[Tuple[Any, ...], str]) -> None: ...
|
||||
def accept(self) -> Optional[Tuple[SocketType, Any]]: ...
|
||||
def send(self, data: bytes) -> int: ...
|
||||
def recv(self, buffer_size: int) -> bytes: ...
|
||||
@@ -103,7 +103,7 @@ class dispatcher:
|
||||
def recvfrom_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ...
|
||||
def recv_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ...
|
||||
def sendall(self, data: bytes, flags: int = ...) -> None: ...
|
||||
def sendto(self, data: bytes, address: Union[tuple, str], flags: int = ...) -> int: ...
|
||||
def sendto(self, data: bytes, address: Union[Tuple[str, int], str], flags: int = ...) -> int: ...
|
||||
def setblocking(self, flag: bool) -> None: ...
|
||||
def settimeout(self, value: Union[float, None]) -> None: ...
|
||||
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
|
||||
|
||||
@@ -4,19 +4,10 @@ from typing import Any, Sequence, MutableSequence, TypeVar
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
# TODO uncomment when mypy# 2035 is fixed
|
||||
# def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
# def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
# def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
#
|
||||
# def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
# def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
# def insort(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
|
||||
def bisect_left(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect_right(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
|
||||
|
||||
def insort_left(a: MutableSequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort_right(a: MutableSequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort(a: MutableSequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
|
||||
@@ -53,30 +53,30 @@ class object:
|
||||
def __getattribute__(self, name: str) -> Any: ...
|
||||
def __delattr__(self, name: str) -> None: ...
|
||||
def __sizeof__(self) -> int: ...
|
||||
def __reduce__(self) -> tuple: ...
|
||||
def __reduce_ex__(self, protocol: int) -> tuple: ...
|
||||
def __reduce__(self) -> Tuple[Any, ...]: ...
|
||||
def __reduce_ex__(self, protocol: int) -> Tuple[Any, ...]: ...
|
||||
if sys.version_info >= (3,):
|
||||
def __dir__(self) -> Iterable[str]: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def __init_subclass__(cls) -> None: ...
|
||||
|
||||
class staticmethod(object): # Special, only valid as a decorator.
|
||||
__func__: Callable
|
||||
__func__: Callable[..., Any]
|
||||
if sys.version_info >= (3,):
|
||||
__isabstractmethod__: bool
|
||||
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __init__(self, f: Callable[..., Any]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
|
||||
|
||||
class classmethod(object): # Special, only valid as a decorator.
|
||||
__func__: Callable
|
||||
__func__: Callable[..., Any]
|
||||
if sys.version_info >= (3,):
|
||||
__isabstractmethod__: bool
|
||||
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __init__(self, f: Callable[..., Any]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
|
||||
|
||||
class type(object):
|
||||
__base__: type
|
||||
@@ -1130,7 +1130,7 @@ if sys.version_info >= (3, 6):
|
||||
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
|
||||
class _PathLike(Generic[AnyStr]):
|
||||
def __fspath__(self) -> AnyStr: ...
|
||||
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike[Any]], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
elif sys.version_info >= (3,):
|
||||
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
else:
|
||||
@@ -1187,8 +1187,8 @@ else:
|
||||
def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
@overload
|
||||
def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ...
|
||||
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
|
||||
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
|
||||
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
|
||||
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
|
||||
def len(__o: Sized) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
def license() -> None: ...
|
||||
@@ -1324,7 +1324,7 @@ def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
|
||||
def oct(__i: Union[int, _SupportsIndex]) -> str: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
|
||||
def open(file: Union[str, bytes, int, _PathLike[Any]], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...,
|
||||
opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ...
|
||||
elif sys.version_info >= (3,):
|
||||
|
||||
@@ -101,7 +101,7 @@ class FieldStorage(object):
|
||||
if sys.version_info < (3, 0):
|
||||
from UserDict import UserDict
|
||||
|
||||
class FormContentDict(UserDict):
|
||||
class FormContentDict(UserDict[str, List[str]]):
|
||||
query_string: str
|
||||
def __init__(self, environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ...
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ _F = TypeVar('_F', bound=Callable[..., Any])
|
||||
_ExitFunc = Callable[[Optional[Type[BaseException]],
|
||||
Optional[BaseException],
|
||||
Optional[TracebackType]], bool]
|
||||
_CM_EF = TypeVar('_CM_EF', ContextManager, _ExitFunc)
|
||||
_CM_EF = TypeVar('_CM_EF', ContextManager[Any], _ExitFunc)
|
||||
|
||||
if sys.version_info >= (3, 2):
|
||||
class _GeneratorContextManager(ContextManager[_T], Generic[_T]):
|
||||
@@ -85,7 +85,7 @@ if sys.version_info >= (3, 7):
|
||||
Optional[BaseException],
|
||||
Optional[TracebackType]], Awaitable[bool]]
|
||||
_CallbackCoroFunc = Callable[..., Awaitable[Any]]
|
||||
_ACM_EF = TypeVar('_ACM_EF', AsyncContextManager, _ExitCoroFunc)
|
||||
_ACM_EF = TypeVar('_ACM_EF', AsyncContextManager[Any], _ExitCoroFunc)
|
||||
|
||||
class AsyncExitStack(AsyncContextManager[AsyncExitStack]):
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@@ -92,9 +92,9 @@ class AbstractWriter(NullWriter):
|
||||
def send_literal_data(self, data: str) -> None: ...
|
||||
|
||||
class DumbWriter(NullWriter):
|
||||
file: IO
|
||||
file: IO[str]
|
||||
maxcol: int
|
||||
def __init__(self, file: Optional[IO] = ..., maxcol: int = ...) -> None: ...
|
||||
def __init__(self, file: Optional[IO[str]] = ..., maxcol: int = ...) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def send_paragraph(self, blankline: int) -> None: ...
|
||||
def send_line_break(self) -> None: ...
|
||||
|
||||
@@ -44,7 +44,7 @@ class IMAP4:
|
||||
def recent(self) -> CommandResults: ...
|
||||
def response(self, code: str) -> CommandResults: ...
|
||||
def append(self, mailbox: str, flags: str, date_time: str, message: str) -> str: ...
|
||||
def authenticate(self, mechanism: str, authobject: Callable) -> Tuple[str, str]: ...
|
||||
def authenticate(self, mechanism: str, authobject: Callable[[bytes], Optional[bytes]]) -> Tuple[str, str]: ...
|
||||
def capability(self) -> CommandResults: ...
|
||||
def check(self) -> CommandResults: ...
|
||||
def close(self) -> CommandResults: ...
|
||||
@@ -111,7 +111,7 @@ class IMAP4_stream(IMAP4):
|
||||
port: int = ...
|
||||
sock: _socket = ...
|
||||
file: IO[Any] = ...
|
||||
process: subprocess.Popen = ...
|
||||
process: subprocess.Popen[bytes] = ...
|
||||
writefile: IO[Any] = ...
|
||||
readfile: IO[Any] = ...
|
||||
def open(self, host: str = ..., port: Optional[int] = ...) -> None: ...
|
||||
@@ -121,8 +121,8 @@ class IMAP4_stream(IMAP4):
|
||||
def shutdown(self) -> None: ...
|
||||
|
||||
class _Authenticator:
|
||||
mech: Callable = ...
|
||||
def __init__(self, mechinst: Callable) -> None: ...
|
||||
mech: Callable[[bytes], bytes] = ...
|
||||
def __init__(self, mechinst: Callable[[bytes], bytes]) -> None: ...
|
||||
def process(self, data: str) -> str: ...
|
||||
def encode(self, inp: bytes) -> str: ...
|
||||
def decode(self, inp: str) -> bytes: ...
|
||||
|
||||
@@ -4,6 +4,6 @@ from typing import Dict, Match, Text
|
||||
|
||||
simple_escapes: Dict[Text, Text]
|
||||
|
||||
def escape(m: Match) -> Text: ...
|
||||
def escape(m: Match[str]) -> Text: ...
|
||||
def evalString(s: Text) -> Text: ...
|
||||
def test() -> None: ...
|
||||
|
||||
@@ -39,7 +39,7 @@ if sys.version_info >= (3,):
|
||||
_levelToName: Dict[int, str]
|
||||
_nameToLevel: Dict[str, int]
|
||||
else:
|
||||
_levelNames: dict
|
||||
_levelNames: Dict[Union[int, str], Union[str, int]] # Union[int:str, str:int]
|
||||
|
||||
class Filterer(object):
|
||||
filters: List[Filter]
|
||||
|
||||
@@ -198,19 +198,19 @@ class HTTPHandler(Handler):
|
||||
if sys.version_info >= (3,):
|
||||
class QueueHandler(Handler):
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(self, queue: Union[SimpleQueue, Queue]) -> None: ...
|
||||
def __init__(self, queue: Union[SimpleQueue[Any], Queue[Any]]) -> None: ...
|
||||
else:
|
||||
def __init__(self, queue: Queue) -> None: ...
|
||||
def __init__(self, queue: Queue[Any]) -> None: ...
|
||||
def prepare(self, record: LogRecord) -> Any: ...
|
||||
def enqueue(self, record: LogRecord) -> None: ...
|
||||
|
||||
class QueueListener:
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(self, queue: Union[SimpleQueue, Queue],
|
||||
def __init__(self, queue: Union[SimpleQueue[Any], Queue[Any]],
|
||||
*handlers: Handler,
|
||||
respect_handler_level: bool = ...) -> None: ...
|
||||
elif sys.version_info >= (3, 5):
|
||||
def __init__(self, queue: Queue, *handlers: Handler,
|
||||
def __init__(self, queue: Queue[Any], *handlers: Handler,
|
||||
respect_handler_level: bool = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self,
|
||||
|
||||
@@ -40,7 +40,7 @@ else:
|
||||
def floor(x: SupportsFloat) -> float: ...
|
||||
def fmod(x: SupportsFloat, y: SupportsFloat) -> float: ...
|
||||
def frexp(x: SupportsFloat) -> Tuple[float, int]: ...
|
||||
def fsum(iterable: Iterable) -> float: ...
|
||||
def fsum(iterable: Iterable[float]) -> float: ...
|
||||
def gamma(x: SupportsFloat) -> float: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
def gcd(a: int, b: int) -> int: ...
|
||||
|
||||
@@ -49,7 +49,7 @@ class _mmap(Generic[AnyStr]):
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
class mmap(_mmap, ContextManager[mmap], Iterable[bytes], Sized):
|
||||
class mmap(_mmap[bytes], ContextManager[mmap], Iterable[bytes], Sized):
|
||||
closed: bool
|
||||
def rfind(self, sub: bytes, start: int = ..., stop: int = ...) -> int: ...
|
||||
@overload
|
||||
@@ -65,7 +65,7 @@ if sys.version_info >= (3,):
|
||||
# __len__, so we claim that there is also an __iter__ to help type checkers.
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
else:
|
||||
class mmap(_mmap, Sequence[bytes]):
|
||||
class mmap(_mmap[bytes], Sequence[bytes]):
|
||||
def rfind(self, string: bytes, start: int = ..., stop: int = ...) -> int: ...
|
||||
def __getitem__(self, index: Union[int, slice]) -> bytes: ...
|
||||
def __getslice__(self, i: Optional[int], j: Optional[int]) -> bytes: ...
|
||||
|
||||
@@ -34,8 +34,8 @@ def is_(a: Any, b: Any) -> bool: ...
|
||||
|
||||
def is_not(a: Any, b: Any) -> bool: ...
|
||||
|
||||
def abs(x: SupportsAbs) -> Any: ...
|
||||
def __abs__(a: SupportsAbs) -> Any: ...
|
||||
def abs(x: SupportsAbs[_T]) -> _T: ...
|
||||
def __abs__(a: SupportsAbs[_T]) -> _T: ...
|
||||
|
||||
def add(a: Any, b: Any) -> Any: ...
|
||||
def __add__(a: Any, b: Any) -> Any: ...
|
||||
|
||||
@@ -92,12 +92,12 @@ class Option:
|
||||
ACTIONS: Tuple[_Text, ...]
|
||||
ALWAYS_TYPED_ACTIONS: Tuple[_Text, ...]
|
||||
ATTRS: List[_Text]
|
||||
CHECK_METHODS: Optional[List[Callable]]
|
||||
CHECK_METHODS: Optional[List[Callable[..., Any]]]
|
||||
CONST_ACTIONS: Tuple[_Text, ...]
|
||||
STORE_ACTIONS: Tuple[_Text, ...]
|
||||
TYPED_ACTIONS: Tuple[_Text, ...]
|
||||
TYPES: Tuple[_Text, ...]
|
||||
TYPE_CHECKER: Dict[_Text, Callable]
|
||||
TYPE_CHECKER: Dict[_Text, Callable[..., Any]]
|
||||
_long_opts: List[_Text]
|
||||
_short_opts: List[_Text]
|
||||
action: _Text
|
||||
@@ -196,13 +196,13 @@ class OptionParser(OptionContainer):
|
||||
def _add_version_option(self) -> None: ...
|
||||
def _create_option_list(self) -> None: ...
|
||||
def _get_all_options(self) -> List[Option]: ...
|
||||
def _get_args(self, args: Iterable) -> List[Any]: ...
|
||||
def _get_args(self, args: Iterable[Any]) -> List[Any]: ...
|
||||
def _init_parsing_state(self) -> None: ...
|
||||
def _match_long_opt(self, opt: _Text) -> _Text: ...
|
||||
def _populate_option_list(self, option_list: Iterable[Option], add_help: bool = ...) -> None: ...
|
||||
def _process_args(self, largs: List, rargs: List, values: Values) -> None: ...
|
||||
def _process_long_opt(self, rargs: List, values: Any) -> None: ...
|
||||
def _process_short_opts(self, rargs: List, values: Any) -> None: ...
|
||||
def _process_args(self, largs: List[Any], rargs: List[Any], values: Values) -> None: ...
|
||||
def _process_long_opt(self, rargs: List[Any], values: Any) -> None: ...
|
||||
def _process_short_opts(self, rargs: List[Any], values: Any) -> None: ...
|
||||
def add_option_group(self, *args, **kwargs) -> OptionParser: ...
|
||||
def check_values(self, values: Values, args: List[_Text]) -> Tuple[Values, List[_Text]]: ...
|
||||
def disable_interspersed_args(self) -> None: ...
|
||||
|
||||
@@ -26,11 +26,11 @@ class PicklingError(PickleError): ...
|
||||
class UnpicklingError(PickleError): ...
|
||||
|
||||
_reducedtype = Union[str,
|
||||
Tuple[Callable[..., Any], Tuple],
|
||||
Tuple[Callable[..., Any], Tuple, Any],
|
||||
Tuple[Callable[..., Any], Tuple, Any,
|
||||
Tuple[Callable[..., Any], Tuple[Any, ...]],
|
||||
Tuple[Callable[..., Any], Tuple[Any, ...], Any],
|
||||
Tuple[Callable[..., Any], Tuple[Any, ...], Any,
|
||||
Optional[Iterator]],
|
||||
Tuple[Callable[..., Any], Tuple, Any,
|
||||
Tuple[Callable[..., Any], Tuple[Any, ...], Any,
|
||||
Optional[Iterator], Optional[Iterator]]]
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ if sys.version_info < (3,):
|
||||
def writePlistToString(rootObject: Mapping[str, Any]) -> str: ...
|
||||
|
||||
if sys.version_info < (3, 7):
|
||||
class Dict(dict):
|
||||
class Dict(DictT[str, Any]):
|
||||
def __getattr__(self, attr: str) -> Any: ...
|
||||
def __setattr__(self, attr: str, value: Any) -> None: ...
|
||||
def __delattr__(self, attr: str) -> None: ...
|
||||
|
||||
@@ -81,7 +81,7 @@ class HTMLDoc(Doc):
|
||||
def modulelink(self, object: object) -> str: ...
|
||||
def modpkglink(self, data: Tuple[str, str, bool, bool]) -> str: ...
|
||||
def markup(self, text: str, escape: Optional[Callable[[str], str]] = ..., funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., methods: Mapping[str, str] = ...) -> str: ...
|
||||
def formattree(self, tree: List[Union[Tuple[type, Tuple[type, ...]], list]], modname: str, parent: Optional[type] = ...) -> str: ...
|
||||
def formattree(self, tree: List[Union[Tuple[type, Tuple[type, ...]], List[Any]]], modname: str, parent: Optional[type] = ...) -> str: ...
|
||||
def docmodule(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., *ignored) -> str: ...
|
||||
def docclass(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., *ignored) -> str: ...
|
||||
def formatvalue(self, object: object) -> str: ...
|
||||
@@ -108,7 +108,7 @@ class TextDoc(Doc):
|
||||
def bold(self, text: str) -> str: ...
|
||||
def indent(self, text: str, prefix: str = ...) -> str: ...
|
||||
def section(self, title: str, contents: str) -> str: ...
|
||||
def formattree(self, tree: List[Union[Tuple[type, Tuple[type, ...]], list]], modname: str, parent: Optional[type] = ..., prefix: str = ...) -> str: ...
|
||||
def formattree(self, tree: List[Union[Tuple[type, Tuple[type, ...]], List[Any]]], modname: str, parent: Optional[type] = ..., prefix: str = ...) -> str: ...
|
||||
def docmodule(self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., *ignored) -> str: ...
|
||||
def docclass(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., *ignored) -> str: ...
|
||||
def formatvalue(self, object: object) -> str: ...
|
||||
@@ -171,7 +171,7 @@ help: Helper
|
||||
|
||||
class ModuleScanner:
|
||||
quit: bool
|
||||
def run(self, callback: Callable[[Optional[str], str, str], None], key: Optional[Any] = ..., completer: Optional[Callable[[], None]] = ..., onerror: Optional[Callable] = ...) -> None: ...
|
||||
def run(self, callback: Callable[[Optional[str], str, str], None], key: Optional[Any] = ..., completer: Optional[Callable[[], None]] = ..., onerror: Optional[Callable[[str], None]] = ...) -> None: ...
|
||||
|
||||
def apropos(key: str) -> None: ...
|
||||
def serve(port: int, callback: Optional[Callable[[Any], None]] = ..., completer: Optional[Callable[[], None]] = ...) -> None: ...
|
||||
|
||||
@@ -73,15 +73,17 @@ else:
|
||||
def ignore_patterns(*patterns: _Path) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
_IgnoreFn = Union[None, Callable[[str, List[str]], Iterable[str]], Callable[[_Path, List[str]], Iterable[str]]]
|
||||
def copytree(src: _Path, dst: _Path, symlinks: bool = ...,
|
||||
ignore: _IgnoreFn = ...,
|
||||
ignore: Union[None,
|
||||
Callable[[str, List[str]], Iterable[str]],
|
||||
Callable[[_Path, List[str]], Iterable[str]]] = ...,
|
||||
copy_function: Callable[[str, str], None] = ...,
|
||||
ignore_dangling_symlinks: bool = ...) -> _PathReturn: ...
|
||||
else:
|
||||
_IgnoreFn = Union[None, Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]]]
|
||||
def copytree(src: AnyStr, dst: AnyStr, symlinks: bool = ...,
|
||||
ignore: _IgnoreFn = ...) -> _PathReturn: ...
|
||||
ignore: Union[None,
|
||||
Callable[[AnyStr, List[AnyStr]],
|
||||
Iterable[AnyStr]]] = ...) -> _PathReturn: ...
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
@overload
|
||||
|
||||
@@ -600,7 +600,7 @@ def gethostbyname(hostname: str) -> str: ...
|
||||
def gethostbyname_ex(hostname: str) -> Tuple[str, List[str], List[str]]: ...
|
||||
def gethostname() -> str: ...
|
||||
def gethostbyaddr(ip_address: str) -> Tuple[str, List[str], List[str]]: ...
|
||||
def getnameinfo(sockaddr: tuple, flags: int) -> Tuple[str, int]: ...
|
||||
def getnameinfo(sockaddr: Union[Tuple[str, int], Tuple[str, int, int, int]], flags: int) -> Tuple[str, int]: ...
|
||||
def getprotobyname(protocolname: str) -> int: ...
|
||||
def getservbyname(servicename: str, protocolname: str = ...) -> int: ...
|
||||
def getservbyport(port: int, protocolname: str = ...) -> str: ...
|
||||
|
||||
@@ -130,9 +130,9 @@ class Connection(object):
|
||||
def create_collation(self, name: str, callable: Any) -> None: ...
|
||||
def create_function(self, name: str, num_params: int, func: Any) -> None: ...
|
||||
def cursor(self, cursorClass: Optional[type] = ...) -> Cursor: ...
|
||||
def execute(self, sql: str, parameters: Iterable = ...) -> Cursor: ...
|
||||
def execute(self, sql: str, parameters: Iterable[Any] = ...) -> Cursor: ...
|
||||
# TODO: please check in executemany() if seq_of_parameters type is possible like this
|
||||
def executemany(self, sql: str, seq_of_parameters: Iterable[Iterable]) -> Cursor: ...
|
||||
def executemany(self, sql: str, seq_of_parameters: Iterable[Iterable[Any]]) -> Cursor: ...
|
||||
def executescript(self, sql_script: Union[bytes, Text]) -> Cursor: ...
|
||||
def interrupt(self, *args, **kwargs) -> None: ...
|
||||
def iterdump(self, *args, **kwargs) -> None: ...
|
||||
@@ -168,8 +168,8 @@ class Cursor(Iterator[Any]):
|
||||
# however, the name of the __init__ variable is unknown
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def close(self, *args, **kwargs) -> None: ...
|
||||
def execute(self, sql: str, parameters: Iterable = ...) -> Cursor: ...
|
||||
def executemany(self, sql: str, seq_of_parameters: Iterable[Iterable]) -> Cursor: ...
|
||||
def execute(self, sql: str, parameters: Iterable[Any] = ...) -> Cursor: ...
|
||||
def executemany(self, sql: str, seq_of_parameters: Iterable[Iterable[Any]]) -> Cursor: ...
|
||||
def executescript(self, sql_script: Union[bytes, Text]) -> Cursor: ...
|
||||
def fetchall(self) -> List[Any]: ...
|
||||
def fetchmany(self, size: Optional[int] = ...) -> List[Any]: ...
|
||||
|
||||
@@ -15,4 +15,4 @@ else:
|
||||
_IsStringType = bool
|
||||
|
||||
def isstring(obj: Any) -> _IsStringType: ...
|
||||
def compile(p: Union[str, bytes, SubPattern], flags: int = ...) -> Pattern: ...
|
||||
def compile(p: Union[str, bytes, SubPattern], flags: int = ...) -> Pattern[Any]: ...
|
||||
|
||||
@@ -53,14 +53,14 @@ class Thread:
|
||||
def __init__(self, group: None = ...,
|
||||
target: Optional[Callable[..., Any]] = ...,
|
||||
name: Optional[str] = ...,
|
||||
args: Iterable = ...,
|
||||
args: Iterable[Any] = ...,
|
||||
kwargs: Mapping[str, Any] = ...,
|
||||
*, daemon: Optional[bool] = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, group: None = ...,
|
||||
target: Optional[Callable[..., Any]] = ...,
|
||||
name: Optional[str] = ...,
|
||||
args: Iterable = ...,
|
||||
args: Iterable[Any] = ...,
|
||||
kwargs: Mapping[str, Any] = ...) -> None: ...
|
||||
def start(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
|
||||
@@ -94,7 +94,7 @@ if sys.version_info >= (3, 5):
|
||||
def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ...
|
||||
def format_exception_only(self) -> Generator[str, None, None]: ...
|
||||
|
||||
class FrameSummary(Iterable):
|
||||
class FrameSummary(Iterable[Any]):
|
||||
filename: str
|
||||
lineno: int
|
||||
name: str
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from typing import Pattern, Dict, Generator, Tuple, List, Union, TypeVar, Callable, Optional
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
xpath_tokenizer_re: Pattern
|
||||
xpath_tokenizer_re: Pattern[str]
|
||||
|
||||
_token = Tuple[str, str]
|
||||
_next = Callable[[], _token]
|
||||
|
||||
@@ -29,7 +29,7 @@ class ZipExtFile(io.BufferedIOBase):
|
||||
MIN_READ_SIZE: int = ...
|
||||
|
||||
if sys.version_info < (3, 6):
|
||||
PATTERN: Pattern = ...
|
||||
PATTERN: Pattern[str] = ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
MAX_SEEK_READ: int = ...
|
||||
|
||||
Reference in New Issue
Block a user