From 75d2f6c881014b85849837be053513651abb5c26 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Tue, 10 May 2022 23:06:35 -0700 Subject: [PATCH] statistics: improve type for median_grouped (#7825) --- stdlib/statistics.pyi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stdlib/statistics.pyi b/stdlib/statistics.pyi index 540ccfcaa..e6c3d8f35 100644 --- a/stdlib/statistics.pyi +++ b/stdlib/statistics.pyi @@ -94,7 +94,13 @@ else: def median(data: Iterable[_NumberT]) -> _NumberT: ... def median_low(data: Iterable[SupportsRichComparisonT]) -> SupportsRichComparisonT: ... def median_high(data: Iterable[SupportsRichComparisonT]) -> SupportsRichComparisonT: ... -def median_grouped(data: Iterable[_NumberT], interval: _NumberT = ...) -> _NumberT: ... + +if sys.version_info >= (3, 11): + def median_grouped(data: Iterable[SupportsFloat], interval: SupportsFloat = ...) -> float: ... + +else: + def median_grouped(data: Iterable[_NumberT], interval: _NumberT = ...) -> _NumberT | float: ... + def mode(data: Iterable[_HashableT]) -> _HashableT: ... if sys.version_info >= (3, 8):