stdlib: add __slots__ (#14611)

This commit is contained in:
Jelle Zijlstra
2025-08-21 07:24:59 -07:00
committed by GitHub
parent 28abff1eb3
commit f32d9f08bd
38 changed files with 247 additions and 12 deletions
+6
View File
@@ -22,6 +22,7 @@ def ip_interface(
) -> IPv4Interface | IPv6Interface: ...
class _IPAddressBase:
__slots__ = ()
@property
def compressed(self) -> str: ...
@property
@@ -33,6 +34,7 @@ class _IPAddressBase:
def version(self) -> int: ...
class _BaseAddress(_IPAddressBase):
__slots__ = ()
def __add__(self, other: int) -> Self: ...
def __hash__(self) -> int: ...
def __int__(self) -> int: ...
@@ -105,6 +107,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]):
def hostmask(self) -> _A: ...
class _BaseV4:
__slots__ = ()
if sys.version_info >= (3, 14):
version: Final = 4
max_prefixlen: Final = 32
@@ -115,6 +118,7 @@ class _BaseV4:
def max_prefixlen(self) -> Literal[32]: ...
class IPv4Address(_BaseV4, _BaseAddress):
__slots__ = ("_ip", "__weakref__")
def __init__(self, address: object) -> None: ...
@property
def is_global(self) -> bool: ...
@@ -156,6 +160,7 @@ class IPv4Interface(IPv4Address):
def with_prefixlen(self) -> str: ...
class _BaseV6:
__slots__ = ()
if sys.version_info >= (3, 14):
version: Final = 6
max_prefixlen: Final = 128
@@ -166,6 +171,7 @@ class _BaseV6:
def max_prefixlen(self) -> Literal[128]: ...
class IPv6Address(_BaseV6, _BaseAddress):
__slots__ = ("_ip", "_scope_id", "__weakref__")
def __init__(self, address: object) -> None: ...
@property
def is_global(self) -> bool: ...