|
1 |
| -# ruff: noqa: PYI036 # This is the module declaring BaseException |
2 | 1 | import _ast
|
3 | 2 | import _sitebuiltins
|
4 | 3 | import _typeshed
|
@@ -88,8 +87,8 @@ _T2 = TypeVar("_T2")
|
88 | 87 | _T3 = TypeVar("_T3")
|
89 | 88 | _T4 = TypeVar("_T4")
|
90 | 89 | _T5 = TypeVar("_T5")
|
91 |
| -_SupportsNextT = TypeVar("_SupportsNextT", bound=SupportsNext[Any], covariant=True) |
92 |
| -_SupportsAnextT = TypeVar("_SupportsAnextT", bound=SupportsAnext[Any], covariant=True) |
| 90 | +_SupportsNextT_co = TypeVar("_SupportsNextT_co", bound=SupportsNext[Any], covariant=True) |
| 91 | +_SupportsAnextT_co = TypeVar("_SupportsAnextT_co", bound=SupportsAnext[Any], covariant=True) |
93 | 92 | _AwaitableT = TypeVar("_AwaitableT", bound=Awaitable[Any])
|
94 | 93 | _AwaitableT_co = TypeVar("_AwaitableT_co", bound=Awaitable[Any], covariant=True)
|
95 | 94 | _P = ParamSpec("_P")
|
@@ -772,7 +771,11 @@ class memoryview(Sequence[_I]):
|
772 | 771 | def __new__(cls, obj: ReadableBuffer) -> Self: ...
|
773 | 772 | def __enter__(self) -> Self: ...
|
774 | 773 | def __exit__(
|
775 |
| - self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None, / |
| 774 | + self, |
| 775 | + exc_type: type[BaseException] | None, # noqa: PYI036 # This is the module declaring BaseException |
| 776 | + exc_val: BaseException | None, |
| 777 | + exc_tb: TracebackType | None, |
| 778 | + /, |
776 | 779 | ) -> None: ...
|
777 | 780 | @overload
|
778 | 781 | def cast(self, format: Literal["c", "@c"], shape: list[int] | tuple[int, ...] = ...) -> memoryview[bytes]: ...
|
@@ -1042,7 +1045,7 @@ class dict(MutableMapping[_KT, _VT]):
|
1042 | 1045 | def fromkeys(cls, iterable: Iterable[_T], value: _S, /) -> dict[_T, _S]: ...
|
1043 | 1046 | # Positional-only in dict, but not in MutableMapping
|
1044 | 1047 | @overload # type: ignore[override]
|
1045 |
| - def get(self, key: _KT, /) -> _VT | None: ... |
| 1048 | + def get(self, key: _KT, default: None = None, /) -> _VT | None: ... |
1046 | 1049 | @overload
|
1047 | 1050 | def get(self, key: _KT, default: _VT, /) -> _VT: ...
|
1048 | 1051 | @overload
|
@@ -1221,7 +1224,7 @@ class _PathLike(Protocol[AnyStr_co]):
|
1221 | 1224 | def __fspath__(self) -> AnyStr_co: ...
|
1222 | 1225 |
|
1223 | 1226 | if sys.version_info >= (3, 10):
|
1224 |
| - def aiter(async_iterable: SupportsAiter[_SupportsAnextT], /) -> _SupportsAnextT: ... |
| 1227 | + def aiter(async_iterable: SupportsAiter[_SupportsAnextT_co], /) -> _SupportsAnextT_co: ... |
1225 | 1228 |
|
1226 | 1229 | class _SupportsSynchronousAnext(Protocol[_AwaitableT_co]):
|
1227 | 1230 | def __anext__(self) -> _AwaitableT_co: ...
|
@@ -1383,7 +1386,7 @@ class _GetItemIterable(Protocol[_T_co]):
|
1383 | 1386 | def __getitem__(self, i: int, /) -> _T_co: ...
|
1384 | 1387 |
|
1385 | 1388 | @overload
|
1386 |
| -def iter(object: SupportsIter[_SupportsNextT], /) -> _SupportsNextT: ... |
| 1389 | +def iter(object: SupportsIter[_SupportsNextT_co], /) -> _SupportsNextT_co: ... |
1387 | 1390 | @overload
|
1388 | 1391 | def iter(object: _GetItemIterable[_T], /) -> Iterator[_T]: ...
|
1389 | 1392 | @overload
|
@@ -1590,17 +1593,17 @@ def print(
|
1590 | 1593 | *values: object, sep: str | None = " ", end: str | None = "\n", file: _SupportsWriteAndFlush[str] | None = None, flush: bool
|
1591 | 1594 | ) -> None: ...
|
1592 | 1595 |
|
1593 |
| -_E = TypeVar("_E", contravariant=True) |
1594 |
| -_M = TypeVar("_M", contravariant=True) |
| 1596 | +_E_contra = TypeVar("_E_contra", contravariant=True) |
| 1597 | +_M_contra = TypeVar("_M_contra", contravariant=True) |
1595 | 1598 |
|
1596 |
| -class _SupportsPow2(Protocol[_E, _T_co]): |
1597 |
| - def __pow__(self, other: _E, /) -> _T_co: ... |
| 1599 | +class _SupportsPow2(Protocol[_E_contra, _T_co]): |
| 1600 | + def __pow__(self, other: _E_contra, /) -> _T_co: ... |
1598 | 1601 |
|
1599 |
| -class _SupportsPow3NoneOnly(Protocol[_E, _T_co]): |
1600 |
| - def __pow__(self, other: _E, modulo: None = None, /) -> _T_co: ... |
| 1602 | +class _SupportsPow3NoneOnly(Protocol[_E_contra, _T_co]): |
| 1603 | + def __pow__(self, other: _E_contra, modulo: None = None, /) -> _T_co: ... |
1601 | 1604 |
|
1602 |
| -class _SupportsPow3(Protocol[_E, _M, _T_co]): |
1603 |
| - def __pow__(self, other: _E, modulo: _M, /) -> _T_co: ... |
| 1605 | +class _SupportsPow3(Protocol[_E_contra, _M_contra, _T_co]): |
| 1606 | + def __pow__(self, other: _E_contra, modulo: _M_contra, /) -> _T_co: ... |
1604 | 1607 |
|
1605 | 1608 | _SupportsSomeKindOfPow = ( # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
|
1606 | 1609 | _SupportsPow2[Any, Any] | _SupportsPow3NoneOnly[Any, Any] | _SupportsPow3[Any, Any, Any]
|
@@ -1636,11 +1639,11 @@ def pow(base: float, exp: complex | _SupportsSomeKindOfPow, mod: None = None) ->
|
1636 | 1639 | @overload
|
1637 | 1640 | def pow(base: complex, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> complex: ...
|
1638 | 1641 | @overload
|
1639 |
| -def pow(base: _SupportsPow2[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ... # type: ignore[overload-overlap] |
| 1642 | +def pow(base: _SupportsPow2[_E_contra, _T_co], exp: _E_contra, mod: None = None) -> _T_co: ... # type: ignore[overload-overlap] |
1640 | 1643 | @overload
|
1641 |
| -def pow(base: _SupportsPow3NoneOnly[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ... # type: ignore[overload-overlap] |
| 1644 | +def pow(base: _SupportsPow3NoneOnly[_E_contra, _T_co], exp: _E_contra, mod: None = None) -> _T_co: ... # type: ignore[overload-overlap] |
1642 | 1645 | @overload
|
1643 |
| -def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ... |
| 1646 | +def pow(base: _SupportsPow3[_E_contra, _M_contra, _T_co], exp: _E_contra, mod: _M_contra) -> _T_co: ... |
1644 | 1647 | @overload
|
1645 | 1648 | def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = None) -> Any: ...
|
1646 | 1649 | @overload
|
|
0 commit comments