From faf827bc363bf130aeb6ab60cd8ecdb4e1f2432b Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Thu, 22 Oct 2020 04:31:23 -0700 Subject: [PATCH] mark some positional-only arguments (#4693) https://github.com/python/mypy/pull/9626 will make stubtest a little bit stricter about positional-only arguments for dunders like __init__ Co-authored-by: hauntsaninja <> --- stdlib/2and3/weakref.pyi | 2 +- stdlib/3.7/_py_abc.pyi | 2 +- stdlib/3/collections/__init__.pyi | 2 +- stdlib/3/functools.pyi | 4 ++-- stdlib/3/unittest/mock.pyi | 2 +- third_party/2and3/mock.pyi | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/stdlib/2and3/weakref.pyi b/stdlib/2and3/weakref.pyi index cc9491640..9dc723388 100644 --- a/stdlib/2and3/weakref.pyi +++ b/stdlib/2and3/weakref.pyi @@ -111,7 +111,7 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): if sys.version_info >= (3, 4): class finalize: - def __init__(self, obj: _S, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ... + def __init__(self, __obj: _S, __func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ... def __call__(self, _: Any = ...) -> Optional[_T]: ... def detach(self) -> Optional[Tuple[_S, _T, Tuple[Any, ...], Dict[str, Any]]]: ... def peek(self) -> Optional[Tuple[_S, _T, Tuple[Any, ...], Dict[str, Any]]]: ... diff --git a/stdlib/3.7/_py_abc.pyi b/stdlib/3.7/_py_abc.pyi index c8fd1f918..9b0812d67 100644 --- a/stdlib/3.7/_py_abc.pyi +++ b/stdlib/3.7/_py_abc.pyi @@ -6,5 +6,5 @@ _T = TypeVar("_T") def get_cache_token() -> object: ... class ABCMeta(type): - def __new__(cls, __name: str, __bases: Tuple[Type[Any], ...], __namespace: Dict[str, Any]) -> ABCMeta: ... + def __new__(__mcls, __name: str, __bases: Tuple[Type[Any], ...], __namespace: Dict[str, Any]) -> ABCMeta: ... def register(cls, subclass: Type[_T]) -> Type[_T]: ... diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index e16b0efba..c3183de27 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -74,7 +74,7 @@ else: class UserDict(MutableMapping[_KT, _VT]): data: Dict[_KT, _VT] - def __init__(self, dict: Optional[Mapping[_KT, _VT]] = ..., **kwargs: _VT) -> None: ... + def __init__(self, __dict: Optional[Mapping[_KT, _VT]] = ..., **kwargs: _VT) -> None: ... def __len__(self) -> int: ... def __getitem__(self, key: _KT) -> _VT: ... def __setitem__(self, key: _KT, item: _VT) -> None: ... diff --git a/stdlib/3/functools.pyi b/stdlib/3/functools.pyi index cd1c1d130..c44dcf7f8 100644 --- a/stdlib/3/functools.pyi +++ b/stdlib/3/functools.pyi @@ -77,9 +77,9 @@ class partialmethod(Generic[_T]): args: Tuple[Any, ...] keywords: Dict[str, Any] @overload - def __init__(self, func: Callable[..., _T], *args: Any, **keywords: Any) -> None: ... + def __init__(self, __func: Callable[..., _T], *args: Any, **keywords: Any) -> None: ... @overload - def __init__(self, func: _Descriptor, *args: Any, **keywords: Any) -> None: ... + def __init__(self, __func: _Descriptor, *args: Any, **keywords: Any) -> None: ... def __get__(self, obj: Any, cls: Type[Any]) -> Callable[..., _T]: ... @property def __isabstractmethod__(self) -> bool: ... diff --git a/stdlib/3/unittest/mock.pyi b/stdlib/3/unittest/mock.pyi index 0acbb6875..cdaec7d97 100644 --- a/stdlib/3/unittest/mock.pyi +++ b/stdlib/3/unittest/mock.pyi @@ -73,7 +73,7 @@ class Base: def __init__(self, *args: Any, **kwargs: Any) -> None: ... class NonCallableMock(Base, Any): # type: ignore - def __new__(cls, *args: Any, **kw: Any) -> NonCallableMock: ... + def __new__(__cls, *args: Any, **kw: Any) -> NonCallableMock: ... def __init__( self, spec: Union[List[str], object, Type[object], None] = ..., diff --git a/third_party/2and3/mock.pyi b/third_party/2and3/mock.pyi index 0acbb6875..cdaec7d97 100644 --- a/third_party/2and3/mock.pyi +++ b/third_party/2and3/mock.pyi @@ -73,7 +73,7 @@ class Base: def __init__(self, *args: Any, **kwargs: Any) -> None: ... class NonCallableMock(Base, Any): # type: ignore - def __new__(cls, *args: Any, **kw: Any) -> NonCallableMock: ... + def __new__(__cls, *args: Any, **kw: Any) -> NonCallableMock: ... def __init__( self, spec: Union[List[str], object, Type[object], None] = ...,