Skip to content

Commit 93bb460

Browse files
z33kyJukkaL
authored andcommitted
Add special methods for object (#774)
* Add special methods for object * Add __format__ to 2/__builtin__.pyi too * Remove redundant __format__ from float.
1 parent 5f98dbb commit 93bb460

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

stdlib/2/__builtin__.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class object:
3939
def __str__(self) -> str: ...
4040
def __repr__(self) -> str: ...
4141
def __hash__(self) -> int: ...
42+
def __format__(self, format_spec: str) -> str: ...
43+
def __getattribute__(self, name: str) -> Any: ...
44+
def __delattr__(self, name: str) -> None: ...
4245

4346
class type:
4447
__bases__ = ... # type: Tuple[type, ...]
@@ -162,7 +165,6 @@ class float(SupportsFloat, SupportsInt, SupportsAbs[float]):
162165
def __float__(self) -> float: ...
163166
def __abs__(self) -> float: ...
164167
def __hash__(self) -> int: ...
165-
def __format__(self, format_spec: AnyStr) -> str: ...
166168

167169
class complex(SupportsAbs[float]):
168170
@overload

stdlib/3/builtins.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class object:
4242
def __str__(self) -> str: ...
4343
def __repr__(self) -> str: ...
4444
def __hash__(self) -> int: ...
45+
def __format__(self, format_spec: str) -> str: ...
46+
def __getattribute__(self, name: str) -> Any: ...
47+
def __delattr__(self, name: str) -> None: ...
4548

4649
class type:
4750
__bases__ = ... # type: Tuple[type, ...]
@@ -151,7 +154,6 @@ class float(SupportsFloat, SupportsInt, SupportsAbs[float]):
151154
def __float__(self) -> float: ...
152155
def __abs__(self) -> float: ...
153156
def __hash__(self) -> int: ...
154-
def __format__(self, format_spec: str) -> str: ...
155157

156158
class complex(SupportsAbs[float]):
157159
@overload
@@ -639,7 +641,6 @@ class enumerate(Iterator[Tuple[int, _T]], Generic[_T]):
639641
def __init__(self, iterable: Iterable[_T], start: int = 0) -> None: ...
640642
def __iter__(self) -> Iterator[Tuple[int, _T]]: ...
641643
def __next__(self) -> Tuple[int, _T]: ...
642-
# TODO __getattribute__
643644

644645
class range(Sequence[int]):
645646
@overload

0 commit comments

Comments
 (0)