Skip to content

Commit e404e15

Browse files
laydayJelleZijlstra
authored andcommitted
Preserve original type in total_ordering annotation (#3552)
See microsoft/pyright#443 for reference.
1 parent f7119c3 commit e404e15

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

stdlib/2/functools.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# NOTE: These are incomplete!
44

55
from abc import ABCMeta, abstractmethod
6-
from typing import Any, Callable, Generic, Dict, Iterable, Optional, Sequence, Tuple, TypeVar, overload
6+
from typing import Any, Callable, Generic, Dict, Iterable, Optional, Sequence, Tuple, Type, TypeVar, overload
77

88
_AnyCallable = Callable[..., Any]
99

@@ -22,7 +22,7 @@ WRAPPER_UPDATES: Sequence[str]
2222
def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ...,
2323
updated: Sequence[str] = ...) -> _AnyCallable: ...
2424
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ...
25-
def total_ordering(cls: type) -> type: ...
25+
def total_ordering(cls: Type[_T]) -> Type[_T]: ...
2626
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...
2727

2828
class partial(Generic[_T]):

stdlib/3/functools.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ WRAPPER_UPDATES: Sequence[str]
3939
def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ...,
4040
updated: Sequence[str] = ...) -> _AnyCallable: ...
4141
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ...
42-
def total_ordering(cls: type) -> type: ...
42+
def total_ordering(cls: Type[_T]) -> Type[_T]: ...
4343
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...
4444

4545
class partial(Generic[_T]):

0 commit comments

Comments
 (0)