diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-03-06 23:15:35 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-03-06 23:15:35 +0000 |
commit | 819578a1b2d5f9adf9ab6719e8b9b425c5ca7e00 (patch) | |
tree | e0dfce89c9c9fa810169d00979939a6218ceb842 | |
parent | 2ce56bc1c3faa7d2e9e4ba5e64e2a8bdd5bb5313 (diff) | |
download | numpy-819578a1b2d5f9adf9ab6719e8b9b425c5ca7e00.tar.gz |
Apply Tim's code-checker tests except for white-space-only changes.
-rw-r--r-- | numpy/core/arrayprint.py | 14 | ||||
-rw-r--r-- | numpy/core/defmatrix.py | 5 | ||||
-rw-r--r-- | numpy/core/numeric.py | 4 | ||||
-rw-r--r-- | numpy/core/numerictypes.py | 7 | ||||
-rw-r--r-- | numpy/core/records.py | 4 | ||||
-rw-r--r-- | numpy/core/tests/test_ma.py | 1 |
6 files changed, 15 insertions, 20 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index 4e5db082a..a78601188 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -79,7 +79,7 @@ def set_printoptions(precision=None, threshold=None, edgeitems=None, linewidth the number of characters per line for the purpose of inserting line breaks. (default 75) - supress Boolean value indicating whether or not suppress printing + suppress Boolean value indicating whether or not suppress printing of small floating point values using scientific notation (default False) """ @@ -95,7 +95,7 @@ def set_printoptions(precision=None, threshold=None, edgeitems=None, if (precision is not None): _float_output_precision = precision if (suppress is not None): - _float_output_supress_small = not not suppress + _float_output_suppress_small = not not suppress return def get_printoptions(): @@ -139,8 +139,6 @@ def _array2string(a, max_line_width, precision, suppress_small, separator=' ', else: summary_insert = "" data = a.ravel() - - items_per_line = a.shape[-1] try: format_function = a._format @@ -168,9 +166,9 @@ def _array2string(a, max_line_width, precision, suppress_small, separator=' ', format = "%s" format_function = lambda x, f = format: repr(x) else: - format = '%s' - format_function = lambda x, f = format: format % str(x) - + format = '%s' + format_function = lambda x, f = format: format % str(x) + next_line_prefix = " " # skip over "[" next_line_prefix += " "*len(prefix) # skip over array( @@ -252,7 +250,7 @@ def _formatArray(a, format_function, rank, max_line_len, s += _formatArray(a[i], format_function, rank-1, max_line_len, " " + next_line_prefix, separator, edge_items, summary_insert) - s = s.rstrip()+ sep.rstrip() + '\n'*max(rank-1,1) + s = s.rstrip() + sep.rstrip() + '\n'*max(rank-1,1) if summary_insert1: s += next_line_prefix + summary_insert1 + "\n" diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py index 1dbfb0d54..d89260ef6 100644 --- a/numpy/core/defmatrix.py +++ b/numpy/core/defmatrix.py @@ -2,8 +2,7 @@ __all__ = ['matrix', 'bmat', 'mat', 'asmatrix'] import numeric as N -from numeric import ArrayType, concatenate, integer, multiply, power, \ - isscalar, binary_repr +from numeric import ArrayType, concatenate, isscalar, binary_repr import types import string as str_ import sys @@ -265,7 +264,7 @@ def _from_string(str,gdict,ldict): return concatenate(rowtup,axis=0) -def bmat(obj,ldict=None, gdict=None): +def bmat(obj, ldict=None, gdict=None): """Build a matrix object from string, nested sequence, or array. Ex: F = bmat('A, B; C, D') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 4416a07fc..4ba599081 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -45,7 +45,7 @@ newaxis = None ndarray = multiarray.ndarray flatiter = multiarray.flatiter broadcast = multiarray.broadcast -dtype=multiarray.dtype +dtype = multiarray.dtype ufunc = type(sin) arange = multiarray.arange @@ -175,7 +175,7 @@ def cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None): returned. """ if axis is not None: - axisa,axisb,axisc=(axis,)*3 + axisa,axisb,axisc=(axis,)*3 a = _move_axis_to_0(asarray(a), axisa) b = _move_axis_to_0(asarray(b), axisb) msg = "incompatible dimensions for cross product\n"\ diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py index 75cd8de45..d7df600c4 100644 --- a/numpy/core/numerictypes.py +++ b/numpy/core/numerictypes.py @@ -1,5 +1,3 @@ -# Borrowed and adapted from numarray - """numerictypes: Define the numeric type objects This module is designed so 'from numerictypes import *' is safe. @@ -78,7 +76,8 @@ $Id: numerictypes.py,v 1.17 2005/09/09 22:20:06 teoliphant Exp $ """ # we add more at the bottom -__all__ = ['typeDict', 'typeNA', 'sctypes', 'ScalarType', 'obj2sctype', 'cast', 'nbytes', 'sctype2char','maximum_sctype', 'issctype'] +__all__ = ['typeDict', 'typeNA', 'sctypes', 'ScalarType', 'obj2sctype', 'cast', 'nbytes', + 'sctype2char', 'maximum_sctype', 'issctype'] from multiarray import typeinfo, ndarray, array, empty import types as _types @@ -233,7 +232,7 @@ def _construct_char_code_lookup(): for name in typeinfo.keys(): tup = typeinfo[name] if isinstance(tup, tuple): - if tup[0] not in ['p','P']: + if tup[0] not in ['p','P']: _sctype2char_dict[tup[-1]] = tup[0] _construct_char_code_lookup() diff --git a/numpy/core/records.py b/numpy/core/records.py index fa901482e..f389388d7 100644 --- a/numpy/core/records.py +++ b/numpy/core/records.py @@ -1,12 +1,10 @@ -__all__ = ['record', 'recarray','format_parser'] +__all__ = ['record', 'recarray', 'format_parser'] import numeric as sb from defchararray import chararray import numerictypes as nt -import sys import types import stat, os -import _internal _byteorderconv = {'b':'>', 'l':'<', diff --git a/numpy/core/tests/test_ma.py b/numpy/core/tests/test_ma.py index 58b357528..abee7d91f 100644 --- a/numpy/core/tests/test_ma.py +++ b/numpy/core/tests/test_ma.py @@ -2,6 +2,7 @@ import numpy import types, time from numpy.core.ma import * from numpy.testing import ScipyTestCase, ScipyTest +pi = numpy.pi def eq(v,w, msg=''): result = allclose(v,w) if not result: |