collections/typing: fix various arg names (#4258)

This feels nervous, but if it passes unit tests it's unlikely to break
anything
This commit is contained in:
Shantanu
2020-06-28 12:27:21 -07:00
committed by GitHub
parent 0dd3258ed2
commit fe58699ca5
4 changed files with 16 additions and 65 deletions

View File

@@ -302,15 +302,15 @@ class Sequence(_Collection[_T_co], Reversible[_T_co], Generic[_T_co]):
@abstractmethod
def __getitem__(self, s: slice) -> Sequence[_T_co]: ...
# Mixin methods
def index(self, x: Any, start: int = ..., end: int = ...) -> int: ...
def count(self, x: Any) -> int: ...
def index(self, value: Any, start: int = ..., stop: int = ...) -> int: ...
def count(self, value: Any) -> int: ...
def __contains__(self, x: object) -> bool: ...
def __iter__(self) -> Iterator[_T_co]: ...
def __reversed__(self) -> Iterator[_T_co]: ...
class MutableSequence(Sequence[_T], Generic[_T]):
@abstractmethod
def insert(self, index: int, object: _T) -> None: ...
def insert(self, index: int, value: _T) -> None: ...
@overload
@abstractmethod
def __getitem__(self, i: int) -> _T: ...
@@ -330,12 +330,12 @@ class MutableSequence(Sequence[_T], Generic[_T]):
@abstractmethod
def __delitem__(self, i: slice) -> None: ...
# Mixin methods
def append(self, object: _T) -> None: ...
def append(self, value: _T) -> None: ...
def clear(self) -> None: ...
def extend(self, iterable: Iterable[_T]) -> None: ...
def extend(self, values: Iterable[_T]) -> None: ...
def reverse(self) -> None: ...
def pop(self, index: int = ...) -> _T: ...
def remove(self, object: _T) -> None: ...
def remove(self, value: _T) -> None: ...
def __iadd__(self, x: Iterable[_T]) -> MutableSequence[_T]: ...
class AbstractSet(_Collection[_T_co], Generic[_T_co]):
@@ -350,17 +350,17 @@ class AbstractSet(_Collection[_T_co], Generic[_T_co]):
def __or__(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ...
def __sub__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ...
def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ...
def isdisjoint(self, s: Iterable[Any]) -> bool: ...
def isdisjoint(self, other: Iterable[Any]) -> bool: ...
class MutableSet(AbstractSet[_T], Generic[_T]):
@abstractmethod
def add(self, x: _T) -> None: ...
def add(self, value: _T) -> None: ...
@abstractmethod
def discard(self, x: _T) -> None: ...
def discard(self, value: _T) -> None: ...
# Mixin methods
def clear(self) -> None: ...
def pop(self) -> _T: ...
def remove(self, element: _T) -> None: ...
def remove(self, value: _T) -> None: ...
def __ior__(self, s: AbstractSet[_S]) -> MutableSet[Union[_T, _S]]: ...
def __iand__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ...
def __ixor__(self, s: AbstractSet[_S]) -> MutableSet[Union[_T, _S]]: ...
@@ -432,9 +432,9 @@ class Mapping(_Collection[_KT], Generic[_KT, _VT_co]):
...
# Mixin methods
@overload
def get(self, k: _KT) -> Optional[_VT_co]: ...
def get(self, key: _KT) -> Optional[_VT_co]: ...
@overload
def get(self, k: _KT, default: Union[_VT_co, _T]) -> Union[_VT_co, _T]: ...
def get(self, key: _KT, default: Union[_VT_co, _T]) -> Union[_VT_co, _T]: ...
def items(self) -> AbstractSet[Tuple[_KT, _VT_co]]: ...
def keys(self) -> AbstractSet[_KT]: ...
def values(self) -> ValuesView[_VT_co]: ...
@@ -448,11 +448,11 @@ class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]):
def clear(self) -> None: ...
@overload
def pop(self, k: _KT) -> _VT: ...
def pop(self, key: _KT) -> _VT: ...
@overload
def pop(self, k: _KT, default: Union[_VT, _T] = ...) -> Union[_VT, _T]: ...
def pop(self, key: _KT, default: Union[_VT, _T] = ...) -> Union[_VT, _T]: ...
def popitem(self) -> Tuple[_KT, _VT]: ...
def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...
def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ...
# 'update' used to take a Union, but using overloading is better.
# The second overloaded type here is a bit too general, because
# Mapping[Tuple[_KT, _VT], W] is a subclass of Iterable[Tuple[_KT, _VT]],

View File

