summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorKevin Sheppard <kevin.k.sheppard@gmail.com>2019-05-23 11:11:59 +0100
committermattip <matti.picus@gmail.com>2019-05-27 22:58:35 +0300
commit7c52c2810e20a9e483e564751b8e2342c97f56c2 (patch)
treea6de2e359d75a4a61e27ed1a5f3e3672386c3834 /numpy
parent9e5ae6156855e5a2e2edccaf0112362ecb6d31fc (diff)
downloadnumpy-7c52c2810e20a9e483e564751b8e2342c97f56c2.tar.gz
DOC: Add __all__ and document lock
Add docstring for lock Use __all__ to discuorage unless attributes from appearing
Diffstat (limited to 'numpy')
-rw-r--r--numpy/random/bounded_integers.pyx.in2
-rw-r--r--numpy/random/common.pyx3
-rw-r--r--numpy/random/dsfmt.pyx10
-rw-r--r--numpy/random/entropy.pyx2
-rw-r--r--numpy/random/generator.pyx12
-rw-r--r--numpy/random/mt19937.pyx10
-rw-r--r--numpy/random/philox.pyx10
-rw-r--r--numpy/random/threefry.pyx10
-rw-r--r--numpy/random/xoshiro256.pyx10
-rw-r--r--numpy/random/xoshiro512.pyx10
10 files changed, 78 insertions, 1 deletions
diff --git a/numpy/random/bounded_integers.pyx.in b/numpy/random/bounded_integers.pyx.in
index 9f385f521..93277652d 100644
--- a/numpy/random/bounded_integers.pyx.in
+++ b/numpy/random/bounded_integers.pyx.in
@@ -6,6 +6,8 @@ cimport numpy as np
from .distributions cimport *
+__all__ = []
+
np.import_array()
_integers_types = {'bool': (0, 2),
diff --git a/numpy/random/common.pyx b/numpy/random/common.pyx
index fdf930900..994de4345 100644
--- a/numpy/random/common.pyx
+++ b/numpy/random/common.pyx
@@ -8,6 +8,8 @@ cimport numpy as np
from .common cimport *
+__all__ = ['interface']
+
np.import_array()
interface = namedtuple('interface', ['state_address', 'state', 'next_uint64',
@@ -929,7 +931,6 @@ cdef object cont_f(void *func, bitgen_t *state, object size, object lock,
cdef int requirements = np.NPY_ALIGNED | np.NPY_FORCECAST
check_output(out, np.float32, size)
a_arr = <np.ndarray>np.PyArray_FROMANY(a, np.NPY_FLOAT32, 0, 0, requirements)
- # a_arr = <np.ndarray>np.PyArray_FROM_OTF(a, np.NPY_FLOAT32, np.NPY_ALIGNED)
is_scalar = np.PyArray_NDIM(a_arr) == 0
if not is_scalar:
diff --git a/numpy/random/dsfmt.pyx b/numpy/random/dsfmt.pyx
index cd6d92153..ea77b7821 100644
--- a/numpy/random/dsfmt.pyx
+++ b/numpy/random/dsfmt.pyx
@@ -14,6 +14,8 @@ from .common cimport *
from .distributions cimport bitgen_t
from .entropy import random_entropy
+__all__ = ['DSFMT']
+
np.import_array()
DEF DSFMT_MEXP = 19937
@@ -83,6 +85,14 @@ cdef class DSFMT:
``/dev/urandom`` (or the Windows analog) if available. If unavailable,
a 32-bit hash of the time and process ID is used.
+ Attributes
+ ----------
+ lock: threading.Lock
+ Lock instance that is shared so that the same bit git generator can
+ be used in multiple Generators without corrupting the state. Code that
+ generates values from a bit generator should hold the bit generator's
+ lock.
+
Notes
-----
``DSFMT`` provides a capsule containing function pointers that produce
diff --git a/numpy/random/entropy.pyx b/numpy/random/entropy.pyx
index 72b0a9851..ecbacd9c8 100644
--- a/numpy/random/entropy.pyx
+++ b/numpy/random/entropy.pyx
@@ -3,6 +3,8 @@ import numpy as np
from libc.stdint cimport uint32_t, uint64_t
+__all__ = ['random_entropy', 'seed_by_array']
+
np.import_array()
cdef extern from "src/splitmix64/splitmix64.h":
diff --git a/numpy/random/generator.pyx b/numpy/random/generator.pyx
index 9389e85ee..ae920fc9f 100644
--- a/numpy/random/generator.pyx
+++ b/numpy/random/generator.pyx
@@ -19,6 +19,18 @@ from .bounded_integers cimport *
from .common cimport *
from .distributions cimport *
+
+__all__ = ['Generator', 'beta', 'binomial', 'bytes', 'chisquare', 'choice',
+ 'dirichlet', 'exponential', 'f', 'gamma',
+ 'geometric', 'gumbel', 'hypergeometric', 'integers', 'laplace',
+ 'logistic', 'lognormal', 'logseries', 'multinomial',
+ 'multivariate_normal', 'negative_binomial', 'noncentral_chisquare',
+ 'noncentral_f', 'normal', 'pareto', 'permutation',
+ 'poisson', 'power', 'random', 'rayleigh', 'shuffle',
+ 'standard_cauchy', 'standard_exponential', 'standard_gamma',
+ 'standard_normal', 'standard_t', 'triangular',
+ 'uniform', 'vonmises', 'wald', 'weibull', 'zipf']
+
np.import_array()
diff --git a/numpy/random/mt19937.pyx b/numpy/random/mt19937.pyx
index 0579b3634..8b3ca3825 100644
--- a/numpy/random/mt19937.pyx
+++ b/numpy/random/mt19937.pyx
@@ -14,6 +14,8 @@ from .common cimport *
from .distributions cimport bitgen_t
from .entropy import random_entropy
+__all__ = ['MT19937']
+
np.import_array()
cdef extern from "src/mt19937/mt19937.h":
@@ -59,6 +61,14 @@ cdef class MT19937:
``/dev/urandom`` (or the Windows analog) if available. If unavailable,
a 32-bit hash of the time and process ID is used.
+ Attributes
+ ----------
+ lock: threading.Lock
+ Lock instance that is shared so that the same bit git generator can
+ be used in multiple Generators without corrupting the state. Code that
+ generates values from a bit generator should hold the bit generator's
+ lock.
+
Notes
-----
``MT19937`` provides a capsule containing function pointers that produce
diff --git a/numpy/random/philox.pyx b/numpy/random/philox.pyx
index 19fd64399..b36d65d69 100644
--- a/numpy/random/philox.pyx
+++ b/numpy/random/philox.pyx
@@ -11,6 +11,8 @@ from .common cimport *
from .distributions cimport bitgen_t
from .entropy import random_entropy, seed_by_array
+__all__ = ['Philox']
+
np.import_array()
DEF PHILOX_BUFFER_SIZE=4
@@ -78,6 +80,14 @@ cdef class Philox:
a Python int (long in 2.x) in [0, 2**128) or a 2-element uint64 array.
key and seed cannot both be used.
+ Attributes
+ ----------
+ lock: threading.Lock
+ Lock instance that is shared so that the same bit git generator can
+ be used in multiple Generators without corrupting the state. Code that
+ generates values from a bit generator should hold the bit generator's
+ lock.
+
Notes
-----
Philox is a 64-bit PRNG that uses a counter-based design based on weaker
diff --git a/numpy/random/threefry.pyx b/numpy/random/threefry.pyx
index d008cd828..02911528b 100644
--- a/numpy/random/threefry.pyx
+++ b/numpy/random/threefry.pyx
@@ -11,6 +11,8 @@ from .common cimport *
from .distributions cimport bitgen_t
from .entropy import random_entropy, seed_by_array
+__all__ = ['ThreeFry']
+
np.import_array()
DEF THREEFRY_BUFFER_SIZE=4
@@ -74,6 +76,14 @@ cdef class ThreeFry:
a Python int in [0, 2**256) or a 4-element uint64 array.
key and seed cannot both be used.
+ Attributes
+ ----------
+ lock: threading.Lock
+ Lock instance that is shared so that the same bit git generator can
+ be used in multiple Generators without corrupting the state. Code that
+ generates values from a bit generator should hold the bit generator's
+ lock.
+
Notes
-----
ThreeFry is a 64-bit PRNG that uses a counter-based design based on
diff --git a/numpy/random/xoshiro256.pyx b/numpy/random/xoshiro256.pyx
index 7258ea3fb..362139cfa 100644
--- a/numpy/random/xoshiro256.pyx
+++ b/numpy/random/xoshiro256.pyx
@@ -13,6 +13,8 @@ from .common cimport *
from .distributions cimport bitgen_t
from .entropy import random_entropy, seed_by_array
+__all__ = ['Xoshiro256']
+
np.import_array()
cdef extern from "src/xoshiro256/xoshiro256.h":
@@ -52,6 +54,14 @@ cdef class Xoshiro256:
from ``/dev/urandom`` (or the Windows analog) if available. If
unavailable, a hash of the time and process ID is used.
+ Attributes
+ ----------
+ lock: threading.Lock
+ Lock instance that is shared so that the same bit git generator can
+ be used in multiple Generators without corrupting the state. Code that
+ generates values from a bit generator should hold the bit generator's
+ lock.
+
Notes
-----
xoshiro256** is written by David Blackman and Sebastiano Vigna.
diff --git a/numpy/random/xoshiro512.pyx b/numpy/random/xoshiro512.pyx
index a2c0a4896..0505af207 100644
--- a/numpy/random/xoshiro512.pyx
+++ b/numpy/random/xoshiro512.pyx
@@ -13,6 +13,8 @@ from .common cimport *
from .distributions cimport bitgen_t
from .entropy import random_entropy, seed_by_array
+__all__ = ['Xoshiro512']
+
np.import_array()
cdef extern from "src/xoshiro512/xoshiro512.h":
@@ -52,6 +54,14 @@ cdef class Xoshiro512:
from ``/dev/urandom`` (or the Windows analog) if available. If
unavailable, a hash of the time and process ID is used.
+ Attributes
+ ----------
+ lock: threading.Lock
+ Lock instance that is shared so that the same bit git generator can
+ be used in multiple Generators without corrupting the state. Code that
+ generates values from a bit generator should hold the bit generator's
+ lock.
+
Notes
-----
xoshiro512** is written by David Blackman and Sebastiano Vigna.