Skip to content

make __class__ refer to the current object's class #1549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions stdlib/2/__builtin__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ from typing import (
SupportsRound, IO, BinaryIO, Union, AnyStr, MutableSequence, MutableMapping,
MutableSet, ItemsView, KeysView, ValuesView, Optional, Container, Type
)
from abc import abstractmethod, ABCMeta
from abc import ABCMeta
from mypy_extensions import NoReturn

_T = TypeVar('_T')
Expand All @@ -27,10 +27,13 @@ _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: ...
Expand Down
1 change: 0 additions & 1 deletion stdlib/2/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ class UnboundMethodType:

class InstanceType:
__doc__ = ... # type: Optional[str]
__class__ = ... # type: type
__module__ = ... # type: Any

MethodType = UnboundMethodType
Expand Down
5 changes: 4 additions & 1 deletion stdlib/3/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ _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: ...
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/unittest/mock.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ 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
Expand Down