8000 Merge pull request #4937 from charris/pep8-numpy-random · numpy/numpy@4475f1e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4475f1e

Browse files
committed
Merge pull request #4937 from charris/pep8-numpy-random
Pep8 numpy random
2 parents 3f165d4 + 275b1dd commit 4475f1e

File tree

4 files changed

+171
-175
lines changed

4 files changed

+171
-175
lines changed

numpy/random/mtrand/mtrand.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ cdef class RandomState:
10681068
if pop_size is 0:
10691069
raise ValueError("a must be non-empty")
10701070

1071-
if None != p:
1071+
if p is not None:
10721072
d = len(p)
10731073
p = <ndarray>PyArray_ContiguousFromObject(p, NPY_DOUBLE, 1, 1)
10741074
pix = <double*>PyArray_DATA(p)
@@ -1090,7 +1090,7 @@ cdef class RandomState:
10901090

10911091
# Actual sampling
10921092
if replace:
1093-
if None != p:
1093+
if p is not None:
10941094
cdf = p.cumsum()
10951095
cdf /= cdf[-1]
10961096
uniform_samples = self.random_sample(shape)
@@ -1103,7 +1103,7 @@ cdef class RandomState:
11031103
raise ValueError("Cannot take a larger sample than "
11041104
"population when 'replace=False'")
11051105

1106-
if None != p:
1106+
if p is not None:
11071107
if np.count_nonzero(p > 0) < size:
11081108
raise ValueError("Fewer non-zero entries in p than size")
11091109
n_uniq = 0

numpy/random/setup.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ def generate_libraries(ext, build_dir):
4545
['mtrand.c', 'randomkit.c', 'initarray.c',
4646
'distributions.c']]+[generate_libraries],
4747
libraries=libs,
48-
depends = [join('mtrand', '*.h'),
49-
join('mtrand', '*.pyx'),
50-
join('mtrand', '*.pxi'),
51-
],
52-
define_macros = defs,
53-
)
48+
depends=[join('mtrand', '*.h'),
49+
join('mtrand', '*.pyx'),
50+
join('mtrand', '*.pxi'),],
51+
define_macros=defs,
52+
)
5453

5554
config.add_data_files(('.', join('mtrand', 'randomkit.h')))
5655
config.add_data_dir('tests')

0 commit comments

Comments
 (0)
0