Skip to content

Commit

Permalink
Merge pull request #41 from jorenham/fix/scipy.stats._distn_infrastru…
Browse files Browse the repository at this point in the history
…cture

various fixes and improvements in `scipy.stats._distn_infrastructure`
  • Loading branch information
jorenham authored Sep 7, 2024
2 parents 257eb2a + bf473f3 commit 4a33b59
Show file tree
Hide file tree
Showing 2 changed files with 376 additions and 465 deletions.
7 changes: 6 additions & 1 deletion scipy-stubs/_typing.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Helper types for internal use (type-check only).
from collections.abc import Callable
from collections.abc import Callable, Sequence
from typing import Any, Literal, Protocol, TypeAlias, type_check_only
from typing_extensions import LiteralString, TypeVar

import numpy as np
import optype as op
import optype.numpy as onpt

__all__ = [
Expand All @@ -14,6 +15,7 @@ __all__ = [
"AnyInt",
"AnyReal",
"AnyScalar",
"AnyShape",
"Array0D",
"CorrelateMode",
"NanPolicy",
Expand Down Expand Up @@ -46,6 +48,9 @@ AnyComplex: TypeAlias = int | float | complex | np.number[Any] | np.bool_
AnyChar: TypeAlias = str | bytes # `np.str_ <: builtins.str` and `np.bytes_ <: builtins.bytes`
AnyScalar: TypeAlias = int | float | complex | AnyChar | np.generic

# equivalent to `numpy._typing._shape._ShapeLike`
AnyShape: TypeAlias = op.CanIndex | Sequence[op.CanIndex]

# numpy literals
RNG: TypeAlias = np.random.Generator | np.random.RandomState
Seed: TypeAlias = int | RNG
Expand Down
Loading

0 comments on commit 4a33b59

Please sign in to comment.