Skip to content

Commit b336182

Browse files
author
Guido van Rossum
authored
Fix some errors with --disallow-any-generics (#3276)
See #3267. Covers all of stdlib/2and3.
1 parent 1e881ad commit b336182

27 files changed

+85
-92
lines changed

stdlib/2/__builtin__.pyi

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,30 +53,30 @@ class object:
5353
def __getattribute__(self, name: str) -> Any: ...
5454
def __delattr__(self, name: str) -> None: ...
5555
def __sizeof__(self) -> int: ...
56-
def __reduce__(self) -> tuple: ...
57-
def __reduce_ex__(self, protocol: int) -> tuple: ...
56+
def __reduce__(self) -> Tuple[Any, ...]: ...
57+
def __reduce_ex__(self, protocol: int) -> Tuple[Any, ...]: ...
5858
if sys.version_info >= (3,):
5959
def __dir__(self) -> Iterable[str]: ...
6060
if sys.version_info >= (3, 6):
6161
def __init_subclass__(cls) -> None: ...
6262

6363
class staticmethod(object): # Special, only valid as a decorator.
64-
__func__: Callable
64+
__func__: Callable[..., Any]
6565
if sys.version_info >= (3,):
6666
__isabstractmethod__: bool
6767

68-
def __init__(self, f: Callable) -> None: ...
68+
def __init__(self, f: Callable[..., Any]) -> None: ...
6969
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
70-
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
70+
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
7171

7272
class classmethod(object): # Special, only valid as a decorator.
73-
__func__: Callable
73+
__func__: Callable[..., Any]
7474
if sys.version_info >= (3,):
7575
__isabstractmethod__: bool
7676

77-
def __init__(self, f: Callable) -> None: ...
77+
def __init__(self, f: Callable[..., Any]) -> None: ...
7878
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
79-
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
79+
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
8080

8181
class type(object):
8282
__base__: type
@@ -1130,7 +1130,7 @@ if sys.version_info >= (3, 6):
11301130
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
11311131
class _PathLike(Generic[AnyStr]):
11321132
def __fspath__(self) -> AnyStr: ...
1133-
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
1133+
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike[Any]], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
11341134
elif sys.version_info >= (3,):
11351135
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
11361136
else:
@@ -1187,8 +1187,8 @@ else:
11871187
def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
11881188
@overload
11891189
def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ...
1190-
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
1191-
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
1190+
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
1191+
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
11921192
def len(__o: Sized) -> int: ...
11931193
if sys.version_info >= (3,):
11941194
def license() -> None: ...
@@ -1324,7 +1324,7 @@ def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
13241324
def oct(__i: Union[int, _SupportsIndex]) -> str: ...
13251325

