diff options
author | Jarrod Millman <millman@berkeley.edu> | 2008-08-08 04:33:45 +0000 |
---|---|---|
committer | Jarrod Millman <millman@berkeley.edu> | 2008-08-08 04:33:45 +0000 |
commit | 70ed0f238156680efba9b4028810f3aed486357b (patch) | |
tree | e5e0f42e586156ed74128cff0fe84404398b918b /numpy/core | |
parent | 0da812e06828be6749b1840b48c4f100dc3dfd68 (diff) | |
download | numpy-70ed0f238156680efba9b4028810f3aed486357b.tar.gz |
ran reindent
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/code_generators/docstrings.py | 1 | ||||
-rw-r--r-- | numpy/core/numeric.py | 2 | ||||
-rw-r--r-- | numpy/core/records.py | 4 | ||||
-rw-r--r-- | numpy/core/scons_support.py | 2 | ||||
-rw-r--r-- | numpy/core/setup.py | 2 | ||||
-rw-r--r-- | numpy/core/setupscons.py | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_defchararray.py | 6 | ||||
-rw-r--r-- | numpy/core/tests/test_defmatrix.py | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_memmap.py | 1 | ||||
-rw-r--r-- | numpy/core/tests/test_numeric.py | 1 | ||||
-rw-r--r-- | numpy/core/tests/test_numerictypes.py | 3 | ||||
-rw-r--r-- | numpy/core/tests/test_records.py | 3 | ||||
-rw-r--r-- | numpy/core/tests/test_regression.py | 4 | ||||
-rw-r--r-- | numpy/core/tests/test_scalarmath.py | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_umath.py | 30 | ||||
-rw-r--r-- | numpy/core/tests/test_unicode.py | 21 |
16 files changed, 40 insertions, 46 deletions
diff --git a/numpy/core/code_generators/docstrings.py b/numpy/core/code_generators/docstrings.py index e6e6ab0f2..7271a509d 100644 --- a/numpy/core/code_generators/docstrings.py +++ b/numpy/core/code_generators/docstrings.py @@ -2234,4 +2234,3 @@ add_newdoc('numpy.core.umath', 'true_divide', equivalent to true division in Python. """) - diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 40f14cd79..449754f87 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1778,7 +1778,7 @@ class errstate(object): """with errstate(**state): --> operations in following block use given state. # Set error handling to known state. - >>> _ = np.seterr(invalid='raise', divide='raise', over='raise', + >>> _ = np.seterr(invalid='raise', divide='raise', over='raise', ... under='ignore') >>> a = -np.arange(3) diff --git a/numpy/core/records.py b/numpy/core/records.py index 545330a30..6f94c3e9f 100644 --- a/numpy/core/records.py +++ b/numpy/core/records.py @@ -551,7 +551,7 @@ def fromrecords(recList, dtype=None, shape=None, formats=None, names=None, >>> r.col1 array([456, 2]) >>> r.col2 - chararray(['dbe', 'de'], + chararray(['dbe', 'de'], dtype='|S3') >>> import cPickle >>> print cPickle.loads(cPickle.dumps(r)) @@ -639,7 +639,7 @@ def fromfile(fd, dtype=None, shape=None, offset=0, formats=None, >>> a.tofile(fd) >>> >>> fd.seek(0) - >>> r=np.core.records.fromfile(fd, formats='f8,i4,a5', shape=10, + >>> r=np.core.records.fromfile(fd, formats='f8,i4,a5', shape=10, ... byteorder='<') >>> print r[5] (0.5, 10, 'abcde') diff --git a/numpy/core/scons_support.py b/numpy/core/scons_support.py index c4a0ef6de..d8190537a 100644 --- a/numpy/core/scons_support.py +++ b/numpy/core/scons_support.py @@ -185,7 +185,7 @@ def define_no_smp(): array_api_gen_bld = Builder(action = Action(do_generate_numpy_api, '$ARRAPIGENCOMSTR'), emitter = generate_api_emitter) - + ufunc_api_gen_bld = Builder(action = Action(do_generate_ufunc_api, '$UFUNCAPIGENCOMSTR'), emitter = generate_api_emitter) diff --git a/numpy/core/setup.py b/numpy/core/setup.py index 1f4f23d82..531df6a2e 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -190,7 +190,7 @@ def configuration(parent_package='',top_path=None): "See previous error messages for more information." moredefs = [] - + # Check wether we can use inttypes (C99) formats if config_cmd.check_decl('PRIdPTR', headers = ['inttypes.h']): moredefs.append(('NPY_USE_C99_FORMATS', 1)) diff --git a/numpy/core/setupscons.py b/numpy/core/setupscons.py index 322b341e3..be42246ad 100644 --- a/numpy/core/setupscons.py +++ b/numpy/core/setupscons.py @@ -51,7 +51,7 @@ def configuration(parent_package='',top_path=None): # XXX: I really have to think about how to communicate path info # between scons and distutils, and set the options at one single # location. - target = join(get_scons_pkg_build_dir(config.name), + target = join(get_scons_pkg_build_dir(config.name), 'include/numpy/numpyconfig.h') incl_dir = os.path.dirname(target) if incl_dir not in config.numpy_include_dirs: diff --git a/numpy/core/tests/test_defchararray.py b/numpy/core/tests/test_defchararray.py index 8abeccc6c..8fa189df4 100644 --- a/numpy/core/tests/test_defchararray.py +++ b/numpy/core/tests/test_defchararray.py @@ -47,7 +47,7 @@ class TestOperations(TestCase): # [A[1,0]*r, A[1,1]*r]]).view(np.chararray) # # assert all(Ar == (self.A * r)) - + for ob in [object(), 'qrs']: try: A * ob @@ -63,7 +63,7 @@ class TestOperations(TestCase): # [A[1,0]*r, A[1,1]*r]]).view(np.chararray) # # assert all(Ar == (r * self.A)) - + for ob in [object(), 'qrs']: try: ob * A @@ -78,7 +78,7 @@ class TestOperations(TestCase): def test_rmod(self): assert ("%s" % self.A) == str(self.A) assert ("%r" % self.A) == repr(self.A) - + for ob in [42, object()]: try: ob % self.A diff --git a/numpy/core/tests/test_defmatrix.py b/numpy/core/tests/test_defmatrix.py index 8e28dcbe1..87dc8596c 100644 --- a/numpy/core/tests/test_defmatrix.py +++ b/numpy/core/tests/test_defmatrix.py @@ -200,7 +200,7 @@ class TestAlgebra(TestCase): mA2 = matrix(A) mA2 *= 3 assert allclose(mA2.A, 3*A) - + def test_notimplemented(self): '''Check that 'not implemented' operations produce a failure.''' A = matrix([[1., 2.], diff --git a/numpy/core/tests/test_memmap.py b/numpy/core/tests/test_memmap.py index 32c01621e..9d940ede9 100644 --- a/numpy/core/tests/test_memmap.py +++ b/numpy/core/tests/test_memmap.py @@ -48,4 +48,3 @@ class TestMemmap(TestCase): if __name__ == "__main__": run_module_suite() - diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py index 83aaf5f45..126ed1973 100644 --- a/numpy/core/tests/test_numeric.py +++ b/numpy/core/tests/test_numeric.py @@ -887,4 +887,3 @@ class TestLikeFuncs(TestCase): if __name__ == "__main__": run_module_suite() - diff --git a/numpy/core/tests/test_numerictypes.py b/numpy/core/tests/test_numerictypes.py index f8ffddbd7..745f48737 100644 --- a/numpy/core/tests/test_numerictypes.py +++ b/numpy/core/tests/test_numerictypes.py @@ -252,7 +252,7 @@ class read_values_nested: self._buffer[1][4]], dtype='f8')) assert_equal(h['z'], np.array([self._buffer[0][5], self._buffer[1][5]], dtype='u1')) - + def test_nested1_acessors(self): """Check reading the nested fields of a nested array (1st level)""" @@ -356,4 +356,3 @@ class TestCommonType(TestCase): if __name__ == "__main__": run_module_suite() - diff --git a/numpy/core/tests/test_records.py b/numpy/core/tests/test_records.py index 8239da5c7..85306b1af 100644 --- a/numpy/core/tests/test_records.py +++ b/numpy/core/tests/test_records.py @@ -57,7 +57,7 @@ class TestFromrecords(TestCase): y = eval("np." + repr(x)) assert isinstance(y, np.recarray) assert_equal(y, x) - + def test_recarray_from_names(self): ra = np.rec.array([ (1, 'abc', 3.7000002861022949, 0), @@ -130,4 +130,3 @@ def test_find_duplicate(): if __name__ == "__main__": run_module_suite() - diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py index aa924fac8..33d12b61c 100644 --- a/numpy/core/tests/test_regression.py +++ b/numpy/core/tests/test_regression.py @@ -1070,9 +1070,9 @@ class TestRegression(TestCase): dat = TestArray([[1,2,3,4],[5,6,7,8]],'jubba') assert dat.info == 'jubba' dat.resize((4,2)) - assert dat.info == 'jubba' + assert dat.info == 'jubba' dat.sort() - assert dat.info == 'jubba' + assert dat.info == 'jubba' dat.fill(2) assert dat.info == 'jubba' dat.put([2,3,4],[6,3,4]) diff --git a/numpy/core/tests/test_scalarmath.py b/numpy/core/tests/test_scalarmath.py index 1b1fc7b2d..bb1ada66b 100644 --- a/numpy/core/tests/test_scalarmath.py +++ b/numpy/core/tests/test_scalarmath.py @@ -86,7 +86,7 @@ class TestRepr(TestCase): last_exponent_bit_idx = finfo.nexp storage_bytes = np.dtype(t).itemsize*8 # could add some more types to the list below - for which in ['small denorm','small norm']: + for which in ['small denorm','small norm']: # Values from http://en.wikipedia.org/wiki/IEEE_754 constr = np.array([0x00]*storage_bytes,dtype=np.uint8) if which == 'small denorm': diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index eda52f961..0f5a3365c 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -211,11 +211,11 @@ class TestComplexFunctions(object): yield _check_branch_cut, np.log10, -0.5, 1j, 1, -1, True yield _check_branch_cut, np.log1p, -1.5, 1j, 1, -1, True yield _check_branch_cut, np.sqrt, -0.5, 1j, 1, -1 - + yield _check_branch_cut, np.arcsin, [ -2, 2], [1j, -1j], 1, -1 yield _check_branch_cut, np.arccos, [ -2, 2], [1j, -1j], 1, -1 yield _check_branch_cut, np.arctan, [-2j, 2j], [1, -1 ], -1, 1 - + yield _check_branch_cut, np.arcsinh, [-2j, 2j], [-1, 1], -1, 1 yield _check_branch_cut, np.arccosh, [ -1, 0.5], [1j, 1j], 1, -1 yield _check_branch_cut, np.arctanh, [ -2, 2], [1j, -1j], 1, -1 @@ -239,7 +239,7 @@ class TestComplexFunctions(object): yield _check_branch_cut, np.arccosh, [ -1, 0.5], [1j, 1j], 1, -1, True yield _check_branch_cut, np.arctanh, [ -2, 2], [1j, -1j], 1, -1, True test_branch_cuts_failing = dec.skipknownfailure(test_branch_cuts_failing) - + def test_against_cmath(self): import cmath, sys @@ -248,7 +248,7 @@ class TestComplexFunctions(object): broken_cmath_asinh = False if sys.version_info < (2,5,3): broken_cmath_asinh = True - + points = [-2, 2j, 2, -2j, -1-1j, -1+1j, +1-1j, +1+1j] name_map = {'arcsin': 'asin', 'arccos': 'acos', 'arctan': 'atan', 'arcsinh': 'asinh', 'arccosh': 'acosh', 'arctanh': 'atanh'} @@ -261,20 +261,20 @@ class TestComplexFunctions(object): for p in points: a = complex(func(np.complex_(p))) b = cfunc(p) - + if cname == 'asinh' and broken_cmath_asinh: - continue + continue assert abs(a - b) < atol, "%s %s: %s; cmath: %s"%(fname,p,a,b) class TestC99(object): """Check special functions at special points against the C99 standard""" # NB: inherits from object instead of TestCase since using test generators - + # # Non-conforming results are with XXX added to the exception field. # - + def test_clog(self): for p, v, e in [ ((-0., 0.), (-inf, pi), 'divide'), @@ -292,7 +292,7 @@ class TestC99(object): ((+nan, nan), (nan, nan), 'XXX'), # raises 'invalid' on some platfs ]: yield self._check, np.log, p, v, e - + def test_csqrt(self): for p, v, e in [ ((-0., 0.), (0.,0.), 'XXX'), # now (-0., 0.) @@ -391,7 +391,7 @@ class TestC99(object): got = "(%s, %s)" % (repr(got.real), repr(got.imag)) expected = "(%s, %s)" % (repr(value.real), repr(value.imag)) assert got == expected, (got, expected) - + # check exceptions if exc in ('divide', 'invalid', 'over', 'under'): v[exc] = 'raise' @@ -442,24 +442,24 @@ def _check_branch_cut(f, x0, dx, re_sign=1, im_sign=-1, sig_zero_ok=False, """ x0 = np.atleast_1d(x0).astype(dtype) dx = np.atleast_1d(dx).astype(dtype) - + scale = np.finfo(dtype).eps * 1e3 atol = 1e-4 - + y0 = f(x0) yp = f(x0 + dx*scale*np.absolute(x0)/np.absolute(dx)) ym = f(x0 - dx*scale*np.absolute(x0)/np.absolute(dx)) - + assert np.all(np.absolute(y0.real - yp.real) < atol), (y0, yp) assert np.all(np.absolute(y0.imag - yp.imag) < atol), (y0, yp) assert np.all(np.absolute(y0.real - ym.real*re_sign) < atol), (y0, ym) assert np.all(np.absolute(y0.imag - ym.imag*im_sign) < atol), (y0, ym) - + if sig_zero_ok: # check that signed zeros also work as a displacement jr = (x0.real == 0) & (dx.real != 0) ji = (x0.imag == 0) & (dx.imag != 0) - + x = -x0 x.real[jr] = 0.*dx.real x.imag[ji] = 0.*dx.imag diff --git a/numpy/core/tests/test_unicode.py b/numpy/core/tests/test_unicode.py index 3d7492414..4968b28ac 100644 --- a/numpy/core/tests/test_unicode.py +++ b/numpy/core/tests/test_unicode.py @@ -214,31 +214,31 @@ class test_assign_values_1_ucs4(assign_values, TestCase): """Check the assignment of valued arrays (size 1, UCS4 values)""" ulen = 1 ucs_value = ucs4_value - + class test_assign_values_2_ucs2(assign_values, TestCase): """Check the assignment of valued arrays (size 2, UCS2 values)""" ulen = 2 ucs_value = ucs2_value - + class test_assign_values_2_ucs4(assign_values, TestCase): """Check the assignment of valued arrays (size 2, UCS4 values)""" ulen = 2 ucs_value = ucs4_value - + class test_assign_values_1009_ucs2(assign_values, TestCase): """Check the assignment of valued arrays (size 1009, UCS2 values)""" ulen = 1009 ucs_value = ucs2_value - + class test_assign_values_1009_ucs4(assign_values, TestCase): """Check the assignment of valued arrays (size 1009, UCS4 values)""" ulen = 1009 ucs_value = ucs4_value - + ############################################################ @@ -286,31 +286,31 @@ class test_byteorder_1_ucs2(byteorder_values, TestCase): """Check the byteorder in unicode (size 1, UCS2 values)""" ulen = 1 ucs_value = ucs2_value - + class test_byteorder_1_ucs4(byteorder_values, TestCase): """Check the byteorder in unicode (size 1, UCS4 values)""" ulen = 1 ucs_value = ucs4_value - + class test_byteorder_2_ucs2(byteorder_values, TestCase): """Check the byteorder in unicode (size 2, UCS2 values)""" ulen = 2 ucs_value = ucs2_value - + class test_byteorder_2_ucs4(byteorder_values, TestCase): """Check the byteorder in unicode (size 2, UCS4 values)""" ulen = 2 ucs_value = ucs4_value - + class test_byteorder_1009_ucs2(byteorder_values, TestCase): """Check the byteorder in unicode (size 1009, UCS2 values)""" ulen = 1009 ucs_value = ucs2_value - + class test_byteorder_1009_ucs4(byteorder_values, TestCase): """Check the byteorder in unicode (size 1009, UCS4 values)""" @@ -320,4 +320,3 @@ class test_byteorder_1009_ucs4(byteorder_values, TestCase): if __name__ == "__main__": run_module_suite() - |