Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use an alias, remove unnecessary _co suffix
  • Loading branch information
JelleZijlstra committed May 16, 2023
commit 16b09782f22be7b4d5c71898d3ed9a50bc380f86
13 changes: 8 additions & 5 deletions Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2630,22 +2630,22 @@ def __index__(self) -> int:


@runtime_checkable
class SupportsAbs[T_co](Protocol):
class SupportsAbs[T](Protocol):
"""An ABC with one abstract method __abs__ that is covariant in its return type."""
__slots__ = ()

@abstractmethod
def __abs__(self) -> T_co:
def __abs__(self) -> T:
pass


@runtime_checkable
class SupportsRound[T_co](Protocol):
class SupportsRound[T](Protocol):
"""An ABC with one abstract method __round__ that is covariant in its return type."""
__slots__ = ()

@abstractmethod
def __round__(self, ndigits: int = 0) -> T_co:
def __round__(self, ndigits: int = 0) -> T:
pass


Expand Down Expand Up @@ -3287,7 +3287,10 @@ def decorator(cls_or_fn):
return decorator


def override[F: Callable[..., Any]](method: F, /) -> F:
type _Func = Callable[..., Any]


def override[F: _Func](method: F, /) -> F:
"""Indicate that a method is intended to override a method in a base class.

Usage:
Expand Down