Add __slots__ to third-party packages using stubdefaulter (#14619)

This commit is contained in:
Jelle Zijlstra
2025-08-21 15:38:13 -07:00
committed by GitHub
parent 573b57d8da
commit ca44e4c45d
135 changed files with 675 additions and 25 deletions
+4
View File
@@ -8,11 +8,13 @@ from netaddr.strategy.eui48 import mac_eui48
from netaddr.strategy.eui64 import eui64_base
class BaseIdentifier:
__slots__ = ("_value", "__weakref__")
def __init__(self) -> None: ...
def __int__(self) -> int: ...
def __index__(self) -> int: ...
class OUI(BaseIdentifier):
__slots__ = ("records",)
records: list[dict[str, object]]
def __init__(self, oui: str | int) -> None: ...
def __eq__(self, other: object) -> bool: ...
@@ -22,6 +24,7 @@ class OUI(BaseIdentifier):
def registration(self, index: int = 0) -> DictDotLookup: ...
class IAB(BaseIdentifier):
__slots__ = ("record",)
IAB_EUI_VALUES: ClassVar[tuple[int, int]]
@classmethod
def split_iab_mac(cls, eui_int: int, strict: bool = False) -> tuple[int, int]: ...
@@ -32,6 +35,7 @@ class IAB(BaseIdentifier):
def registration(self) -> DictDotLookup: ...
class EUI(BaseIdentifier):
__slots__ = ("_module", "_dialect")
def __init__(
self, addr: EUI | int | str, version: int | None = None, dialect: type[mac_eui48 | eui64_base] | None = None
) -> None: ...
+5
View File
@@ -8,6 +8,7 @@ from netaddr.core import DictDotLookup
from netaddr.strategy.ipv6 import ipv6_verbose
class BaseIP:
__slots__ = ("_value", "_module", "__weakref__")
def __init__(self) -> None: ...
@property
def value(self) -> int | None: ...
@@ -40,6 +41,7 @@ _IPAddressAddr: TypeAlias = BaseIP | int | str
_IPNetworkAddr: TypeAlias = IPNetwork | IPAddress | tuple[int, int] | str
class IPAddress(BaseIP):
__slots__ = ()
def __init__(self, addr: _IPAddressAddr, version: Literal[4, 6] | None = None, flags: int = 0) -> None: ...
def netmask_bits(self) -> int: ...
def is_hostmask(self) -> bool: ...
@@ -79,6 +81,7 @@ class IPAddress(BaseIP):
def is_ipv6_unique_local(self) -> bool: ...
class IPListMixin:
__slots__ = ()
def __iter__(self) -> Iterator[IPAddress]: ...
@property
def size(self) -> int: ...
@@ -95,6 +98,7 @@ class IPListMixin:
def parse_ip_network(module, addr: tuple[int, int] | str, flags: int = 0, *, expand_partial: bool = False) -> tuple[int, int]: ...
class IPNetwork(BaseIP, IPListMixin):
__slots__ = ("_prefixlen",)
def __init__(
self, addr: _IPNetworkAddr, version: Literal[4, 6] | None = None, flags: int = 0, *, expand_partial: bool = False
) -> None: ...
@@ -135,6 +139,7 @@ class IPNetwork(BaseIP, IPListMixin):
def iter_hosts(self) -> Iterator[IPAddress]: ...
class IPRange(BaseIP, IPListMixin):
__slots__ = ("_start", "_end")
def __init__(self, start: _IPAddressAddr, end: _IPAddressAddr, flags: int = 0) -> None: ...
def __contains__(self, other: BaseIP | _IPAddressAddr) -> bool: ...
@property
+1
View File
@@ -10,6 +10,7 @@ def glob_to_cidrs(ipglob: str) -> list[IPNetwork]: ...
def cidr_to_glob(cidr: _IPNetworkAddr) -> str: ...
class IPGlob(IPRange):
__slots__ = ("_glob",)
def __init__(self, ipglob: str) -> None: ...
@property
def glob(self) -> str: ...
+1
View File
@@ -7,6 +7,7 @@ from netaddr.ip import IPAddress, IPNetwork, IPRange, _IPNetworkAddr
_IPIterable: TypeAlias = IPNetwork | IPRange | IPSet | Iterable[_IPNetworkAddr | IPRange | int]
class IPSet:
__slots__ = ("_cidrs", "__weakref__")
def __init__(self, iterable: _IPIterable | None = None, flags: int = 0) -> None: ...
def compact(self) -> None: ...
def __hash__(self) -> NoReturn: ...