Skip to content

Commit fe58699

Browse files
authored
collections/typing: fix various arg names (#4258)
This feels nervous, but if it passes unit tests it's unlikely to break anything
1 parent 0dd3258 commit fe58699

File tree

4 files changed

+16
-65
lines changed

4 files changed

+16
-65
lines changed

Diff for: stdlib/3/typing.pyi

+15-15
Original file line numberDiff line numberDiff line change
@@ -302,15 +302,15 @@ class Sequence(_Collection[_T_co], Reversible[_T_co], Generic[_T_co]):
302302
@abstractmethod
303303
def __getitem__(self, s: slice) -> Sequence[_T_co]: ...
304304
# Mixin methods
305-
def index(self, x: Any, start: int = ..., end: int = ...) -> int: ...
306-
def count(self, x: Any) -> int: ...
305+
def index(self, value: Any, start: int = ..., stop: int = ...) -> int: ...
306+
def count(self, value: Any) -> int: ...
307307
def __contains__(self, x: object) -> bool: ...
308308
def __iter__(self) -> Iterator[_T_co]: ...
309309
def __reversed__(self) -> Iterator[_T_co]: ...
310310

311311
class MutableSequence(Sequence[_T], Generic[_T]):
312312
@abstractmethod
313-
def insert(self, index: int, object: _T) -> None: ...
313+
def insert(self, index: int, value: _T) -> None: ...
314314
@overload
315315
@abstractmethod
316316
def __getitem__(self, i: int) -> _T: ...
@@ -330,12 +330,12 @@ class MutableSequence(Sequence[_T], Generic[_T]):
330330
@abstractmethod
331331
def __delitem__(self, i: slice) -> None: ...
332332
# Mixin methods
333-
def append(self, object: _T) -> None: ...
333+
def append(self, value: _T) -> None: ...
334334
def clear(self) -> None: ...
335-
def extend(self, iterable: Iterable[_T]) -> None: ...
335+
def extend(self, values: Iterable[_T]) -> None: ...
336336
def reverse(self) -> None: ...
337337
def pop(self, index: int = ...) -> _T: ...
338-
def remove(self, object: _T) -> None: ...
338+
def remove(self, value: _T) -> None: ...
339339
def __iadd__(self, x: Iterable[_T]) -> MutableSequence[_T]: ...
340340

341341
class AbstractSet(_Collection[_T_co], Generic[_T_co]):
@@ -350,17 +350,17 @@ class AbstractSet(_Collection[_T_co], Generic[_T_co]):
350350
def __or__(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ...
351351
def __sub__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ...
352352
def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ...
353-
def isdisjoint(self, s: Iterable[Any]) -> bool: ...
353+
def isdisjoint(self, other: Iterable[Any]) -> bool: ...
354354

355355
class MutableSet(AbstractSet[_T], Generic[_T]):
356356
@abstractmethod
357-
def add(self, x: _T) -> None: ...
357+
def add(self, value: _T) -> None: ...
358358
@abstractmethod
359-
def discard(self, x: _T) -> None: ...
359+
def discard(self, value: _T) -> None: ...
360360
# Mixin methods
361361
def clear(self) -> None: ...
362362
def pop(self) -> _T: ...
363-
def remove(self, element: _T) -> None: ...
363+
def remove(self, value: _T) -> None: ...
364364
def __ior__(self, s: AbstractSet[_S]) -> MutableSet[Union[_T, _S]]: ...
365365
def __iand__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ...
366366
def __ixor__(self, s: AbstractSet[_S]) -> MutableSet[Union[_T, _S]]: ...
@@ -432,9 +432,9 @@ class Mapping(_Collection[_KT], Generic[_KT, _VT_co]):
432432
...
433433
# Mixin methods
434434
@overload
435-
def get(self, k: _KT) -> Optional[_VT_co]: ...
435+
def get(self, key: _KT) -> Optional[_VT_co]: ...
436436
@overload
437-
def get(self, k: _KT, default: Union[_VT_co, _T]) -> Union[_VT_co, _T]: ...
437+
def get(self, key: _KT, default: Union[_VT_co, _T]) -> Union[_VT_co, _T]: ...
438438
def items(self) -> AbstractSet[Tuple[_KT, _VT_co]]: ...
439439
def keys(self) -> AbstractSet[_KT]: ...
440440
def values(self) -> ValuesView[_VT_co]: ...
@@ -448,11 +448,11 @@ class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]):
448448

449449
def clear(self) -> None: ...
450450
@overload
451-
def pop(self, k: _KT) -> _VT: ...
451+
def pop(self, key: _KT) -> _VT: ...
452452
@overload
453-
def pop(self, k: _KT, default: Union[_VT, _T] = ...) -> Union[_VT, _T]: ...
453+
def pop(self, key: _KT, default: Union[_VT, _T] = ...) -> Union[_VT, _T]: ...
454454
def popitem(self) -> Tuple[_KT, _VT]: ...
455-
def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...
455+
def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ...
456456
# 'update' used to take a Union, but using overloading is better.
457457
# The second overloaded type here is a bit too general, because
458458
# Mapping[Tuple[_KT, _VT], W] is a subclass of Iterable[Tuple[_KT, _VT]],

Diff for: tests/stubtest_whitelists/py35.txt

