-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
ENH: Add typing for np.random and Generator #17103
Copy link
Copy link
Closed
Labels
Description
NumPy supplies partial typing support. Currently random's methods and Generator do not have typing information which results in errors in mypy.
Reproducing code example:
Use mypy on any project that uses np.random and you will see output like
linearmodels/tests/iv/results/simulated-test-data.py:16: error: Module 'numpy.random' has no attribute 'multivariate_normal'
linearmodels/tests/iv/results/simulated-test-data.py:16: error: Module 'numpy.random' has no attribute 'seed'
linearmodels/tests/iv/results/simulated-test-data.py:69: error: Module has no attribute "chisquare"
linearmodels/panel/utility.py:496: error: Name 'np.random.RandomState' is not defined
linearmodels/panel/utility.py:534: error: Module has no attribute "RandomState"; maybe "__RandomState_ctor"?
Numpy/Python version information:
1.19.1 3.7.7 (default, May 7 2020, 21:25:33)
[GCC 7.3.0]
Reactions are currently unavailable