Add methods for subnet_of and supernet_of (#3851)

This commit is contained in:
Debjyoti Biswas
2020-03-17 14:36:49 +05:30
committed by GitHub
parent 1b13e94108
commit c0938525d8
2 changed files with 10 additions and 0 deletions

View File

@@ -1,6 +1,8 @@
from typing import (Any, Container, Generic, Iterable, Iterator, Optional,
overload, SupportsInt, Text, Tuple, TypeVar)
import sys
# Undocumented length constants
IPV4LENGTH: int
IPV6LENGTH: int
@@ -87,6 +89,9 @@ class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]):
def overlaps(self: _T, other: _T) -> bool: ...
@property
def prefixlen(self) -> int: ...
if sys.version_info >= (3, 7):
def subnet_of(self: _T, other: _T) -> bool: ...
def supernet_of(self: _T, other: _T) -> bool: ...
def subnets(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> Iterator[_T]: ...
def supernet(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> _T: ...
@property