mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 04:34:28 +08:00
@@ -3,7 +3,7 @@
|
||||
from decimal import Decimal
|
||||
from fractions import Fraction
|
||||
import sys
|
||||
from typing import Any, Iterable, List, Optional, SupportsFloat, Type, TypeVar, Union, Protocol
|
||||
from typing import Any, Iterable, List, Optional, SupportsFloat, Type, TypeVar, Union, Protocol, Hashable
|
||||
|
||||
_T = TypeVar("_T")
|
||||
# Most functions in this module accept homogeneous collections of one of these types
|
||||
@@ -14,6 +14,9 @@ class _Sortable(Protocol):
|
||||
def __lt__(self, other) -> bool: ...
|
||||
_SortableT = TypeVar("_SortableT", bound=_Sortable)
|
||||
|
||||
# Used in mode, multimode
|
||||
_HashableT = TypeVar("_HashableT", bound=Hashable)
|
||||
|
||||
class StatisticsError(ValueError): ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
@@ -26,9 +29,9 @@ def median(data: Iterable[_Number]) -> _Number: ...
|
||||
def median_low(data: Iterable[_SortableT]) -> _SortableT: ...
|
||||
def median_high(data: Iterable[_SortableT]) -> _SortableT: ...
|
||||
def median_grouped(data: Iterable[_Number], interval: _Number = ...) -> _Number: ...
|
||||
def mode(data: Iterable[_Number]) -> _Number: ...
|
||||
def mode(data: Iterable[_HashableT]) -> _HashableT: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def multimode(data: Iterable[_T]) -> List[_T]: ...
|
||||
def multimode(data: Iterable[_HashableT]) -> List[_HashableT]: ...
|
||||
def pstdev(data: Iterable[_Number], mu: Optional[_Number] = ...) -> _Number: ...
|
||||
def pvariance(data: Iterable[_Number], mu: Optional[_Number] = ...) -> _Number: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
|
||||
Reference in New Issue
Block a user