Skip to content

Commit

Permalink
fixed whitespace w/ reindent
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodmillman committed May 22, 2008
1 parent 0e968fd commit 9525f46
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 49 deletions.
1 change: 0 additions & 1 deletion numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,3 @@ def test(*args, **kw):
print 'Python version %s' % (sys.version.replace('\n', '',),)
return NumpyTest().test(*args, **kw)
test.__doc__ = NumpyTest.test.__doc__

8 changes: 4 additions & 4 deletions numpy/core/scons_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,17 @@ def define_no_smp():
nosmp = 0
return nosmp == 1

array_api_gen_bld = Builder(action = Action(do_generate_array_api, '$ARRAPIGENCOMSTR'),
array_api_gen_bld = Builder(action = Action(do_generate_array_api, '$ARRAPIGENCOMSTR'),
emitter = [generate_api_emitter,
distutils_dirs_emitter])

ufunc_api_gen_bld = Builder(action = Action(do_generate_ufunc_api, '$UFUNCAPIGENCOMSTR'),
ufunc_api_gen_bld = Builder(action = Action(do_generate_ufunc_api, '$UFUNCAPIGENCOMSTR'),
emitter = [generate_api_emitter,
distutils_dirs_emitter])

template_bld = Builder(action = Action(generate_from_template, '$TEMPLATECOMSTR'),
template_bld = Builder(action = Action(generate_from_template, '$TEMPLATECOMSTR'),
emitter = [generate_from_template_emitter,
distutils_dirs_emitter])

umath_bld = Builder(action = Action(generate_umath, '$UMATHCOMSTR'),
umath_bld = Builder(action = Action(generate_umath, '$UMATHCOMSTR'),
emitter = [generate_umath_emitter, distutils_dirs_emitter])
2 changes: 1 addition & 1 deletion numpy/core/tests/test_defmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,6 @@ def check_list_indexing(self):
assert_array_equal(x[[2,1,0],:],x[::-1,:])



if __name__ == "__main__":
NumpyTest().run()
2 changes: 1 addition & 1 deletion numpy/core/tests/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ def check_compress_small_type(self, level=rlevel):
except TypeError:
pass


def check_recarray_tolist(self, level=rlevel):
"""Ticket #793, changeset r5215
"""
Expand Down
6 changes: 3 additions & 3 deletions numpy/distutils/command/scons.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def find_common(seq1, seq2):
"""Given two list, return the index of the common items.
The index are relative to seq1.
Note: do not handle duplicate items."""
dict2 = dict([(i, None) for i in seq2])

Expand Down Expand Up @@ -288,7 +288,7 @@ def finalize_options(self):
cxxcompiler.customize_cmd(self)
self.cxxcompiler = cxxcompiler.cxx_compiler()
#print self.cxxcompiler.compiler_cxx[0]

if self.package_list:
self.package_list = parse_package_list(self.package_list)

Expand All @@ -314,7 +314,7 @@ def run(self):
scons_exec = get_python_exec_invoc()
scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py'))

if self.package_list is not None:
if self.package_list is not None:
id = select_packages(self.pkg_names, self.package_list)
sconscripts = [self.sconscripts[i] for i in id]
pre_hooks = [self.pre_hooks[i] for i in id]
Expand Down
1 change: 0 additions & 1 deletion numpy/distutils/conv_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,3 @@ def unique_key(adict):
allstr = fid.read()
writestr = process_str(allstr)
outfile.write(writestr)

1 change: 0 additions & 1 deletion numpy/doc/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,3 @@ def foo(var1, var2, long_var_name='hi') :
"""

pass

36 changes: 18 additions & 18 deletions numpy/lib/tests/test_function_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def check_simple_new(self):
assert_array_equal(a, 10)

def check_normed_new(self):
# Check that the integral of the density equals 1.
# Check that the integral of the density equals 1.
n = 100
v = rand(n)
a,b = histogram(v, normed=True, new=True)
Expand All @@ -466,49 +466,49 @@ def check_normed_new(self):
a,b = histogram(v, bins, normed=True, new=True)
area = sum(a*diff(b))
assert_almost_equal(area, 1)


def check_outliers_new(self):
# Check that outliers are not tallied
a = arange(10)+.5

# Lower outliers
h,b = histogram(a, range=[0,9], new=True)
assert_equal(h.sum(),9)

# Upper outliers
h,b = histogram(a, range=[1,10], new=True)
assert_equal(h.sum(),9)

# Normalization
h,b = histogram(a, range=[1,9], normed=True, new=True)
assert_equal((h*diff(b)).sum(),1)

# Weights
w = arange(10)+.5
h,b = histogram(a, range=[1,9], weights=w, normed=True, new=True)
assert_equal((h*diff(b)).sum(),1)

h,b = histogram(a, bins=8, range=[1,9], weights=w, new=True)
assert_equal(h, w[1:-1])


def check_type_new(self):
# Check the type of the returned histogram
a = arange(10)+.5
h,b = histogram(a, new=True)
assert(issubdtype(h.dtype, int))

h,b = histogram(a, normed=True, new=True)
assert(issubdtype(h.dtype, float))

h,b = histogram(a, weights=ones(10, int), new=True)
assert(issubdtype(h.dtype, int))

h,b = histogram(a, weights=ones(10, float), new=True)
assert(issubdtype(h.dtype, float))


def check_weights_new(self):
v = rand(100)
w = ones(100)*5
Expand All @@ -518,19 +518,19 @@ def check_weights_new(self):
nwa,nwb = histogram(v, weights=w, normed=True, new=True)
assert_array_almost_equal(a*5, wa)
assert_array_almost_equal(na, nwa)

# Check weights are properly applied.
v = linspace(0,10,10)
w = concatenate((zeros(5), ones(5)))
wa,wb = histogram(v, bins=arange(11),weights=w, new=True)
assert_array_almost_equal(wa, w)

# Check with integer weights
wa, wb = histogram([1,2,2,4], bins=4, weights=[4,3,2,1], new=True)
assert_array_equal(wa, [4,5,0,1])
wa, wb = histogram([1,2,2,4], bins=4, weights=[4,3,2,1], normed=True, new=True)
assert_array_equal(wa, array([4,5,0,1])/10./3.*4)

class TestHistogramdd(NumpyTestCase):
def check_simple(self):
x = array([[-.5, .5, 1.5], [-.5, 1.5, 2.5], [-.5, 2.5, .5], \
Expand Down
13 changes: 6 additions & 7 deletions numpy/ma/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ def __new__(cls, data=None, mask=nomask, dtype=None, copy=False,
#
def _update_from(self, obj):
"""Copies some attributes of obj to self.
"""
"""
if obj is not None and isinstance(obj,ndarray):
_baseclass = type(obj)
else:
Expand All @@ -1237,7 +1237,7 @@ def _update_from(self, obj):
_baseclass=getattr(obj,'_baseclass',_baseclass),
_basedict=_basedict,)
self.__dict__.update(_dict)
self.__dict__.update(_basedict)
self.__dict__.update(_basedict)
return
#........................
def __array_finalize__(self,obj):
Expand Down Expand Up @@ -1368,7 +1368,7 @@ def __setitem__(self, indx, value):
return
#....
dval = narray(value, copy=False, dtype=self.dtype)
valmask = getmask(value)
valmask = getmask(value)
if self._mask is nomask:
# Set the data, then the mask
ndarray.__setitem__(self._data,indx,dval)
Expand Down Expand Up @@ -2893,17 +2893,17 @@ def power(a, b, third=None):
result[invalid] = masked
result._data[invalid] = result.fill_value
return result

# if fb.dtype.char in typecodes["Integer"]:
# return masked_array(umath.power(fa, fb), m)
# m = mask_or(m, (fa < 0) & (fb != fb.astype(int)))
# m = mask_or(m, (fa < 0) & (fb != fb.astype(int)))
# if m is nomask:
# return masked_array(umath.power(fa, fb))
# else:
# fa = fa.copy()
# if m.all():
# fa.flat = 1
# else:
# else:
# numpy.putmask(fa,m,1)
# return masked_array(umath.power(fa, fb), m)

Expand Down Expand Up @@ -3420,4 +3420,3 @@ def __call__(self, a, *args, **params):
clip = numpy.clip

###############################################################################

6 changes: 3 additions & 3 deletions numpy/ma/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ def vander(x, n=None):

def polyfit(x, y, deg, rcond=None, full=False):
"""%s
Notes
-----
Any masked values in x is propagated in y, and vice-versa.
Expand Down Expand Up @@ -876,7 +876,7 @@ def polyfit(x, y, deg, rcond=None, full=False):
x = x / scale
# solve least squares equation for powers of x
v = vander(x, order)
c, resids, rank, s = _lstsq(v, y.filled(0), rcond)
c, resids, rank, s = _lstsq(v, y.filled(0), rcond)
# warn on rank reduction, which indicates an ill conditioned matrix
if rank != order and not full:
warnings.warn("Polyfit may be poorly conditioned", np.RankWarning)
Expand All @@ -890,7 +890,7 @@ def polyfit(x, y, deg, rcond=None, full=False):
return c, resids, rank, s, rcond
else :
return c

_g = globals()
for nfunc in ('vander', 'polyfit'):
_g[nfunc].func_doc = _g[nfunc].func_doc % getattr(np,nfunc).__doc__
Expand Down
5 changes: 2 additions & 3 deletions numpy/ma/mrecords.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ def __setitem__(self, indx, value):
"Sets the given record to value."
MaskedArray.__setitem__(self, indx, value)
if isinstance(indx, basestring):
self._fieldmask[indx] = ma.getmaskarray(value)
self._fieldmask[indx] = ma.getmaskarray(value)

#............................................
def __setslice__(self, i, j, value):
"Sets the slice described by [i,j] to `value`."
Expand Down Expand Up @@ -780,4 +780,3 @@ def addfield(mrecord, newfield, newfieldname=None):
return newdata

###############################################################################

6 changes: 3 additions & 3 deletions numpy/ma/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def test_scalararithmetic(self):
# Make sure we don't lose the shape in some circumstances
xm = array((0,0))/0.
assert_equal(xm.shape,(2,))
assert_equal(xm.mask,[1,1])
assert_equal(xm.mask,[1,1])
#.........................
def test_basic_ufuncs (self):
"Test various functions such as sin, cos."
Expand Down Expand Up @@ -1376,7 +1376,7 @@ def test_compressed(self):
a[0,0] = masked
b = a.compressed()
assert_equal(b, [[2,3,4]])


def test_tolist(self):
"Tests to list"
Expand Down Expand Up @@ -1582,7 +1582,7 @@ def test_power(self):
assert_equal(x._mask, y._mask)
assert_almost_equal(x,y)
assert_almost_equal(x._data,y._data)



###############################################################################
Expand Down
4 changes: 2 additions & 2 deletions numpy/ma/tests/test_mrecords.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def test_set_fields(self):
rdata['num'] = val
assert_equal(rdata.num, val)
assert_equal(rdata.num.mask, [1,0,0])

#
def test_set_mask(self):
base = self.base.copy()
Expand Down Expand Up @@ -297,7 +297,7 @@ def test_fromarrays(self):
# One record only
_x = ma.array([1,1.1,'one'], mask=[1,0,0],)
assert_equal_records(fromarrays(_x, dtype=mrec.dtype), mrec[0])



def test_fromrecords(self):
Expand Down
2 changes: 1 addition & 1 deletion numpy/ma/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def almost(a, b, decimal=6, fill_value=True):
y = filled(masked_array(d2, copy=False, mask=m), 1).astype(float_)
d = N.around(N.abs(x-y),decimal) <= 10.0**(-decimal)
return d.ravel()


#................................................
def _assert_equal_on_sequences(actual, desired, err_msg=''):
Expand Down

0 comments on commit 9525f46

Please sign in to comment.