diff --git a/.mypyignore-todo b/.mypyignore-todo index 6150cb02..cf72c506 100644 --- a/.mypyignore-todo +++ b/.mypyignore-todo @@ -1,4 +1,4 @@ scipy\.stats\.__all__ scipy\.stats\.(Normal|Uniform) -scipy\.stats\.(_distribution_infrastructure\.)?(abs|exp|make_distribution|order_statistic) +scipy\.stats\.(_distribution_infrastructure\.)?(make_distribution|order_statistic) scipy\.stats\._distribution_infrastructure\.(Folded|OrderStatistic)Distribution\.__init__ diff --git a/scipy-stubs/stats/__init__.pyi b/scipy-stubs/stats/__init__.pyi index a69f8aa7..ef0b0e18 100644 --- a/scipy-stubs/stats/__init__.pyi +++ b/scipy-stubs/stats/__init__.pyi @@ -7,7 +7,7 @@ from ._correlation import chatterjeexi from ._covariance import Covariance # TODO(jorenham) -from ._distribution_infrastructure import Mixture, exp, log, truncate # abs, make_distribution, order_statistic +from ._distribution_infrastructure import Mixture, abs, exp, log, truncate # make_distribution, order_statistic from ._entropy import differential_entropy, entropy from ._fit import fit, goodness_of_fit from ._hypotests import ( @@ -314,7 +314,7 @@ __all__ = [ # "Normal", "PermutationMethod", # "Uniform", - # "abs", + "abs", "alexandergovern", "alpha", "anderson", diff --git a/scipy-stubs/stats/_distribution_infrastructure.pyi b/scipy-stubs/stats/_distribution_infrastructure.pyi index 6d279b84..ad92e599 100644 --- a/scipy-stubs/stats/_distribution_infrastructure.pyi +++ b/scipy-stubs/stats/_distribution_infrastructure.pyi @@ -438,8 +438,56 @@ class FoldedDistribution( TransformedDistribution[_CDistT_co, _FloatingT_co, _ShapeT0_co], Generic[_CDistT_co, _FloatingT_co, _ShapeT0_co], ): - # TODO(jorenham) - ... + @overload + def __init__( + self: FoldedDistribution[_CDistT0, np.floating[Any], tuple[()]], + X: _CDistT0, + /, + *args: Never, + tol: opt.Just[float] | _Null = ..., + validation_policy: _ValidationPolicy = None, + cache_policy: _CachePolicy = None, + ) -> None: ... + @overload + def __init__( + self: FoldedDistribution[_CDistT1, np.floating[Any], tuple[int]], + X: _CDistT1, + /, + *args: Never, + tol: opt.Just[float] | _Null = ..., + validation_policy: _ValidationPolicy = None, + cache_policy: _CachePolicy = None, + ) -> None: ... + @overload + def __init__( + self: FoldedDistribution[_CDistT2, np.floating[Any], tuple[int, int]], + X: _CDistT2, + /, + *args: Never, + tol: opt.Just[float] | _Null = ..., + validation_policy: _ValidationPolicy = None, + cache_policy: _CachePolicy = None, + ) -> None: ... + @overload + def __init__( + self: FoldedDistribution[_CDistT3, np.floating[Any], tuple[int, int, int]], + X: _CDistT3, + /, + *args: Never, + tol: opt.Just[float] | _Null = ..., + validation_policy: _ValidationPolicy = None, + cache_policy: _CachePolicy = None, + ) -> None: ... + @overload + def __init__( + self: FoldedDistribution[_CDistT, np.floating[Any], tuple[int, ...]], + X: _CDistT, + /, + *args: Never, + tol: opt.Just[float] | _Null = ..., + validation_policy: _ValidationPolicy = None, + cache_policy: _CachePolicy = None, + ) -> None: ... class TruncatedDistribution( TransformedDistribution[_CDistT_co, _FloatingT_co, _ShapeT0_co], @@ -515,10 +563,6 @@ class TruncatedDistribution( cache_policy: _CachePolicy = None, ) -> None: ... -class OrderStatisticDistribution(TransformedDistribution[_CDistT_co, np.float64, _ShapeT0_co], Generic[_CDistT_co, _ShapeT0_co]): - # TODO(jorenham) - ... - # without HKT there's no reasonable way tot determine the floating scalar type class MonotonicTransformedDistribution( TransformedDistribution[_CDistT_co, np.floating[Any], _ShapeT0_co], @@ -547,6 +591,10 @@ class MonotonicTransformedDistribution( cache_policy: _CachePolicy = None, ) -> None: ... +class OrderStatisticDistribution(TransformedDistribution[_CDistT_co, np.float64, _ShapeT0_co], Generic[_CDistT_co, _ShapeT0_co]): + # TODO(jorenham) + ... + class Mixture(_BaseDistribution[_FloatingT_co, tuple[()]], Generic[_FloatingT_co]): _shape: tuple[()] _dtype: np.dtype[_FloatingT_co] @@ -600,6 +648,18 @@ def truncate( ub: onp.ToFloat | onp.ToFloatND = ..., ) -> TruncatedDistribution[_CDistT, np.floating[Any], tuple[int, ...]]: ... +# +@overload +def abs(X: _CDistT0, /) -> FoldedDistribution[_CDistT0, np.floating[Any], tuple[()]]: ... +@overload +def abs(X: _CDistT1, /) -> FoldedDistribution[_CDistT1, np.floating[Any], tuple[int]]: ... +@overload +def abs(X: _CDistT2, /) -> FoldedDistribution[_CDistT2, np.floating[Any], tuple[int, int]]: ... +@overload +def abs(X: _CDistT3, /) -> FoldedDistribution[_CDistT3, np.floating[Any], tuple[int, int, int]]: ... +@overload +def abs(X: _CDistT, /) -> FoldedDistribution[_CDistT, np.floating[Any], tuple[int, ...]]: ... + # @overload def exp(X: _CDistT0, /) -> MonotonicTransformedDistribution[_CDistT0, tuple[()]]: ...