Add missing attributes of type (#2544)

All these attributes can be seen when using `dir(type)`.

In the future we should be discussing if certain methods on object (like
__eq__) should really be there. IMO this should be defined on type where it
actually also appears when using `dir`.
This commit is contained in:
Dave Halter
2018-12-21 05:01:40 +01:00
committed by Jelle Zijlstra
parent 9b5976e15b
commit 2cedbc7d63
3 changed files with 37 additions and 16 deletions

View File

@@ -66,9 +66,17 @@ class classmethod(object): # Special, only valid as a decorator.
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
class type(object):
__bases__ = ... # type: Tuple[type, ...]
__name__ = ... # type: str
__module__ = ... # type: str
__base__: type = ...
__bases__: Tuple[type, ...] = ...
__basicsize__: int = ...
__dict__: Dict[str, Any] = ...
__dictoffset__: int = ...
__flags__: int = ...
__itemsize__: int = ...
__module__: str = ...
__mro__: Tuple[type, ...] = ...
__name__: str = ...
__weakrefoffset__: int = ...
@overload
def __init__(self, o: object) -> None: ...
@@ -81,8 +89,6 @@ class type(object):
def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ...
def __call__(self, *args: Any, **kwds: Any) -> Any: ...
# Only new-style classes
__mro__ = ... # type: Tuple[type, ...]
# Note: the documentation doesnt specify what the return type is, the standard
# implementation seems to be returning a list.
def mro(self) -> List[type]: ...