Add operator.call() and operator.__call__() for Python 3.11 (#6396)

Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
Pavel Karateev
2021-11-27 17:43:17 +03:00
committed by GitHub
parent 98af7d667f
commit 575a008744
2 changed files with 13 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
# 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,
@@ -57,4 +58,7 @@ from operator import (
)
from typing import AnyStr
if sys.version_info >= (3, 11):
from operator import call as call
def _compare_digest(__a: AnyStr, __b: AnyStr) -> bool: ...

View File

@@ -1,5 +1,7 @@
import sys
from typing import (
Any,
Callable,
Container,
Generic,
Mapping,
@@ -11,12 +13,14 @@ from typing import (
TypeVar,
overload,
)
from typing_extensions import SupportsIndex, final
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: ...
@@ -177,3 +181,7 @@ 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: ...
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