Skip to content

Commit

Permalink
Run reindent.py (script distributed with Python) over the source to r…
Browse files Browse the repository at this point in the history
…emove extraneous whitespace
  • Loading branch information
cookedm committed Mar 10, 2006
1 parent f2db317 commit bf57380
Show file tree
Hide file tree
Showing 93 changed files with 635 additions and 688 deletions.
5 changes: 0 additions & 5 deletions benchmarks/sorting.py
Expand Up @@ -29,8 +29,3 @@
print "Numarray: ", t1.repeat(3,100)
print "NumPy: ", t2.repeat(3,100)
print "Numeric: ", t3.repeat(3,100)





8 changes: 4 additions & 4 deletions numpy/_import_tools.py
Expand Up @@ -91,7 +91,7 @@ def _init_info_modules(self, packages=None):

def _get_sorted_names(self):
""" Return package names sorted in the order as they should be
imported due to dependence relations between packages.
imported due to dependence relations between packages.
"""

depend_dict = {}
Expand Down Expand Up @@ -178,14 +178,14 @@ def __call__(self,*packages, **options):
if '.' not in package_name:
self.parent_export_names.append(package_name)
continue

old_object = frame.f_locals.get(package_name,None)

cmdstr = 'import '+package_name
if self._execcmd(cmdstr):
continue
self.imported_packages.append(package_name)

if verbose!=-1:
new_object = frame.f_locals.get(package_name)
if old_object is not None and old_object is not new_object:
Expand Down Expand Up @@ -242,7 +242,7 @@ def _execcmd(self,cmdstr):
self.error('%s -> failed: %s' % (cmdstr,msg))
return True
else:
self.log('%s -> success' % (cmdstr))
self.log('%s -> success' % (cmdstr))
return

def _obj2repr(self,obj):
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/__init__.py
Expand Up @@ -26,5 +26,5 @@
__all__ += char.__all__

def test(level=1, verbosity=1):
from numpy.testing import NumpyTest
from numpy.testing import NumpyTest
return NumpyTest().test(level, verbosity)
24 changes: 12 additions & 12 deletions numpy/core/_internal.py
Expand Up @@ -64,7 +64,7 @@ def __getitem__(self, key):
return (self._flagnum & num == num) and not \
(self._flagnum & _cnum == _cnum)
raise KeyError, "Unknown flag: %s" % key

def __setitem__(self, item, val):
if self.scalar:
raise ValueError, "Cannot set flags on array scalars."
Expand All @@ -80,7 +80,7 @@ def __setitem__(self, item, val):

# now actually update array flags
self._arr.setflags(**kwds)


def get_fnc(self):
fl = self._flagnum
Expand Down Expand Up @@ -152,15 +152,15 @@ def set_updateifcopy(self, val):
behaved = property(get_behaved, None, "")
carray = property(get_carray, None, "")
farray = property(get_farray, None, "")



# make sure the tuple entries are PyArray_Descr
# or convert them
# or convert them
#
# make sure offsets are all interpretable
# as positive integers and
# convert them to positive integers if so
# make sure offsets are all interpretable
# as positive integers and
# convert them to positive integers if so
#
#
# return totalsize from last offset and size
Expand Down Expand Up @@ -223,7 +223,7 @@ def _usefields(adict, align):
# from the fields attribute of a descriptor
# This calls itself recursively but should eventually hit
# a descriptor that has no fields and then return
# a simple typestring
# a simple typestring

def _array_descr(descriptor):
fields = descriptor.fields
Expand Down Expand Up @@ -258,7 +258,7 @@ def _reconstruct(subtype, shape, dtype):
format_re = re.compile(r'(?P<repeat> *[(]?[ ,0-9]*[)]? *)(?P<dtype>[><|A-Za-z0-9.]*)')

def _split(input):
"""Split the input formats string into field formats without splitting
"""Split the input formats string into field formats without splitting
the tuple used to specify multi-dimensional arrays."""

newlist = []
Expand All @@ -274,7 +274,7 @@ def _split(input):

# if the parenthesis is not balanced, hold the string
if left > right :
hold = item
hold = item

# when balanced, append to the output list and reset the hold
elif left == right:
Expand All @@ -301,9 +301,9 @@ def _commastring(astr):
# convert item
try:
(repeats, dtype) = format_re.match(item).groups()
except (TypeError, AttributeError):
except (TypeError, AttributeError):
raise ValueError('format %s is not recognized' % item)

if (repeats == ''):
newitem = dtype
else:
Expand Down
30 changes: 15 additions & 15 deletions numpy/core/arrayprint.py
Expand Up @@ -4,7 +4,7 @@
"""
__all__ = ["set_summary", "summary_off", "set_precision", "set_line_width",
"array2string"]

