Stubtest fixes (#5249)

This commit is contained in:
hatal175
2021-04-26 07:56:54 +03:00
committed by GitHub
parent 761bd6e6b4
commit d151d1b8bb
3 changed files with 23 additions and 40 deletions

View File

@@ -7,7 +7,7 @@ _FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
class ABCMeta(type):
def register(cls: ABCMeta, subclass: Type[_T]) -> Type[_T]: ...
def abstractmethod(callable: _FuncT) -> _FuncT: ...
def abstractmethod(funcobj: _FuncT) -> _FuncT: ...
class abstractproperty(property): ...

View File

@@ -1,5 +1,5 @@
import sys
from typing import Any, Dict, Generic, List, Optional, Tuple, Type, TypeVar, Union, overload
from typing import Any, Dict, Generic, List, NoReturn, Optional, Tuple, Type, TypeVar, Union, overload
if sys.version_info >= (3, 10):
from typing import (
@@ -190,7 +190,6 @@ class deque(MutableSequence[_T], Generic[_T]):
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __hash__(self) -> int: ...
# These methods of deque don't really take slices, but we need to
# define them as taking a slice to satisfy MutableSequence.
@overload
@@ -222,6 +221,8 @@ class Counter(Dict[_T, int], Generic[_T]):
def copy(self: _S) -> _S: ...
def elements(self) -> Iterator[_T]: ...
def most_common(self, n: Optional[int] = ...) -> List[Tuple[_T, int]]: ...
@classmethod
def fromkeys(cls, iterable: Any, v: Optional[int] = ...) -> NoReturn: ... # type: ignore
@overload
def subtract(self, __iterable: None = ...) -> None: ...
@overload
@@ -291,10 +292,9 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
def copy(self: _S) -> _S: ...
class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
maps: List[Mapping[_KT, _VT]]
def __init__(self, *maps: Mapping[_KT, _VT]) -> None: ...
@property
def maps(self) -> List[Mapping[_KT, _VT]]: ...
def new_child(self, m: Mapping[_KT, _VT] = ...) -> ChainMap[_KT, _VT]: ...
def new_child(self, m: Optional[Mapping[_KT, _VT]] = ...) -> ChainMap[_KT, _VT]: ...
@property
def parents(self) -> ChainMap[_KT, _VT]: ...
def __setitem__(self, k: _KT, v: _VT) -> None: ...

View File

@@ -1,4 +1,5 @@
_collections_abc.Callable
_collections_abc.Callable # Some typecheckers need this as specialform
# Coroutine and Generator properties are added programmatically
_collections_abc.Coroutine.cr_await
_collections_abc.Coroutine.cr_code
_collections_abc.Coroutine.cr_frame
@@ -7,31 +8,19 @@ _collections_abc.Generator.gi_code
_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_abc.Mapping.get # Adding None to the Union messed up mypy
_collections_abc.Sequence.index # Supporting None in end is not mandatory
_csv.Dialect.__init__ # C __init__ signature is inaccurate
_dummy_threading
_importlib_modulespec
_threading_local.local.__new__
_typeshed.* # Utility types for typeshed, doesn't exist at runtime
_weakref.CallableProxyType.__getattr__
_weakref.ProxyType.__getattr__
_weakref.ReferenceType.__call__
abc.ABCMeta.__new__
abc.abstractclassmethod
abc.abstractmethod
abc.abstractstaticmethod
abc.ABCMeta.__new__ # pytype wants the parameter named cls and not mcls
_weakref.CallableProxyType.__getattr__ # Should have all attributes of proxy
_weakref.ProxyType.__getattr__ # Should have all attributes of proxy
_weakref.ReferenceType.__call__ # C function default annotation is wrong
argparse.Namespace.__getattr__ # The whole point of this class is its attributes are dynamic
asyncio.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them
# Condition functions are exported in __init__
@@ -69,23 +58,20 @@ codecs.CodecInfo.incrementaldecoder
codecs.CodecInfo.incrementalencoder
codecs.CodecInfo.streamreader
codecs.CodecInfo.streamwriter
collections.Callable
collections.ChainMap.get
collections.ChainMap.maps
collections.ChainMap.new_child
collections.Callable # Some typecheckers need this as specialform
# Coroutine and Generator properties are added programmatically
collections.ChainMap.get # Adding None to the underlying Mapping Union messed up mypy
collections.Coroutine.cr_await
collections.Coroutine.cr_code
collections.Coroutine.cr_frame
collections.Coroutine.cr_running
collections.Counter.fromkeys
collections.Generator.gi_code
collections.Generator.gi_frame
collections.Generator.gi_running
collections.Generator.gi_yieldfrom
collections.Mapping.get
collections.Sequence.index
collections.Set.isdisjoint
collections.abc.Callable
collections.Mapping.get # Adding None to the Union messed up mypy
collections.Sequence.index # Supporting None in end is not mandatory
# Coroutine and Generator properties are added programmatically
collections.abc.Coroutine.cr_await
collections.abc.Coroutine.cr_code
collections.abc.Coroutine.cr_frame
@@ -94,9 +80,6 @@ collections.abc.Generator.gi_code
collections.abc.Generator.gi_frame
collections.abc.Generator.gi_running
collections.abc.Generator.gi_yieldfrom
collections.abc.Mapping.get
collections.abc.Sequence.index
collections.deque.__hash__
configparser.SectionProxy.__getattr__ # SectionProxy can have arbitrary attributes when custom converters are used
# SectionProxy get functions are set in __init__
configparser.SectionProxy.getboolean
@@ -254,9 +237,9 @@ urllib.request.BaseHandler.http_error_nnn
urllib.request.HTTPPasswordMgrWithPriorAuth.__init__
urllib.robotparser.RobotFileParser.can_fetch
warnings.catch_warnings.__init__ # Defining this ruins the __new__ overrides
weakref.CallableProxyType.__getattr__
weakref.ProxyType.__getattr__
weakref.ReferenceType.__call__
weakref.CallableProxyType.__getattr__ # Should have all attributes of proxy
weakref.ProxyType.__getattr__ # Should have all attributes of proxy
weakref.ReferenceType.__call__ # C function default annotation is wrong
weakref.WeakKeyDictionary.get
weakref.WeakKeyDictionary.update
weakref.WeakValueDictionary.get