mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
move definitions from operator to _operator (#6429)
This commit is contained in:
@@ -1,64 +1,129 @@
|
||||
# In reality the import is the other way around, but this way we can keep the operator stub in 2and3
|
||||
import sys
|
||||
from operator import (
|
||||
abs as abs,
|
||||
add as add,
|
||||
and_ as and_,
|
||||
attrgetter as attrgetter,
|
||||
concat as concat,
|
||||
contains as contains,
|
||||
countOf as countOf,
|
||||
delitem as delitem,
|
||||
eq as eq,
|
||||
floordiv as floordiv,
|
||||
ge as ge,
|
||||
getitem as getitem,
|
||||
gt as gt,
|
||||
iadd as iadd,
|
||||
iand as iand,
|
||||
iconcat as iconcat,
|
||||
ifloordiv as ifloordiv,
|
||||
ilshift as ilshift,
|
||||
imatmul as imatmul,
|
||||
imod as imod,
|
||||
imul as imul,
|
||||
index as index,
|
||||
indexOf as indexOf,
|
||||
inv as inv,
|
||||
invert as invert,
|
||||
ior as ior,
|
||||
ipow as ipow,
|
||||
irshift as irshift,
|
||||
is_ as is_,
|
||||
is_not as is_not,
|
||||
isub as isub,
|
||||
itemgetter as itemgetter,
|
||||
itruediv as itruediv,
|
||||
ixor as ixor,
|
||||
le as le,
|
||||
length_hint as length_hint,
|
||||
lshift as lshift,
|
||||
lt as lt,
|
||||
matmul as matmul,
|
||||
methodcaller as methodcaller,
|
||||
mod as mod,
|
||||
mul as mul,
|
||||
ne as ne,
|
||||
neg as neg,
|
||||
not_ as not_,
|
||||
or_ as or_,
|
||||
pos as pos,
|
||||
pow as pow,
|
||||
rshift as rshift,
|
||||
setitem as setitem,
|
||||
sub as sub,
|
||||
truediv as truediv,
|
||||
truth as truth,
|
||||
xor as xor,
|
||||
from typing import (
|
||||
Any,
|
||||
AnyStr,
|
||||
Callable,
|
||||
Container,
|
||||
Generic,
|
||||
Mapping,
|
||||
MutableMapping,
|
||||
MutableSequence,
|
||||
Sequence,
|
||||
SupportsAbs,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
overload,
|
||||
)
|
||||
from typing import AnyStr
|
||||
from typing_extensions import ParamSpec, SupportsIndex, final
|
||||
|
||||
_R = TypeVar("_R")
|
||||
_T = TypeVar("_T")
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
_K = TypeVar("_K")
|
||||
_V = TypeVar("_V")
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
def lt(__a: Any, __b: Any) -> Any: ...
|
||||
def le(__a: Any, __b: Any) -> Any: ...
|
||||
def eq(__a: Any, __b: Any) -> Any: ...
|
||||
def ne(__a: Any, __b: Any) -> Any: ...
|
||||
def ge(__a: Any, __b: Any) -> Any: ...
|
||||
def gt(__a: Any, __b: Any) -> Any: ...
|
||||
def not_(__a: Any) -> bool: ...
|
||||
def truth(__a: Any) -> bool: ...
|
||||
def is_(__a: Any, __b: Any) -> bool: ...
|
||||
def is_not(__a: Any, __b: Any) -> bool: ...
|
||||
def abs(__a: SupportsAbs[_T]) -> _T: ...
|
||||
def add(__a: Any, __b: Any) -> Any: ...
|
||||
def and_(__a: Any, __b: Any) -> Any: ...
|
||||
def floordiv(__a: Any, __b: Any) -> Any: ...
|
||||
def index(__a: Any) -> int: ...
|
||||
def inv(__a: Any) -> Any: ...
|
||||
def invert(__a: Any) -> Any: ...
|
||||
def lshift(__a: Any, __b: Any) -> Any: ...
|
||||
def mod(__a: Any, __b: Any) -> Any: ...
|
||||
def mul(__a: Any, __b: Any) -> Any: ...
|
||||
def matmul(__a: Any, __b: Any) -> Any: ...
|
||||
def neg(__a: Any) -> Any: ...
|
||||
def or_(__a: Any, __b: Any) -> Any: ...
|
||||
def pos(__a: Any) -> Any: ...
|
||||
def pow(__a: Any, __b: Any) -> Any: ...
|
||||
def rshift(__a: Any, __b: Any) -> Any: ...
|
||||
def sub(__a: Any, __b: Any) -> Any: ...
|
||||
def truediv(__a: Any, __b: Any) -> Any: ...
|
||||
def xor(__a: Any, __b: Any) -> Any: ...
|
||||
def concat(__a: Sequence[_T], __b: Sequence[_T]) -> Sequence[_T]: ...
|
||||
def contains(__a: Container[Any], __b: Any) -> bool: ...
|
||||
def countOf(__a: Container[Any], __b: Any) -> int: ...
|
||||
@overload
|
||||
def delitem(__a: MutableSequence[Any], __b: SupportsIndex) -> None: ...
|
||||
@overload
|
||||
def delitem(__a: MutableSequence[Any], __b: slice) -> None: ...
|
||||
@overload
|
||||
def delitem(__a: MutableMapping[_K, Any], __b: _K) -> None: ...
|
||||
@overload
|
||||
def getitem(__a: Sequence[_T], __b: SupportsIndex) -> _T: ...
|
||||
@overload
|
||||
def getitem(__a: Sequence[_T], __b: slice) -> Sequence[_T]: ...
|
||||
@overload
|
||||
def getitem(__a: Mapping[_K, _V], __b: _K) -> _V: ...
|
||||
def indexOf(__a: Sequence[_T], __b: _T) -> int: ...
|
||||
@overload
|
||||
def setitem(__a: MutableSequence[_T], __b: SupportsIndex, __c: _T) -> None: ...
|
||||
@overload
|
||||
def setitem(__a: MutableSequence[_T], __b: slice, __c: Sequence[_T]) -> None: ...
|
||||
@overload
|
||||
def setitem(__a: MutableMapping[_K, _V], __b: _K, __c: _V) -> None: ...
|
||||
def length_hint(__obj: Any, __default: int = ...) -> int: ...
|
||||
@final
|
||||
class attrgetter(Generic[_T_co]):
|
||||
@overload
|
||||
def __new__(cls, attr: str) -> attrgetter[Any]: ...
|
||||
@overload
|
||||
def __new__(cls, attr: str, __attr2: str) -> attrgetter[tuple[Any, Any]]: ...
|
||||
@overload
|
||||
def __new__(cls, attr: str, __attr2: str, __attr3: str) -> attrgetter[tuple[Any, Any, Any]]: ...
|
||||
@overload
|
||||
def __new__(cls, attr: str, __attr2: str, __attr3: str, __attr4: str) -> attrgetter[tuple[Any, Any, Any, Any]]: ...
|
||||
@overload
|
||||
def __new__(cls, attr: str, *attrs: str) -> attrgetter[Tuple[Any, ...]]: ...
|
||||
def __call__(self, obj: Any) -> _T_co: ...
|
||||
|
||||
@final
|
||||
class itemgetter(Generic[_T_co]):
|
||||
@overload
|
||||
def __new__(cls, item: Any) -> itemgetter[Any]: ...
|
||||
@overload
|
||||
def __new__(cls, item: Any, __item2: Any) -> itemgetter[tuple[Any, Any]]: ...
|
||||
@overload
|
||||
def __new__(cls, item: Any, __item2: Any, __item3: Any) -> itemgetter[tuple[Any, Any, Any]]: ...
|
||||
@overload
|
||||
def __new__(cls, item: Any, __item2: Any, __item3: Any, __item4: Any) -> itemgetter[tuple[Any, Any, Any, Any]]: ...
|
||||
@overload
|
||||
def __new__(cls, item: Any, *items: Any) -> itemgetter[Tuple[Any, ...]]: ...
|
||||
def __call__(self, obj: Any) -> _T_co: ...
|
||||
|
||||
@final
|
||||
class methodcaller:
|
||||
def __init__(self, __name: str, *args: Any, **kwargs: Any) -> None: ...
|
||||
def __call__(self, obj: Any) -> Any: ...
|
||||
|
||||
def iadd(__a: Any, __b: Any) -> Any: ...
|
||||
def iand(__a: Any, __b: Any) -> Any: ...
|
||||
def iconcat(__a: Any, __b: Any) -> Any: ...
|
||||
def ifloordiv(__a: Any, __b: Any) -> Any: ...
|
||||
def ilshift(__a: Any, __b: Any) -> Any: ...
|
||||
def imod(__a: Any, __b: Any) -> Any: ...
|
||||
def imul(__a: Any, __b: Any) -> Any: ...
|
||||
def imatmul(__a: Any, __b: Any) -> Any: ...
|
||||
def ior(__a: Any, __b: Any) -> Any: ...
|
||||
def ipow(__a: Any, __b: Any) -> Any: ...
|
||||
def irshift(__a: Any, __b: Any) -> Any: ...
|
||||
def isub(__a: Any, __b: Any) -> Any: ...
|
||||
def itruediv(__a: Any, __b: Any) -> Any: ...
|
||||
def ixor(__a: Any, __b: Any) -> Any: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from operator import call as call
|
||||
def call(__obj: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ... # type: ignore
|
||||
|
||||
def _compare_digest(__a: AnyStr, __b: AnyStr) -> bool: ...
|
||||
|
||||
@@ -1,187 +1,51 @@
|
||||
import sys
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Container,
|
||||
Generic,
|
||||
Mapping,
|
||||
MutableMapping,
|
||||
MutableSequence,
|
||||
Sequence,
|
||||
SupportsAbs,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
overload,
|
||||
)
|
||||
from typing_extensions import ParamSpec, SupportsIndex, final
|
||||
|
||||
_R = TypeVar("_R")
|
||||
_T = TypeVar("_T")
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
_K = TypeVar("_K")
|
||||
_V = TypeVar("_V")
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
def lt(__a: Any, __b: Any) -> Any: ...
|
||||
def le(__a: Any, __b: Any) -> Any: ...
|
||||
def eq(__a: Any, __b: Any) -> Any: ...
|
||||
def ne(__a: Any, __b: Any) -> Any: ...
|
||||
def ge(__a: Any, __b: Any) -> Any: ...
|
||||
def gt(__a: Any, __b: Any) -> Any: ...
|
||||
def __lt__(a: Any, b: Any) -> Any: ...
|
||||
def __le__(a: Any, b: Any) -> Any: ...
|
||||
def __eq__(a: Any, b: Any) -> Any: ...
|
||||
def __ne__(a: Any, b: Any) -> Any: ...
|
||||
def __ge__(a: Any, b: Any) -> Any: ...
|
||||
def __gt__(a: Any, b: Any) -> Any: ...
|
||||
def not_(__a: Any) -> bool: ...
|
||||
def __not__(a: Any) -> bool: ...
|
||||
def truth(__a: Any) -> bool: ...
|
||||
def is_(__a: Any, __b: Any) -> bool: ...
|
||||
def is_not(__a: Any, __b: Any) -> bool: ...
|
||||
def abs(__a: SupportsAbs[_T]) -> _T: ...
|
||||
def __abs__(a: SupportsAbs[_T]) -> _T: ...
|
||||
def add(__a: Any, __b: Any) -> Any: ...
|
||||
def __add__(a: Any, b: Any) -> Any: ...
|
||||
def and_(__a: Any, __b: Any) -> Any: ...
|
||||
def __and__(a: Any, b: Any) -> Any: ...
|
||||
def floordiv(__a: Any, __b: Any) -> Any: ...
|
||||
def __floordiv__(a: Any, b: Any) -> Any: ...
|
||||
def index(__a: Any) -> int: ...
|
||||
def __index__(a: Any) -> int: ...
|
||||
def inv(__a: Any) -> Any: ...
|
||||
def invert(__a: Any) -> Any: ...
|
||||
def __inv__(a: Any) -> Any: ...
|
||||
def __invert__(a: Any) -> Any: ...
|
||||
def lshift(__a: Any, __b: Any) -> Any: ...
|
||||
def __lshift__(a: Any, b: Any) -> Any: ...
|
||||
def mod(__a: Any, __b: Any) -> Any: ...
|
||||
def __mod__(a: Any, b: Any) -> Any: ...
|
||||
def mul(__a: Any, __b: Any) -> Any: ...
|
||||
def __mul__(a: Any, b: Any) -> Any: ...
|
||||
def matmul(__a: Any, __b: Any) -> Any: ...
|
||||
def __matmul__(a: Any, b: Any) -> Any: ...
|
||||
def neg(__a: Any) -> Any: ...
|
||||
def __neg__(a: Any) -> Any: ...
|
||||
def or_(__a: Any, __b: Any) -> Any: ...
|
||||
def __or__(a: Any, b: Any) -> Any: ...
|
||||
def pos(__a: Any) -> Any: ...
|
||||
def __pos__(a: Any) -> Any: ...
|
||||
def pow(__a: Any, __b: Any) -> Any: ...
|
||||
def __pow__(a: Any, b: Any) -> Any: ...
|
||||
def rshift(__a: Any, __b: Any) -> Any: ...
|
||||
def __rshift__(a: Any, b: Any) -> Any: ...
|
||||
def sub(__a: Any, __b: Any) -> Any: ...
|
||||
def __sub__(a: Any, b: Any) -> Any: ...
|
||||
def truediv(__a: Any, __b: Any) -> Any: ...
|
||||
def __truediv__(a: Any, b: Any) -> Any: ...
|
||||
def xor(__a: Any, __b: Any) -> Any: ...
|
||||
def __xor__(a: Any, b: Any) -> Any: ...
|
||||
def concat(__a: Sequence[_T], __b: Sequence[_T]) -> Sequence[_T]: ...
|
||||
def __concat__(a: Sequence[_T], b: Sequence[_T]) -> Sequence[_T]: ...
|
||||
def contains(__a: Container[Any], __b: Any) -> bool: ...
|
||||
def __contains__(a: Container[Any], b: Any) -> bool: ...
|
||||
def countOf(__a: Container[Any], __b: Any) -> int: ...
|
||||
@overload
|
||||
def delitem(__a: MutableSequence[Any], __b: SupportsIndex) -> None: ...
|
||||
@overload
|
||||
def delitem(__a: MutableSequence[Any], __b: slice) -> None: ...
|
||||
@overload
|
||||
def delitem(__a: MutableMapping[_K, Any], __b: _K) -> None: ...
|
||||
@overload
|
||||
def __delitem__(a: MutableSequence[Any], b: SupportsIndex) -> None: ...
|
||||
@overload
|
||||
def __delitem__(a: MutableSequence[Any], b: slice) -> None: ...
|
||||
@overload
|
||||
def __delitem__(a: MutableMapping[_K, Any], b: _K) -> None: ...
|
||||
@overload
|
||||
def getitem(__a: Sequence[_T], __b: SupportsIndex) -> _T: ...
|
||||
@overload
|
||||
def getitem(__a: Sequence[_T], __b: slice) -> Sequence[_T]: ...
|
||||
@overload
|
||||
def getitem(__a: Mapping[_K, _V], __b: _K) -> _V: ...
|
||||
@overload
|
||||
def __getitem__(a: Sequence[_T], b: SupportsIndex) -> _T: ...
|
||||
@overload
|
||||
def __getitem__(a: Sequence[_T], b: slice) -> Sequence[_T]: ...
|
||||
@overload
|
||||
def __getitem__(a: Mapping[_K, _V], b: _K) -> _V: ...
|
||||
def indexOf(__a: Sequence[_T], __b: _T) -> int: ...
|
||||
@overload
|
||||
def setitem(__a: MutableSequence[_T], __b: SupportsIndex, __c: _T) -> None: ...
|
||||
@overload
|
||||
def setitem(__a: MutableSequence[_T], __b: slice, __c: Sequence[_T]) -> None: ...
|
||||
@overload
|
||||
def setitem(__a: MutableMapping[_K, _V], __b: _K, __c: _V) -> None: ...
|
||||
@overload
|
||||
def __setitem__(a: MutableSequence[_T], b: SupportsIndex, c: _T) -> None: ...
|
||||
@overload
|
||||
def __setitem__(a: MutableSequence[_T], b: slice, c: Sequence[_T]) -> None: ...
|
||||
@overload
|
||||
def __setitem__(a: MutableMapping[_K, _V], b: _K, c: _V) -> None: ...
|
||||
def length_hint(__obj: Any, __default: int = ...) -> int: ...
|
||||
@final
|
||||
class attrgetter(Generic[_T_co]):
|
||||
@overload
|
||||
def __new__(cls, attr: str) -> attrgetter[Any]: ...
|
||||
@overload
|
||||
def __new__(cls, attr: str, __attr2: str) -> attrgetter[tuple[Any, Any]]: ...
|
||||
@overload
|
||||
def __new__(cls, attr: str, __attr2: str, __attr3: str) -> attrgetter[tuple[Any, Any, Any]]: ...
|
||||
@overload
|
||||
def __new__(cls, attr: str, __attr2: str, __attr3: str, __attr4: str) -> attrgetter[tuple[Any, Any, Any, Any]]: ...
|
||||
@overload
|
||||
def __new__(cls, attr: str, *attrs: str) -> attrgetter[Tuple[Any, ...]]: ...
|
||||
def __call__(self, obj: Any) -> _T_co: ...
|
||||
|
||||
@final
|
||||
class itemgetter(Generic[_T_co]):
|
||||
@overload
|
||||
def __new__(cls, item: Any) -> itemgetter[Any]: ...
|
||||
@overload
|
||||
def __new__(cls, item: Any, __item2: Any) -> itemgetter[tuple[Any, Any]]: ...
|
||||
@overload
|
||||
def __new__(cls, item: Any, __item2: Any, __item3: Any) -> itemgetter[tuple[Any, Any, Any]]: ...
|
||||
@overload
|
||||
def __new__(cls, item: Any, __item2: Any, __item3: Any, __item4: Any) -> itemgetter[tuple[Any, Any, Any, Any]]: ...
|
||||
@overload
|
||||
def __new__(cls, item: Any, *items: Any) -> itemgetter[Tuple[Any, ...]]: ...
|
||||
def __call__(self, obj: Any) -> _T_co: ...
|
||||
|
||||
@final
|
||||
class methodcaller:
|
||||
def __init__(self, __name: str, *args: Any, **kwargs: Any) -> None: ...
|
||||
def __call__(self, obj: Any) -> Any: ...
|
||||
|
||||
def iadd(__a: Any, __b: Any) -> Any: ...
|
||||
def __iadd__(a: Any, b: Any) -> Any: ...
|
||||
def iand(__a: Any, __b: Any) -> Any: ...
|
||||
def __iand__(a: Any, b: Any) -> Any: ...
|
||||
def iconcat(__a: Any, __b: Any) -> Any: ...
|
||||
def __iconcat__(a: Any, b: Any) -> Any: ...
|
||||
def ifloordiv(__a: Any, __b: Any) -> Any: ...
|
||||
def __ifloordiv__(a: Any, b: Any) -> Any: ...
|
||||
def ilshift(__a: Any, __b: Any) -> Any: ...
|
||||
def __ilshift__(a: Any, b: Any) -> Any: ...
|
||||
def imod(__a: Any, __b: Any) -> Any: ...
|
||||
def __imod__(a: Any, b: Any) -> Any: ...
|
||||
def imul(__a: Any, __b: Any) -> Any: ...
|
||||
def __imul__(a: Any, b: Any) -> Any: ...
|
||||
def imatmul(__a: Any, __b: Any) -> Any: ...
|
||||
def __imatmul__(a: Any, b: Any) -> Any: ...
|
||||
def ior(__a: Any, __b: Any) -> Any: ...
|
||||
def __ior__(a: Any, b: Any) -> Any: ...
|
||||
def ipow(__a: Any, __b: Any) -> Any: ...
|
||||
def __ipow__(a: Any, b: Any) -> Any: ...
|
||||
def irshift(__a: Any, __b: Any) -> Any: ...
|
||||
def __irshift__(a: Any, b: Any) -> Any: ...
|
||||
def isub(__a: Any, __b: Any) -> Any: ...
|
||||
def __isub__(a: Any, b: Any) -> Any: ...
|
||||
def itruediv(__a: Any, __b: Any) -> Any: ...
|
||||
def __itruediv__(a: Any, b: Any) -> Any: ...
|
||||
def ixor(__a: Any, __b: Any) -> Any: ...
|
||||
def __ixor__(a: Any, b: Any) -> Any: ...
|
||||
from _operator import *
|
||||
|
||||
__lt__ = lt
|
||||
__le__ = le
|
||||
__eq__ = eq
|
||||
__ne__ = ne
|
||||
__ge__ = ge
|
||||
__gt__ = gt
|
||||
__not__ = not_
|
||||
__abs__ = abs
|
||||
__add__ = add
|
||||
__and__ = and_
|
||||
__floordiv__ = floordiv
|
||||
__index__ = index
|
||||
__inv__ = inv
|
||||
__invert__ = invert
|
||||
__lshift__ = lshift
|
||||
__mod__ = mod
|
||||
__mul__ = mul
|
||||
__matmul__ = matmul
|
||||
__neg__ = neg
|
||||
__or__ = or_
|
||||
__pos__ = pos
|
||||
__pow__ = pow
|
||||
__rshift__ = rshift
|
||||
__sub__ = sub
|
||||
__truediv__ = truediv
|
||||
__xor__ = xor
|
||||
__concat__ = concat
|
||||
__contains__ = contains
|
||||
__delitem__ = delitem
|
||||
__getitem__ = getitem
|
||||
__setitem__ = setitem
|
||||
__iadd__ = iadd
|
||||
__iand__ = iand
|
||||
__iconcat__ = iconcat
|
||||
__ifloordiv__ = ifloordiv
|
||||
__ilshift__ = ilshift
|
||||
__imod__ = imod
|
||||
__imul__ = imul
|
||||
__imatmul__ = imatmul
|
||||
__ior__ = ior
|
||||
__ipow__ = ipow
|
||||
__irshift__ = irshift
|
||||
__isub__ = isub
|
||||
__itruediv__ = itruediv
|
||||
__ixor__ = ixor
|
||||
if sys.version_info >= (3, 11):
|
||||
def call(__obj: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ... # type: ignore
|
||||
def __call__(obj: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ... # type: ignore
|
||||
__call__ = call
|
||||
|
||||
Reference in New Issue
Block a user