From 026f374daec15af5dafe409002e265358694cdea Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 29 Sep 2017 11:28:26 -0700 Subject: [PATCH] Revert "make __class__ refer to the current object's class (#1549)" This reverts commit 1a164b630cbb27511ce0da7f2f08e62589858862. --- stdlib/2/__builtin__.pyi | 7 ++----- stdlib/2/types.pyi | 1 + stdlib/3/builtins.pyi | 5 +---- stdlib/3/unittest/mock.pyi | 1 + 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 3d9a6d450a22..b781292ec2b6 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -10,7 +10,7 @@ from typing import ( SupportsRound, IO, BinaryIO, Union, AnyStr, MutableSequence, MutableMapping, MutableSet, ItemsView, KeysView, ValuesView, Optional, Container, Type ) -from abc import ABCMeta +from abc import abstractmethod, ABCMeta from mypy_extensions import NoReturn _T = TypeVar('_T') @@ -27,13 +27,10 @@ _TT = TypeVar('_TT', bound='type') class object: __doc__ = ... # type: Optional[str] + __class__ = ... # type: type __slots__ = ... # type: Optional[Union[str, unicode, Iterable[Union[str, unicode]]]] __module__ = ... # type: str - @property - def __class__(self: _T) -> Type[_T]: ... - @__class__.setter - def __class__(self, __type: Type[object]) -> None: ... def __init__(self) -> None: ... def __new__(cls) -> Any: ... def __setattr__(self, name: str, value: Any) -> None: ... diff --git a/stdlib/2/types.pyi b/stdlib/2/types.pyi index 43de3ee57f63..87380b32478d 100644 --- a/stdlib/2/types.pyi +++ b/stdlib/2/types.pyi @@ -90,6 +90,7 @@ class UnboundMethodType: class InstanceType: __doc__ = ... # type: Optional[str] + __class__ = ... # type: type __module__ = ... # type: Any MethodType = UnboundMethodType diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index 4ebabe359360..8d0dfb88319c 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -29,16 +29,13 @@ _TT = TypeVar('_TT', bound='type') class object: __doc__ = ... # type: Optional[str] + __class__ = ... # type: type __dict__ = ... # type: Dict[str, Any] __slots__ = ... # type: Optional[Union[str, Iterable[str]]] __module__ = ... # type: str if sys.version_info >= (3, 6): __annotations__ = ... # type: Dict[str, Any] - @property - def __class__(self: _T) -> Type[_T]: ... - @__class__.setter - def __class__(self, __type: Type[object]) -> None: ... def __init__(self) -> None: ... def __new__(cls) -> Any: ... def __setattr__(self, name: str, value: Any) -> None: ... diff --git a/stdlib/3/unittest/mock.pyi b/stdlib/3/unittest/mock.pyi index 078869f4d1fb..2002f89338d0 100644 --- a/stdlib/3/unittest/mock.pyi +++ b/stdlib/3/unittest/mock.pyi @@ -42,6 +42,7 @@ if sys.version_info >= (3, 3): def attach_mock(self, mock: Any, attribute: Any) -> Any: ... def mock_add_spec(self, spec: Any, spec_set: Any = False) -> Any: ... return_value = ... # type: Any + __class__ = ... # type: type called = ... # type: Any call_count = ... # type: Any call_args = ... # type: Any