8000 Pep8 numpy random by charris · Pull Request #4937 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Pep8 numpy random #4937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions numpy/random/mtrand/mtrand.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ cdef class RandomState:
if pop_size is 0:
raise ValueError("a must be non-empty")

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

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

if None != p:
if p is not None:
if np.count_nonzero(p > 0) < size:
raise ValueError("Fewer non-zero entries in p than size")
n_uniq = 0
Expand Down
11 changes: 5 additions & 6 deletions numpy/random/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ def generate_libraries(ext, build_dir):
['mtrand.c', 'randomkit.c', 'initarray.c',
'distributions.c']]+[generate_libraries],
libraries=libs,
depends = [join('mtrand', '*.h'),
join('mtrand', '*.pyx'),
join('mtrand', '*.pxi'),
],
define_macros = defs,
)
depends=[join('mtrand', '*.h'),
join('mtrand', '*.pyx'),
join('mtrand', '*.pxi'),],
define_macros=defs,
)

config.add_data_files(('.', join('mtrand', 'randomkit.h')))
config.add_data_dir('tests')
Expand Down
Loading
0