13261326
if sys.version_info >= (3, 6):
1327-
def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
1327+
def open(file: Union[str, bytes, int, _PathLike[Any]], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
13281328
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...,
13291329
opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ...
13301330
elif sys.version_info >= (3,):

stdlib/2and3/_weakrefset.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from typing import Iterator, Any, Iterable, MutableSet, Optional, TypeVar, Gener
22

33
_S = TypeVar('_S')
44
_T = TypeVar('_T')
5-
_SelfT = TypeVar('_SelfT', bound=WeakSet)
5+
_SelfT = TypeVar('_SelfT', bound=WeakSet[Any])
66

77
class WeakSet(MutableSet[_T], Generic[_T]):
88
def __init__(self, data: Optional[Iterable[_T]] = ...) -> None: ...

stdlib/2and3/asyncore.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class dispatcher:
5050
def readable(self) -> bool: ...
5151
def writable(self) -> bool: ...
5252
def listen(self, backlog: int) -> None: ...
53-
def bind(self, address: Union[tuple, str]) -> None: ...
54-
def connect(self, address: Union[tuple, str]) -> None: ...
53+
def bind(self, address: Union[Tuple[Any, ...], str]) -> None: ...
54+
def connect(self, address: Union[Tuple[Any, ...], str]) -> None: ...
5555
def accept(self) -> Optional[Tuple[SocketType, Any]]: ...
5656
def send(self, data: bytes) -> int: ...
5757
def recv(self, buffer_size: int) -> bytes: ...
@@ -103,7 +103,7 @@ class dispatcher:
103103
def recvfrom_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ...
104104
def recv_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ...
105105
def sendall(self, data: bytes, flags: int = ...) -> None: ...
106-
def sendto(self, data: bytes, address: Union[tuple, str], flags: int = ...) -> int: ...
106+
def sendto(self, data: bytes, address: Union[Tuple[str, int], str], flags: int = ...) -> int: ...
107107
def setblocking(self, flag: bool) -> None: ...
108108
def settimeout(self, value: Union[float, None]) -> None: ...
109109
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...

stdlib/2and3/bisect.pyi

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,10 @@ from typing import Any, Sequence, MutableSequence, TypeVar
44

55
_T = TypeVar('_T')
66

7-
# TODO uncomment when mypy# 2035 is fixed
8-
# def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
9-
# def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
10-
# def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
11-
#
12-
# def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
13-
# def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
14-
# def insort(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
7+
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
8+
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
9+
def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
1510

16-
def bisect_left(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
17-
def bisect_right(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
18-
def bisect(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
19-
20-
def insort_left(a: MutableSequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
21-
def insort_right(a: MutableSequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
22-
def insort(a: MutableSequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
11+
def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
12+
def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
13+
def insort(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...

stdlib/2and3/builtins.pyi

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,30 +53,30 @@ class object:
5353
def __getattribute__(self, name: str) -> Any: ...
5454
def __delattr__(self, name: str) -> None: ...
5555
def __sizeof__(self) -> int: ...
56-
def __reduce__(self) -> tuple: ...
57-
def __reduce_ex__(self, protocol: int) -> tuple: ...
56+
def __reduce__(self) -> Tuple[Any, ...]: ...
57+
def __reduce_ex__(self, protocol: int) -> Tuple[Any, ...]: ...
5858
if sys.version_info >= (3,):
5959
def __dir__(self) -> Iterable[str]: ...
6060
if sys.version_info >= (3, 6):
6161
def __init_subclass__(cls) -> None: ...
6262

6363
class staticmethod(object): # Special, only valid as a decorator.
64-
__func__: Callable
64+
__func__: Callable[..., Any]
6565
if sys.version_info >= (3,):
6666
__isabstractmethod__: bool
6767

68-
def __init__(self, f: Callable) -> None: ...
68+
def __init__(self, f: Callable[..., Any]) -> None: ...
6969
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
70-
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
70+
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
7171

7272
class classmethod(object): # Special, only valid as a decorator.
73-
__func__: Callable
73+
__func__: Callable[..., Any]
7474
if sys.version_info >= (3,):
7575
__isabstractmethod__: bool
7676

77-
def __init__(self, f: Callable) -> None: ...
77+
def __init__(self, f: Callable[..., Any]) -> None: ...
7878
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
79-
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
79+
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
8080

8181
class type(object):
8282
__base__: type
@@ -1130,7 +1130,7 @@ if sys.version_info >= (3, 6):
11301130
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
11311131
class _PathLike(Generic[AnyStr]):
11321132
def __fspath__(self) -> AnyStr: ...
1133-
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
1133+
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike[Any]], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
11341134
elif sys.version_info >= (3,):
11351135
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
11361136
else:
@@ -1187,8 +1187,8 @@ else:
11871187
def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
11881188
@overload
11891189
def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ...
1190-
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
1191-
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
1190+
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
1191+
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
11921192
def len(__o: Sized) -> int: ...
11931193
if sys.version_info >= (3,):
11941194
def license() -> None: ...
@@ -1324,7 +1324,7 @@ def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
13241324
def oct(__i: Union[int, _SupportsIndex]) -> str: ...
13251325

13261326
if sys.version_info >= (3, 6):
1327-
def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
1327+
def open(file: Union[str, bytes, int, _PathLike[Any]], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
13281328
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...,
13291329
opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ...
13301330
elif sys.version_info >= (3,):

stdlib/2and3/cgi.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class FieldStorage(object):
101101
if sys.version_info < (3, 0):
102102
from UserDict import UserDict
103103

104-
class FormContentDict(UserDict):
104+
class FormContentDict(UserDict[str, List[str]]):
105105
query_string: str
106106
def __init__(self, environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ...
107107

stdlib/2and3/contextlib.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ _F = TypeVar('_F', bound=Callable[..., Any])
2323
_ExitFunc = Callable[[Optional[Type[BaseException]],
2424
Optional[BaseException],
2525
Optional[TracebackType]], bool]
26-
_CM_EF = TypeVar('_CM_EF', ContextManager, _ExitFunc)
26+
_CM_EF = TypeVar('_CM_EF', ContextManager[Any], _ExitFunc)
2727

2828
if sys.version_info >= (3, 2):
2929
class _GeneratorContextManager(ContextManager[_T], Generic[_T]):
@@ -85,7 +85,7 @@ if sys.version_info >= (3, 7):
8585
Optional[BaseException],
8686
Optional[TracebackType]], Awaitable[bool]]
8787
_CallbackCoroFunc = Callable[..., Awaitable[Any]]
88-
_ACM_EF = TypeVar('_ACM_EF', AsyncContextManager, _ExitCoroFunc)
88+
_ACM_EF = TypeVar('_ACM_EF', AsyncContextManager[Any], _ExitCoroFunc)
8989

9090
class AsyncExitStack(AsyncContextManager[AsyncExitStack]):
9191
def __init__(self) -> None: ...

stdlib/2and3/formatter.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ class AbstractWriter(NullWriter):
9292
def send_literal_data(self, data: str) -> None: ...
9393

9494
class DumbWriter(NullWriter):
95-
file: IO
95+
file: IO[str]
9696
maxcol: int
97-
def __init__(self, file: Optional[IO] = ..., maxcol: int = ...) -> None: ...
97+
def __init__(self, file: Optional[IO[str]] = ..., maxcol: int = ...) -> None: ...
9898
def reset(self) -> None: ...
9999
def send_paragraph(self, blankline: int) -> None: ...
100100
def send_line_break(self) -> None: ...

stdlib/2and3/imaplib.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class IMAP4:
4444
def recent(self) -> CommandResults: ...
4545
def response(self, code: str) -> CommandResults: ...
4646
def append(self, mailbox: str, flags: str, date_time: str, message: str) -> str: ...
47-
def authenticate(self, mechanism: str, authobject: Callable) -> Tuple[str, str]: ...
47+
def authenticate(self, mechanism: str, authobject: Callable[[bytes], Optional[bytes]]) -> Tuple[str, str]: ...
4848
def capability(self) -> CommandResults: ...
4949
def check(self) -> CommandResults: ...
5050
def close(self) -> CommandResults: ...
@@ -111,7 +111,7 @@ class IMAP4_stream(IMAP4):
111111
port: int = ...
112112
sock: _socket = ...
113113
file: IO[Any] = ...
114-
process: subprocess.Popen = ...
114+
process: subprocess.Popen[bytes] = ...
115115
writefile: IO[Any] = ...
116116
readfile: IO[Any] = ...
117117
def open(self, host: str = ..., port: Optional[int] = ...) -> None: ...
@@ -121,8 +121,8 @@ class IMAP4_stream(IMAP4):
121121
def shutdown(self) -> None: ...
122122

123123
class _Authenticator:
124-
mech: Callable = ...
125-
def __init__(self, mechinst: Callable) -> None: ...
124+
mech: Callable[[bytes], bytes] = ...
125+
def __init__(self, mechinst: Callable[[bytes], bytes]) -> None: ...
126126
def process(self, data: str) -> str: ...
127127
def encode(self, inp: bytes) -> str: ...
128128
def decode(self, inp: str) -> bytes: ...

stdlib/2and3/lib2to3/pgen2/literals.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ from typing import Dict, Match, Text
44

55
simple_escapes: Dict[Text, Text]
66

7-
def escape(m: Match) -> Text: ...
7+
def escape(m: Match[str]) -> Text: ...
88
def evalString(s: Text) -> Text: ...
99
def test() -> None: ...

stdlib/2and3/logging/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if sys.version_info >= (3,):
3939
_levelToName: Dict[int, str]
4040
_nameToLevel: Dict[str, int]
4141
else:
42-
_levelNames: dict
42+
_levelNames: Dict[Union[int, str], Union[str, int]] # Union[int:str, str:int]
4343

4444
class Filterer(object):
4545
filters: List[Filter]

stdlib/2and3/logging/handlers.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,19 +198,19 @@ class HTTPHandler(Handler):
198198
if sys.version_info >= (3,):
199199
class QueueHandler(Handler):
200200
if sys.version_info >= (3, 7):
201-
def __init__(self, queue: Union[SimpleQueue, Queue]) -> None: ...
201+
def __init__(self, queue: Union[SimpleQueue[Any], Queue[Any]]) -> None: ...
202202
else:
203-
def __init__(self, queue: Queue) -> None: ...
203+
def __init__(self, queue: Queue[Any]) -> None: ...
204204
def prepare(self, record: LogRecord) -> Any: ...
205205
def enqueue(self, record: LogRecord) -> None: ...
206206

207207
class QueueListener:
208208
if sys.version_info >= (3, 7):
209-
def __init__(self, queue: Union[SimpleQueue, Queue],
209+
def __init__(self, queue: Union[SimpleQueue[Any], Queue[Any]],
210210
*handlers: Handler,
211211
respect_handler_level: bool = ...) -> None: ...
212212
elif sys.version_info >= (3, 5):
213-
def __init__(self, queue: Queue, *handlers: Handler,
213+
def __init__(self, queue: Queue[Any], *handlers: Handler,
214214
respect_handler_level: bool = ...) -> None: ...
215215
else:
216216
def __init__(self,

stdlib/2and3/math.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ else:
4040
def floor(x: SupportsFloat) -> float: ...
4141
def fmod(x: SupportsFloat, y: SupportsFloat) -> float: ...
4242
def frexp(x: SupportsFloat) -> Tuple[float, int]: ...
43-
def fsum(iterable: Iterable) -> float: ...
43+
def fsum(iterable: Iterable[float]) -> float: ...
4444
def gamma(x: SupportsFloat) -> float: ...
4545
if sys.version_info >= (3, 5):
4646
def gcd(a: int, b: int) -> int: ...

stdlib/2and3/mmap.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class _mmap(Generic[AnyStr]):
4949
def __len__(self) -> int: ...
5050

5151
if sys.version_info >= (3,):
52-
class mmap(_mmap, ContextManager[mmap], Iterable[bytes], Sized):
52+
class mmap(_mmap[bytes], ContextManager[mmap], Iterable[bytes], Sized):
5353
closed: bool
5454
def rfind(self, sub: bytes, start: int = ..., stop: int = ...) -> int: ...
5555
@overload
@@ -65,7 +65,7 @@ if sys.version_info >= (3,):
6565
# __len__, so we claim that there is also an __iter__ to help type checkers.
6666
def __iter__(self) -> Iterator[bytes]: ...
6767
else:
68-
class mmap(_mmap, Sequence[bytes]):
68+
class mmap(_mmap[bytes], Sequence[bytes]):
6969
def rfind(self, string: bytes, start: int = ..., stop: int = ...) -> int: ...
7070
def __getitem__(self, index: Union[int, slice]) -> bytes: ...
7171
def __getslice__(self, i: Optional[int], j: Optional[int]) -> bytes: ...

stdlib/2and3/operator.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def is_(a: Any, b: Any) -> bool: ...
3434

3535
def is_not(a: Any, b: Any) -> bool: ...
3636

37-
def abs(x: SupportsAbs) -> Any: ...
38-
def __abs__(a: SupportsAbs) -> Any: ...
37+
def abs(x: SupportsAbs[_T]) -> _T: ...
38+
def __abs__(a: SupportsAbs[_T]) -> _T: ...
3939

4040
def add(a: Any, b: Any) -> Any: ...
4141
def __add__(a: Any, b: Any) -> Any: ...

stdlib/2and3/optparse.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ class Option:
9292
ACTIONS: Tuple[_Text, ...]
9393
ALWAYS_TYPED_ACTIONS: Tuple[_Text, ...]
9494
ATTRS: List[_Text]
95-
CHECK_METHODS: Optional[List[Callable]]
95+
CHECK_METHODS: Optional[List[Callable[..., Any]]]
9696
CONST_ACTIONS: Tuple[_Text, ...]
9797
STORE_ACTIONS: Tuple[_Text, ...]
9898
TYPED_ACTIONS: Tuple[_Text, ...]
9999
TYPES: Tuple[_Text, ...]
100-
TYPE_CHECKER: Dict[_Text, Callable]
100+
TYPE_CHECKER: Dict[_Text, Callable[..., Any]]
101101
_long_opts: List[_Text]
102102
_short_opts: List[_Text]
103103
action: _Text
@@ -196,13 +196,13 @@ class OptionParser(OptionContainer):
196196
def _add_version_option(self) -> None: ...
197197
def _create_option_list(self) -> None: ...
198198
def _get_all_options(self) -> List[Option]: ...
199-
def _get_args(self, args: Iterable) -> List[Any]: ...
199+
def _get_args(self, args: Iterable[Any]) -> List[Any]: ...
200200
def _init_parsing_state(self) -> None: ...
201201
def _match_long_opt(self, opt: _Text) -> _Text: ...
202202
def _populate_option_list(self, option_list: Iterable[Option], add_help: bool = ...) -> None: ...
203-
def _process_args(self, largs: List, rargs: List, values: Values) -> None: ...
204-
def _process_long_opt(self, rargs: List, values: Any) -> None: ...
205-
def _process_short_opts(self, rargs: List, values: Any) -> None: ...
203+
def _process_args(self, largs: List[Any], rargs: List[Any], values: Values) -> None: ...
204+
def _process_long_opt(self, rargs: List[Any], values: Any) -> None: ...
205+
def _process_short_opts(self, rargs: List[Any], values: Any) -> None: ...
206206
def add_option_group(self, *args, **kwargs) -> OptionParser: ...
207207
def check_values(self, values: Values, args: List[_Text]) -> Tuple[Values, List[_Text]]: ...
208208
def disable_interspersed_args(self) -> None: ...

stdlib/2and3/pickle.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ class PicklingError(PickleError): ...
2626
class UnpicklingError(PickleError): ...
2727

2828
_reducedtype = Union[str,
29-
Tuple[Callable[..., Any], Tuple],
30-
Tuple[Callable[..., Any], Tuple, Any],
31-
Tuple[Callable[..., Any], Tuple, Any,
29+
Tuple[Callable[..., Any], Tuple[Any, ...]],
30+
Tuple[Callable[..., Any], Tuple[Any, ...], Any],
31+
Tuple[Callable[..., Any], Tuple[Any, ...], Any,
3232
Optional[Iterator]],
33-
Tuple[Callable[..., Any], Tuple, Any,
33+
Tuple[Callable[..., Any], Tuple[Any, ...], Any,
3434
Optional[Iterator], Optional[Iterator]]]
3535

3636

stdlib/2and3/plistlib.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ if sys.version_info < (3,):
4747
def writePlistToString(rootObject: Mapping[str, Any]) -> str: ...
4848

4949
if sys.version_info < (3, 7):
50-
class Dict(dict):
50+
class Dict(DictT[str, Any]):
5151
def __getattr__(self, attr: str) -> Any: ...
5252
def __setattr__(self, attr: str, value: Any) -> None: ...
5353
def __delattr__(self, attr: str) -> None: ...

0 commit comments

Comments
 (0)