diff options
author | Jarrod Millman <millman@berkeley.edu> | 2008-12-31 23:25:03 +0000 |
---|---|---|
committer | Jarrod Millman <millman@berkeley.edu> | 2008-12-31 23:25:03 +0000 |
commit | 8c448a31743b9ea5bc18e06dfa42c078206ca529 (patch) | |
tree | ce25aed9f383011568653d7761918eeb11ba7dde | |
parent | 1bb5bb5529d78ba95e76c802544f8b6efa84ec33 (diff) | |
download | numpy-8c448a31743b9ea5bc18e06dfa42c078206ca529.tar.gz |
ran reindent
-rw-r--r-- | numpy/core/setup.py | 4 | ||||
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 6 | ||||
-rw-r--r-- | numpy/distutils/command/config.py | 4 | ||||
-rw-r--r-- | numpy/distutils/fcompiler/gnu.py | 42 | ||||
-rw-r--r-- | numpy/distutils/mingw32ccompiler.py | 6 | ||||
-rwxr-xr-x | numpy/f2py/f2py2e.py | 2 | ||||
-rw-r--r-- | numpy/lib/function_base.py | 16 | ||||
-rw-r--r-- | numpy/lib/utils.py | 8 | ||||
-rw-r--r-- | numpy/linalg/linalg.py | 2 | ||||
-rw-r--r-- | numpy/ma/core.py | 34 | ||||
-rw-r--r-- | numpy/ma/mrecords.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_core.py | 12 | ||||
-rw-r--r-- | numpy/ma/tests/test_extras.py | 4 | ||||
-rw-r--r-- | numpy/ma/tests/test_subclassing.py | 2 | ||||
-rw-r--r-- | numpy/numarray/util.py | 2 | ||||
-rw-r--r-- | numpy/oldnumeric/arrayfns.py | 4 | ||||
-rw-r--r-- | numpy/oldnumeric/mlab.py | 2 | ||||
-rw-r--r-- | numpy/oldnumeric/rng.py | 2 | ||||
-rw-r--r-- | numpy/testing/decorators.py | 2 | ||||
-rw-r--r-- | numpy/testing/noseclasses.py | 2 |
20 files changed, 78 insertions, 80 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py index dbae644cd..25e0c9301 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -67,8 +67,8 @@ def check_math_capabilities(config, moredefs, mathlibs): # Mandatory functions: if not found, fail the build mandatory_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", - "floor", "ceil", "sqrt", "log10", "log", "exp", "asin", - "acos", "atan", "fmod", 'modf', 'frexp', 'ldexp'] + "floor", "ceil", "sqrt", "log10", "log", "exp", "asin", + "acos", "atan", "fmod", 'modf', 'frexp', 'ldexp'] if not check_funcs_once(mandatory_funcs): raise SystemError("One of the required function to build numpy is not" diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index d165fc293..1c3977cc4 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -955,7 +955,7 @@ class TestChoose(TestCase): self.x = 2*ones((3,),dtype=int) self.y = 3*ones((3,),dtype=int) self.x2 = 2*ones((2,3), dtype=int) - self.y2 = 3*ones((2,3), dtype=int) + self.y2 = 3*ones((2,3), dtype=int) self.ind = [0,0,1] def test_basic(self): @@ -965,11 +965,11 @@ class TestChoose(TestCase): def test_broadcast1(self): A = np.choose(self.ind, (self.x2, self.y2)) assert_equal(A, [[2,2,3],[2,2,3]]) - + def test_broadcast2(self): A = np.choose(self.ind, (self.x, self.y2)) assert_equal(A, [[2,2,3],[2,2,3]]) - + if __name__ == "__main__": run_module_suite() diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py index 1526dd411..408b9f0b4 100644 --- a/numpy/distutils/command/config.py +++ b/numpy/distutils/command/config.py @@ -53,11 +53,11 @@ class config(old_config): self.compiler.initialize() except IOError, e: msg = """\ -Could not initialize compiler instance: do you have Visual Studio +Could not initialize compiler instance: do you have Visual Studio installed ? If you are trying to build with mingw, please use python setup.py build -c mingw32 instead ). If you have Visual Studio installed, check it is correctly installed, and the right version (VS 2008 for python 2.6, VS 2003 for -2.5, etc...). Original exception was: %s, and the Compiler +2.5, etc...). Original exception was: %s, and the Compiler class was %s ============================================================================""" \ % (e, self.compiler.__class__.__name__) diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py index 7b642aff3..800677399 100644 --- a/numpy/distutils/fcompiler/gnu.py +++ b/numpy/distutils/fcompiler/gnu.py @@ -272,30 +272,30 @@ class Gnu95FCompiler(GnuFCompiler): def get_library_dirs(self): opt = GnuFCompiler.get_library_dirs(self) - if sys.platform == 'win32': - c_compiler = self.c_compiler - if c_compiler and c_compiler.compiler_type == "msvc": - target = self.get_target() - if target: + if sys.platform == 'win32': + c_compiler = self.c_compiler + if c_compiler and c_compiler.compiler_type == "msvc": + target = self.get_target() + if target: d = os.path.normpath(self.get_libgcc_dir()) - root = os.path.join(d, os.pardir, os.pardir, os.pardir, os.pardir) - mingwdir = os.path.normpath(os.path.join(root, target, "lib")) - full = os.path.join(mingwdir, "libmingwex.a") - if os.path.exists(full): - opt.append(mingwdir) - return opt + root = os.path.join(d, os.pardir, os.pardir, os.pardir, os.pardir) + mingwdir = os.path.normpath(os.path.join(root, target, "lib")) + full = os.path.join(mingwdir, "libmingwex.a") + if os.path.exists(full): + opt.append(mingwdir) + return opt def get_libraries(self): opt = GnuFCompiler.get_libraries(self) if sys.platform == 'darwin': opt.remove('cc_dynamic') - if sys.platform == 'win32': - c_compiler = self.c_compiler - if c_compiler and c_compiler.compiler_type == "msvc": - if "gcc" in opt: - i = opt.index("gcc") - opt.insert(i+1, "mingwex") - opt.insert(i+1, "mingw32") + if sys.platform == 'win32': + c_compiler = self.c_compiler + if c_compiler and c_compiler.compiler_type == "msvc": + if "gcc" in opt: + i = opt.index("gcc") + opt.insert(i+1, "mingwex") + opt.insert(i+1, "mingw32") return opt def get_target(self): @@ -303,9 +303,9 @@ class Gnu95FCompiler(GnuFCompiler): ['-v'], use_tee=0) if not status: - m = TARGET_R.search(output) - if m: - return m.group(1) + m = TARGET_R.search(output) + if m: + return m.group(1) return "" if __name__ == '__main__': diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py index 19cb22a1b..5975272b2 100644 --- a/numpy/distutils/mingw32ccompiler.py +++ b/numpy/distutils/mingw32ccompiler.py @@ -327,15 +327,15 @@ def check_embedded_msvcr_match_linked(msver): def configtest_name(config): base = os.path.basename(config._gen_temp_sourcefile("yo", [], "c")) return os.path.splitext(base)[0] - + def manifest_name(config): - # Get configest name (including suffix) + # Get configest name (including suffix) root = configtest_name(config) exext = config.compiler.exe_extension return root + exext + ".manifest" def rc_name(config): - # Get configest name (including suffix) + # Get configest name (including suffix) root = configtest_name(config) return root + ".rc" diff --git a/numpy/f2py/f2py2e.py b/numpy/f2py/f2py2e.py index 2fd4f6caa..264a01312 100755 --- a/numpy/f2py/f2py2e.py +++ b/numpy/f2py/f2py2e.py @@ -543,7 +543,7 @@ def run_compile(): setup(ext_modules = [ext]) if remove_build_dir and os.path.exists(build_dir): - import shutil + import shutil outmess('Removing build directory %s\n'%(build_dir)) shutil.rmtree(build_dir) diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 8bf20d3fb..425960639 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -228,10 +228,10 @@ def histogram(a, bins=10, range=None, normed=False, weights=None, new=None): * None : the new behaviour is used, no warning is printed. * True : the new behaviour is used and a warning is raised about the future removal of the `new` keyword. - * False : the old behaviour is used and a DeprecationWarning + * False : the old behaviour is used and a DeprecationWarning is raised. - As of NumPy 1.3, this keyword should not be used explicitly since it - will disappear in NumPy 1.4. + As of NumPy 1.3, this keyword should not be used explicitly since it + will disappear in NumPy 1.4. Returns ------- @@ -267,9 +267,9 @@ def histogram(a, bins=10, range=None, normed=False, weights=None, new=None): # Old behavior if new == False: warnings.warn(""" - The histogram semantics being used is now deprecated and - will disappear in NumPy 1.4. Please update your code to - use the default semantics. + The histogram semantics being used is now deprecated and + will disappear in NumPy 1.4. Please update your code to + use the default semantics. """, DeprecationWarning) a = asarray(a).ravel() @@ -320,8 +320,8 @@ def histogram(a, bins=10, range=None, normed=False, weights=None, new=None): elif new in [True, None]: if new is True: warnings.warn(""" - The new semantics of histogram is now the default and the `new` - keyword will be removed in NumPy 1.4. + The new semantics of histogram is now the default and the `new` + keyword will be removed in NumPy 1.4. """, Warning) a = asarray(a) if weights is not None: diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index d749f00b6..9717a7a8f 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -699,11 +699,11 @@ def _lookfor_generate_cache(module, import_modules, regenerate): # import sub-packages if import_modules and hasattr(item, '__path__'): - for pth in item.__path__: - for mod_path in os.listdir(pth): - init_py = os.path.join(pth, mod_path, '__init__.py') + for pth in item.__path__: + for mod_path in os.listdir(pth): + init_py = os.path.join(pth, mod_path, '__init__.py') if not os.path.isfile(init_py): - continue + continue if _all is not None and mod_path not in _all: continue try: diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 352b47549..583ab2f71 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -9,7 +9,7 @@ dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetrf, zgetrf, dpotrf, zpotrf, dgeqrf, zgeqrf, zungqr, dorgqr. """ -__all__ = ['matrix_power', 'solve', 'tensorsolve', 'tensorinv', 'inv', +__all__ = ['matrix_power', 'solve', 'tensorsolve', 'tensorinv', 'inv', 'cholesky', 'eigvals', 'eigvalsh', 'pinv', 'det', 'svd', 'eig', 'eigh','lstsq', 'norm', 'qr', 'cond', 'LinAlgError'] diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 8ee19778c..3ea5a3da5 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -54,7 +54,7 @@ __all__ = ['MAError', 'MaskError', 'MaskType', 'MaskedArray', 'rank', 'ravel', 'remainder', 'repeat', 'reshape', 'resize', 'right_shift', 'round_', 'round', 'set_fill_value', 'shape', 'sin', 'sinh', 'size', 'sometrue', - 'sort', 'soften_mask', 'sqrt', 'squeeze', 'std', 'subtract', 'sum', + 'sort', 'soften_mask', 'sqrt', 'squeeze', 'std', 'subtract', 'sum', 'swapaxes', 'take', 'tan', 'tanh', 'trace', 'transpose', 'true_divide', 'var', 'where', @@ -335,7 +335,7 @@ def common_fill_value(a, b): def filled(a, fill_value = None): """ Return `a` as an array where masked data have been replaced by `value`. - + If `a` is not a MaskedArray, `a` itself is returned. If `a` is a MaskedArray and `fill_value` is None, `fill_value` is set to `a.fill_value`. @@ -627,7 +627,7 @@ class _MaskedBinaryOperation: elif m: return masked return result -# +# # result = self.f(d1, d2, *args, **kwargs).view(get_masked_subclass(a, b)) # if len(result.shape): # if m is not nomask: @@ -1016,7 +1016,7 @@ def mask_or (m1, m2, copy=False, shrink=True): if current1.dtype.names: _recursive_mask_or(current1, m2[name], newmask[name]) else: - umath.logical_or(current1, m2[name], newmask[name]) + umath.logical_or(current1, m2[name], newmask[name]) return # if (m1 is nomask) or (m1 is False): @@ -1041,7 +1041,7 @@ def flatten_mask(mask): """ Returns a completely flattened version of the mask, where nested fields are collapsed. - + Parameters ---------- mask : array_like @@ -1064,7 +1064,7 @@ def flatten_mask(mask): >>> mask = np.array([(0, (0, 0)), (0, (0, 1))], dtype=mdtype) >>> flatten_mask(mask) array([False, False, False, False, False, True], dtype=bool) - + """ # def _flatmask(mask): @@ -1711,7 +1711,7 @@ class MaskedArray(ndarray): if dtype is None: dtype = output.dtype mdtype = make_mask_descr(dtype) - + output._mask = self._mask.view(mdtype, ndarray) output._mask.shape = output.shape # Make sure to reset the _fill_value if needed @@ -3144,7 +3144,7 @@ masked_%(name)s(data = %(data)s, index_array : ndarray, int Array of indices that sort `a` along the specified axis. In other words, ``a[index_array]`` yields a sorted `a`. - + See Also -------- sort : Describes sorting algorithms used. @@ -3471,7 +3471,7 @@ masked_%(name)s(data = %(data)s, outmask = out._mask = make_mask_none(out.shape) outmask.flat = newmask else: - + if out.dtype.kind in 'biu': errmsg = "Masked data information would be lost in one or more"\ " location." @@ -4016,12 +4016,12 @@ sort.__doc__ = MaskedArray.sort.__doc__ def compressed(x): """ Return a 1-D array of all the non-masked data. - + See Also -------- MaskedArray.compressed equivalent method - + """ if getmask(x) is nomask: return np.asanyarray(x) @@ -4389,8 +4389,8 @@ def inner(a, b): Returns the inner product of a and b for arrays of floating point types. Like the generic NumPy equivalent the product sum is over the last dimension - of a and b. - + of a and b. + Notes ----- The first argument is not conjugated. @@ -4460,7 +4460,7 @@ def allclose (a, b, masked_equal=True, rtol=1.e-5, atol=1.e-8, fill_value=None): fill_value : boolean, optional Whether masked values in a or b are considered equal (True) or not (False). - + rtol : Relative tolerance The relative difference is equal to `rtol` * `b`. atol : Absolute tolerance @@ -4483,7 +4483,7 @@ def allclose (a, b, masked_equal=True, rtol=1.e-5, atol=1.e-8, fill_value=None): True. absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) - + Return True if all elements of a and b are equal subject to given tolerances. @@ -4519,7 +4519,7 @@ def allclose (a, b, masked_equal=True, rtol=1.e-5, atol=1.e-8, fill_value=None): def asarray(a, dtype=None): """ Convert the input to a masked array. - + Parameters ---------- a : array_like @@ -4531,7 +4531,7 @@ def asarray(a, dtype=None): order : {'C', 'F'}, optional Whether to use row-major ('C') or column-major ('FORTRAN') memory representation. Defaults to 'C'. - + Returns ------- out : ndarray diff --git a/numpy/ma/mrecords.py b/numpy/ma/mrecords.py index d5c03c22d..72e78f507 100644 --- a/numpy/ma/mrecords.py +++ b/numpy/ma/mrecords.py @@ -357,7 +357,7 @@ The fieldname base is either `_data` or `_mask`.""" dtype = None else: output = ndarray.view(self, dtype) - # OK, there's the change + # OK, there's the change except TypeError: dtype = np.dtype(dtype) # we need to revert to MaskedArray, but keeping the possibility diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index 5c65ef5f4..09bd647d1 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -777,7 +777,7 @@ class TestMaskedArrayArithmetic(TestCase): test = mod(xm, ym) assert_equal(test, np.mod(xm, ym)) assert_equal(test.mask, mask_or(mask_or(xm.mask, ym.mask), (ym == 0))) - + def test_TakeTransposeInnerOuter(self): @@ -1452,7 +1452,7 @@ class TestMaskedArrayMethods(TestCase): a *= 1e-8 a[0] = 0 self.failUnless(allclose(a, 0, masked_equal=True)) - + def test_allany(self): """Checks the any/all methods/functions.""" @@ -2088,7 +2088,7 @@ class TestMaskArrayMathMethod(TestCase): assert_equal(out, [0, 4, 8]) assert_equal(out.mask, [0, 1, 0]) out = diag(out) - control = array([[0, 0, 0], [0, 4, 0], [0, 0, 8]], + control = array([[0, 0, 0], [0, 4, 0], [0, 0, 8]], mask = [[0, 0, 0], [0, 1, 0], [0, 0, 0]]) assert_equal(out, control) @@ -2559,7 +2559,7 @@ class TestMaskedArrayFunctions(TestCase): test = flatten_mask(mask) control = np.array([0, 0, 0, 1], dtype=bool) assert_equal(test, control) - + mdtype = [('a', bool), ('b', [('ba', bool), ('bb', bool)])] data = [(0, (0, 0)), (0, (0, 1))] mask = np.array(data, dtype=mdtype) @@ -2707,7 +2707,7 @@ class TestMaskedView(TestCase): self.failUnless(isinstance(test, MaskedArray)) assert_equal(test._data, a._data) assert_equal(test._mask, a._mask) - + # def test_view_to_type(self): (data, a, controlmask) = self.data @@ -2743,7 +2743,7 @@ class TestMaskedView(TestCase): assert_equal(test.dtype.names, ('A', 'B')) assert_equal(test['A'], a['a'][-1]) assert_equal(test['B'], a['b'][-1]) - + # def test_view_to_subdtype(self): (data, a, controlmask) = self.data diff --git a/numpy/ma/tests/test_extras.py b/numpy/ma/tests/test_extras.py index 344dfce5a..7c051377a 100644 --- a/numpy/ma/tests/test_extras.py +++ b/numpy/ma/tests/test_extras.py @@ -22,7 +22,7 @@ class TestGeneric(TestCase): # def test_masked_all(self): "Tests masked_all" - # Standard dtype + # Standard dtype test = masked_all((2,), dtype=float) control = array([1, 1], mask=[1, 1], dtype=float) assert_equal(test, control) @@ -53,7 +53,7 @@ class TestGeneric(TestCase): def test_masked_all_like(self): "Tests masked_all" - # Standard dtype + # Standard dtype base = array([1, 2], dtype=float) test = masked_all_like(base) control = array([1, 1], mask=[1, 1], dtype=float) diff --git a/numpy/ma/tests/test_subclassing.py b/numpy/ma/tests/test_subclassing.py index 939b8ee56..5943ad6c1 100644 --- a/numpy/ma/tests/test_subclassing.py +++ b/numpy/ma/tests/test_subclassing.py @@ -153,5 +153,3 @@ class TestSubclassing(TestCase): ################################################################################ if __name__ == '__main__': run_module_suite() - - diff --git a/numpy/numarray/util.py b/numpy/numarray/util.py index 01002f194..3f0fc20d0 100644 --- a/numpy/numarray/util.py +++ b/numpy/numarray/util.py @@ -1,7 +1,7 @@ import os import numpy -__all__ = ['MathDomainError', 'UnderflowError', 'NumOverflowError', +__all__ = ['MathDomainError', 'UnderflowError', 'NumOverflowError', 'handleError', 'get_numarray_include_dirs'] class MathDomainError(ArithmeticError): pass diff --git a/numpy/oldnumeric/arrayfns.py b/numpy/oldnumeric/arrayfns.py index dbb910770..230b200a9 100644 --- a/numpy/oldnumeric/arrayfns.py +++ b/numpy/oldnumeric/arrayfns.py @@ -1,8 +1,8 @@ """Backward compatible with arrayfns from Numeric """ -__all__ = ['array_set', 'construct3', 'digitize', 'error', 'find_mask', - 'histogram', 'index_sort', 'interp', 'nz', 'reverse', 'span', +__all__ = ['array_set', 'construct3', 'digitize', 'error', 'find_mask', + 'histogram', 'index_sort', 'interp', 'nz', 'reverse', 'span', 'to_corners', 'zmin_zmax'] import numpy as np diff --git a/numpy/oldnumeric/mlab.py b/numpy/oldnumeric/mlab.py index c11e34c1f..151649f6a 100644 --- a/numpy/oldnumeric/mlab.py +++ b/numpy/oldnumeric/mlab.py @@ -1,7 +1,7 @@ # This module is for compatibility only. All functions are defined elsewhere. __all__ = ['rand', 'tril', 'trapz', 'hanning', 'rot90', 'triu', 'diff', 'angle', - 'roots', 'ptp', 'kaiser', 'randn', 'cumprod', 'diag', 'msort', + 'roots', 'ptp', 'kaiser', 'randn', 'cumprod', 'diag', 'msort', 'LinearAlgebra', 'RandomArray', 'prod', 'std', 'hamming', 'flipud', 'max', 'blackman', 'corrcoef', 'bartlett', 'eye', 'squeeze', 'sinc', 'tri', 'cov', 'svd', 'min', 'median', 'fliplr', 'eig', 'mean'] diff --git a/numpy/oldnumeric/rng.py b/numpy/oldnumeric/rng.py index b4c72a68c..28d3f16df 100644 --- a/numpy/oldnumeric/rng.py +++ b/numpy/oldnumeric/rng.py @@ -5,7 +5,7 @@ __all__ = ['CreateGenerator','ExponentialDistribution','LogNormalDistribution', - 'NormalDistribution', 'UniformDistribution', 'error', 'ranf', + 'NormalDistribution', 'UniformDistribution', 'error', 'ranf', 'default_distribution', 'random_sample', 'standard_generator'] import numpy.random.mtrand as mt diff --git a/numpy/testing/decorators.py b/numpy/testing/decorators.py index 5d8f863d2..418c1d9fa 100644 --- a/numpy/testing/decorators.py +++ b/numpy/testing/decorators.py @@ -89,7 +89,7 @@ def knownfailureif(skip_condition, msg=None): Parameters --------- skip_condition : bool - Flag to determine whether to mark test as known failure (True) + Flag to determine whether to mark test as known failure (True) or not (False) msg : string Message to give on raising a KnownFailureTest exception diff --git a/numpy/testing/noseclasses.py b/numpy/testing/noseclasses.py index d838a5f84..ef2f90745 100644 --- a/numpy/testing/noseclasses.py +++ b/numpy/testing/noseclasses.py @@ -251,7 +251,7 @@ class KnownFailureTest(Exception): class KnownFailure(ErrorClassPlugin): - '''Plugin that installs a KNOWNFAIL error class for the + '''Plugin that installs a KNOWNFAIL error class for the KnownFailureClass exception. When KnownFailureTest is raised, the exception will be logged in the knownfail attribute of the result, 'K' or 'KNOWNFAIL' (verbose) will be output, and the |