mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 14:01:55 +08:00
Stdlib: add 'obvious' default values (#9688)
This commit is contained in:
@@ -257,13 +257,13 @@ class int:
|
||||
@overload
|
||||
def __pow__(self, __x: Literal[0], __modulo: None) -> Literal[1]: ...
|
||||
@overload
|
||||
def __pow__(self, __x: _PositiveInteger, __modulo: None = ...) -> int: ...
|
||||
def __pow__(self, __x: _PositiveInteger, __modulo: None = None) -> int: ...
|
||||
@overload
|
||||
def __pow__(self, __x: _NegativeInteger, __modulo: None = ...) -> float: ...
|
||||
def __pow__(self, __x: _NegativeInteger, __modulo: None = None) -> float: ...
|
||||
# positive x -> int; negative x -> float
|
||||
# return type must be Any as `int | float` causes too many false-positive errors
|
||||
@overload
|
||||
def __pow__(self, __x: int, __modulo: None = ...) -> Any: ...
|
||||
def __pow__(self, __x: int, __modulo: None = None) -> Any: ...
|
||||
@overload
|
||||
def __pow__(self, __x: int, __modulo: int) -> int: ...
|
||||
def __rpow__(self, __x: int, __mod: int | None = None) -> Any: ...
|
||||
@@ -330,7 +330,7 @@ class float:
|
||||
def __rmod__(self, __x: float) -> float: ...
|
||||
def __rdivmod__(self, __x: float) -> tuple[float, float]: ...
|
||||
@overload
|
||||
def __rpow__(self, __x: _PositiveInteger, __modulo: None = ...) -> float: ...
|
||||
def __rpow__(self, __x: _PositiveInteger, __modulo: None = None) -> float: ...
|
||||
@overload
|
||||
def __rpow__(self, __x: _NegativeInteger, __mod: None = None) -> complex: ...
|
||||
# Returning `complex` for the general case gives too many false-positive errors.
|
||||
@@ -1450,30 +1450,30 @@ class map(Iterator[_S], Generic[_S]):
|
||||
|
||||
@overload
|
||||
def max(
|
||||
__arg1: SupportsRichComparisonT, __arg2: SupportsRichComparisonT, *_args: SupportsRichComparisonT, key: None = ...
|
||||
__arg1: SupportsRichComparisonT, __arg2: SupportsRichComparisonT, *_args: SupportsRichComparisonT, key: None = None
|
||||
) -> SupportsRichComparisonT: ...
|
||||
@overload
|
||||
def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], SupportsRichComparison]) -> _T: ...
|
||||
@overload
|
||||
def max(__iterable: Iterable[SupportsRichComparisonT], *, key: None = ...) -> SupportsRichComparisonT: ...
|
||||
def max(__iterable: Iterable[SupportsRichComparisonT], *, key: None = None) -> SupportsRichComparisonT: ...
|
||||
@overload
|
||||
def max(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsRichComparison]) -> _T: ...
|
||||
@overload
|
||||
def max(__iterable: Iterable[SupportsRichComparisonT], *, key: None = ..., default: _T) -> SupportsRichComparisonT | _T: ...
|
||||
def max(__iterable: Iterable[SupportsRichComparisonT], *, key: None = None, default: _T) -> SupportsRichComparisonT | _T: ...
|
||||
@overload
|
||||
def max(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsRichComparison], default: _T2) -> _T1 | _T2: ...
|
||||
@overload
|
||||
def min(
|
||||
__arg1: SupportsRichComparisonT, __arg2: SupportsRichComparisonT, *_args: SupportsRichComparisonT, key: None = ...
|
||||
__arg1: SupportsRichComparisonT, __arg2: SupportsRichComparisonT, *_args: SupportsRichComparisonT, key: None = None
|
||||
) -> SupportsRichComparisonT: ...
|
||||
@overload
|
||||
def min(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], SupportsRichComparison]) -> _T: ...
|
||||
@overload
|
||||
def min(__iterable: Iterable[SupportsRichComparisonT], *, key: None = ...) -> SupportsRichComparisonT: ...
|
||||
def min(__iterable: Iterable[SupportsRichComparisonT], *, key: None = None) -> SupportsRichComparisonT: ...
|
||||
@overload
|
||||
def min(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsRichComparison]) -> _T: ...
|
||||
@overload
|
||||
def min(__iterable: Iterable[SupportsRichComparisonT], *, key: None = ..., default: _T) -> SupportsRichComparisonT | _T: ...
|
||||
def min(__iterable: Iterable[SupportsRichComparisonT], *, key: None = None, default: _T) -> SupportsRichComparisonT | _T: ...
|
||||
@overload
|
||||
def min(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsRichComparison], default: _T2) -> _T1 | _T2: ...
|
||||
@overload
|
||||
@@ -1595,7 +1595,7 @@ class _SupportsPow2(Protocol[_E, _T_co]):
|
||||
def __pow__(self, __other: _E) -> _T_co: ...
|
||||
|
||||
class _SupportsPow3NoneOnly(Protocol[_E, _T_co]):
|
||||
def __pow__(self, __other: _E, __modulo: None = ...) -> _T_co: ...
|
||||
def __pow__(self, __other: _E, __modulo: None = None) -> _T_co: ...
|
||||
|
||||
class _SupportsPow3(Protocol[_E, _M, _T_co]):
|
||||
def __pow__(self, __other: _E, __modulo: _M) -> _T_co: ...
|
||||
|
||||
Reference in New Issue
Block a user