mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Improve some in-place BinOp methods (#7149)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from typing import BinaryIO, Generic, Iterable, MutableSequence, TypeVar, Union, overload
|
||||
from typing_extensions import Literal, SupportsIndex
|
||||
|
||||
@@ -61,8 +62,8 @@ class array(MutableSequence[_T], Generic[_T]):
|
||||
def __add__(self, __x: array[_T]) -> array[_T]: ...
|
||||
def __ge__(self, __other: array[_T]) -> bool: ...
|
||||
def __gt__(self, __other: array[_T]) -> bool: ...
|
||||
def __iadd__(self, __x: array[_T]) -> array[_T]: ... # type: ignore # Overrides MutableSequence
|
||||
def __imul__(self, __n: int) -> array[_T]: ...
|
||||
def __iadd__(self: Self, __x: array[_T]) -> Self: ... # type: ignore # Overrides MutableSequence
|
||||
def __imul__(self: Self, __n: int) -> Self: ...
|
||||
def __le__(self, __other: array[_T]) -> bool: ...
|
||||
def __lt__(self, __other: array[_T]) -> bool: ...
|
||||
def __mul__(self, __n: int) -> array[_T]: ...
|
||||
|
||||
@@ -645,10 +645,10 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def __setitem__(self, __s: slice, __x: Iterable[SupportsIndex] | bytes) -> None: ...
|
||||
def __delitem__(self, __i: SupportsIndex | slice) -> None: ...
|
||||
def __add__(self, __s: bytes) -> bytearray: ...
|
||||
def __iadd__(self, __s: Iterable[int]) -> bytearray: ...
|
||||
def __iadd__(self: Self, __s: Iterable[int]) -> Self: ...
|
||||
def __mul__(self, __n: SupportsIndex) -> bytearray: ...
|
||||
def __rmul__(self, __n: SupportsIndex) -> bytearray: ...
|
||||
def __imul__(self, __n: SupportsIndex) -> bytearray: ...
|
||||
def __imul__(self: Self, __n: SupportsIndex) -> Self: ...
|
||||
def __mod__(self, __value: Any) -> bytes: ...
|
||||
# Incompatible with Sequence.__contains__
|
||||
def __contains__(self, __o: SupportsIndex | bytes) -> bool: ... # type: ignore[override]
|
||||
|
||||
@@ -263,10 +263,10 @@ class Counter(dict[_T, int], Generic[_T]):
|
||||
def __or__(self, other: Counter[_T]) -> Counter[_T]: ... # type: ignore[override]
|
||||
def __pos__(self) -> Counter[_T]: ...
|
||||
def __neg__(self) -> Counter[_T]: ...
|
||||
def __iadd__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __isub__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __iand__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __ior__(self, other: Counter[_T]) -> Counter[_T]: ... # type: ignore[override]
|
||||
def __iadd__(self: Self, other: Counter[_T]) -> Self: ...
|
||||
def __isub__(self: Self, other: Counter[_T]) -> Self: ...
|
||||
def __iand__(self: Self, other: Counter[_T]) -> Self: ...
|
||||
def __ior__(self: Self, other: Counter[_T]) -> Self: ... # type: ignore[override]
|
||||
if sys.version_info >= (3, 10):
|
||||
def total(self) -> int: ...
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import datetime
|
||||
from _typeshed import Self
|
||||
from typing import Iterable
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
@@ -19,9 +20,9 @@ class DateTimeRange:
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
def __add__(self, other: datetime.timedelta) -> DateTimeRange: ...
|
||||
def __iadd__(self, other: datetime.timedelta) -> DateTimeRange: ...
|
||||
def __iadd__(self: Self, other: datetime.timedelta) -> Self: ...
|
||||
def __sub__(self, other: datetime.timedelta) -> DateTimeRange: ...
|
||||
def __isub__(self, other: datetime.timedelta) -> DateTimeRange: ...
|
||||
def __isub__(self: Self, other: datetime.timedelta) -> Self: ...
|
||||
def __contains__(self, x: datetime.timedelta | DateTimeRange | str) -> bool: ...
|
||||
@property
|
||||
def start_datetime(self) -> datetime.datetime: ...
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import importlib.abc
|
||||
import types
|
||||
import zipimport
|
||||
from _typeshed import Self
|
||||
from abc import ABCMeta
|
||||
from typing import IO, Any, Callable, Generator, Iterable, Optional, Sequence, TypeVar, Union, overload
|
||||
|
||||
@@ -53,7 +54,7 @@ class Environment:
|
||||
def remove(self, dist: Distribution) -> None: ...
|
||||
def can_add(self, dist: Distribution) -> bool: ...
|
||||
def __add__(self, other: Distribution | Environment) -> Environment: ...
|
||||
def __iadd__(self, other: Distribution | Environment) -> Environment: ...
|
||||
def __iadd__(self: Self, other: Distribution | Environment) -> Self: ...
|
||||
@overload
|
||||
def best_match(self, req: Requirement, working_set: WorkingSet) -> Distribution: ...
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user