Skip to content

Commit

Permalink
MAINT, TYP: stats: add __init__.pyi and ignore errors in test_samplin…
Browse files Browse the repository at this point in the history
…g.py

Stubs were not getting exported as no __init__.pyi file was found by mypy.
This file has been added and other errors (false positives) have been ignored.
  • Loading branch information
tirthasheshpatel committed Jun 18, 2021
1 parent 6ae6b79 commit d2bcaa7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions mypy.ini
Expand Up @@ -393,6 +393,9 @@ ignore_errors = True
[mypy-scipy.stats.tests.test_qmc]
ignore_errors = True

[mypy-scipy.stats.tests.test_sampling]
ignore_errors = True

#
# Files referencing compiled code that needs stubs added.
#
Expand Down
5 changes: 4 additions & 1 deletion scipy/stats/unuran/__init__.py
@@ -1 +1,4 @@
from .unuran_wrapper import *
from .unuran_wrapper import (
TransformedDensityRejection,
DiscreteAliasUrn
)
4 changes: 4 additions & 0 deletions scipy/stats/unuran/__init__.pyi
@@ -0,0 +1,4 @@
from .unuran_wrapper import (
TransformedDensityRejection as TransformedDensityRejection,
DiscreteAliasUrn as DiscreteAliasUrn
)
4 changes: 2 additions & 2 deletions scipy/stats/unuran/unuran_wrapper.pyi
Expand Up @@ -27,7 +27,7 @@ class TDRDist(Protocol):


class TransformedDensityRejection(Method):
def __cinit__(self,
def __init__(self,
dist: TDRDist,
mode: None | float = ...,
center: None | float = ...,
Expand Down Expand Up @@ -62,7 +62,7 @@ class DAUDist(Protocol):
def pmf(self) -> Callable[..., float]: ...

class DiscreteAliasUrn(Method):
def __cinit__(self,
def __init__(self,
pv: None | npt.ArrayLike = ...,
dist: None | DAUDist = ...,
params: Tuple[Any, ...] = ...,
Expand Down

0 comments on commit d2bcaa7

Please sign in to comment.