Fix stub for the ipaddress module (#1384)

* Fix stub for the ipaddress module

All methods that accept an "address" work on arbitrary objects. They
call str() on them and attempt to parse the result. As such, the type
of "address" should be object.
This commit is contained in:
mpage
2017-06-02 12:49:12 -07:00
committed by Łukasz Langa
parent 66765c1fdb
commit dca968102e

View File

@@ -1,6 +1,4 @@
from typing import Any, Iterator, Optional, SupportsInt, Tuple, TypeVar, Union
_address = Union[bytes, int, str]
from typing import Any, Iterable, Iterator, Optional, SupportsInt, Tuple, TypeVar, Union
IPV4LENGTH = ... # type: int
IPV6LENGTH = ... # type: int
@@ -84,7 +82,7 @@ class _BaseV4:
def version(self): ...
class IPv4Address(_BaseV4, _BaseAddress):
def __init__(self, address: _address) -> None: ...
def __init__(self, address: object) -> None: ...
@property
def packed(self) -> bytes: ...
@property
@@ -104,7 +102,7 @@ class IPv4Interface(IPv4Address):
network = ... # type: IPv4Network
netmask = ... # type: IPv4Address
hostmask = ... # type: IPv4Address
def __init__(self, address: _address) -> None: ...
def __init__(self, address: object) -> None: ...
def __eq__(self, other: Any) -> bool: ...
def __lt__(self, other: Any) -> bool: ...
def __hash__(self) -> int: ...
@@ -121,7 +119,7 @@ class IPv4Network(_BaseV4, _BaseNetwork):
network_address = ... # type: IPv4Address
netmask = ... # type: IPv4Address
hosts = ... # type: Iterator[IPv4Address]
def __init__(self, address: _address, strict: bool = ...) -> None: ...
def __init__(self, address: object, strict: bool = ...) -> None: ...
@property
def is_global(self) -> bool: ...
@@ -133,7 +131,7 @@ class _BaseV6:
def version(self): ...
class IPv6Address(_BaseV6, _BaseAddress):
def __init__(self, address: _address) -> None: ...
def __init__(self, address: object) -> None: ...
@property
def packed(self) -> bytes: ...
@property
@@ -163,7 +161,7 @@ class IPv6Interface(IPv6Address):
network = ... # type: IPv6Network
netmask = ... # type: IPv6Address
hostmask = ... # type: IPv6Address
def __init__(self, address: _address) -> None: ...
def __init__(self, address: object) -> None: ...
def __eq__(self, other: Any) -> bool: ...
def __lt__(self, other: Any) -> bool: ...
def __hash__(self) -> int: ...
@@ -183,7 +181,7 @@ class IPv6Interface(IPv6Address):
class IPv6Network(_BaseV6, _BaseNetwork):
network_address = ... # type: IPv6Address
netmask = ... # type: IPv6Address
def __init__(self, address: _address, strict: bool = ...) -> None: ...
def __init__(self, address: object, strict: bool = ...) -> None: ...
def hosts(self) -> Iterator[IPv6Address]: ...
@property
def is_site_local(self) -> bool: ...
@@ -193,11 +191,11 @@ _ip_network = Union[IPv4Network, IPv6Network]
_ip_interface = Union[IPv4Interface, IPv6Interface]
_AnyIPAddress = TypeVar("_AnyIPAddress", IPv4Address, IPv6Address)
def ip_address(address: _address) -> _ip_address: ...
def ip_network(address: _address, strict: bool = ...) -> _ip_network: ...
def ip_interface(address: _address) -> _ip_interface: ...
def ip_address(address: object) -> _ip_address: ...
def ip_network(address: object, strict: bool = ...) -> _ip_network: ...
def ip_interface(address: object) -> _ip_interface: ...
def v4_int_to_packed(address: int) -> bytes: ...
def v6_int_to_packed(address: int) -> bytes: ...
def summarize_address_range(first: _AnyIPAddress, _AnyIPAddress) -> Iterator[_AnyIPAddress]: ...
def collapse_addresses(addresses: Iterator[_AnyIPAddress]) -> Iterator[_AnyIPAddress]: ...
def collapse_addresses(addresses: Iterable[_AnyIPAddress]) -> Iterator[_AnyIPAddress]: ...
def get_mixed_type_key(obj): ...