mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-15 16:27:08 +08:00
stdlib: Add several missing comparison methods (#7202)
This commit is contained in:
@@ -55,6 +55,11 @@ class TimerHandle(Handle):
|
||||
if sys.version_info >= (3, 7):
|
||||
def when(self) -> float: ...
|
||||
|
||||
def __lt__(self, other: TimerHandle) -> bool: ...
|
||||
def __le__(self, other: TimerHandle) -> bool: ...
|
||||
def __gt__(self, other: TimerHandle) -> bool: ...
|
||||
def __ge__(self, other: TimerHandle) -> bool: ...
|
||||
|
||||
class AbstractServer:
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
|
||||
@@ -220,6 +220,10 @@ class deque(MutableSequence[_T], Generic[_T]):
|
||||
def __add__(self: Self, __other: Self) -> Self: ...
|
||||
def __mul__(self: Self, __other: int) -> Self: ...
|
||||
def __imul__(self: Self, __other: int) -> Self: ...
|
||||
def __lt__(self, __other: deque[_T]) -> bool: ...
|
||||
def __le__(self, __other: deque[_T]) -> bool: ...
|
||||
def __gt__(self, __other: deque[_T]) -> bool: ...
|
||||
def __ge__(self, __other: deque[_T]) -> bool: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
|
||||
|
||||
@@ -266,6 +270,10 @@ class Counter(dict[_T, int], Generic[_T]):
|
||||
def __ior__(self: Self, other: Counter[_T]) -> Self: ... # type: ignore[override]
|
||||
if sys.version_info >= (3, 10):
|
||||
def total(self) -> int: ...
|
||||
def __le__(self, other: Counter[object]) -> bool: ...
|
||||
def __lt__(self, other: Counter[object]) -> bool: ...
|
||||
def __ge__(self, other: Counter[object]) -> bool: ...
|
||||
def __gt__(self, other: Counter[object]) -> bool: ...
|
||||
|
||||
@final
|
||||
class _OrderedDictKeysView(dict_keys[_KT_co, _VT_co], Reversible[_KT_co]): # type: ignore[misc]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from _tracemalloc import *
|
||||
from typing import Optional, Sequence, Union, overload
|
||||
from typing import Any, Optional, Sequence, Union, overload
|
||||
from typing_extensions import SupportsIndex
|
||||
|
||||
def get_object_traceback(obj: object) -> Traceback | None: ...
|
||||
@@ -41,6 +41,15 @@ class Frame:
|
||||
filename: str
|
||||
lineno: int
|
||||
def __init__(self, frame: _FrameTupleT) -> None: ...
|
||||
def __lt__(self, other: Frame) -> bool: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __gt__(self, other: Frame) -> bool: ...
|
||||
def __ge__(self, other: Frame) -> bool: ...
|
||||
def __le__(self, other: Frame) -> bool: ...
|
||||
else:
|
||||
def __gt__(self, other: Frame, NotImplemented: Any = ...) -> bool: ...
|
||||
def __ge__(self, other: Frame, NotImplemented: Any = ...) -> bool: ...
|
||||
def __le__(self, other: Frame, NotImplemented: Any = ...) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
_TraceTupleT = Union[tuple[int, int, Sequence[_FrameTupleT], Optional[int]], tuple[int, int, Sequence[_FrameTupleT]]]
|
||||
@@ -69,6 +78,15 @@ class Traceback(Sequence[Frame]):
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> Sequence[Frame]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __lt__(self, other: Traceback) -> bool: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __gt__(self, other: Traceback) -> bool: ...
|
||||
def __ge__(self, other: Traceback) -> bool: ...
|
||||
def __le__(self, other: Traceback) -> bool: ...
|
||||
else:
|
||||
def __gt__(self, other: Traceback, NotImplemented: Any = ...) -> bool: ...
|
||||
def __ge__(self, other: Traceback, NotImplemented: Any = ...) -> bool: ...
|
||||
def __le__(self, other: Traceback, NotImplemented: Any = ...) -> bool: ...
|
||||
|
||||
class Snapshot:
|
||||
def __init__(self, traces: Sequence[_TraceTupleT], traceback_limit: int) -> None: ...
|
||||
|
||||
@@ -92,6 +92,7 @@ class BaseHandler:
|
||||
parent: OpenerDirector
|
||||
def add_parent(self, parent: OpenerDirector) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def __lt__(self, other: object) -> bool: ...
|
||||
|
||||
class HTTPDefaultErrorHandler(BaseHandler):
|
||||
def http_error_default(
|
||||
|
||||
@@ -111,6 +111,10 @@ PI: Callable[..., Element]
|
||||
class QName:
|
||||
text: str
|
||||
def __init__(self, text_or_uri: str, tag: str | None = ...) -> None: ...
|
||||
def __lt__(self, other: QName | str) -> bool: ...
|
||||
def __le__(self, other: QName | str) -> bool: ...
|
||||
def __gt__(self, other: QName | str) -> bool: ...
|
||||
def __ge__(self, other: QName | str) -> bool: ...
|
||||
|
||||
class ElementTree:
|
||||
def __init__(self, element: Element | None = ..., file: _File | None = ...) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user