massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 3.3 / ipaddress.pyi
1 import sys\r
2 from typing import (Any, Container, Generic, Iterable, Iterator, Optional,\r
3                     overload, SupportsInt, Tuple, TypeVar, Union)\r
4 \r
5 # Undocumented length constants\r
6 IPV4LENGTH: int\r
7 IPV6LENGTH: int\r
8 \r
9 _A = TypeVar("_A", IPv4Address, IPv6Address)\r
10 _N = TypeVar("_N", IPv4Network, IPv6Network)\r
11 _T = TypeVar("_T")\r
12 \r
13 def ip_address(address: object) -> Union[IPv4Address, IPv6Address]: ...\r
14 def ip_network(address: object, strict: bool = ...) -> Union[IPv4Network, IPv6Network]: ...\r
15 def ip_interface(address: object) -> Union[IPv4Interface, IPv6Interface]: ...\r
16 \r
17 class _IPAddressBase:\r
18     def __eq__(self, other: Any) -> bool: ...\r
19     def __ge__(self: _T, other: _T) -> bool: ...\r
20     def __gt__(self: _T, other: _T) -> bool: ...\r
21     def __le__(self: _T, other: _T) -> bool: ...\r
22     def __lt__(self: _T, other: _T) -> bool: ...\r
23     def __ne__(self, other: Any) -> bool: ...\r
24     @property\r
25     def compressed(self) -> str: ...\r
26     @property\r
27     def exploded(self) -> str: ...\r
28     if sys.version_info >= (3, 5):\r
29         @property\r
30         def reverse_pointer(self) -> str: ...\r
31     @property\r
32     def version(self) -> int: ...\r
33 \r
34 class _BaseAddress(_IPAddressBase, SupportsInt):\r
35     def __init__(self, address: object) -> None: ...\r
36     def __add__(self: _T, other: int) -> _T: ...\r
37     def __hash__(self) -> int: ...\r
38     def __int__(self) -> int: ...\r
39     def __sub__(self: _T, other: int) -> _T: ...\r
40     if sys.version_info >= (3, 4):\r
41         @property\r
42         def is_global(self) -> bool: ...\r
43     @property\r
44     def is_link_local(self) -> bool: ...\r
45     @property\r
46     def is_loopback(self) -> bool: ...\r
47     @property\r
48     def is_multicast(self) -> bool: ...\r
49     @property\r
50     def is_private(self) -> bool: ...\r
51     @property\r
52     def is_reserved(self) -> bool: ...\r
53     @property\r
54     def is_unspecified(self) -> bool: ...\r
55     @property\r
56     def max_prefixlen(self) -> int: ...\r
57     @property\r
58     def packed(self) -> bytes: ...\r
59 \r
60 class _BaseNetwork(_IPAddressBase, Container, Iterable[_A], Generic[_A]):\r
61     network_address: _A\r
62     netmask: _A\r
63     def __init__(self, address: object, strict: bool = ...) -> None: ...\r
64     def __contains__(self, other: Any) -> bool: ...\r
65     def __getitem__(self, n: int) -> _A: ...\r
66     def __iter__(self) -> Iterator[_A]: ...\r
67     def address_exclude(self: _T, other: _T) -> Iterator[_T]: ...\r
68     @property\r
69     def broadcast_address(self) -> _A: ...\r
70     def compare_networks(self: _T, other: _T) -> int: ...\r
71     def hosts(self) -> Iterator[_A]: ...\r
72     @property\r
73     def is_global(self) -> bool: ...\r
74     @property\r
75     def is_link_local(self) -> bool: ...\r
76     @property\r
77     def is_loopback(self) -> bool: ...\r
78     @property\r
79     def is_multicast(self) -> bool: ...\r
80     @property\r
81     def is_private(self) -> bool: ...\r
82     @property\r
83     def is_reserved(self) -> bool: ...\r
84     @property\r
85     def is_unspecified(self) -> bool: ...\r
86     @property\r
87     def max_prefixlen(self) -> int: ...\r
88     @property\r
89     def num_addresses(self) -> int: ...\r
90     def overlaps(self: _T, other: _T) -> bool: ...\r
91     @property\r
92     def prefixlen(self) -> int: ...\r
93     def subnets(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> Iterator[_T]: ...\r
94     def supernet(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> _T: ...\r
95     @property\r
96     def with_hostmask(self) -> str: ...\r
97     @property\r
98     def with_netmask(self) -> str: ...\r
99     @property\r
100     def with_prefixlen(self) -> str: ...\r
101 \r
102 class _BaseInterface(_BaseAddress, Generic[_A, _N]):\r
103     hostmask: _A\r
104     netmask: _A\r
105     network: _N\r
106     @property\r
107     def ip(self) -> _A: ...\r
108     @property\r
109     def with_hostmask(self) -> str: ...\r
110     @property\r
111     def with_netmask(self) -> str: ...\r
112     @property\r
113     def with_prefixlen(self) -> str: ...\r
114 \r
115 class IPv4Address(_BaseAddress): ...\r
116 class IPv4Network(_BaseNetwork[IPv4Address]): ...\r
117 class IPv4Interface(IPv4Address, _BaseInterface[IPv4Address, IPv4Network]): ...\r
118 \r
119 class IPv6Address(_BaseAddress):\r
120     @property\r
121     def ipv4_mapped(self) -> Optional[IPv4Address]: ...\r
122     @property\r
123     def is_site_local(self) -> bool: ...\r
124     @property\r
125     def sixtofour(self) -> Optional[IPv4Address]: ...\r
126     @property\r
127     def teredo(self) -> Optional[Tuple[IPv4Address, IPv4Address]]: ...\r
128 \r
129 class IPv6Network(_BaseNetwork[IPv6Address]):\r
130     @property\r
131     def is_site_local(self) -> bool: ...\r
132 \r
133 class IPv6Interface(IPv6Address, _BaseInterface[IPv6Address, IPv6Network]): ...\r
134 \r
135 def v4_int_to_packed(address: int) -> bytes: ...\r
136 def v6_int_to_packed(address: int) -> bytes: ...\r
137 @overload\r
138 def summarize_address_range(first: IPv4Address, last: IPv4Address) -> Iterator[IPv4Network]: ...\r
139 @overload\r
140 def summarize_address_range(first: IPv6Address, last: IPv6Address) -> Iterator[IPv6Network]: ...\r
141 def collapse_addresses(addresses: Iterable[_N]) -> Iterator[_N]: ...\r
142 @overload\r
143 def get_mixed_type_key(obj: _A) -> Tuple[int, _A]: ...\r
144 @overload\r
145 def get_mixed_type_key(obj: IPv4Network) -> Tuple[int, IPv4Address, IPv4Address]: ...\r
146 @overload\r
147 def get_mixed_type_key(obj: IPv6Network) -> Tuple[int, IPv6Address, IPv6Address]: ...\r
148 \r
149 class AddressValueError(ValueError): ...\r
150 class NetmaskValueError(ValueError): ...\r