summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/code_generators/generate_umath.py8
-rw-r--r--numpy/core/memmap.py2
-rw-r--r--numpy/distutils/command/scons.py10
-rw-r--r--numpy/doc/subclassing.py82
-rw-r--r--numpy/lib/_datasource.py4
-rw-r--r--numpy/lib/scimath.py6
-rw-r--r--numpy/lib/tests/test_format.py6
-rw-r--r--numpy/lib/ufunclike.py4
-rw-r--r--numpy/ma/core.py6
-rw-r--r--numpy/testing/nosetester.py2
-rw-r--r--numpy/testing/parametric.py4
11 files changed, 67 insertions, 67 deletions
diff --git a/numpy/core/code_generators/generate_umath.py b/numpy/core/code_generators/generate_umath.py
index ba57d53e0..d831ceda9 100644
--- a/numpy/core/code_generators/generate_umath.py
+++ b/numpy/core/code_generators/generate_umath.py
@@ -673,10 +673,10 @@ def make_ufuncs(funcdict):
mlist = []
docstring = textwrap.dedent(uf.docstring).strip()
docstring = docstring.encode('string-escape').replace(r'"', r'\"')
- # Split the docstring because some compilers (like MS) do not like big
- # string literal in C code. We split at endlines because textwrap.wrap
- # do not play well with \n
- docstring = '\\n\"\"'.join(docstring.split(r"\n"))
+ # Split the docstring because some compilers (like MS) do not like big
+ # string literal in C code. We split at endlines because textwrap.wrap
+ # do not play well with \n
+ docstring = '\\n\"\"'.join(docstring.split(r"\n"))
mlist.append(\
r"""f = PyUFunc_FromFuncAndData(%s_functions, %s_data, %s_signatures, %d,
%d, %d, %s, "%s",
diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py
index dd09b8e28..5bc314efc 100644
--- a/numpy/core/memmap.py
+++ b/numpy/core/memmap.py
@@ -74,7 +74,7 @@ class memmap(ndarray):
Given a memmap ``fp``, ``isinstance(fp, numpy.ndarray)`` returns
``True``.
- Notes
+ Notes
-----
Memory-mapped arrays use the the Python memory-map object which
diff --git a/numpy/distutils/command/scons.py b/numpy/distutils/command/scons.py
index e183f001b..d0792be5d 100644
--- a/numpy/distutils/command/scons.py
+++ b/numpy/distutils/command/scons.py
@@ -287,11 +287,11 @@ class scons(old_build_ext):
self.post_hooks = []
self.pkg_names = []
- # To avoid trouble, just don't do anything if no sconscripts are used.
- # This is useful when for example f2py uses numpy.distutils, because
- # f2py does not pass compiler information to scons command, and the
- # compilation setup below can crash in some situation.
- if len(self.sconscripts) > 0:
+ # To avoid trouble, just don't do anything if no sconscripts are used.
+ # This is useful when for example f2py uses numpy.distutils, because
+ # f2py does not pass compiler information to scons command, and the
+ # compilation setup below can crash in some situation.
+ if len(self.sconscripts) > 0:
# Try to get the same compiler than the ones used by distutils: this is
# non trivial because distutils and scons have totally different
# conventions on this one (distutils uses PATH from user's environment,
diff --git a/numpy/doc/subclassing.py b/numpy/doc/subclassing.py
index f23cf6652..859ab32f9 100644
--- a/numpy/doc/subclassing.py
+++ b/numpy/doc/subclassing.py
@@ -7,7 +7,7 @@ Credits
-------
This page is based with thanks on the wiki page on subclassing by Pierre
-Gerard-Marchant - http://www.scipy.org/Subclasses.
+Gerard-Marchant - http://www.scipy.org/Subclasses.
Introduction
------------
@@ -40,21 +40,21 @@ this machinery that makes subclassing slightly non-standard.
To allow subclassing, and views of subclasses, ndarray uses the
ndarray ``__new__`` method for the main work of object initialization,
-rather then the more usual ``__init__`` method.
+rather then the more usual ``__init__`` method.
``__new__`` and ``__init__``
============================
``__new__`` is a standard python method, and, if present, is called
before ``__init__`` when we create a class instance. Consider the
-following::
+following::
class C(object):
def __new__(cls, *args):
- print 'Args in __new__:', args
- return object.__new__(cls, *args)
+ print 'Args in __new__:', args
+ return object.__new__(cls, *args)
def __init__(self, *args):
- print 'Args in __init__:', args
+ print 'Args in __init__:', args
C('hello')
@@ -75,7 +75,7 @@ following.
As you can see, the object can be initialized in the ``__new__``
method or the ``__init__`` method, or both, and in fact ndarray does
not have an ``__init__`` method, because all the initialization is
-done in the ``__new__`` method.
+done in the ``__new__`` method.
Why use ``__new__`` rather than just the usual ``__init__``? Because
in some cases, as for ndarray, we want to be able to return an object
@@ -83,21 +83,21 @@ of some other class. Consider the following::
class C(object):
def __new__(cls, *args):
- print 'cls is:', cls
- print 'Args in __new__:', args
- return object.__new__(cls, *args)
+ print 'cls is:', cls
+ print 'Args in __new__:', args
+ return object.__new__(cls, *args)
def __init__(self, *args):
- print 'self is :', self
- print 'Args in __init__:', args
+ print 'self is :', self
+ print 'Args in __init__:', args
class D(C):
def __new__(cls, *args):
- print 'D cls is:', cls
- print 'D args in __new__:', args
- return C.__new__(C, *args)
+ print 'D cls is:', cls
+ print 'D args in __new__:', args
+ return C.__new__(C, *args)
def __init__(self, *args):
- print 'D self is :', self
- print 'D args in __init__:', args
+ print 'D self is :', self
+ print 'D args in __init__:', args
D('hello')
@@ -131,7 +131,7 @@ this way, in its standard methods for taking views, but the ndarray
``__new__`` method knows nothing of what we have done in our own
``__new__`` method in order to set attributes, and so on. (Aside -
why not call ``obj = subdtype.__new__(...`` then? Because we may not
-have a ``__new__`` method with the same call signature).
+have a ``__new__`` method with the same call signature).
So, when creating a new view object of our subclass, we need to be
able to set any extra attributes from the original object of our
@@ -153,21 +153,21 @@ Simple example - adding an extra attribute to ndarray
class InfoArray(np.ndarray):
def __new__(subtype, shape, dtype=float, buffer=None, offset=0,
- strides=None, order=None, info=None):
- # Create the ndarray instance of our type, given the usual
- # input arguments. This will call the standard ndarray
- # constructor, but return an object of our type
- obj = np.ndarray.__new__(subtype, shape, dtype, buffer, offset, strides,
- order)
- # add the new attribute to the created instance
- obj.info = info
- # Finally, we must return the newly created object:
- return obj
+ strides=None, order=None, info=None):
+ # Create the ndarray instance of our type, given the usual
+ # input arguments. This will call the standard ndarray
+ # constructor, but return an object of our type
+ obj = np.ndarray.__new__(subtype, shape, dtype, buffer, offset, strides,
+ order)
+ # add the new attribute to the created instance
+ obj.info = info
+ # Finally, we must return the newly created object:
+ return obj
def __array_finalize__(self,obj):
- # reset the attribute from passed original object
- self.info = getattr(obj, 'info', None)
- # We do not need to return anything
+ # reset the attribute from passed original object
+ self.info = getattr(obj, 'info', None)
+ # We do not need to return anything
obj = InfoArray(shape=(3,), info='information')
print type(obj)
@@ -200,18 +200,18 @@ extra attribute::
class RealisticInfoArray(np.ndarray):
def __new__(cls, input_array, info=None):
- # Input array is an already formed ndarray instance
- # We first cast to be our class type
- obj = np.asarray(input_array).view(cls)
- # add the new attribute to the created instance
- obj.info = info
- # Finally, we must return the newly created object:
- return obj
+ # Input array is an already formed ndarray instance
+ # We first cast to be our class type
+ obj = np.asarray(input_array).view(cls)
+ # add the new attribute to the created instance
+ obj.info = info
+ # Finally, we must return the newly created object:
+ return obj
def __array_finalize__(self,obj):
- # reset the attribute from passed original object
- self.info = getattr(obj, 'info', None)
- # We do not need to return anything
+ # reset the attribute from passed original object
+ self.info = getattr(obj, 'info', None)
+ # We do not need to return anything
arr = np.arange(5)
obj = RealisticInfoArray(arr, info='information')
diff --git a/numpy/lib/_datasource.py b/numpy/lib/_datasource.py
index 3055bf47a..7e760b416 100644
--- a/numpy/lib/_datasource.py
+++ b/numpy/lib/_datasource.py
@@ -38,7 +38,7 @@ import os
from shutil import rmtree
# Using a class instead of a module-level dictionary
-# to reduce the inital 'import numpy' overhead by
+# to reduce the inital 'import numpy' overhead by
# deferring the import of bz2 and gzip until needed
# TODO: .zip support, .tar support?
@@ -197,7 +197,7 @@ class DataSource (object):
def _isurl(self, path):
"""Test if path is a net location. Tests the scheme and netloc."""
-
+
# We do this here to reduce the 'import numpy' initial import time.
from urlparse import urlparse
diff --git a/numpy/lib/scimath.py b/numpy/lib/scimath.py
index ed04d1ce5..0d765fa20 100644
--- a/numpy/lib/scimath.py
+++ b/numpy/lib/scimath.py
@@ -198,15 +198,15 @@ def sqrt(x):
As the numpy.sqrt, this returns the principal square root of x, which is
what most people mean when they use square root; the principal square root
- of x is not any number z such as z^2 = x.
+ of x is not any number z such as z^2 = x.
For positive numbers, the principal square root is defined as the positive
- number z such as z^2 = x.
+ number z such as z^2 = x.
The principal square root of -1 is i, the principal square root of any
negative number -x is defined a i * sqrt(x). For any non zero complex
number, it is defined by using the following branch cut: x = r e^(i t) with
- r > 0 and -pi < t <= pi. The principal square root is then
+ r > 0 and -pi < t <= pi. The principal square root is then
sqrt(r) e^(i t/2).
"""
x = _fix_real_lt_zero(x)
diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py
index 073af3dac..35558400f 100644
--- a/numpy/lib/tests/test_format.py
+++ b/numpy/lib/tests/test_format.py
@@ -434,13 +434,13 @@ def test_memmap_roundtrip():
format.write_array(fp, arr)
finally:
fp.close()
-
+
fortran_order = (arr.flags.f_contiguous and not arr.flags.c_contiguous)
ma = format.open_memmap(mfn, mode='w+', dtype=arr.dtype,
shape=arr.shape, fortran_order=fortran_order)
ma[...] = arr
del ma
-
+
# Check that both of these files' contents are the same.
fp = open(nfn, 'rb')
normal_bytes = fp.read()
@@ -449,7 +449,7 @@ def test_memmap_roundtrip():
memmap_bytes = fp.read()
fp.close()
yield assert_equal, normal_bytes, memmap_bytes
-
+
# Check that reading the file using memmap works.
ma = format.open_memmap(nfn, mode='r')
#yield assert_array_equal, ma, arr
diff --git a/numpy/lib/ufunclike.py b/numpy/lib/ufunclike.py
index 5abdc9c8b..6df529609 100644
--- a/numpy/lib/ufunclike.py
+++ b/numpy/lib/ufunclike.py
@@ -10,12 +10,12 @@ def fix(x, y=None):
""" Round x to nearest integer towards zero.
"""
x = nx.asanyarray(x)
- if y is None:
+ if y is None:
y = nx.zeros_like(x)
y1 = nx.floor(x)
y2 = nx.ceil(x)
y[...] = nx.where(x >= 0, y1, y2)
- return y
+ return y
def isposinf(x, y=None):
"""
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index efda5ee85..b2692c94d 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -86,7 +86,7 @@ def doc_note(initialdoc, note):
return
newdoc = """
%s
-
+
Notes
-----
%s
@@ -896,7 +896,7 @@ def masked_where(condition, a, copy=True):
"""
cond = make_mask(condition)
a = np.array(a, copy=copy, subok=True)
-
+
(cshape, ashape) = (cond.shape, a.shape)
if cshape and cshape != ashape:
raise IndexError("Inconsistant shape between the condition and the input"\
@@ -3865,7 +3865,7 @@ def inner(a, b):
if len(fb.shape) == 0:
fb.shape = (1,)
return np.inner(fa, fb).view(MaskedArray)
-inner.__doc__ = doc_note(np.inner.__doc__,
+inner.__doc__ = doc_note(np.inner.__doc__,
"Masked values are replaced by 0.")
innerproduct = inner
diff --git a/numpy/testing/nosetester.py b/numpy/testing/nosetester.py
index d4e523c52..ae3a56094 100644
--- a/numpy/testing/nosetester.py
+++ b/numpy/testing/nosetester.py
@@ -164,7 +164,7 @@ class NoseTester(object):
pyversion = sys.version.replace('\n','')
print "Python version %s" % pyversion
print "nose version %d.%d.%d" % nose.__versioninfo__
-
+
def test(self, label='fast', verbose=1, extra_argv=None, doctests=False,
coverage=False, **kwargs):
diff --git a/numpy/testing/parametric.py b/numpy/testing/parametric.py
index e6f2b3390..27b9d23c6 100644
--- a/numpy/testing/parametric.py
+++ b/numpy/testing/parametric.py
@@ -61,9 +61,9 @@ class _ParametricTestCase(unittest.TestCase):
_shareParTestPrefix = 'testsp'
def __init__(self, methodName = 'runTest'):
- warnings.warn("ParametricTestCase will be removed in the next NumPy "
+ warnings.warn("ParametricTestCase will be removed in the next NumPy "
"release", DeprecationWarning)
- unittest.TestCase.__init__(self, methodName)
+ unittest.TestCase.__init__(self, methodName)
def exec_test(self,test,args,result):
"""Execute a single test. Returns a success boolean"""