mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-24 18:48:46 +08:00
Use typing_extensions.Self instead of _typeshed.Self (#9702)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
from _typeshed import Self
|
||||
from typing import ClassVar, SupportsInt, overload
|
||||
from typing_extensions import Literal, SupportsIndex
|
||||
from typing_extensions import Literal, Self, SupportsIndex
|
||||
|
||||
from netaddr.core import DictDotLookup
|
||||
from netaddr.ip import IPAddress
|
||||
@@ -76,8 +75,8 @@ class EUI(BaseIdentifier):
|
||||
def words(self) -> tuple[int, ...]: ...
|
||||
@property
|
||||
def bin(self) -> str: ...
|
||||
def eui64(self: Self) -> Self: ...
|
||||
def modified_eui64(self: Self) -> Self: ...
|
||||
def eui64(self) -> Self: ...
|
||||
def modified_eui64(self) -> Self: ...
|
||||
def ipv6(self, prefix: str | SupportsInt | SupportsIndex) -> IPAddress: ...
|
||||
def ipv6_link_local(self) -> IPAddress: ...
|
||||
@property
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from _typeshed import Incomplete, Self
|
||||
from _typeshed import Incomplete
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Iterable, Iterator
|
||||
from typing import SupportsInt, overload
|
||||
from typing_extensions import Literal, SupportsIndex, TypeAlias
|
||||
from typing_extensions import Literal, Self, SupportsIndex, TypeAlias
|
||||
|
||||
from netaddr.core import DictDotLookup
|
||||
from netaddr.strategy.ipv6 import ipv6_verbose
|
||||
@@ -45,12 +45,12 @@ class IPAddress(BaseIP):
|
||||
def netmask_bits(self) -> int: ...
|
||||
def is_hostmask(self) -> bool: ...
|
||||
def is_netmask(self) -> bool: ...
|
||||
def __iadd__(self: Self, num: int) -> Self: ...
|
||||
def __isub__(self: Self, num: int) -> Self: ...
|
||||
def __add__(self: Self, num: int) -> Self: ...
|
||||
def __iadd__(self, num: int) -> Self: ...
|
||||
def __isub__(self, num: int) -> Self: ...
|
||||
def __add__(self, num: int) -> Self: ...
|
||||
__radd__ = __add__
|
||||
def __sub__(self: Self, num: int) -> Self: ...
|
||||
def __rsub__(self: Self, num: int) -> Self: ...
|
||||
def __sub__(self, num: int) -> Self: ...
|
||||
def __rsub__(self, num: int) -> Self: ...
|
||||
def key(self) -> tuple[int, ...]: ...
|
||||
def sort_key(self) -> tuple[int, ...]: ...
|
||||
def __int__(self) -> int: ...
|
||||
@@ -68,14 +68,14 @@ class IPAddress(BaseIP):
|
||||
def bin(self) -> str: ...
|
||||
@property
|
||||
def reverse_dns(self) -> str: ...
|
||||
def ipv4(self: Self) -> Self: ...
|
||||
def ipv6(self: Self, ipv4_compatible: bool = ...) -> Self: ...
|
||||
def ipv4(self) -> Self: ...
|
||||
def ipv6(self, ipv4_compatible: bool = ...) -> Self: ...
|
||||
def format(self, dialect: type[ipv6_verbose] | None = ...) -> str: ...
|
||||
def __or__(self: Self, other: str | SupportsInt | SupportsIndex) -> Self: ...
|
||||
def __and__(self: Self, other: str | SupportsInt | SupportsIndex) -> Self: ...
|
||||
def __xor__(self: Self, other: str | SupportsInt | SupportsIndex) -> Self: ...
|
||||
def __lshift__(self: Self, numbits: int) -> Self: ...
|
||||
def __rshift__(self: Self, numbits: int) -> Self: ...
|
||||
def __or__(self, other: str | SupportsInt | SupportsIndex) -> Self: ...
|
||||
def __and__(self, other: str | SupportsInt | SupportsIndex) -> Self: ...
|
||||
def __xor__(self, other: str | SupportsInt | SupportsIndex) -> Self: ...
|
||||
def __lshift__(self, numbits: int) -> Self: ...
|
||||
def __rshift__(self, numbits: int) -> Self: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
|
||||
class IPListMixin:
|
||||
@@ -122,18 +122,18 @@ class IPNetwork(BaseIP, IPListMixin):
|
||||
def hostmask(self) -> IPAddress: ...
|
||||
@property
|
||||
def cidr(self) -> IPNetwork: ...
|
||||
def __iadd__(self: Self, num: int) -> Self: ...
|
||||
def __isub__(self: Self, num: int) -> Self: ...
|
||||
def __iadd__(self, num: int) -> Self: ...
|
||||
def __isub__(self, num: int) -> Self: ...
|
||||
# runtime overrides __contains__ with incompatible type for "other"
|
||||
def __contains__(self, other: BaseIP | _IPNetworkAddr) -> bool: ... # type: ignore[override]
|
||||
def key(self) -> tuple[int, ...]: ...
|
||||
def sort_key(self) -> tuple[int, ...]: ...
|
||||
def ipv4(self: Self) -> Self: ...
|
||||
def ipv6(self: Self, ipv4_compatible: bool = ...) -> Self: ...
|
||||
def previous(self: Self, step: int = ...) -> Self: ...
|
||||
def next(self: Self, step: int = ...) -> Self: ...
|
||||
def ipv4(self) -> Self: ...
|
||||
def ipv6(self, ipv4_compatible: bool = ...) -> Self: ...
|
||||
def previous(self, step: int = ...) -> Self: ...
|
||||
def next(self, step: int = ...) -> Self: ...
|
||||
def supernet(self, prefixlen: int = ...) -> list[IPNetwork]: ...
|
||||
def subnet(self: Self, prefixlen: int, count: int | None = ..., fmt: object | None = ...) -> Iterator[Self]: ...
|
||||
def subnet(self, prefixlen: int, count: int | None = ..., fmt: object | None = ...) -> Iterator[Self]: ...
|
||||
def iter_hosts(self) -> Iterator[IPAddress]: ...
|
||||
|
||||
class IPRange(BaseIP, IPListMixin):
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from _typeshed import Self
|
||||
from collections.abc import Iterable, Iterator
|
||||
from typing import NoReturn
|
||||
from typing_extensions import TypeAlias
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
from netaddr.ip import IPAddress, IPNetwork, IPRange, _IPNetworkAddr
|
||||
|
||||
@@ -19,7 +18,7 @@ class IPSet:
|
||||
def remove(self, addr: IPRange | _IPNetworkAddr | int, flags: int = ...) -> None: ...
|
||||
def pop(self) -> IPNetwork: ...
|
||||
def isdisjoint(self, other: IPSet) -> bool: ...
|
||||
def copy(self: Self) -> Self: ...
|
||||
def copy(self) -> Self: ...
|
||||
def update(self, iterable: _IPIterable, flags: int = ...) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
@@ -30,7 +29,7 @@ class IPSet:
|
||||
def __gt__(self, other: IPSet) -> bool: ...
|
||||
def issuperset(self, other: IPSet) -> bool: ...
|
||||
__ge__ = issuperset
|
||||
def union(self: Self, other: IPSet) -> Self: ...
|
||||
def union(self, other: IPSet) -> Self: ...
|
||||
__or__ = union
|
||||
def intersection(self, other: IPSet) -> IPSet: ...
|
||||
__and__ = intersection
|
||||
|
||||
Reference in New Issue
Block a user