mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Add __complex__ to complex (#2004)
* Add __complex__ to complex complex SupportsComplex! * Allow constructing complex from SupportsComplex
This commit is contained in:
@@ -4,8 +4,8 @@ from typing import (
|
||||
TypeVar, Iterator, Iterable, overload, Container,
|
||||
Sequence, MutableSequence, Mapping, MutableMapping, NoReturn, Tuple, List, Any, Dict, Callable, Generic,
|
||||
Set, AbstractSet, FrozenSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat,
|
||||
SupportsBytes, SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView, ValuesView,
|
||||
ByteString, Optional, AnyStr, Type,
|
||||
SupportsComplex, SupportsBytes, SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView,
|
||||
ValuesView, ByteString, Optional, AnyStr, Type,
|
||||
)
|
||||
from abc import abstractmethod, ABCMeta
|
||||
from types import TracebackType, CodeType
|
||||
@@ -204,6 +204,8 @@ class complex:
|
||||
def __init__(self, re: float = ..., im: float = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, s: str) -> None: ...
|
||||
@overload
|
||||
def __init__(self, s: SupportsComplex) -> None: ...
|
||||
|
||||
@property
|
||||
def real(self) -> float: ...
|
||||
@@ -229,6 +231,7 @@ class complex:
|
||||
def __pos__(self) -> complex: ...
|
||||
|
||||
def __str__(self) -> str: ...
|
||||
def __complex__(self) -> complex: ...
|
||||
def __abs__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user