@@ -48,7 +48,6 @@ smtpd.SMTPChannel.__init__
smtpd.SMTPServer.__init__
sre_compile.dis
ssl.SSLSocket.__init__
typing.AbstractSet.isdisjoint
typing.Coroutine.cr_await
typing.Coroutine.cr_code
typing.Coroutine.cr_frame
@@ -61,20 +60,10 @@ typing.Generator.gi_yieldfrom
typing.GenericMeta.__new__
typing.IO.closed # Incorrect definition in CPython, fixed in bpo-39493
typing.Mapping.get
typing.MutableMapping.pop
typing.MutableMapping.setdefault
typing.MutableSequence.append
typing.MutableSequence.extend
typing.MutableSequence.insert
typing.MutableSequence.remove
typing.MutableSet.add
typing.MutableSet.discard
typing.MutableSet.remove
typing.NamedTuple.__new__
typing.NamedTuple._asdict
typing.NamedTuple._make
typing.NamedTuple._replace
typing.Sequence.count
typing.Sequence.index
typing.runtime_checkable
unittest.async_case # Added in Python 3.8

View File

@@ -39,7 +39,6 @@ secrets.SystemRandom.getstate
smtplib.SMTP.sendmail
sre_compile.dis
ssl.SSLSocket.__init__
typing.AbstractSet.isdisjoint
typing.AsyncGenerator.ag_await
typing.AsyncGenerator.ag_code
typing.AsyncGenerator.ag_frame
@@ -56,20 +55,10 @@ typing.Generator.gi_yieldfrom
typing.GenericMeta.__new__
typing.IO.closed # Incorrect definition in CPython, fixed in bpo-39493
typing.Mapping.get
typing.MutableMapping.pop
typing.MutableMapping.setdefault
typing.MutableSequence.append
typing.MutableSequence.extend
typing.MutableSequence.insert
typing.MutableSequence.remove
typing.MutableSet.add
typing.MutableSet.discard
typing.MutableSet.remove
typing.NamedTuple.__new__
typing.NamedTuple._asdict
typing.NamedTuple._make
typing.NamedTuple._replace
typing.Sequence.count
typing.Sequence.index
typing.runtime_checkable
unittest.async_case # Added in Python 3.8

View File

@@ -32,8 +32,8 @@ asyncio.tasks.Task.print_stack
builtins.bytearray.__float__
builtins.bytearray.__int__
builtins.bytearray.append
builtins.bytearray.extend
builtins.bytearray.maketrans
builtins.bytearray.remove
builtins.bytes.__float__
builtins.bytes.__int__
builtins.bytes.maketrans
@@ -79,7 +79,6 @@ collections.Callable
collections.ChainMap.get
collections.ChainMap.maps
collections.ChainMap.new_child
collections.ChainMap.pop
collections.Coroutine.cr_await
collections.Coroutine.cr_code
collections.Coroutine.cr_frame
@@ -90,18 +89,7 @@ collections.Generator.gi_frame
collections.Generator.gi_running
collections.Generator.gi_yieldfrom
collections.Mapping.get
collections.MutableMapping.pop
collections.MutableMapping.setdefault
collections.MutableSequence.append
collections.MutableSequence.extend
collections.MutableSequence.insert
collections.MutableSequence.remove
collections.MutableSet.add
collections.MutableSet.discard
collections.MutableSet.remove
collections.Sequence.count
collections.Sequence.index
collections.Set.isdisjoint
collections.abc.Callable
collections.abc.Coroutine.cr_await
collections.abc.Coroutine.cr_code
@@ -112,18 +100,7 @@ collections.abc.Generator.gi_frame
collections.abc.Generator.gi_running
collections.abc.Generator.gi_yieldfrom
collections.abc.Mapping.get
collections.abc.MutableMapping.pop
collections.abc.MutableMapping.setdefault
collections.abc.MutableSequence.append
collections.abc.MutableSequence.extend
collections.abc.MutableSequence.insert
collections.abc.MutableSequence.remove
collections.abc.MutableSet.add
collections.abc.MutableSet.discard
collections.abc.MutableSet.remove
collections.abc.Sequence.count
collections.abc.Sequence.index
collections.abc.Set.isdisjoint
collections.deque.__hash__
concurrent.futures.Executor.map
concurrent.futures._base.Executor.map
@@ -443,12 +420,8 @@ weakref.ProxyType.__getattr__
weakref.ReferenceType.__call__
weakref.WeakKeyDictionary.__init__
weakref.WeakKeyDictionary.get
weakref.WeakKeyDictionary.pop
weakref.WeakKeyDictionary.setdefault
weakref.WeakKeyDictionary.update
weakref.WeakValueDictionary.get
weakref.WeakValueDictionary.pop
weakref.WeakValueDictionary.setdefault
webbrowser.Mozilla.raise_opts
webbrowser.UnixBrowser.raise_opts
webbrowser.UnixBrowser.remote_action