mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-07 10:20:58 +08:00
Use typing_extensions.Self in the stdlib (#9694)
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from collections.abc import Container, Iterable, Iterator
|
||||
from typing import Any, Generic, SupportsInt, TypeVar, overload
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
from typing_extensions import Literal, Self, TypeAlias
|
||||
|
||||
# Undocumented length constants
|
||||
IPV4LENGTH: Literal[32]
|
||||
@@ -34,20 +33,20 @@ class _IPAddressBase:
|
||||
|
||||
class _BaseAddress(_IPAddressBase, SupportsInt):
|
||||
def __init__(self, address: object) -> None: ...
|
||||
def __add__(self: Self, other: int) -> Self: ...
|
||||
def __add__(self, other: int) -> Self: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __sub__(self: Self, other: int) -> Self: ...
|
||||
def __sub__(self, other: int) -> Self: ...
|
||||
def __format__(self, fmt: str) -> str: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __lt__(self: Self, other: Self) -> bool: ...
|
||||
def __lt__(self, other: Self) -> bool: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __ge__(self: Self, other: Self) -> bool: ...
|
||||
def __gt__(self: Self, other: Self) -> bool: ...
|
||||
def __le__(self: Self, other: Self) -> bool: ...
|
||||
def __ge__(self, other: Self) -> bool: ...
|
||||
def __gt__(self, other: Self) -> bool: ...
|
||||
def __le__(self, other: Self) -> bool: ...
|
||||
else:
|
||||
def __ge__(self: Self, other: Self, NotImplemented: Any = ...) -> bool: ...
|
||||
def __gt__(self: Self, other: Self, NotImplemented: Any = ...) -> bool: ...
|
||||
def __le__(self: Self, other: Self, NotImplemented: Any = ...) -> bool: ...
|
||||
def __ge__(self, other: Self, NotImplemented: Any = ...) -> bool: ...
|
||||
def __gt__(self, other: Self, NotImplemented: Any = ...) -> bool: ...
|
||||
def __le__(self, other: Self, NotImplemented: Any = ...) -> bool: ...
|
||||
|
||||
@property
|
||||
def is_global(self) -> bool: ...
|
||||
@@ -76,20 +75,20 @@ class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]):
|
||||
def __getitem__(self, n: int) -> _A: ...
|
||||
def __iter__(self) -> Iterator[_A]: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __lt__(self: Self, other: Self) -> bool: ...
|
||||
def __lt__(self, other: Self) -> bool: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __ge__(self: Self, other: Self) -> bool: ...
|
||||
def __gt__(self: Self, other: Self) -> bool: ...
|
||||
def __le__(self: Self, other: Self) -> bool: ...
|
||||
def __ge__(self, other: Self) -> bool: ...
|
||||
def __gt__(self, other: Self) -> bool: ...
|
||||
def __le__(self, other: Self) -> bool: ...
|
||||
else:
|
||||
def __ge__(self: Self, other: Self, NotImplemented: Any = ...) -> bool: ...
|
||||
def __gt__(self: Self, other: Self, NotImplemented: Any = ...) -> bool: ...
|
||||
def __le__(self: Self, other: Self, NotImplemented: Any = ...) -> bool: ...
|
||||
def __ge__(self, other: Self, NotImplemented: Any = ...) -> bool: ...
|
||||
def __gt__(self, other: Self, NotImplemented: Any = ...) -> bool: ...
|
||||
def __le__(self, other: Self, NotImplemented: Any = ...) -> bool: ...
|
||||
|
||||
def address_exclude(self: Self, other: Self) -> Iterator[Self]: ...
|
||||
def address_exclude(self, other: Self) -> Iterator[Self]: ...
|
||||
@property
|
||||
def broadcast_address(self) -> _A: ...
|
||||
def compare_networks(self: Self, other: Self) -> int: ...
|
||||
def compare_networks(self, other: Self) -> int: ...
|
||||
def hosts(self) -> Iterator[_A]: ...
|
||||
@property
|
||||
def is_global(self) -> bool: ...
|
||||
@@ -112,10 +111,10 @@ class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]):
|
||||
def overlaps(self, other: _BaseNetwork[IPv4Address] | _BaseNetwork[IPv6Address]) -> bool: ...
|
||||
@property
|
||||
def prefixlen(self) -> int: ...
|
||||
def subnet_of(self: Self, other: Self) -> bool: ...
|
||||
def supernet_of(self: Self, other: Self) -> bool: ...
|
||||
def subnets(self: Self, prefixlen_diff: int = 1, new_prefix: int | None = None) -> Iterator[Self]: ...
|
||||
def supernet(self: Self, prefixlen_diff: int = 1, new_prefix: int | None = None) -> Self: ...
|
||||
def subnet_of(self, other: Self) -> bool: ...
|
||||
def supernet_of(self, other: Self) -> bool: ...
|
||||
def subnets(self, prefixlen_diff: int = 1, new_prefix: int | None = None) -> Iterator[Self]: ...
|
||||
def supernet(self, prefixlen_diff: int = 1, new_prefix: int | None = None) -> Self: ...
|
||||
@property
|
||||
def with_hostmask(self) -> str: ...
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user