From numpy-svn at scipy.org Wed Jan 3 09:15:32 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 3 Jan 2007 08:15:32 -0600 (CST) Subject: [Numpy-svn] r3492 - trunk/numpy/core/tests Message-ID: <20070103141532.0202C39C090@new.scipy.org> Author: stefan Date: 2007-01-03 08:15:17 -0600 (Wed, 03 Jan 2007) New Revision: 3492 Modified: trunk/numpy/core/tests/test_regression.py Log: Test for ticket #374. Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2006-12-24 09:02:34 UTC (rev 3491) +++ trunk/numpy/core/tests/test_regression.py 2007-01-03 14:15:17 UTC (rev 3492) @@ -581,6 +581,13 @@ N.rec.fromarrays([(1,2),(3,4)])]: assert(a.dtype in [dt0,dt1]) + def check_random_shuffle(self, level=rlevel): + """Ticket #374""" + a = N.arange(5).reshape((5,1)) + b = a.copy() + N.random.shuffle(b) + assert_equal(sorted(b),a) + def check_refcount_vectorize(self, level=rlevel): """Ticket #378""" def p(x,y): return 123 From numpy-svn at scipy.org Thu Jan 4 20:30:05 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 4 Jan 2007 19:30:05 -0600 (CST) Subject: [Numpy-svn] r3493 - trunk/numpy/core/src Message-ID: <20070105013005.B81B139C011@new.scipy.org> Author: oliphant Date: 2007-01-04 19:29:57 -0600 (Thu, 04 Jan 2007) New Revision: 3493 Modified: trunk/numpy/core/src/scalartypes.inc.src Log: Make it so that array scalars can be sub-classed. Modified: trunk/numpy/core/src/scalartypes.inc.src =================================================================== --- trunk/numpy/core/src/scalartypes.inc.src 2007-01-03 14:15:17 UTC (rev 3492) +++ trunk/numpy/core/src/scalartypes.inc.src 2007-01-05 01:29:57 UTC (rev 3493) @@ -1708,12 +1708,11 @@ #define _WORK(num) \ if (type->tp_bases && (PyTuple_GET_SIZE(type->tp_bases)==2)) { \ PyTypeObject *sup; \ - PyObject *ret; \ /* We are inheriting from a Python type as well so \ give it first dibs on conversion */ \ sup = (PyTypeObject *)PyTuple_GET_ITEM(type->tp_bases, num); \ - ret = sup->tp_new(type, args, kwds); \ - if (ret) return ret; \ + robj = sup->tp_new(type, args, kwds); \ + if (robj != NULL) goto finish; \ if (PyTuple_GET_SIZE(args)!=1) return NULL; \ PyErr_Clear(); \ /* now do default conversion */ \ @@ -1723,7 +1722,7 @@ #define _WORKz _WORK(0) #define _WORK0 -/**begin repeat +/**begin repeat1 #name=byte, short, int, long, longlong, ubyte, ushort, uint, ulong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, string, unicode, object# #TYPE=BYTE, SHORT, INT, LONG, LONGLONG, UBYTE, USHORT, UINT, ULONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, OBJECT# #work=0,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,z,z,1# @@ -1733,33 +1732,64 @@ @name at _arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { PyObject *obj=NULL; + PyObject *robj; PyObject *arr; - PyArray_Descr *typecode; + PyArray_Descr *typecode=NULL; + int itemsize; + void *dest, *src; _WORK at work@ if (!PyArg_ParseTuple(args, "|O", &obj)) return NULL; typecode = PyArray_DescrFromType(PyArray_ at TYPE@); + Py_INCREF(typecode); if (obj == NULL) { #if @default@ == 0 char *mem; - PyObject *obj; mem = malloc(sizeof(@name@)); memset(mem, 0, sizeof(@name@)); - obj = PyArray_Scalar(mem, typecode, NULL); + robj = PyArray_Scalar(mem, typecode, NULL); free(mem); - return obj; #elif @default@ == 1 - return PyArray_Scalar(NULL, typecode, NULL); + robj = PyArray_Scalar(NULL, typecode, NULL); #elif @default@ == 2 - PyObject *obj = Py_None; - return PyArray_Scalar(&obj, typecode, NULL); + obj = Py_None; + robj = PyArray_Scalar(&obj, typecode, NULL); #endif + goto finish; } arr = PyArray_FromAny(obj, typecode, 0, 0, FORCECAST, NULL); - return PyArray_Return((PyArrayObject *)arr); + robj = PyArray_Return((PyArrayObject *)arr); + + finish: + if (robj->ob_type == type) return robj; + /* Need to allocate new type and copy data-area over */ + if (type->tp_itemsize) { + itemsize = PyString_GET_SIZE(robj); + } + else itemsize = 0; + obj = type->tp_alloc(type, itemsize); + if (obj == NULL) {Py_DECREF(robj); return NULL;} + if (typecode==NULL) + typecode = PyArray_DescrFromType(PyArray_ at TYPE@); + dest = scalar_value(obj, typecode); + src = scalar_value(robj, typecode); + Py_DECREF(typecode); +#if @default@ == 0 + *((npy_ at name@ *)dest) = *((npy_ at name@ *)src); +#elif @default@ == 1 + if (itemsize == 0) { + itemsize = ((PyUnicodeObject *)robj)->length << 2; + } + memcpy(dest, src, itemsize); +#elif @default@ == 2 + memcpy(dest, src, sizeof(void *)); + Py_INCREF(*((PyObject **)dest)); +#endif + Py_DECREF(robj); + return obj; } /**end repeat**/ @@ -2524,6 +2554,17 @@ return typenum; } +static PyArray_Descr * +_descr_from_subtype(PyObject *type) +{ + PyObject *mro; + mro = ((PyTypeObject *)type)->tp_mro; + if (PyTuple_GET_SIZE(mro) < 2) { + return PyArray_DescrFromType(PyArray_OBJECT); + } + return PyArray_DescrFromTypeObject(PyTuple_GET_ITEM(mro, 1)); +} + /*New reference */ /*OBJECT_API */ @@ -2563,33 +2604,31 @@ } /* Otherwise --- type is a sub-type of an array scalar - currently only VOID allows it -- use it as the type-object. - This is for non-registered data-type objects. + not corresponding to a registered data-type object. + */ + + /* Do special thing for VOID sub-types */ - /* look for a dtypedescr attribute */ - if (!PyType_IsSubtype((PyTypeObject *)type, &PyVoidArrType_Type)) { - PyErr_SetString(PyExc_TypeError, - "data type cannot be determined from " - "type object"); - return NULL; - } - new = PyArray_DescrNewFromType(PyArray_VOID); + if (PyType_IsSubtype((PyTypeObject *)type, &PyVoidArrType_Type)) { + new = PyArray_DescrNewFromType(PyArray_VOID); - conv = _arraydescr_fromobj(type); - if (conv) { - new->fields = conv->fields; - Py_INCREF(new->fields); - new->names = conv->names; - Py_INCREF(new->names); - new->elsize = conv->elsize; - new->subarray = conv->subarray; - conv->subarray = NULL; - Py_DECREF(conv); + conv = _arraydescr_fromobj(type); + if (conv) { + new->fields = conv->fields; + Py_INCREF(new->fields); + new->names = conv->names; + Py_INCREF(new->names); + new->elsize = conv->elsize; + new->subarray = conv->subarray; + conv->subarray = NULL; + Py_DECREF(conv); + } + Py_XDECREF(new->typeobj); + new->typeobj = (PyTypeObject *)type; + Py_INCREF(type); + return new; } - Py_XDECREF(new->typeobj); - new->typeobj = (PyTypeObject *)type; - Py_INCREF(type); - return new; + return _descr_from_subtype(type); } /*OBJECT_API From numpy-svn at scipy.org Sun Jan 7 16:49:04 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 7 Jan 2007 15:49:04 -0600 (CST) Subject: [Numpy-svn] r3494 - branches Message-ID: <20070107214904.EA04339C0E1@new.scipy.org> Author: charris Date: 2007-01-07 15:49:02 -0600 (Sun, 07 Jan 2007) New Revision: 3494 Added: branches/splitcode/ Log: Make branch to use in splitting up large code blocks. Copied: branches/splitcode (from rev 3493, trunk) From numpy-svn at scipy.org Sun Jan 7 21:22:23 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 7 Jan 2007 20:22:23 -0600 (CST) Subject: [Numpy-svn] r3495 - trunk/numpy Message-ID: <20070108022223.42E2839C0F1@new.scipy.org> Author: timl Date: 2007-01-07 20:22:12 -0600 (Sun, 07 Jan 2007) New Revision: 3495 Modified: trunk/numpy/add_newdocs.py Log: Fix docstring typo as per #397 Modified: trunk/numpy/add_newdocs.py =================================================================== --- trunk/numpy/add_newdocs.py 2007-01-07 21:49:02 UTC (rev 3494) +++ trunk/numpy/add_newdocs.py 2007-01-08 02:22:12 UTC (rev 3495) @@ -701,7 +701,7 @@ """a.byteswap(False) -> View or copy. Swap the bytes in the array. Swap the bytes in the array. Return the byteswapped array. If the first - argument is TRUE, byteswap in-place and return a reference to self. + argument is True, byteswap in-place and return a reference to self. """)) From numpy-svn at scipy.org Sun Jan 7 22:43:58 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 7 Jan 2007 21:43:58 -0600 (CST) Subject: [Numpy-svn] r3496 - trunk/numpy/lib Message-ID: <20070108034358.B03CD39C01E@new.scipy.org> Author: timl Date: 2007-01-07 21:43:54 -0600 (Sun, 07 Jan 2007) New Revision: 3496 Modified: trunk/numpy/lib/type_check.py Log: add a docstring to nan_to_num. closes #406 Modified: trunk/numpy/lib/type_check.py =================================================================== --- trunk/numpy/lib/type_check.py 2007-01-08 02:22:12 UTC (rev 3495) +++ trunk/numpy/lib/type_check.py 2007-01-08 03:43:54 UTC (rev 3496) @@ -104,10 +104,14 @@ return f.max, f.min def nan_to_num(x): - # mapping: - # NaN -> 0 - # Inf -> limits.double_max - # -Inf -> limits.double_min + """ + Replaces NaN's with 0 and infinities with large numbers + + The following mappings are applied: + NaN -> 0 + Inf -> limits.double_max + -Inf -> limits.double_min + """ try: t = x.dtype.type except AttributeError: From numpy-svn at scipy.org Sun Jan 7 23:01:57 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 7 Jan 2007 22:01:57 -0600 (CST) Subject: [Numpy-svn] r3497 - in trunk/numpy/lib: . tests Message-ID: <20070108040157.F10A339C022@new.scipy.org> Author: timl Date: 2007-01-07 22:01:52 -0600 (Sun, 07 Jan 2007) New Revision: 3497 Modified: trunk/numpy/lib/shape_base.py trunk/numpy/lib/tests/test_shape_base.py Log: fix for #407 and add unit test for it Modified: trunk/numpy/lib/shape_base.py =================================================================== --- trunk/numpy/lib/shape_base.py 2007-01-08 03:43:54 UTC (rev 3496) +++ trunk/numpy/lib/shape_base.py 2007-01-08 04:01:52 UTC (rev 3497) @@ -31,7 +31,7 @@ # if res is a number, then we have a smaller output array if isscalar(res): outarr = zeros(outshape,asarray(res).dtype) - outarr[ind] = res + outarr[tuple(ind)] = res Ntot = product(outshape) k = 1 while k < Ntot: @@ -44,7 +44,7 @@ n -= 1 i.put(indlist,ind) res = func1d(arr[tuple(i.tolist())],*args) - outarr[ind] = res + outarr[tuple(ind)] = res k += 1 return outarr else: Modified: trunk/numpy/lib/tests/test_shape_base.py =================================================================== --- trunk/numpy/lib/tests/test_shape_base.py 2007-01-08 03:43:54 UTC (rev 3496) +++ trunk/numpy/lib/tests/test_shape_base.py 2007-01-08 04:01:52 UTC (rev 3497) @@ -14,6 +14,10 @@ a = ones((10,101),'d') assert_array_equal(apply_along_axis(len,0,a),len(a)*ones(shape(a)[1])) + def check_3d(self): + a = arange(27).reshape((3,3,3)) + assert_array_equal(apply_along_axis(sum,0,a), [[27,30,33],[36,39,42],[45,48,51]]) + class test_array_split(NumpyTestCase): def check_integer_0_split(self): a = arange(10) From numpy-svn at scipy.org Mon Jan 8 00:19:18 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 7 Jan 2007 23:19:18 -0600 (CST) Subject: [Numpy-svn] r3498 - trunk/numpy/lib Message-ID: <20070108051918.3726539C00D@new.scipy.org> Author: rkern Date: 2007-01-07 23:19:16 -0600 (Sun, 07 Jan 2007) New Revision: 3498 Modified: trunk/numpy/lib/arraysetops.py Log: * Fix #410 by using the stable mergesort instead of the unstable default sort in setmember1d(). * Add some more information to the function docstrings. * Reduced the "See also" sections of the docstrings to point to the module instead of the full list of functions (some of which were not entirely relevant). Modified: trunk/numpy/lib/arraysetops.py =================================================================== --- trunk/numpy/lib/arraysetops.py 2007-01-08 04:01:52 UTC (rev 3497) +++ trunk/numpy/lib/arraysetops.py 2007-01-08 05:19:16 UTC (rev 3498) @@ -1,5 +1,5 @@ """ -Set operations for 1D numeric arrays based on sort() function. +Set operations for 1D numeric arrays based on sorting. Contains: ediff1d, @@ -11,16 +11,16 @@ union1d, setdiff1d -All functions work best with integer numerical arrays on input -(e.g. indices). For floating point arrays, innacurate results may appear due to -usual round-off and floating point comparison issues. +All functions work best with integer numerical arrays on input (e.g. indices). +For floating point arrays, innacurate results may appear due to usual round-off +and floating point comparison issues. Except unique1d, union1d and intersect1d_nu, all functions expect inputs with -unique elements. Speed could be gained in some operations by an implementaion -of sort(), that can provide directly the permutation vectors, avoiding thus -calls to argsort(). +unique elements. Speed could be gained in some operations by an implementaion of +sort(), that can provide directly the permutation vectors, avoiding thus calls +to argsort(). -Run test_unique1d_speed() to compare performance of numpy.unique1d() and +Run _test_unique1d_speed() to compare performance of numpy.unique1d() and numpy.unique() - it should be the same. To do: Optionally return indices analogously to unique1d for all functions. @@ -28,7 +28,7 @@ Author: Robert Cimrman created: 01.11.2005 -last revision: 12.10.2006 +last revision: 07.01.2007 """ __all__ = ['ediff1d', 'unique1d', 'intersect1d', 'intersect1d_nu', 'setxor1d', 'setmember1d', 'union1d', 'setdiff1d'] @@ -37,30 +37,60 @@ import numpy as nm def ediff1d(ary, to_end = None, to_begin = None): - """Array difference with prefixed and/or appended value. + """The differences between consecutive elements of an array, possibly with + prefixed and/or appended values. - See also: unique1d, intersect1d, intersect1d_nu, setxor1d, - setmember1d, union1d, setdiff1d + :Parameters: + - `ary` : array + This array will be flattened before the difference is taken. + - `to_end` : number, optional + If provided, this number will be tacked onto the end of the returned + differences. + - `to_begin` : number, optional + If provided, this number will be taked onto the beginning of the + returned differences. + + :Returns: + - `ed` : array + The differences. Loosely, this will be (ary[1:] - ary[:-1]). """ ary = nm.asarray(ary).flat ed = ary[1:] - ary[:-1] + arrays = [ed] if to_begin is not None: - if to_end is not None: - ed = nm.r_[to_begin, ed, to_end] - else: - ed = nm.insert(ed, 0, to_begin) - elif to_end is not None: - ed = nm.append(ed, to_end) - + arrays.insert(0, to_begin) + if to_end is not None: + arrays.append(to_end) + + if len(arrays) != 1: + # We'll save ourselves a copy of a potentially large array in the common + # case where neither to_begin or to_end was given. + ed = nm.hstack(arrays) + return ed def unique1d(ar1, return_index=False): - """Unique elements of 1D array. When return_index is True, return - also the indices indx such that ar1.flat[indx] is the resulting - array of unique elements. - - See also: ediff1d, intersect1d, intersect1d_nu, setxor1d, - setmember1d, union1d, setdiff1d + """Find the unique elements of 1D array. + + Most of the other array set operations operate on the unique arrays + generated by this function. + + :Parameters: + - `ar1` : array + This array will be flattened if it is not already 1D. + - `return_index` : bool, optional + If True, also return the indices against ar1 that result in the unique + array. + + :Returns: + - `unique` : array + The unique values. + - `unique_indices` : int array, optional + The indices of the unique values. Only provided if return_index is True. + + :See also: + numpy.lib.arraysetops has a number of other functions for performing set + operations on arrays. """ ar = nm.asarray(ar1).flatten() if ar.size == 0: @@ -81,8 +111,20 @@ def intersect1d( ar1, ar2 ): """Intersection of 1D arrays with unique elements. - See also: ediff1d, unique1d, intersect1d_nu, setxor1d, - setmember1d, union1d, setdiff1d + Use unique1d() to generate arrays with only unique elements to use as inputs + to this function. Alternatively, use intersect1d_nu() which will find the + unique values for you. + + :Parameters: + - `ar1` : array + - `ar2` : array + + :Returns: + - `intersection` : array + + :See also: + numpy.lib.arraysetops has a number of other functions for performing set + operations on arrays. """ aux = nm.concatenate((ar1,ar2)) aux.sort() @@ -91,10 +133,20 @@ def intersect1d_nu( ar1, ar2 ): """Intersection of 1D arrays with any elements. - See also: ediff1d, unique1d, intersect1d, setxor1d, - setmember1d, union1d, setdiff1d + The input arrays do not have unique elements like intersect1d() requires. + + :Parameters: + - `ar1` : array + - `ar2` : array + + :Returns: + - `intersection` : array + + :See also: + numpy.lib.arraysetops has a number of other functions for performing set + operations on arrays. """ - # Might be faster then unique1d( intersect1d( ar1, ar2 ) )? + # Might be faster than unique1d( intersect1d( ar1, ar2 ) )? aux = nm.concatenate((unique1d(ar1), unique1d(ar2))) aux.sort() return aux[aux[1:] == aux[:-1]] @@ -102,8 +154,20 @@ def setxor1d( ar1, ar2 ): """Set exclusive-or of 1D arrays with unique elements. - See also: ediff1d, unique1d, intersect1d, intersect1d_nu, - setmember1d, union1d, setdiff1d + Use unique1d() to generate arrays with only unique elements to use as inputs + to this function. + + :Parameters: + - `ar1` : array + - `ar2` : array + + :Returns: + - `xor` : array + The values that are only in one, but not both, of the input arrays. + + :See also: + numpy.lib.arraysetops has a number of other functions for performing set + operations on arrays. """ aux = nm.concatenate((ar1, ar2)) if aux.size == 0: @@ -117,16 +181,31 @@ return aux[flag2] def setmember1d( ar1, ar2 ): - """Return an array of shape of ar1 containing 1 where the elements of - ar1 are in ar2 and 0 otherwise. + """Return a boolean array of shape of ar1 containing True where the elements + of ar1 are in ar2 and False otherwise. - See also: ediff1d, unique1d, intersect1d, intersect1d_nu, setxor1d, - union1d, setdiff1d + Use unique1d() to generate arrays with only unique elements to use as inputs + to this function. + + :Parameters: + - `ar1` : array + - `ar2` : array + + :Returns: + - `mask` : bool array + The values ar1[mask] are in ar2. + + :See also: + numpy.lib.arraysetops has a number of other functions for performing set + operations on arrays. """ zlike = nm.zeros_like ar = nm.concatenate( (ar1, ar2 ) ) tt = nm.concatenate( (zlike( ar1 ), zlike( ar2 ) + 1) ) - perm = ar.argsort() + # We need this to be a stable sort, so always use 'mergesort' here. The + # values from the first array should always come before the values from the + # second array. + perm = ar.argsort(kind='mergesort') aux = ar[perm] aux2 = tt[perm] # flag = ediff1d( aux, 1 ) == 0 @@ -137,23 +216,46 @@ perm[ii+1] = perm[ii] perm[ii] = aux - indx = perm.argsort()[:len( ar1 )] + indx = perm.argsort(kind='mergesort')[:len( ar1 )] return flag[indx] def union1d( ar1, ar2 ): """Union of 1D arrays with unique elements. - See also: ediff1d, unique1d, intersect1d, intersect1d_nu, setxor1d, - setmember1d, setdiff1d + Use unique1d() to generate arrays with only unique elements to use as inputs + to this function. + + :Parameters: + - `ar1` : array + - `ar2` : array + + :Returns: + - `union` : array + + :See also: + numpy.lib.arraysetops has a number of other functions for performing set + operations on arrays. """ return unique1d( nm.concatenate( (ar1, ar2) ) ) def setdiff1d( ar1, ar2 ): """Set difference of 1D arrays with unique elements. - See also: ediff1d, unique1d, intersect1d, intersect1d_nu, setxor1d, - setmember1d, union1d + Use unique1d() to generate arrays with only unique elements to use as inputs + to this function. + + :Parameters: + - `ar1` : array + - `ar2` : array + + :Returns: + - `difference` : array + The values in ar1 that are not in ar2. + + :See also: + numpy.lib.arraysetops has a number of other functions for performing set + operations on arrays. """ aux = setmember1d(ar1,ar2) if aux.size == 0: @@ -161,7 +263,7 @@ else: return nm.asarray(ar1)[aux == 0] -def test_unique1d_speed( plot_results = False ): +def _test_unique1d_speed( plot_results = False ): # exponents = nm.linspace( 2, 7, 9 ) exponents = nm.linspace( 2, 7, 9 ) ratios = [] @@ -222,4 +324,4 @@ pylab.show() if (__name__ == '__main__'): - test_unique1d_speed( plot_results = True ) + _test_unique1d_speed( plot_results = True ) From numpy-svn at scipy.org Mon Jan 8 16:35:30 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 8 Jan 2007 15:35:30 -0600 (CST) Subject: [Numpy-svn] r3499 - trunk/numpy Message-ID: <20070108213530.056C539C17C@new.scipy.org> Author: stefan Date: 2007-01-08 15:35:13 -0600 (Mon, 08 Jan 2007) New Revision: 3499 Modified: trunk/numpy/__init__.py Log: Refer to NumpyTest instead of ScipyTest. Modified: trunk/numpy/__init__.py =================================================================== --- trunk/numpy/__init__.py 2007-01-08 05:19:16 UTC (rev 3498) +++ trunk/numpy/__init__.py 2007-01-08 21:35:13 UTC (rev 3499) @@ -66,7 +66,7 @@ random --- Core Random Tools linalg --- Core Linear Algebra Tools fft --- Core FFT routines -testing --- Scipy testing tools +testing --- Numpy testing tools These packages require explicit import f2py --- Fortran to Python Interface Generator. @@ -78,7 +78,7 @@ ------------------------------- core --> * lib --> * -testing --> ScipyTest, NumpyTest +testing --> NumpyTest """ def test(level=1, verbosity=1): From numpy-svn at scipy.org Mon Jan 8 16:37:33 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 8 Jan 2007 15:37:33 -0600 (CST) Subject: [Numpy-svn] r3500 - trunk/numpy/testing Message-ID: <20070108213733.E735139C17C@new.scipy.org> Author: stefan Date: 2007-01-08 15:37:21 -0600 (Mon, 08 Jan 2007) New Revision: 3500 Modified: trunk/numpy/testing/info.py Log: Refer to NumpyTest instead of ScipyTest. Modified: trunk/numpy/testing/info.py =================================================================== --- trunk/numpy/testing/info.py 2007-01-08 21:35:13 UTC (rev 3499) +++ trunk/numpy/testing/info.py 2007-01-08 21:37:21 UTC (rev 3500) @@ -1,12 +1,12 @@ """ -Scipy testing tools +Numpy testing tools =================== -Scipy-style unit-testing +Numpy-style unit-testing ------------------------ - ScipyTest -- Scipy tests site manager - ScipyTestCase -- unittest.TestCase with measure method + NumpyTest -- Numpy tests site manager + NumpyTestCase -- unittest.TestCase with measure method IgnoreException -- raise when checking disabled feature, it'll be ignored set_package_path -- prepend package build directory to path set_local_path -- prepend local directory (to tests files) to path From numpy-svn at scipy.org Mon Jan 8 17:03:56 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 8 Jan 2007 16:03:56 -0600 (CST) Subject: [Numpy-svn] r3501 - in trunk/numpy: . core core/code_generators core/tests distutils distutils/command distutils/fcompiler f2py f2py/lib f2py/lib/parser f2py/tests/array_from_pyobj f2py/tests/c f2py/tests/f77 f2py/tests/f90 fft lib lib/tests linalg numarray oldnumeric oldnumeric/tests random testing tests Message-ID: <20070108220356.A93CC39C110@new.scipy.org> Author: stefan Date: 2007-01-08 15:56:54 -0600 (Mon, 08 Jan 2007) New Revision: 3501 Modified: trunk/numpy/__init__.py trunk/numpy/add_newdocs.py trunk/numpy/core/_internal.py trunk/numpy/core/arrayprint.py trunk/numpy/core/code_generators/generate_array_api.py trunk/numpy/core/code_generators/generate_umath.py trunk/numpy/core/defchararray.py trunk/numpy/core/defmatrix.py trunk/numpy/core/fromnumeric.py trunk/numpy/core/ma.py trunk/numpy/core/numeric.py trunk/numpy/core/numerictypes.py trunk/numpy/core/records.py trunk/numpy/core/setup.py trunk/numpy/core/tests/test_defmatrix.py trunk/numpy/core/tests/test_errstate.py trunk/numpy/core/tests/test_ma.py trunk/numpy/core/tests/test_multiarray.py trunk/numpy/core/tests/test_numeric.py trunk/numpy/core/tests/test_numerictypes.py trunk/numpy/core/tests/test_scalarmath.py trunk/numpy/core/tests/test_umath.py trunk/numpy/distutils/ccompiler.py trunk/numpy/distutils/command/build_clib.py trunk/numpy/distutils/command/config_compiler.py trunk/numpy/distutils/fcompiler/g95.py trunk/numpy/distutils/fcompiler/gnu.py trunk/numpy/distutils/interactive.py trunk/numpy/distutils/misc_util.py trunk/numpy/distutils/system_info.py trunk/numpy/f2py/capi_maps.py trunk/numpy/f2py/f2py_testing.py trunk/numpy/f2py/lib/main.py trunk/numpy/f2py/lib/parser/Fortran2003.py trunk/numpy/f2py/lib/parser/base_classes.py trunk/numpy/f2py/lib/parser/block_statements.py trunk/numpy/f2py/lib/parser/parsefortran.py trunk/numpy/f2py/lib/parser/readfortran.py trunk/numpy/f2py/lib/parser/sourceinfo.py trunk/numpy/f2py/lib/parser/splitline.py trunk/numpy/f2py/lib/parser/statements.py trunk/numpy/f2py/lib/parser/test_Fortran2003.py trunk/numpy/f2py/lib/parser/test_parser.py trunk/numpy/f2py/lib/parser/typedecl_statements.py trunk/numpy/f2py/lib/py_wrap.py trunk/numpy/f2py/lib/py_wrap_subprogram.py trunk/numpy/f2py/lib/py_wrap_type.py trunk/numpy/f2py/lib/test_derived_scalar.py trunk/numpy/f2py/lib/test_scalar_function_in.py trunk/numpy/f2py/lib/test_scalar_in_out.py trunk/numpy/f2py/lib/wrapper_base.py trunk/numpy/f2py/rules.py trunk/numpy/f2py/tests/array_from_pyobj/setup.py trunk/numpy/f2py/tests/c/return_real.py trunk/numpy/f2py/tests/f77/callback.py trunk/numpy/f2py/tests/f77/return_character.py trunk/numpy/f2py/tests/f77/return_complex.py trunk/numpy/f2py/tests/f77/return_integer.py trunk/numpy/f2py/tests/f77/return_logical.py trunk/numpy/f2py/tests/f77/return_real.py trunk/numpy/f2py/tests/f90/return_character.py trunk/numpy/f2py/tests/f90/return_complex.py trunk/numpy/f2py/tests/f90/return_integer.py trunk/numpy/f2py/tests/f90/return_logical.py trunk/numpy/fft/fftpack.py trunk/numpy/lib/__init__.py trunk/numpy/lib/arraysetops.py trunk/numpy/lib/convdtype.py trunk/numpy/lib/function_base.py trunk/numpy/lib/index_tricks.py trunk/numpy/lib/polynomial.py trunk/numpy/lib/setup.py trunk/numpy/lib/shape_base.py trunk/numpy/lib/tests/test_arraysetops.py trunk/numpy/lib/tests/test_function_base.py trunk/numpy/lib/tests/test_index_tricks.py trunk/numpy/lib/tests/test_polynomial.py trunk/numpy/lib/tests/test_shape_base.py trunk/numpy/lib/tests/test_twodim_base.py trunk/numpy/lib/tests/test_type_check.py trunk/numpy/lib/twodim_base.py trunk/numpy/lib/user_array.py trunk/numpy/lib/utils.py trunk/numpy/linalg/info.py trunk/numpy/matlib.py trunk/numpy/numarray/alter_code1.py trunk/numpy/numarray/alter_code2.py trunk/numpy/numarray/convolve.py trunk/numpy/numarray/functions.py trunk/numpy/numarray/image.py trunk/numpy/numarray/numerictypes.py trunk/numpy/numarray/session.py trunk/numpy/numarray/setup.py trunk/numpy/numarray/util.py trunk/numpy/oldnumeric/__init__.py trunk/numpy/oldnumeric/alter_code1.py trunk/numpy/oldnumeric/alter_code2.py trunk/numpy/oldnumeric/compat.py trunk/numpy/oldnumeric/fix_default_axis.py trunk/numpy/oldnumeric/functions.py trunk/numpy/oldnumeric/linear_algebra.py trunk/numpy/oldnumeric/matrix.py trunk/numpy/oldnumeric/misc.py trunk/numpy/oldnumeric/mlab.py trunk/numpy/oldnumeric/precision.py trunk/numpy/oldnumeric/random_array.py trunk/numpy/oldnumeric/rng.py trunk/numpy/oldnumeric/tests/test_oldnumeric.py trunk/numpy/oldnumeric/typeconv.py trunk/numpy/oldnumeric/ufuncs.py trunk/numpy/random/setup.py trunk/numpy/testing/numpytest.py trunk/numpy/tests/test_ctypeslib.py Log: Whitespace cleanup. Modified: trunk/numpy/__init__.py =================================================================== --- trunk/numpy/__init__.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/__init__.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -9,7 +9,7 @@ It is being distributed for a fee for only a few years to cover some of the costs of development. After the restriction period -it will also be freely available. +it will also be freely available. Additional documentation is available in the docstrings and at @@ -53,7 +53,7 @@ __all__ += core.__all__ __all__ += lib.__all__ __all__ += ['linalg', 'fft', 'random', 'ctypeslib'] - + if __doc__ is not None: __doc__ += """ @@ -69,9 +69,9 @@ testing --- Numpy testing tools These packages require explicit import -f2py --- Fortran to Python Interface Generator. -distutils --- Enhancements to distutils with support for - Fortran compilers support and more. +f2py --- Fortran to Python Interface Generator. +distutils --- Enhancements to distutils with support for + Fortran compilers support and more. Global symbols from subpackages @@ -82,7 +82,7 @@ """ def test(level=1, verbosity=1): - if level <= 10: + if level <= 10: return NumpyTest().test(level, verbosity) else: return NumpyTest().testall(level, verbosity) Modified: trunk/numpy/add_newdocs.py =================================================================== --- trunk/numpy/add_newdocs.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/add_newdocs.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -364,8 +364,8 @@ sorting on key[1], and so forth. The result is a sort on multiple keys. If the keys represented columns of a spreadsheet, for example, this would sort using multiple columns (the last key being used for the - primary sort order, the second-to-last key for the secondary sort order, - and so on). The keys argument must be a sequence of things that can be + primary sort order, the second-to-last key for the secondary sort order, + and so on). The keys argument must be a sequence of things that can be converted to arrays of the same shape. """) @@ -660,7 +660,7 @@ order -- If a has fields defined, then the order keyword can be the field name to sort on or a list (or tuple) of field names to indicate the order that fields should be used to define - the sort. + the sort. Returns: array of indices that sort a along the specified axis. @@ -1035,7 +1035,7 @@ order -- If a has fields defined, then the order keyword can be the field name to sort on or a list (or tuple) of field names to indicate the order that fields should be used to define - the sort. + the sort. Returns: None. Modified: trunk/numpy/core/_internal.py =================================================================== --- trunk/numpy/core/_internal.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/_internal.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1,4 +1,3 @@ - #A place for code to be called from C-code # that implements more complicated stuff. @@ -40,7 +39,7 @@ titles = [x[3] for x in allfields] return names, formats, offsets, titles - + # Called in PyArray_DescrConverter function when # a dictionary without "names" and "formats" # fields is used as a data-type descriptor. @@ -219,7 +218,7 @@ def c_void_p(self, num): return num - + class _ctypes(object): def __init__(self, array, ptr=None): try: @@ -233,7 +232,7 @@ self._zerod = True else: self._zerod = False - + def data_as(self, obj): return self._ctypes.cast(self._data, obj) @@ -246,12 +245,12 @@ if self._zerod: return None return (obj*self._arr.ndim)(*self._arr.strides) - + def get_data(self): return self._data def get_shape(self): - if self._zerod: + if self._zerod: return None return (_getintp_ctype()*self._arr.ndim)(*self._arr.shape) @@ -262,7 +261,7 @@ def get_as_parameter(self): return self._ctypes.c_void_p(self._data) - + data = property(get_data, None, doc="c-types data") shape = property(get_shape, None, doc="c-types shape") strides = property(get_strides, None, doc="c-types strides") Modified: trunk/numpy/core/arrayprint.py =================================================================== --- trunk/numpy/core/arrayprint.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/arrayprint.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -125,8 +125,8 @@ def _boolFormatter(x): if x: return ' True' else: return 'False' - + def _array2string(a, max_line_width, precision, suppress_small, separator=' ', prefix=""): Modified: trunk/numpy/core/code_generators/generate_array_api.py =================================================================== --- trunk/numpy/core/code_generators/generate_array_api.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/code_generators/generate_array_api.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -16,8 +16,8 @@ #ifdef _MULTIARRAYMODULE typedef struct { - PyObject_HEAD - npy_bool obval; + PyObject_HEAD + npy_bool obval; } PyBoolScalarObject; Modified: trunk/numpy/core/code_generators/generate_umath.py =================================================================== --- trunk/numpy/core/code_generators/generate_umath.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/code_generators/generate_umath.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -267,7 +267,7 @@ Ufunc(2, 1, None, 'returns minimum (if x1 < x2: x1; else: x2) elementwise', TD(noobj), - TD(O, f='_npy_ObjectMin') + TD(O, f='_npy_ObjectMin') ), 'bitwise_and' : Ufunc(2, 1, One, Modified: trunk/numpy/core/defchararray.py =================================================================== --- trunk/numpy/core/defchararray.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/defchararray.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -38,7 +38,7 @@ return self def __array_finalize__(self, obj): - # The b is a special case because it is used for reconstructing. + # The b is a special case because it is used for reconstructing. if not _globalvar and self.dtype.char not in 'SUb': raise ValueError, "Can only create a chararray from string data." @@ -52,23 +52,23 @@ val = temp return val - def __eq__(self, other): + def __eq__(self, other): return compare_chararrays(self, other, '==', True) - def __ne__(self, other): + def __ne__(self, other): return compare_chararrays(self, other, '!=', True) def __ge__(self, other): - return compare_chararrays(self, other, '>=', True) + return compare_chararrays(self, other, '>=', True) def __le__(self, other): - return compare_chararrays(self, other, '<=', True) + return compare_chararrays(self, other, '<=', True) def __gt__(self, other): return compare_chararrays(self, other, '>', True) def __lt__(self, other): - return compare_chararrays(self, other, '<', True) + return compare_chararrays(self, other, '<', True) def __add__(self, other): b = broadcast(self, other) Modified: trunk/numpy/core/defmatrix.py =================================================================== --- trunk/numpy/core/defmatrix.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/defmatrix.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1,4 +1,3 @@ - __all__ = ['matrix', 'bmat', 'mat', 'asmatrix'] import numeric as N @@ -135,7 +134,7 @@ if out.ndim == 0: return out[()] if out.ndim == 1: - sh = out.shape[0] + sh = out.shape[0] # Determine when we should have a column array try: n = len(index) @@ -146,15 +145,15 @@ else: out.shape = (1,sh) return out - + def _get_truendim(self): shp = self.shape truend = 0 for val in shp: if (val > 1): truend += 1 return truend - + def __mul__(self, other): if isinstance(other, N.ndarray) or N.isscalar(other) or \ not hasattr(other, '__rmul__'): @@ -249,28 +248,28 @@ def var(self, axis=None, dtype=None, out=None): return N.ndarray.var(self, axis, dtype, out)._align(axis) - + def prod(self, axis=None, dtype=None, out=None): return N.ndarray.prod(self, axis, dtype, out)._align(axis) - + def any(self, axis=None, out=None): - return N.ndarray.any(self, axis, out)._align(axis) + return N.ndarray.any(self, axis, out)._align(axis) def all(self, axis=None, out=None): return N.ndarray.all(self, axis, out)._align(axis) - + def max(self, axis=None, out=None): return N.ndarray.max(self, axis, out)._align(axis) def argmax(self, axis=None, out=None): return N.ndarray.argmax(self, axis, out)._align(axis) - + def min(self, axis=None, out=None): return N.ndarray.min(self, axis, out)._align(axis) - + def argmin(self, axis=None, out=None): return N.ndarray.argmin(self, axis, out)._align(axis) - + def ptp(self, axis=None, out=None): return N.ndarray.ptp(self, axis, out)._align(axis) @@ -289,10 +288,10 @@ def getA(self): return self.__array__() - + def getA1(self): return self.__array__().ravel() - + def getT(self): return self.transpose() @@ -300,7 +299,7 @@ if issubclass(self.dtype.type, N.complexfloating): return self.transpose().conjugate() else: - return self.transpose() + return self.transpose() T = property(getT, None, doc="transpose") A = property(getA, None, doc="base array") Modified: trunk/numpy/core/fromnumeric.py =================================================================== --- trunk/numpy/core/fromnumeric.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/fromnumeric.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -124,14 +124,14 @@ axis -- axis to be sorted (default -1). Can be None to indicate that a flattened and sorted array should - be returned (the array method does not support this). + be returned (the array method does not support this). kind -- sorting algorithm (default 'quicksort') Possible values: 'quicksort', 'mergesort', or 'heapsort'. order -- For an array with fields defined, this argument allows specification of which fields to compare first, second, etc. Not all fields need be specified. - + Returns: None. This method sorts 'a' in place along the given axis using the algorithm @@ -171,7 +171,7 @@ axis -- axis to be indirectly sorted (default -1) Can be None to indicate return indices into the - flattened array. + flattened array. kind -- sorting algorithm (default 'quicksort') Possible values: 'quicksort', 'mergesort', or 'heapsort' order -- For an array with fields defined, this argument allows Modified: trunk/numpy/core/ma.py =================================================================== --- trunk/numpy/core/ma.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/ma.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -2101,7 +2101,7 @@ return masked_array(d, m) else: return masked_array(d, fromnumeric.diagonal(m, k, axis1, axis2)) - + def trace (a, offset=0, axis1=0, axis2=1, dtype=None, out=None): """trace(a,offset=0, axis1=0, axis2=1) returns the sum along diagonals (defined by the last two dimenions) of the array. @@ -2177,7 +2177,7 @@ del _choose def _clip(self,a_min,a_max,out=None): - return MaskedArray(data = self.data.clip(asarray(a_min).data, + return MaskedArray(data = self.data.clip(asarray(a_min).data, asarray(a_max).data), mask = mask_or(self.mask, mask_or(getmask(a_min),getmask(a_max)))) @@ -2215,7 +2215,7 @@ def _max(a, axis=None, out=None): if out is not None: - raise TypeError("Output arrays Unsupported for masked arrays") + raise TypeError("Output arrays Unsupported for masked arrays") if axis is None: return maximum(a) else: @@ -2254,7 +2254,7 @@ except AttributeError: result = _wrapit(self, 'squeeze') return result -array.squeeze = _m(_squeeze) +array.squeeze = _m(_squeeze) array.strides = property(_m(not_implemented)) array.sum = _m(sum) Modified: trunk/numpy/core/numeric.py =================================================================== --- trunk/numpy/core/numeric.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/numeric.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -159,7 +159,7 @@ subok = 0 else: subok = 1 - + arr = array(a, dtype=dtype, copy=False, subok=subok) copychar = 'A' @@ -176,7 +176,7 @@ if not arr.flags[prop]: arr = arr.copy(copychar) break - return arr + return arr def isfortran(a): """Returns True if 'a' is arranged in Fortran-order in memory with a.ndim > 1 @@ -240,7 +240,7 @@ def vdot(a, b): """Returns the dot product of 2 vectors (or anything that can be made into a vector). - + Note: this is not the same as `dot`, as it takes the conjugate of its first argument if complex and always returns a scalar.""" return dot(asarray(a).ravel().conj(), asarray(b).ravel()) @@ -265,7 +265,7 @@ the axes to be summed over are given by the axes argument. the first element of the sequence determines the axis or axes in arr1 to sum over, and the second element in axes argument sequence - determines the axis or axes in arr2 to sum over. + determines the axis or axes in arr2 to sum over. When there is more than one axis to sum over, the corresponding arguments to axes should be sequences of the same length with the first @@ -273,7 +273,7 @@ and so forth. If the axes argument is an integer, N, then the last N dimensions of a - and first N dimensions of b are summed over. + and first N dimensions of b are summed over. """ try: iter(axes) @@ -375,8 +375,8 @@ raise ValueError, msg % ('axis', axis, n) if not (0 <= start < n+1): raise ValueError, msg % ('start', start, n+1) - if (axis < start): # it's been removed - start -= 1 + if (axis < start): # it's been removed + start -= 1 if axis==start: return a axes = range(0,n) @@ -488,7 +488,7 @@ def fromfunction(function, shape, **kwargs): """Returns an array constructed by calling a function on a tuple of number grids. - + The function should accept as many arguments as the length of shape and work on array inputs. The shape argument is a sequence of numbers indicating the length of the desired output for each axis. @@ -496,7 +496,7 @@ The function can also accept keyword arguments (except dtype), which will be passed through fromfunction to the function itself. The dtype argument (default float) determines the data-type of the index grid passed to the - function. + function. """ dtype = kwargs.pop('dtype', float) args = indices(shape, dtype=dtype) @@ -532,7 +532,7 @@ 'C':'1100', 'D':'1101', 'E':'1110', - 'F':'1111', + 'F':'1111', 'L':''} def binary_repr(num): @@ -698,7 +698,7 @@ FloatingPointError: overflow encountered in short_scalars >>> seterr(all='ignore') {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'} - + """ pyvals = umath.geterrobj() @@ -785,16 +785,16 @@ """ return umath.geterrobj()[2] -class _unspecified(object): +class _unspecified(object): pass _Unspecified = _unspecified() class errstate(object): """with errstate(**state): --> operations in following block use given state. - + # Set error handling to known state. - >>> _ = seterr(invalid='raise', divide='raise', over='raise', under='ignore') - + >>> _ = seterr(invalid='raise', divide='raise', over='raise', under='ignore') + |>> a = -arange(3) |>> with errstate(invalid='ignore'): ... print sqrt(a) @@ -812,7 +812,7 @@ Traceback (most recent call last): ... FloatingPointError: divide by zero encountered in divide - + """ # Note that we don't want to run the above doctests because they will fail # without a from __future__ import with_statement Modified: trunk/numpy/core/numerictypes.py =================================================================== --- trunk/numpy/core/numerictypes.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/numerictypes.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -216,7 +216,7 @@ Intname = 'Int%d' % bits uval = typeinfo['U'+ctype] typeobj = val[-1] - utypeobj = uval[-1] + utypeobj = uval[-1] if intname not in allTypes.keys(): uintname = 'uint%d' % bits allTypes[intname] = typeobj Modified: trunk/numpy/core/records.py =================================================================== --- trunk/numpy/core/records.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/records.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1,4 +1,4 @@ -# All of the functions allow formats to be a dtype +# All of the functions allow formats to be a dtype __all__ = ['record', 'recarray', 'format_parser'] import numeric as sb @@ -110,7 +110,7 @@ if (byteorder is not None): byteorder = _byteorderconv[byteorder[0]] descr = descr.newbyteorder(byteorder) - + self._descr = descr class record(nt.void): @@ -129,7 +129,7 @@ pass fielddict = nt.void.__getattribute__(self, 'dtype').fields res = fielddict.get(attr,None) - if res: + if res: obj = self.getfield(*res[:2]) # if it has fields return a recarray, # if it's a string return 'SU' return a chararray @@ -142,8 +142,8 @@ else: raise AttributeError, "'record' object has no "\ "attribute '%s'" % attr - + def __setattr__(self, attr, val): if attr in ['setfield', 'getfield', 'dtype']: raise AttributeError, "Cannot set '%s' attribute" % attr; @@ -171,7 +171,7 @@ def __new__(subtype, shape, dtype=None, buf=None, offset=0, strides=None, formats=None, names=None, titles=None, byteorder=None, aligned=False): - + if dtype is not None: descr = sb.dtype(dtype) else: @@ -207,7 +207,7 @@ # Save the dictionary # If the attr is a field name and not in the saved dictionary # Undo any "setting" of the attribute and do a setfield -# Thus, you can't create attributes on-the-fly that are field names. +# Thus, you can't create attributes on-the-fly that are field names. def __setattr__(self, attr, val): newattr = attr not in self.__dict__ @@ -224,14 +224,14 @@ return ret if newattr: # We just added this one try: # or this setattr worked on an internal - # attribute. + # attribute. object.__delattr__(self, attr) except: return ret try: res = fielddict[attr][:2] except (TypeError,KeyError): - raise AttributeError, "record array has no attribute %s" % attr + raise AttributeError, "record array has no attribute %s" % attr return self.setfield(val,*res) def __getitem__(self, indx): @@ -268,8 +268,8 @@ dtype = sb.dtype(obj) if dtype.fields is None: return self.__array__().view(dtype) - return ndarray.view(self, obj) - + return ndarray.view(self, obj) + def fromarrays(arrayList, dtype=None, shape=None, formats=None, names=None, titles=None, aligned=False, byteorder=None): """ create a record array from a (flat) list of arrays @@ -284,9 +284,9 @@ >>> r.a array([1, 2, 3, 4]) """ - + arrayList = [sb.asarray(x) for x in arrayList] - + if shape is None or shape == 0: shape = arrayList[0].shape @@ -318,18 +318,18 @@ if len(descr) != len(arrayList): raise ValueError, "mismatch between the number of fields "\ "and the number of arrays" - + d0 = descr[0].shape nn = len(d0) if nn > 0: shape = shape[:-nn] - + for k, obj in enumerate(arrayList): nn = len(descr[k].shape) testshape = obj.shape[:len(obj.shape)-nn] if testshape != shape: raise ValueError, "array-shape mismatch in array %d" % k - + _array = recarray(shape, descr) # populate the record array (makes a copy) @@ -369,7 +369,7 @@ (2, 'de', 1.3) ] """ - + nfields = len(recList[0]) if formats is None and dtype is None: # slower obj = sb.array(recList,dtype=object) @@ -400,7 +400,7 @@ retval.shape = shape res = retval.view(recarray) - + res.dtype = sb.dtype((record, res.dtype)) return res @@ -409,8 +409,8 @@ names=None, titles=None, aligned=False, byteorder=None): """ create a (read-only) record array from binary data contained in a string""" - + if dtype is None and formats is None: raise ValueError, "Must have dtype= or formats=" @@ -418,11 +418,11 @@ descr = sb.dtype(dtype) else: descr = format_parser(formats, names, titles, aligned, byteorder)._descr - + itemsize = descr.itemsize if (shape is None or shape == 0 or shape == -1): shape = (len(datastring)-offset) / itemsize - + _array = recarray(shape, descr, buf=datastring, offset=offset) return _array @@ -465,7 +465,7 @@ if (offset > 0): fd.seek(offset, 1) size = get_remaining_size(fd) - + if dtype is not None: descr = sb.dtype(dtype) else: @@ -520,7 +520,7 @@ 'aligned' : aligned, 'byteorder' : byteorder } - + if obj is None: if shape is None: raise ValueError("Must define a shape if obj is None") Modified: trunk/numpy/core/setup.py =================================================================== --- trunk/numpy/core/setup.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/setup.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1,4 +1,3 @@ - import imp import os import sys @@ -54,7 +53,7 @@ # which is done in error-handling # ufunc code. NPY_ALLOW_C_API and friends # cause the segfault. So, we disable threading - # for now. + # for now. if sys.version[:5] < '2.4.2': nosmp = 1 else: @@ -100,7 +99,7 @@ if sys.platform == 'win32': moredefs.append('NPY_NO_SIGNAL') - + if sys.version[:3] < '2.4': if config_cmd.check_func('strtod', decl=False, headers=['stdlib.h']): Modified: trunk/numpy/core/tests/test_defmatrix.py =================================================================== --- trunk/numpy/core/tests/test_defmatrix.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/tests/test_defmatrix.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -177,8 +177,8 @@ y = zeros((3,1),float) y[:,0] = [0.8,0.2,0.3] x[:,1] = y>0.5 - assert_equal(x, [[0,1],[0,0],[0,0]]) - + assert_equal(x, [[0,1],[0,0],[0,0]]) + if __name__ == "__main__": NumpyTest().run() Modified: trunk/numpy/core/tests/test_errstate.py =================================================================== --- trunk/numpy/core/tests/test_errstate.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/tests/test_errstate.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1,4 +1,3 @@ - # The following exec statement (or something like it) is needed to # prevent SyntaxError on Python < 2.5. Even though this is a test, # SyntaxErrors are not acceptable; on Debian systems, they block @@ -17,7 +16,7 @@ class test_errstate(NumpyTestCase): - + def test_invalid(self): with errstate(all='raise', under='ignore'): a = -arange(3) @@ -31,7 +30,7 @@ pass else: self.fail() - + def test_divide(self): with errstate(all='raise', under='ignore'): a = -arange(3) @@ -45,7 +44,7 @@ pass else: self.fail() - + def test_errcall(self): def foo(*args): print args Modified: trunk/numpy/core/tests/test_ma.py =================================================================== --- trunk/numpy/core/tests/test_ma.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/tests/test_ma.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -715,32 +715,32 @@ class test_array_methods(NumpyTestCase): - + def setUp(self): - x = numpy.array([ 8.375, 7.545, 8.828, 8.5 , 1.757, 5.928, - 8.43 , 7.78 , 9.865, 5.878, 8.979, 4.732, - 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, + x = numpy.array([ 8.375, 7.545, 8.828, 8.5 , 1.757, 5.928, + 8.43 , 7.78 , 9.865, 5.878, 8.979, 4.732, + 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, 6.04 , 9.63 , 7.712, 3.382, 4.489, 6.479, - 7.189, 9.645, 5.395, 4.961, 9.894, 2.893, + 7.189, 9.645, 5.395, 4.961, 9.894, 2.893, 7.357, 9.828, 6.272, 3.758, 6.693, 0.993]) X = x.reshape(6,6) XX = x.reshape(3,2,2,3) - - m = numpy.array([0, 1, 0, 1, 0, 0, - 1, 0, 1, 1, 0, 1, - 0, 0, 0, 1, 0, 1, - 0, 0, 0, 1, 1, 1, - 1, 0, 0, 1, 0, 0, + + m = numpy.array([0, 1, 0, 1, 0, 0, + 1, 0, 1, 1, 0, 1, + 0, 0, 0, 1, 0, 1, + 0, 0, 0, 1, 1, 1, + 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0]) mx = array(data=x,mask=m) mX = array(data=X,mask=m.reshape(X.shape)) mXX = array(data=XX,mask=m.reshape(XX.shape)) - - m2 = numpy.array([1, 1, 0, 1, 0, 0, - 1, 1, 1, 1, 0, 1, - 0, 0, 1, 1, 0, 1, - 0, 0, 0, 1, 1, 1, - 1, 0, 0, 1, 1, 0, + + m2 = numpy.array([1, 1, 0, 1, 0, 0, + 1, 1, 1, 1, 0, 1, + 0, 0, 1, 1, 0, 1, + 0, 0, 0, 1, 1, 1, + 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1]) m2x = array(data=x,mask=m2) m2X = array(data=X,mask=m2.reshape(X.shape)) @@ -789,14 +789,14 @@ self.failUnless(eq(mXcp.data,mX.filled(1).cumprod(0))) mXcp = mX.cumprod(1) self.failUnless(eq(mXcp.data,mX.filled(1).cumprod(1))) - + def test_cumsum(self): (x,X,XX,m,mx,mX,mXX,) = self.d mXcp = mX.cumsum(0) self.failUnless(eq(mXcp.data,mX.filled(0).cumsum(0))) mXcp = mX.cumsum(1) self.failUnless(eq(mXcp.data,mX.filled(0).cumsum(1))) - + def test_varstd(self): (x,X,XX,m,mx,mX,mXX,) = self.d self.failUnless(eq(mX.var(axis=None),mX.compressed().var())) @@ -809,8 +809,8 @@ self.failUnless(eq(mXvar0[k],mX[:,k].compressed().var())) self.failUnless(eq(numpy.sqrt(mXvar0[k]), mX[:,k].compressed().std())) - + def eqmask(m1, m2): if m1 is nomask: return m2 is nomask Modified: trunk/numpy/core/tests/test_multiarray.py =================================================================== --- trunk/numpy/core/tests/test_multiarray.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/tests/test_multiarray.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1,4 +1,3 @@ - from numpy.testing import * from numpy.core import * from numpy import random @@ -196,7 +195,7 @@ def check_output(self): x = array(2) self.failUnlessRaises(ValueError, add, x, [1], x) - + class test_creation(NumpyTestCase): def check_from_attribute(self): class x(object): @@ -283,23 +282,23 @@ p = loads(s) assert_equal(a, p) -class test_fancy_indexing(NumpyTestCase): - def check_list(self): - x = ones((1,1)) - x[:,[0]] = 2.0 - assert_array_equal(x, array([[2.0]])) +class test_fancy_indexing(NumpyTestCase): + def check_list(self): + x = ones((1,1)) + x[:,[0]] = 2.0 + assert_array_equal(x, array([[2.0]])) - x = ones((1,1,1)) - x[:,:,[0]] = 2.0 - assert_array_equal(x, array([[[2.0]]])) + x = ones((1,1,1)) + x[:,:,[0]] = 2.0 + assert_array_equal(x, array([[[2.0]]])) - def check_tuple(self): - x = ones((1,1)) - x[:,(0,)] = 2.0 - assert_array_equal(x, array([[2.0]])) - x = ones((1,1,1)) - x[:,:,(0,)] = 2.0 - assert_array_equal(x, array([[[2.0]]])) + def check_tuple(self): + x = ones((1,1)) + x[:,(0,)] = 2.0 + assert_array_equal(x, array([[2.0]])) + x = ones((1,1,1)) + x[:,:,(0,)] = 2.0 + assert_array_equal(x, array([[[2.0]]])) class test_string_compare(NumpyTestCase): def check_string(self): @@ -309,8 +308,8 @@ assert_array_equal(g1 != g2, [g1[i] != g2[i] for i in [0,1,2]]) assert_array_equal(g1 <= g2, [g1[i] <= g2[i] for i in [0,1,2]]) assert_array_equal(g1 >= g2, [g1[i] >= g2[i] for i in [0,1,2]]) - assert_array_equal(g1 < g2, [g1[i] < g2[i] for i in [0,1,2]]) - assert_array_equal(g1 > g2, [g1[i] > g2[i] for i in [0,1,2]]) + assert_array_equal(g1 < g2, [g1[i] < g2[i] for i in [0,1,2]]) + assert_array_equal(g1 > g2, [g1[i] > g2[i] for i in [0,1,2]]) def check_mixed(self): g1 = array(["spam","spa","spammer","and eggs"]) @@ -321,8 +320,8 @@ assert_array_equal(g1 > g2, [x > g2 for x in g1]) assert_array_equal(g1 <= g2, [x <= g2 for x in g1]) assert_array_equal(g1 >= g2, [x >= g2 for x in g1]) - + def check_unicode(self): g1 = array([u"This",u"is",u"example"]) g2 = array([u"This",u"was",u"example"]) @@ -330,8 +329,8 @@ assert_array_equal(g1 != g2, [g1[i] != g2[i] for i in [0,1,2]]) assert_array_equal(g1 <= g2, [g1[i] <= g2[i] for i in [0,1,2]]) assert_array_equal(g1 >= g2, [g1[i] >= g2[i] for i in [0,1,2]]) - assert_array_equal(g1 < g2, [g1[i] < g2[i] for i in [0,1,2]]) - assert_array_equal(g1 > g2, [g1[i] > g2[i] for i in [0,1,2]]) + assert_array_equal(g1 < g2, [g1[i] < g2[i] for i in [0,1,2]]) + assert_array_equal(g1 > g2, [g1[i] > g2[i] for i in [0,1,2]]) class test_argmax(NumpyTestCase): @@ -339,10 +338,10 @@ a = random.normal(0,1,(4,5,6,7,8)) for i in xrange(a.ndim): amax = a.max(i) - aargmax = a.argmax(i) + aargmax = a.argmax(i) axes = range(a.ndim) axes.remove(i) - assert all(amax == aargmax.choose(*a.transpose(i,*axes))) + assert all(amax == aargmax.choose(*a.transpose(i,*axes))) class test_newaxis(NumpyTestCase): def check_basic(self): Modified: trunk/numpy/core/tests/test_numeric.py =================================================================== --- trunk/numpy/core/tests/test_numeric.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/tests/test_numeric.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -8,7 +8,7 @@ def __init__(self,sequence=None): if sequence is None: sequence=[] - self.array=array(sequence) + self.array=array(sequence) def __add__(self,other): out=Vec() out.array=self.array+other.array @@ -118,7 +118,7 @@ b2 = rand(1,1) c1 = dot(b1,b2) c2 = dot_(b1,b2) - assert_almost_equal(c1, c2, decimal=self.N) + assert_almost_equal(c1, c2, decimal=self.N) def check_all(self): dims = [(),(1,),(1,1)] @@ -196,14 +196,14 @@ self.fail() seterr(divide='ignore') array([1.]) / array([0.]) - - + + class test_fromiter(NumpyTestCase): - + def makegen(self): for x in xrange(24): yield x**2 - + def test_types(self): ai32 = fromiter(self.makegen(), int32) ai64 = fromiter(self.makegen(), int64) @@ -247,7 +247,7 @@ def test_large(self): assert_equal(binary_repr(10736848),'101000111101010011010000') - + import sys if sys.version_info[:2] >= (2, 5): set_local_path() Modified: trunk/numpy/core/tests/test_numerictypes.py =================================================================== --- trunk/numpy/core/tests/test_numerictypes.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/tests/test_numerictypes.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -50,7 +50,7 @@ ('z2', 'b1')]), ('color', 'S2'), ('info', [ - ('Name', 'U8'), + ('Name', 'U8'), ('Value', 'c16')]), ('y', 'f8', (2, 2)), ('z', 'u1')] @@ -333,7 +333,7 @@ class test_empty_field(NumpyTestCase): def check_assign(self): - a = numpy.arange(10, dtype=numpy.float32) + a = numpy.arange(10, dtype=numpy.float32) a.dtype = [("int", "<0i4"),("float", "<2f4")] assert(a['int'].shape == (5,0)) assert(a['float'].shape == (5,2)) Modified: trunk/numpy/core/tests/test_scalarmath.py =================================================================== --- trunk/numpy/core/tests/test_scalarmath.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/tests/test_scalarmath.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1,4 +1,3 @@ - from numpy.testing import * set_package_path() import numpy.core.umath as ncu @@ -11,7 +10,7 @@ N.single, N.double, N.longdouble, N.csingle, N.cdouble, N.clongdouble] -# This compares scalarmath against ufuncs. +# This compares scalarmath against ufuncs. class test_types(NumpyTestCase): def check_types(self, level=1): Modified: trunk/numpy/core/tests/test_umath.py =================================================================== --- trunk/numpy/core/tests/test_umath.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/core/tests/test_umath.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1,4 +1,3 @@ - from numpy.testing import * set_package_path() from numpy.core.umath import minimum, maximum, exp @@ -167,7 +166,7 @@ def setUp(self): self.x = 0.52 self.z = self.x+0j - self.funcs = ['arcsin', 'arccos', 'arctan', 'arcsinh', 'arccosh', + self.funcs = ['arcsin', 'arccos', 'arctan', 'arcsinh', 'arccosh', 'arctanh', 'sin', 'cos', 'tan', 'exp', 'log', 'sqrt', 'log10'] def test_it(self): Modified: trunk/numpy/distutils/ccompiler.py =================================================================== --- trunk/numpy/distutils/ccompiler.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/distutils/ccompiler.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -192,7 +192,7 @@ # not valid for C++ code, only for C. Remove it if it's there to # avoid a spurious warning on every compilation. All the default # options used by distutils can be extracted with: - + # from distutils import sysconfig # sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS', # 'CCSHARED', 'LDSHARED', 'SO') @@ -200,7 +200,7 @@ self.compiler_so.remove('-Wstrict-prototypes') except (AttributeError, ValueError): pass - + if hasattr(self,'compiler') and self.compiler[0].find('cc')>=0: if not self.compiler_cxx: if self.compiler[0][:3] == 'gcc': Modified: trunk/numpy/distutils/command/build_clib.py =================================================================== --- trunk/numpy/distutils/command/build_clib.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/distutils/command/build_clib.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -110,7 +110,7 @@ sources = list(sources) - + lib_file = compiler.library_filename(lib_name, output_dir=self.build_clib) @@ -135,7 +135,7 @@ force=self.force, requiref90=requiref90) fcompiler.customize(config_fc) - + macros = build_info.get('macros') include_dirs = build_info.get('include_dirs') extra_postargs = build_info.get('extra_compiler_args') or [] Modified: trunk/numpy/distutils/command/config_compiler.py =================================================================== --- trunk/numpy/distutils/command/config_compiler.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/distutils/command/config_compiler.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1,4 +1,3 @@ - import sys from distutils.core import Command @@ -9,7 +8,7 @@ # Using cache to prevent infinite recursion if _cache: return _cache.append(1) - + from numpy.distutils.fcompiler import show_fcompilers import distutils.core dist = distutils.core._setup_distribution Modified: trunk/numpy/distutils/fcompiler/g95.py =================================================================== --- trunk/numpy/distutils/fcompiler/g95.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/distutils/fcompiler/g95.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -16,8 +16,8 @@ version_pattern = r'G95 \((GCC (?P[\d.]+)|.*?) \(g95 (?P.*)!\) (?P.*)\).*' # $ g95 --version # G95 (GCC 4.0.3 (g95 0.90!) Aug 22 2006) - + executables = { 'version_cmd' : ["g95", "--version"], 'compiler_f77' : ["g95", "-ffixed-form"], Modified: trunk/numpy/distutils/fcompiler/gnu.py =================================================================== --- trunk/numpy/distutils/fcompiler/gnu.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/distutils/fcompiler/gnu.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1,4 +1,3 @@ - import re import os import sys @@ -275,7 +274,7 @@ def get_libraries(self): opt = GnuFCompiler.get_libraries(self) if sys.platform == 'darwin': - opt.remove('cc_dynamic') + opt.remove('cc_dynamic') return opt if __name__ == '__main__': Modified: trunk/numpy/distutils/interactive.py =================================================================== --- trunk/numpy/distutils/interactive.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/distutils/interactive.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1,4 +1,3 @@ - import os import sys from pprint import pformat @@ -12,7 +11,7 @@ for a in ['name']: print 'os.%s = %s' % (a,pformat(getattr(os,a))) if hasattr(os,'uname'): - print 'system,node,release,version,machine = ',os.uname() + print 'system,node,release,version,machine = ',os.uname() def show_environ(*args): for k,i in os.environ.items(): @@ -29,7 +28,7 @@ def show_tasks(argv,ccompiler,fcompiler): print """\ -Tasks: +Tasks: i - Show python/platform/machine information ie - Show environment information c - Show C compilers information @@ -65,7 +64,7 @@ if s: argv[1:] = splitcmdline(s) return - + def interactive_sys_argv(argv): print '='*72 print 'Starting interactive session' @@ -186,4 +185,3 @@ print '-'*72 return argv - Modified: trunk/numpy/distutils/misc_util.py =================================================================== --- trunk/numpy/distutils/misc_util.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/distutils/misc_util.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -972,9 +972,9 @@ return def add_numarray_include_dirs(self): - import numpy.numarray.util as nnu - self.add_include_dirs(*nnu.get_numarray_include_dirs()) - + import numpy.numarray.util as nnu + self.add_include_dirs(*nnu.get_numarray_include_dirs()) + def add_headers(self,*files): """ Add installable headers to configuration. Argument(s) can be either Modified: trunk/numpy/distutils/system_info.py =================================================================== --- trunk/numpy/distutils/system_info.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/distutils/system_info.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1114,7 +1114,7 @@ if _cached_atlas_version.has_key(key): return _cached_atlas_version[key] c = cmd_config(Distribution()) - atlas_version = None + atlas_version = None try: s, o = c.get_output(atlas_version_c_text, libraries=libraries, library_dirs=library_dirs) Modified: trunk/numpy/f2py/capi_maps.py =================================================================== --- trunk/numpy/f2py/capi_maps.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/f2py/capi_maps.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -85,7 +85,7 @@ 'complex_long_double':'PyArray_CDOUBLE', 'string':'PyArray_CHAR', # f2py 2e is not ready for PyArray_STRING (must set itemisize etc) #'string':'PyArray_STRING' - + } c2pycode_map={'double':'d', 'float':'f', Modified: trunk/numpy/f2py/f2py_testing.py =================================================================== --- trunk/numpy/f2py/f2py_testing.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/f2py/f2py_testing.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -1,4 +1,3 @@ - import os,sys,re,time def cmdline(): Modified: trunk/numpy/f2py/lib/main.py =================================================================== --- trunk/numpy/f2py/lib/main.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/f2py/lib/main.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -159,7 +159,7 @@ def parse_files(sys_argv): flag = 'file' - file_names = [] + file_names = [] only_names = [] skip_names = [] options = [] @@ -206,7 +206,7 @@ output_stream = open(signature_output,'w') flag = 'file' - file_names = [] + file_names = [] only_names = [] skip_names = [] options = [] @@ -245,7 +245,7 @@ output_stream.write(block.topyf(' ')+'\n') output_stream.write(' END INTERFACE\n') output_stream.write('END PYTHON MODULE %s\n' % (modulename)) - + if signature_output not in ['stdout','stderr']: output_stream.close() return Modified: trunk/numpy/f2py/lib/parser/Fortran2003.py =================================================================== --- trunk/numpy/f2py/lib/parser/Fortran2003.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/f2py/lib/parser/Fortran2003.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -254,7 +254,7 @@ def torepr(self): return '%s(%r, %r)' % (self.__class__.__name__, self.separator, self.items) def compare(self, other): return cmp((self.separator,self.items),(other.separator,self.items)) - + class UnaryOpBase(Base): """ = @@ -265,7 +265,7 @@ m = op_pattern.match(string) if not m: return #if not m: return rhs_cls(string) - rhs = string[m.end():].lstrip() + rhs = string[m.end():].lstrip() if not rhs: return op = string[:m.end()].rstrip().upper() return op, rhs_cls(rhs) @@ -779,8 +779,8 @@ class Executable_Construct_C201(Base): subclass_names = Executable_Construct.subclass_names[:] subclass_names[subclass_names.index('Action_Stmt')] = 'Action_Stmt_C201' - + class Action_Stmt(Base):# R214 """ = @@ -966,7 +966,7 @@ """ subclass_names = [] use_names = ['Kind_Selector','Char_Selector'] - + def match(string): for w,cls in [('INTEGER',Kind_Selector), ('REAL',Kind_Selector), @@ -1243,7 +1243,7 @@ """ subclass_names = [] def match(string): - return NumberBase.match(pattern.abs_logical_literal_constant_named, string) + return NumberBase.match(pattern.abs_logical_literal_constant_named, string) match = staticmethod(match) class Derived_Type_Def(Base): # R429 @@ -1394,7 +1394,7 @@ if not lhs or not rhs: return return Type_Param_Name(lhs),'=',Scalar_Int_Initialization_Expr(rhs) match = staticmethod(match) - + class Type_Param_Attr_Spec(STRINGBase): # R437 """ = KIND @@ -1814,7 +1814,7 @@ = ( , ) """ subclass_names = [] - use_names = ['Ac_Value_List','Ac_Implied_Do_Control'] + use_names = ['Ac_Value_List','Ac_Implied_Do_Control'] def match(string): if string[0]+string[-1] != '()': return line, repmap = string_replace_map(string[1:-1].strip()) @@ -1830,7 +1830,7 @@ class Ac_Implied_Do_Control(Base): # R471 """ - = = , [ , ] + = = , [ , ] """ subclass_names = [] use_names = ['Ac_Do_Variable','Scalar_Int_Expr'] @@ -1849,7 +1849,7 @@ class Ac_Do_Variable(Base): # R472 """ = - shall be a named variable + shall be a named variable """ subclass_names = ['Scalar_Int_Variable'] @@ -2021,7 +2021,7 @@ if self.items[3] is not None: s += ' ' + str(self.items[3]) return s - + class Object_Name(Base): # R505 """ = @@ -2031,7 +2031,7 @@ class Initialization(Base): # R506 """ = = - | => + | => """ subclass_names = [] use_names = ['Initialization_Expr', 'Null_Init'] @@ -2122,7 +2122,7 @@ def tostr(self): if self.items[0] is None: return str(self.items[1]) return SeparatorBase.tostr(self) - + class Lower_Bound(Base): # R512 """ = @@ -2182,7 +2182,7 @@ s += str(self.items[1]) + ' : ' s += '*' return s - + class Intent_Spec(STRINGBase): # R517 """ = IN @@ -2218,7 +2218,7 @@ use_names = ['Deferred_Shape_Spec_List'] def match(string): return CallBase.match(Object_Name, Deferred_Shape_Spec_List, string, require_rhs=True) match = staticmethod(match) - + class Allocatable_Stmt(StmtBase, WORDClsBase): # R520 """ = ALLOCATABLE [ :: ] [ ( ) ] [ , [ ( ) ] ]... @@ -2229,7 +2229,7 @@ return WORDClsBase.match('ALLOCATABLE', Object_Name_Deferred_Shape_Spec_List_Item_List, string, check_colons=True, require_cls=True) match = staticmethod(match) - + class Asynchronous_Stmt(StmtBase, WORDClsBase): # R521 """ = ASYNCHRONOUS [ :: ] @@ -2331,7 +2331,7 @@ return Data_Stmt_Repeat(lhs), Data_Stmt_Constant(rhs) match = staticmethod(match) def tostr(self): - return '%s * %s' % self.items + return '%s * %s' % self.items class Data_Stmt_Repeat(Base): # R531 """ @@ -2420,7 +2420,7 @@ def match(string): return WORDClsBase.match('OPTIONAL',Dummy_Arg_Name_List,string,check_colons=True, require_cls=True) match = staticmethod(match) tostr = WORDClsBase.tostr_a - + class Parameter_Stmt(StmtBase, CALLBase): # R538 """ = PARAMETER ( ) @@ -2438,7 +2438,7 @@ use_names = ['Named_Constant', 'Initialization_Expr'] def match(string): return KeywordValueBase.match(Named_Constant, Initialization_Expr, string) match = staticmethod(match) - + class Pointer_Stmt(StmtBase, WORDClsBase): # R540 """ = POINTER [ :: ] @@ -2448,7 +2448,7 @@ def match(string): return WORDClsBase.match('POINTER',Pointer_Decl_List,string,check_colons=True, require_cls=True) match = staticmethod(match) tostr = WORDClsBase.tostr_a - + class Pointer_Decl(CallBase): # R541 """ = [ ( ) ] @@ -2522,7 +2522,7 @@ def match(string): return WORDClsBase.match('VOLATILE',Object_Name_List,string,check_colons=True, require_cls=True) match = staticmethod(match) tostr = WORDClsBase.tostr_a - + class Implicit_Stmt(StmtBase, WORDClsBase): # R549 """ = IMPLICIT @@ -2783,7 +2783,7 @@ = | | - | + | """ subclass_names = ['Scalar_Variable_Name', 'Array_Element', 'Scalar_Structure_Component', 'Scalar_Constant'] @@ -2915,7 +2915,7 @@ """ subclass_names = [] use_names = ['Type_Spec', 'Allocation_List', 'Alloc_Opt_List'] - + class Alloc_Opt(KeywordValueBase):# R624 """ = STAT = @@ -2966,7 +2966,7 @@ def match(string): return CallBase.match(Allocate_Object, Allocate_Shape_Spec_List, string, require_rhs = True) match = staticmethod(match) - + class Allocate_Object(Base): # R629 """ = @@ -3015,7 +3015,7 @@ use_names = ['Pointer_Object_List'] def match(string): return CALLBase.match('NULLIFY', Pointer_Object_List, string, require_rhs=True) match = staticmethod(match) - + class Pointer_Object(Base): # R634 """ = @@ -3070,7 +3070,7 @@ """ subclass_names = ['Constant', 'Parenthesis', 'Designator','Array_Constructor', 'Structure_Constructor', - 'Function_Reference', 'Type_Param_Inquiry', 'Type_Param_Name', + 'Function_Reference', 'Type_Param_Inquiry', 'Type_Param_Name', ] class Parenthesis(BracketBase): # R701.h @@ -3098,14 +3098,14 @@ class Defined_Unary_Op(STRINGBase): # R703 """ - = . [ ]... . + = . [ ]... . """ subclass_names = ['Defined_Op'] class Defined_Op(STRINGBase): # R703, 723 """ - = . [ ]... . + = . [ ]... . """ subclass_names = [] def match(string): @@ -3208,7 +3208,7 @@ class Or_Operand(BinaryOpBase): # R715 """ - = [ ] + = [ ] = .AND. """ subclass_names = ['And_Operand'] @@ -3264,7 +3264,7 @@ class Defined_Unary_Op(STRINGBase): # R723 """ - = . [ ]... . + = . [ ]... . """ subclass_names = ['Defined_Op'] @@ -3337,7 +3337,7 @@ def match(string): return BinaryOpBase.match(Variable, '=', Expr, string, right=False) match = staticmethod(match) - + class Pointer_Assignment_Stmt(StmtBase): # R735 """ = [ ( ) ] => @@ -3356,7 +3356,7 @@ subclass_names = ['Variable_Name'] use_names = ['Variable', 'Data_Pointer_Component_Name'] def match(string): - return BinaryOpBase.match(Variable, r'%', Data_Pointer_Component_Name, string) + return BinaryOpBase.match(Variable, r'%', Data_Pointer_Component_Name, string) match = staticmethod(match) class Bounds_Spec(SeparatorBase): # R737 @@ -3398,7 +3398,7 @@ subclass_names = [] use_names = ['Variable','Procedure_Component_Name'] def match(string): - return BinaryOpBase.match(Variable, r'%', Procedure_Component_Name, string) + return BinaryOpBase.match(Variable, r'%', Procedure_Component_Name, string) match = staticmethod(match) class Proc_Target(Base): # R742 @@ -3429,8 +3429,8 @@ return Mask_Expr(expr), Where_Assignment_Stmt(stmt) match = staticmethod(match) def tostr(self): return 'WHERE (%s) %s' % tuple(self.items) - + class Where_Construct(Base): # R744 """ = @@ -3507,7 +3507,7 @@ def tostr(self): if self.items[1] is None: return 'ELSEWHERE(%s)' % (self.items[0]) return 'ELSEWHERE(%s) %s' % self.items - + class Elsewhere_Stmt(StmtBase, WORDClsBase): # R750 """ = ELSEWHERE [ ] @@ -3957,7 +3957,7 @@ if self.items[2] is not None: s += ' %s' % (self.items[2]) return s - + class End_Select_Type_Stmt(EndStmtBase): # R824 """ = END SELECT [ ] @@ -4051,7 +4051,7 @@ def tostr(self): if self.itens[1] is None: return 'DO %s' % (self.items[0]) return 'DO %s %s' % self.items - + class Nonlabel_Do_Stmt(StmtBase, WORDClsBase): # R829 """ = [ : ] DO [ ] @@ -4087,7 +4087,7 @@ def tostr(self): if len(self.items)==1: return ', WHILE (%s)' % (self.items[0]) return ', %s = %s' % (self.items[0], ', '.join(map(str,self.items[1]))) - + class Do_Variable(Base): # R831 """ = @@ -4348,7 +4348,7 @@ use_names = ['Connect_Spec_List'] def match(string): CALLBase.match('OPEN', Connect_Spec_List, string, require_rhs=True) match = staticmethod(match) - + class Connect_Spec(KeywordValueBase): # R905 """ = [ UNIT = ] @@ -4473,7 +4473,7 @@ def tostr(self): if self.items[1] is None: return 'WRITE(%s)' % (self.items[0]) return 'WRITE(%s) %s' % tuple(self.items) - + class Print_Stmt(StmtBase): # R912 """ = PRINT [ , ] @@ -4496,7 +4496,7 @@ def tostr(self): if self.items[1] is None: return 'PRINT %s' % (self.items[0]) return 'PRINT %s, %s' % tuple(self.items) - + class Io_Control_Spec_List(SequenceBase): # R913-list """ is a list taking into account C910, C917, C918 @@ -5049,7 +5049,7 @@ subclass_names = [] def match(string): return STRINGBase.match(['SS','SP','S'], string) match = staticmethod(match) - + class Blank_Interp_Edit_Desc(STRINGBase): # R1016 """ = BN @@ -5210,7 +5210,7 @@ if self.items[3] is not None: s += ' %s' % (self.items[3]) return s - + class Module_Nature(STRINGBase): # R1110 """ = INTRINSIC @@ -5397,7 +5397,7 @@ def match(string): return WORDClsBase.match('IMPORT',Import_Name_List,string,check_colons=True, require_cls=True) match = staticmethod(match) tostr = WORDClsBase.tostr_a - + class External_Stmt(StmtBase, WORDClsBase): # R1210 """ = EXTERNAL [ :: ] @@ -5407,7 +5407,7 @@ def match(string): return WORDClsBase.match('EXTERNAL',External_Name_List,string,check_colons=True, require_cls=True) match = staticmethod(match) tostr = WORDClsBase.tostr_a - + class Procedure_Declaration_Stmt(StmtBase): # R1211 """ = PROCEDURE ( [ ] ) [ [ , ]... :: ] @@ -5441,7 +5441,7 @@ use_names = ['Null_Init'] def match(string): return BinaryOpBase.match(Procedure_Entity_Name,'=>', Null_Init, string) match = staticmethod(match) - + class Interface_Name(Base): # R1215 """ = @@ -5457,7 +5457,7 @@ def match(string): return WORDClsBase.match('INTRINSIC',Intrinsic_Procedure_Name_List,string,check_colons=True, require_cls=True) match = staticmethod(match) tostr = WORDClsBase.tostr_a - + class Function_Reference(CallBase): # R1217 """ = ( [ ] ) @@ -5730,7 +5730,7 @@ if len(string)==6: return None, return Scalar_Int_Expr(string[6:].lstrip()), match = staticmethod(match) - def tostr(self): + def tostr(self): if self.items[0] is None: return 'RETURN' return 'RETURN %s' % self.items @@ -5833,11 +5833,11 @@ l = [] for n in getattr(cls,'subclass_names',[]): l1 = _rpl_list(n) - for n1 in l1: + for n1 in l1: if n1 not in l: l.append(n1) return l - + for cls in Base_classes.values(): if not hasattr(cls, 'subclass_names'): continue opt_subclass_names = [] @@ -5881,7 +5881,7 @@ break if n not in subclasses_names: print '%s needs to be added to %s subclass_name list' % (n,cls.__name__) - for n in use_names + subclass_names: + for n in use_names + subclass_names: if not Base_classes.has_key(n): print '%s not defined used by %s' % (n, cls.__name__) Modified: trunk/numpy/f2py/lib/parser/base_classes.py =================================================================== --- trunk/numpy/f2py/lib/parser/base_classes.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/f2py/lib/parser/base_classes.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -95,7 +95,7 @@ bases = () for c in cls.__bases__: bases += get_base_classes(c) - return bases + cls.__bases__ + (cls,) + return bases + cls.__bases__ + (cls,) class Variable: """ @@ -391,7 +391,7 @@ def is_array_pointer(self): return self.is_array() and self.is_pointer() - + def analyze(self): typedecl = self.get_typedecl() if self.is_array(): @@ -406,7 +406,7 @@ shape.append(spec[0]) else: shape.append(spec[1]-spec[0]) - self.shape = shape + self.shape = shape return class ProgramBlock: @@ -528,7 +528,7 @@ lines.append(line+'\n') else: lines.append(line+'\n') return ''.join(lines).replace('\n &\n','\n') - + def format_message(self, kind, message): if self.item is not None: message = self.reader.format_message(kind, message, @@ -613,7 +613,7 @@ self.blocktype = self.__class__.__name__.lower() if not hasattr(self, 'name'): # process_item may change this - self.name = '__'+self.blocktype.upper()+'__' + self.name = '__'+self.blocktype.upper()+'__' Statement.__init__(self, parent, item) return @@ -701,7 +701,7 @@ return False # item may be cloned that changes the items line: line = item.get_line() - + # Check if f77 code contains inline comments or other f90 # constructs that got undetected by get_source_info. if item.reader.isfix77: @@ -734,10 +734,10 @@ % (item.get_line(),self.__class__.__name__), item.span[0], item.span[1]) self.show_message(message) - + item.reader.set_mode(False, False) self.classes = classes - + r = BeginStatement.process_subitem(self, item) if r is None: # restore f77 fix mode @@ -817,4 +817,3 @@ def tofortran(self, isfix=None): return self.get_indent_tab(isfix=isfix) + 'END %s %s'\ % (self.blocktype.upper(),self.name or '') - Modified: trunk/numpy/f2py/lib/parser/block_statements.py =================================================================== --- trunk/numpy/f2py/lib/parser/block_statements.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/f2py/lib/parser/block_statements.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -391,7 +391,7 @@ class EndBlockData(EndStatement): """ - END [ BLOCK DATA [ ] ] + END [ BLOCK DATA [ ] ] """ match = re.compile(r'end(\s*block\s*data\s*\w*|)\Z', re.I).match blocktype = 'blockdata' @@ -410,7 +410,7 @@ def get_classes(self): return specification_part - + # Interface class EndInterface(EndStatement): @@ -432,7 +432,7 @@ | READ ( UNFORMATTED ) | WRITE ( FORMATTED ) | WRITE ( UNFORMATTED ) - + """ modes = ['free90', 'fix90', 'pyf'] match = re.compile(r'(interface\s*(\w+\s*\(.*\)|\w*)|abstract\s*interface)\Z',re.I).match @@ -444,7 +444,7 @@ def get_classes(self): l = intrinsic_type_spec + interface_specification if self.reader.mode=='pyf': - return [Subroutine, Function] + l + return [Subroutine, Function] + l return l def process_item(self): @@ -498,7 +498,7 @@ s += HasAttributes.topyf(self, tab=tab+' ') s += HasUseStmt.topyf(self, tab=tab+' ') s += tab + 'END' + self.tostr() + '\n' - return s + return s # Subroutine @@ -729,7 +729,7 @@ class Select(BeginStatement): """ [ : ] SELECT CASE ( ) - + """ match = re.compile(r'select\s*case\s*\(.*\)\Z',re.I).match end_stmt_cls = EndSelect @@ -738,7 +738,7 @@ return 'SELECT CASE ( %s )' % (self.expr) def process_item(self): self.expr = self.item.get_line()[6:].lstrip()[4:].lstrip()[1:-1].strip() - self.name = self.item.label + self.name = self.item.label return BeginStatement.process_item(self) def get_classes(self): @@ -751,8 +751,8 @@ END WHERE [ ] """ match = re.compile(r'end\s*\where\s*\w*\Z',re.I).match - + class Where(BeginStatement): """ [ : ] WHERE ( ) @@ -782,7 +782,7 @@ END FORALL [ ] """ match = re.compile(r'end\s*forall\s*\w*\Z',re.I).match - + class Forall(BeginStatement): """ [ : ] FORALL @@ -842,7 +842,7 @@ self.expr = line[1:-1].strip() self.name = item.label return BeginStatement.process_item(self) - + def get_classes(self): return [Else, ElseIf] + execution_part_construct @@ -883,7 +883,7 @@ self.put_item(newitem) self.isvalid = False return - + def tostr(self): assert len(self.content)==1,`self.content` return 'IF (%s) %s' % (self.expr, str(self.content[0]).lstrip()) @@ -959,7 +959,7 @@ """ match = re.compile(r'associate\s*\(.*\)\Z',re.I).match end_stmt_cls = EndAssociate - + def process_item(self): line = self.item.get_line()[9:].lstrip() self.associations = line[1:-1].strip() @@ -1090,7 +1090,7 @@ def topyf(self, tab=''): s = tab + 'TYPE' if self.a.extends is not None: - s += ', EXTENDS(%s) ::' % (self.a.extends) + s += ', EXTENDS(%s) ::' % (self.a.extends) s += ' ' + self.name if self.a.parameters: s += ' (%s)' % (', '.join(self.a.parameters)) @@ -1171,7 +1171,7 @@ derived_type_spec = [ ] type_spec = intrinsic_type_spec + derived_type_spec declaration_type_spec = intrinsic_type_spec + [ TypeStmt, Class ] - + type_declaration_stmt = declaration_type_spec private_or_sequence = [ Private, Sequence ] Modified: trunk/numpy/f2py/lib/parser/parsefortran.py =================================================================== --- trunk/numpy/f2py/lib/parser/parsefortran.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/f2py/lib/parser/parsefortran.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -79,7 +79,7 @@ if self.block is None: self.reader.show_message('Nothing to analyze.') return - + try: self.block.analyze() except AnalyzeError: @@ -129,9 +129,9 @@ hey = 1 end subroutine bar abstract interface - + end interface - + end module foo """ reader = FortranStringReader(string, True, False) @@ -195,4 +195,3 @@ simple_main() #profile_main() #parse_all_f() - Modified: trunk/numpy/f2py/lib/parser/readfortran.py =================================================================== --- trunk/numpy/f2py/lib/parser/readfortran.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/f2py/lib/parser/readfortran.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -52,9 +52,9 @@ class Line: """ Holds a Fortran source line. """ - + f2py_strmap_findall = re.compile(r'(_F2PY_STRING_CONSTANT_\d+_|F2PY_EXPR_TUPLE_\d+)').findall - + def __init__(self, line, linenospan, label, reader): self.line = line.strip() self.span = linenospan @@ -87,7 +87,7 @@ self.line = self.apply_map(line) self.strline = None return - + def __repr__(self): return self.__class__.__name__+'(%r,%s,%r)' \ % (self.line, self.span, self.label) @@ -182,7 +182,7 @@ used to retrive a line. source may contain - Fortran 77 code - - fixed format Fortran 90 code + - fixed format Fortran 90 code - free format Fortran 90 code - .pyf signatures - extended free format Fortran 90 syntax """ @@ -277,7 +277,7 @@ return self def next(self, ignore_comments = False): - + try: if self.reader is not None: try: @@ -402,7 +402,7 @@ break linenostr = '%5d:' % (i) if i==endlineno: - sourceline = self.source_lines[i-1] + sourceline = self.source_lines[i-1] l0 = linenostr+sourceline[:startcolno] if endcolno==-1: l1 = sourceline[startcolno:] @@ -414,7 +414,7 @@ else: r.append(linenostr+ self.source_lines[i-1]) return '\n'.join(r) - + def format_error_message(self, message, startlineno, endlineno, startcolno=0, endcolno=-1): return self.format_message('ERROR',message, startlineno, @@ -555,7 +555,7 @@ # XXX: should we do line.replace('\\'+mlstr[0],mlstr[0]) # for line in multilines? return self.multiline_item(prefix,multilines,suffix, - startlineno, self.linecount) + startlineno, self.linecount) # The main method of interpreting raw source lines within # the following contexts: f77, fixed f90, free f90, pyf. @@ -565,7 +565,7 @@ a source item is .. - a fortran line - a list of continued fortran lines - - a multiline - lines inside triple-qoutes, only when in ispyf mode + - a multiline - lines inside triple-qoutes, only when in ispyf mode """ get_single_line = self.get_single_line line = get_single_line() @@ -613,7 +613,7 @@ return self.line_item(''.join(lines),startlineno,self.linecount,label) handle_inline_comment = self.handle_inline_comment - + if self.isfix90 and not is_f2py_directive: # handle inline comment newline,qc = handle_inline_comment(line[6:], startlineno) @@ -739,7 +739,7 @@ self.file.close() class FortranStringReader(FortranReaderBase): - + def __init__(self, string, isfree, isstrict, include_dirs = None): self.id = 'string-'+str(id(string)) source = StringIO(string) @@ -765,7 +765,7 @@ reader = FortranStringReader(string_f77,False,True) for item in reader: print item - + filename = tempfile.mktemp()+'.f' f = open(filename,'w') f.write(string_f77) @@ -823,7 +823,7 @@ obj%bin_wid,' VEL_DMO = ', obj%vel_dmo end subroutine foo subroutine - + & foo end """ Modified: trunk/numpy/f2py/lib/parser/sourceinfo.py =================================================================== --- trunk/numpy/f2py/lib/parser/sourceinfo.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/f2py/lib/parser/sourceinfo.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -76,6 +76,6 @@ for filename in sys.argv[1:]: isfree, isstrict = get_source_info(filename) print '%s: isfree=%s, isstrict=%s' % (filename, isfree, isstrict) - + if __name__ == '__main__': simple_main() Modified: trunk/numpy/f2py/lib/parser/splitline.py =================================================================== --- trunk/numpy/f2py/lib/parser/splitline.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/f2py/lib/parser/splitline.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -209,7 +209,7 @@ quotechar = self.quotechar l = [] l_append = l.append - + nofslashes = 0 if quotechar is None: # search for string start @@ -323,7 +323,7 @@ self.startchar = paren[0] self.endchar = paren[1] self.stopchar = None - + def get_item(self): fifo_pop = self.fifo_line.pop try: @@ -336,7 +336,7 @@ stopchar = self.stopchar l = [] l_append = l.append - + nofslashes = 0 if stopchar is None: # search for parenthesis start @@ -377,7 +377,7 @@ except IndexError: break return ParenString(''.join(l)) - + def test(): splitter = LineSplitter('abc\\\' def"12\\"3""56"dfad\'a d\'') l = [item for item in splitter] @@ -394,7 +394,7 @@ l,stopchar = splitquote('"abc123&') assert l==['"abc123&'],`l` assert stopchar=='"' - + splitter = LineSplitter(' &abc"123','"') l = [item for item in splitter] assert l==[' &abc"','123'] @@ -402,7 +402,7 @@ l,stopchar = splitquote(' &abc"123','"') assert l==[' &abc"','123'] assert stopchar is None - + l = split2('') assert l==('',''),`l` l = split2('12') @@ -424,4 +424,3 @@ if __name__ == '__main__': test() - Modified: trunk/numpy/f2py/lib/parser/statements.py =================================================================== --- trunk/numpy/f2py/lib/parser/statements.py 2007-01-08 21:37:21 UTC (rev 3500) +++ trunk/numpy/f2py/lib/parser/statements.py 2007-01-08 21:56:54 UTC (rev 3501) @@ -95,7 +95,7 @@ if sign=='=>': self.__class__ = PointerAssignment else: - self.__class__ = Assignment + self.__class__ = Assignment apply_map = self.item.apply_map self.variable = apply_map(m.group('variable').replace(' ','')) self.expr = apply_map(m.group('expr')) @@ -247,7 +247,7 @@ tab = self.get_indent_tab(isfix=isfix) if self.items: return tab + 'GO TO %s (%s)' \ - % (self.varname, ', '.join(self.items)) + % (self.varname, ', '.join(self.items)) return tab + 'GO TO %s' % (self.varname) def analyze(self): return @@ -339,7 +339,7 @@ | [ NML = ] | ADVANCE = ... - + Read1: READ [, ] == |