#
# Written by Konrad Hinsen <hinsenk@ere.umontreal.ca>
# last revision: 1996-3-13
Expand Down Expand Up @@ -63,7 +63,7 @@ def _numeric_compress(arr):
_line_width = 75


def set_printoptions(precision=None, threshold=None, edgeitems=None,
def set_printoptions(precision=None, threshold=None, edgeitems=None,
linewidth=None, suppress=None):
"""Set options associated with printing.
Expand All @@ -82,8 +82,8 @@ def set_printoptions(precision=None, threshold=None, edgeitems=None,
suppress Boolean value indicating whether or not suppress printing
of small floating point values using scientific notation
(default False)
"""
"""

global _summaryThreshhold, _summaryEdgeItems, _float_output_precision, \
_line_width, _float_output_suppress_small
if (linewidth is not None):
Expand Down Expand Up @@ -126,7 +126,7 @@ def _array2string(a, max_line_width, precision, suppress_small, separator=' ',

if max_line_width is None:
max_line_width = _line_width

if precision is None:
precision = _float_output_precision

Expand All @@ -139,7 +139,7 @@ def _array2string(a, max_line_width, precision, suppress_small, separator=' ',
else:
summary_insert = ""
data = a.ravel()

try:
format_function = a._format
except AttributeError:
Expand Down Expand Up @@ -168,7 +168,7 @@ def _array2string(a, max_line_width, precision, suppress_small, separator=' ',
else:
format = '%s'
format_function = lambda x, f = format: format % str(x)

next_line_prefix = " " # skip over "["
next_line_prefix += " "*len(prefix) # skip over array(

Expand Down Expand Up @@ -211,32 +211,32 @@ def _formatArray(a, format_function, rank, max_line_len,
1. Full output
2. Summarized output
"""
if rank == 0:
return str(a.item())

if summary_insert and 2*edge_items < len(a):
leading_items, trailing_items, summary_insert1 = \
edge_items, edge_items, summary_insert
else:
leading_items, trailing_items, summary_insert1 = 0, len(a), ""

if rank == 1:

s = ""
line = next_line_prefix
for i in xrange(leading_items):
word = format_function(a[i]) + separator
s, line = _extendLine(s, line, word, max_line_len, next_line_prefix)

if summary_insert1:
s, line = _extendLine(s, line, summary_insert1, max_line_len, next_line_prefix)

for i in xrange(trailing_items, 1, -1):
word = format_function(a[-i]) + separator
word = format_function(a[-i]) + separator
s, line = _extendLine(s, line, word, max_line_len, next_line_prefix)

word = format_function(a[-1])
s, line = _extendLine(s, line, word, max_line_len, next_line_prefix)
s += line + "]\n"
Expand All @@ -251,10 +251,10 @@ def _formatArray(a, format_function, rank, max_line_len,
" " + next_line_prefix, separator, edge_items,
summary_insert)
s = s.rstrip() + sep.rstrip() + '\n'*max(rank-1,1)

if summary_insert1:
s += next_line_prefix + summary_insert1 + "\n"

for i in xrange(trailing_items, 1, -1):
if leading_items or i != trailing_items:
s += next_line_prefix
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/code_generators/generate_array_api.py
Expand Up @@ -88,7 +88,7 @@
(void *) &PyArrayDescr_Type,
(void *) &PyArrayIter_Type,
(void *) &PyArrayMultiIter_Type,
(int *) &PyArray_NUMUSERTYPES,
(int *) &PyArray_NUMUSERTYPES,
%s
};
"""
Expand Down
6 changes: 3 additions & 3 deletions numpy/core/code_generators/generate_umath.py
Expand Up @@ -73,11 +73,11 @@ def __init__(self, nin, nout, identity, docstring,
#each entry in defdict is

#name: [string of chars for which it is defined,
# string of characters using func interface,
# tuple of strings giving funcs for data,
# string of characters using func interface,
# tuple of strings giving funcs for data,
# (in, out), or (instr, outstr) giving the signature as character codes,
# identity,
# docstring,
# docstring,
# output specification (optional)
# ]

Expand Down

0 comments on commit bf57380

Please sign in to comment.