-11
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ smtpd.SMTPChannel.__init__
4848
smtpd.SMTPServer.__init__
4949
sre_compile.dis
5050
ssl.SSLSocket.__init__
51-
typing.AbstractSet.isdisjoint
5251
typing.Coroutine.cr_await
5352
typing.Coroutine.cr_code
5453
typing.Coroutine.cr_frame
@@ -61,20 +60,10 @@ typing.Generator.gi_yieldfrom
6160
typing.GenericMeta.__new__
6261
typing.IO.closed # Incorrect definition in CPython, fixed in bpo-39493
6362
typing.Mapping.get
64-
typing.MutableMapping.pop
65-
typing.MutableMapping.setdefault
66-
typing.MutableSequence.append
67-
typing.MutableSequence.extend
68-
typing.MutableSequence.insert
69-
typing.MutableSequence.remove
70-
typing.MutableSet.add
71-
typing.MutableSet.discard
72-
typing.MutableSet.remove
7363
typing.NamedTuple.__new__
7464
typing.NamedTuple._asdict
7565
typing.NamedTuple._make
7666
typing.NamedTuple._replace
77-
typing.Sequence.count
7867
typing.Sequence.index
7968
typing.runtime_checkable
8069
unittest.async_case # Added in Python 3.8

Diff for: tests/stubtest_whitelists/py36.txt

-11
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ secrets.SystemRandom.getstate
3939
smtplib.SMTP.sendmail
4040
sre_compile.dis
4141
ssl.SSLSocket.__init__
42-
typing.AbstractSet.isdisjoint
4342
typing.AsyncGenerator.ag_await
4443
typing.AsyncGenerator.ag_code
4544
typing.AsyncGenerator.ag_frame
@@ -56,20 +55,10 @@ typing.Generator.gi_yieldfrom
5655
typing.GenericMeta.__new__
5756
typing.IO.closed # Incorrect definition in CPython, fixed in bpo-39493
5857
typing.Mapping.get
59-
typing.MutableMapping.pop
60-
typing.MutableMapping.setdefault
61-
typing.MutableSequence.append
62-
typing.MutableSequence.extend
63-
typing.MutableSequence.insert
64-
typing.MutableSequence.remove
65-
typing.MutableSet.add
66-
typing.MutableSet.discard
67-
typing.MutableSet.remove
6858
typing.NamedTuple.__new__
6959
typing.NamedTuple._asdict
7060
typing.NamedTuple._make
7161
typing.NamedTuple._replace
72-
typing.Sequence.count
7362
typing.Sequence.index
7463
typing.runtime_checkable
7564
unittest.async_case # Added in Python 3.8

Diff for: tests/stubtest_whitelists/py3_common.txt

+1-28
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ asyncio.tasks.Task.print_stack
3232
builtins.bytearray.__float__
3333
builtins.bytearray.__int__
3434
builtins.bytearray.append
35+
builtins.bytearray.extend
3536
builtins.bytearray.maketrans
36-
builtins.bytearray.remove
3737
builtins.bytes.__float__
3838
builtins.bytes.__int__
3939
builtins.bytes.maketrans
@@ -79,7 +79,6 @@ collections.Callable
7979
collections.ChainMap.get
8080
collections.ChainMap.maps
8181
collections.ChainMap.new_child
82-
collections.ChainMap.pop
8382
collections.Coroutine.cr_await
8483
collections.Coroutine.cr_code
8584
collections.Coroutine.cr_frame
@@ -90,18 +89,7 @@ collections.Generator.gi_frame
9089
collections.Generator.gi_running
9190
collections.Generator.gi_yieldfrom
9291
collections.Mapping.get
93-
collections.MutableMapping.pop
94-
collections.MutableMapping.setdefault
95-
collections.MutableSequence.append
96-
collections.MutableSequence.extend
97-
collections.MutableSequence.insert
98-
collections.MutableSequence.remove
99-
collections.MutableSet.add
100-
collections.MutableSet.discard
101-
collections.MutableSet.remove
102-
collections.Sequence.count
10392
collections.Sequence.index
104-
collections.Set.isdisjoint
10593
collections.abc.Callable
10694
collections.abc.Coroutine.cr_await
10795
collections.abc.Coroutine.cr_code
@@ -112,18 +100,7 @@ collections.abc.Generator.gi_frame
112100
collections.abc.Generator.gi_running
113101
collections.abc.Generator.gi_yieldfrom
114102
collections.abc.Mapping.get
115-
collections.abc.MutableMapping.pop
116-
collections.abc.MutableMapping.setdefault
117-
collections.abc.MutableSequence.append
118-
collections.abc.MutableSequence.extend
119-
collections.abc.MutableSequence.insert
120-
collections.abc.MutableSequence.remove
121-
collections.abc.MutableSet.add
122-
collections.abc.MutableSet.discard
123-
collections.abc.MutableSet.remove
124-
collections.abc.Sequence.count
125103
collections.abc.Sequence.index
126-
collections.abc.Set.isdisjoint
127104
collections.deque.__hash__
128105
concurrent.futures.Executor.map
129106
concurrent.futures._base.Executor.map
@@ -443,12 +420,8 @@ weakref.ProxyType.__getattr__
443420
weakref.ReferenceType.__call__
444421
weakref.WeakKeyDictionary.__init__
445422
weakref.WeakKeyDictionary.get
446-
weakref.WeakKeyDictionary.pop
447-
weakref.WeakKeyDictionary.setdefault
448423
weakref.WeakKeyDictionary.update
449424
weakref.WeakValueDictionary.get
450-
weakref.WeakValueDictionary.pop
451-
weakref.WeakValueDictionary.setdefault
452425
webbrowser.Mozilla.raise_opts
453426
webbrowser.UnixBrowser.raise_opts
454427
webbrowser.UnixBrowser.remote_action

0 commit comments

Comments
 (0)