diff --git a/scipy-stubs/stats/_multicomp.pyi b/scipy-stubs/stats/_multicomp.pyi index a9d23150..7925fd37 100644 --- a/scipy-stubs/stats/_multicomp.pyi +++ b/scipy-stubs/stats/_multicomp.pyi @@ -3,9 +3,8 @@ from typing import Literal import numpy as np import numpy.typing as npt -from scipy import stats as stats -from scipy._lib._util import DecimalNumber as DecimalNumber, SeedType as SeedType -from scipy.stats._common import ConfidenceInterval as ConfidenceInterval +from scipy._typing import AnyReal, Seed +from ._common import ConfidenceInterval __all__ = ["dunnett"] @@ -13,11 +12,11 @@ __all__ = ["dunnett"] class DunnettResult: statistic: npt.NDArray[np.float64] pvalue: npt.NDArray[np.float64] - def confidence_interval(self, confidence_level: DecimalNumber = 0.95) -> ConfidenceInterval: ... + def confidence_interval(self, confidence_level: AnyReal = 0.95) -> ConfidenceInterval: ... def dunnett( *samples: npt.ArrayLike, control: npt.ArrayLike, alternative: Literal["two-sided", "less", "greater"] = "two-sided", - random_state: SeedType = None, + random_state: Seed | None = None, ) -> DunnettResult: ... diff --git a/scipy-stubs/stats/_qmc.pyi b/scipy-stubs/stats/_qmc.pyi index 57d02ab6..8fc41b59 100644 --- a/scipy-stubs/stats/_qmc.pyi +++ b/scipy-stubs/stats/_qmc.pyi @@ -1,10 +1,10 @@ from abc import ABC, abstractmethod from typing import ClassVar, Literal, TypeVar, overload +from typing_extensions import override import numpy as np import numpy.typing as npt -from scipy._lib._util import DecimalNumber, IntNumber, SeedType -from scipy._typing import Untyped, UntypedArray +from scipy._typing import AnyInt, AnyReal, Seed, Untyped, UntypedArray __all__ = [ "Halton", @@ -23,7 +23,7 @@ __all__ = [ _RNGT = TypeVar("_RNGT", bound=np.random.Generator | np.random.RandomState) @overload -def check_random_state(seed: IntNumber | None = ...) -> np.random.Generator: ... +def check_random_state(seed: AnyInt | None = ...) -> np.random.Generator: ... @overload def check_random_state(seed: _RNGT) -> _RNGT: ... def scale(sample: npt.ArrayLike, l_bounds: npt.ArrayLike, u_bounds: npt.ArrayLike, *, reverse: bool = False) -> UntypedArray: ... @@ -32,25 +32,25 @@ def discrepancy( *, iterative: bool = False, method: Literal["CD", "WD", "MD", "L2-star"] = "CD", - workers: IntNumber = 1, + workers: AnyInt = 1, ) -> float: ... def geometric_discrepancy( sample: npt.ArrayLike, method: Literal["mindist", "mst"] = "mindist", metric: str = "euclidean", ) -> float: ... -def update_discrepancy(x_new: npt.ArrayLike, sample: npt.ArrayLike, initial_disc: DecimalNumber) -> float: ... +def update_discrepancy(x_new: npt.ArrayLike, sample: npt.ArrayLike, initial_disc: AnyReal) -> float: ... def primes_from_2_to(n: int) -> UntypedArray: ... -def n_primes(n: IntNumber) -> list[int]: ... +def n_primes(n: AnyInt) -> list[int]: ... def van_der_corput( - n: IntNumber, - base: IntNumber = 2, + n: AnyInt, + base: AnyInt = 2, *, - start_index: IntNumber = 0, + start_index: AnyInt = 0, scramble: bool = False, permutations: npt.ArrayLike | None = None, - seed: SeedType = None, - workers: IntNumber = 1, + seed: Seed | None = None, + workers: AnyInt = 1, ) -> UntypedArray: ... class QMCEngine(ABC): @@ -62,23 +62,23 @@ class QMCEngine(ABC): @abstractmethod def __init__( self, - d: IntNumber, + d: AnyInt, *, optimization: Literal["random-cd", "lloyd"] | None = None, - seed: SeedType = None, + seed: Seed | None = None, ) -> None: ... - def random(self, n: IntNumber = 1, *, workers: IntNumber = 1) -> UntypedArray: ... + def random(self, n: AnyInt = 1, *, workers: AnyInt = 1) -> UntypedArray: ... def integers( self, l_bounds: npt.ArrayLike, *, u_bounds: npt.ArrayLike | None = None, - n: IntNumber = 1, + n: AnyInt = 1, endpoint: bool = False, - workers: IntNumber = 1, + workers: AnyInt = 1, ) -> UntypedArray: ... def reset(self) -> QMCEngine: ... - def fast_forward(self, n: IntNumber) -> QMCEngine: ... + def fast_forward(self, n: AnyInt) -> QMCEngine: ... class Halton(QMCEngine): seed: Untyped @@ -86,25 +86,25 @@ class Halton(QMCEngine): scramble: Untyped def __init__( self, - d: IntNumber, + d: AnyInt, *, scramble: bool = True, optimization: Literal["random-cd", "lloyd"] | None = None, - seed: SeedType = None, - ): ... + seed: Seed | None = None, + ) -> None: ... class LatinHypercube(QMCEngine): scramble: Untyped lhs_method: Untyped def __init__( self, - d: IntNumber, + d: AnyInt, *, scramble: bool = True, strength: int = 1, optimization: Literal["random-cd", "lloyd"] | None = None, - seed: SeedType = None, - ): ... + seed: Seed | None = None, + ) -> None: ... class Sobol(QMCEngine): MAXDIM: ClassVar[int] @@ -113,16 +113,18 @@ class Sobol(QMCEngine): maxn: Untyped def __init__( self, - d: IntNumber, + d: AnyInt, *, scramble: bool = True, - bits: IntNumber | None = None, - seed: SeedType = None, + bits: AnyInt | None = None, + seed: Seed | None = None, optimization: Literal["random-cd", "lloyd"] | None = None, - ): ... - def random_base2(self, m: IntNumber) -> UntypedArray: ... + ) -> None: ... + def random_base2(self, m: AnyInt) -> UntypedArray: ... + @override def reset(self) -> Sobol: ... - def fast_forward(self, n: IntNumber) -> Sobol: ... + @override + def fast_forward(self, n: AnyInt) -> Sobol: ... class PoissonDisk(QMCEngine): hypersphere_method: Untyped @@ -134,17 +136,18 @@ class PoissonDisk(QMCEngine): grid_size: Untyped def __init__( self, - d: IntNumber, + d: AnyInt, *, - radius: DecimalNumber = 0.05, + radius: AnyReal = 0.05, hypersphere: Literal["volume", "surface"] = "volume", - ncandidates: IntNumber = 30, + ncandidates: AnyInt = 30, optimization: Literal["random-cd", "lloyd"] | None = None, - seed: SeedType = None, + seed: Seed | None = None, l_bounds: npt.ArrayLike | None = None, u_bounds: npt.ArrayLike | None = None, - ): ... + ) -> None: ... def fill_space(self) -> UntypedArray: ... + @override def reset(self) -> PoissonDisk: ... class MultivariateNormalQMC: @@ -157,13 +160,20 @@ class MultivariateNormalQMC: cov_root: npt.ArrayLike | None = None, inv_transform: bool = True, engine: QMCEngine | None = None, - seed: SeedType = None, - ): ... - def random(self, n: IntNumber = 1) -> UntypedArray: ... + seed: Seed | None = None, + ) -> None: ... + def random(self, n: AnyInt = 1) -> UntypedArray: ... class MultinomialQMC: pvals: Untyped n_trials: Untyped engine: Untyped - def __init__(self, pvals: npt.ArrayLike, n_trials: IntNumber, *, engine: QMCEngine | None = None, seed: SeedType = None): ... - def random(self, n: IntNumber = 1) -> UntypedArray: ... + def __init__( + self, + pvals: npt.ArrayLike, + n_trials: AnyInt, + *, + engine: QMCEngine | None = None, + seed: Seed | None = None, + ) -> None: ... + def random(self, n: AnyInt = 1) -> UntypedArray: ... diff --git a/tests/stubtest/allowlist.txt b/tests/stubtest/allowlist.txt index d88cbba4..d660966e 100644 --- a/tests/stubtest/allowlist.txt +++ b/tests/stubtest/allowlist.txt @@ -6,11 +6,7 @@ scipy.optimize._typing # submodules scipy._lib.array_api_compat.* -scipy._lib.boost_math.* scipy._lib.cobyqa.* -scipy._lib.highs.* -scipy._lib.pocketfft.* -scipy._lib.unuran.* # internal testing scipy._lib.messagestream.__test__ @@ -62,7 +58,6 @@ scipy.sparse.linalg.eigen.test scipy.sparse.linalg.isolve.test scipy.sparse.linalg.tests.* scipy.sparse.tests.* -scipy.spatial.PytestTester scipy.spatial.tests.* scipy.spatial.transform.tests.* scipy.spatial.transform._rotation.__test__ @@ -72,13 +67,6 @@ scipy.stats._qmc_cy.__test__ scipy.stats._sobol.__test__ # undocumented & irrelevant internal scipy machinery -scipy._lib._uarray._backend.get_defaults -scipy._lib._uarray._backend.pickle_function -scipy._lib._uarray._backend.pickle_function -scipy._lib._uarray._backend.pickle_set_backend_context -scipy._lib._uarray._backend.pickle_skip_backend_context -scipy._lib._uarray._backend.pickle_state -scipy._lib._uarray._backend.unpickle_function scipy._lib.decorator.DEF scipy._lib.decorator.ArgSpec scipy._lib.decorator.FunctionMaker @@ -102,35 +90,4 @@ scipy._lib._ccallback.PyCFuncPtr # `final(T)` is impossible scipy._lib._docscrape.Parameter.__replace__ # py313 scipy._lib._pep440._Version.__replace__ # py313 scipy._lib._util.FullArgSpec.__replace__ # py313 -scipy._lib.decorator.ArgSpec.__replace__ # py313 scipy.integrate._quadrature.QMCQuadResult.__replace__ # py313 - -# TODO: -scipy.sparse._matrix.__all__ -scipy.sparse.csgraph.__all__ -scipy.sparse.csgraph._flow.__all__ -scipy.sparse.csgraph._laplacian.__all__ -scipy.sparse.csgraph._matching.__all__ -scipy.sparse.csgraph._min_spanning_tree.__all__ -scipy.sparse.csgraph._reordering.__all__ -scipy.sparse.csgraph._shortest_path.__all__ -scipy.sparse.csgraph._tools.__all__ -scipy.sparse.csgraph._traversal.__all__ -scipy.sparse.linalg._dsolve.__all__ -scipy.sparse.linalg._dsolve._superlu.__all__ -scipy.stats.__all__ -scipy.stats._binomtest.__all__ -scipy.stats._bws_test.__all__ -scipy.stats._censored_data.__all__ -scipy.stats._common.__all__ -scipy.stats._continuous_distns.__all__ -scipy.stats._discrete_distns.__all__ -scipy.stats._distn_infrastructure.__all__ -scipy.stats._distr_params.__all__ -scipy.stats.distributions.__all__ -scipy.stats.sampling.__all__ -scipy.stats.kde.* -scipy.stats.morestats.* -scipy.stats.mstats_basic.* -scipy.stats.mstats_extras.* -scipy.stats.stats.*