internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: numpy/numpy

Issue:
2to3 run `itertools` fixer



Discussion:

Resolving patch:
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -24,8 +24,10 @@
 
 if sys.version_info[0] >= 3:
     import pickle
+    imap = map
 else:
     import cPickle as pickle
+    imap = itertools.imap
 
 loads = pickle.loads
 
@@ -1607,7 +1609,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
                 converter.iterupgrade(current_column)
             except ConverterLockError:
                 errmsg = "Converter #%i is locked and cannot be upgraded: " % i
-                current_column = itertools.imap(itemgetter(i), rows)
+                current_column = imap(itemgetter(i), rows)
                 for (j, value) in enumerate(current_column):
                     try:
                         converter.upgrade(value)
diff --git a/numpy/lib/recfunctions.py b/numpy/lib/recfunctions.py
--- a/numpy/lib/recfunctions.py
+++ b/numpy/lib/recfunctions.py
@@ -16,6 +16,11 @@
 from numpy.ma.mrecords import MaskedRecords
 from numpy.lib._iotools import _is_string_like
 
+if sys.version_info[0] >= 3:
+    izip = zip
+else:
+    izip = itertools.izip
+
 _check_fill_value = np.ma.core._check_fill_value
 
 __all__ = ['append_fields',
@@ -287,7 +292,7 @@ def sentinel(counter=([fill_value] * (len(seqarrays) - 1)).pop):
         zipfunc = _izip_fields
     #
     try:
-        for tup in itertools.izip(*iters):
+        for tup in izip(*iters):
             yield tuple(zipfunc(tup))
     except IndexError:
         pass
@@ -412,7 +417,7 @@ def merge_arrays(seqarrays,
     seqmask = []
     # If we expect some kind of MaskedArray, make a special loop.
     if usemask:
-        for (a, n) in itertools.izip(seqarrays, sizes):
+        for (a, n) in izip(seqarrays, sizes):
             nbmissing = (maxlength - n)
             # Get the data and mask
             data = a.ravel().__array__()
@@ -441,7 +446,7 @@ def merge_arrays(seqarrays,
             output = output.view(MaskedRecords)
     else:
         # Same as before, without the mask we don't need...
-        for (a, n) in itertools.izip(seqarrays, sizes):
+        for (a, n) in izip(seqarrays, sizes):
             nbmissing = (maxlength - n)
             data = a.ravel().__array__()
             if nbmissing:
diff --git a/tools/py3tool.py b/tools/py3tool.py
--- a/tools/py3tool.py
+++ b/tools/py3tool.py
@@ -65,8 +65,8 @@
     'input',
     'intern',
 #    'isinstance',
-#    'itertools',
     'itertools_imports',
+    'itertools',
 #    'long',
     'map',
     'metaclass',


Test patch:
Repository: numpy/numpy

Issue:
2to3 run `nonzero` fixer



Discussion:
This only changes file in oldnumeric. We should probably just leave it alone and raise an error when an attempt is made to import it into python 3.


Resolving patch:
diff --git a/numpy/oldnumeric/ma.py b/numpy/oldnumeric/ma.py
--- a/numpy/oldnumeric/ma.py
+++ b/numpy/oldnumeric/ma.py
@@ -865,6 +865,18 @@ def __nonzero__(self):
         return bool(m is not nomask and m.any()
                     or d is not nomask and d.any())
 
+    def __bool__(self):
+        """returns true if any element is non-zero or masked
+
+        """
+        # XXX: This changes bool conversion logic from MA.
+        # XXX: In MA bool(a) == len(a) != 0, but in numpy
+        # XXX: scalars do not have len
+        m = self._mask
+        d = self._data
+        return bool(m is not nomask and m.any()
+                    or d is not nomask and d.any())
+
     def __len__ (self):
         """Return length of first dimension. This is weird but Python's
          slicing behavior depends on it."""
@@ -2134,10 +2146,13 @@ def asarray(data, dtype=None):
 # XXX: I is better to to change the masked_*_operation adaptors
 # XXX: to wrap ndarray methods directly to create ma.array methods.
 from types import MethodType
+
 def _m(f):
     return MethodType(f, None, array)
+
 def not_implemented(*args, **kwds):
     raise NotImplementedError("not yet implemented for numpy.ma arrays")
+
 array.all = _m(alltrue)
 array.any = _m(sometrue)
 array.argmax = _m(argmax)
diff --git a/tools/py3tool.py b/tools/py3tool.py
--- a/tools/py3tool.py
+++ b/tools/py3tool.py
@@ -73,7 +73,7 @@
     'methodattrs',
     'ne',
 #    'next',
-#    'nonzero',
+    'nonzero',
     'numliterals',
     'operator',
     'paren',


Test patch:
Repository: numpy/numpy

Issue:
2to3 run `standarderror` fixer



Discussion:
No changes.


Resolving patch:
diff --git a/tools/py3tool.py b/tools/py3tool.py
--- a/tools/py3tool.py
+++ b/tools/py3tool.py
@@ -64,7 +64,7 @@
     'imports2',
     'input',
     'intern',
-#    'isinstance',
+    'isinstance',
     'itertools',
     'itertools_imports',
     'long',


Test patch:
Repository: numpy/numpy

Issue:
2to3 run `urllib` fixer



Discussion:
This replaces urllib2 with urllib, which doesn't have the right structure/functions in 2.7. This will need to be special cased to make numpy version independent.


Resolving patch:
diff --git a/numpy/lib/_datasource.py b/numpy/lib/_datasource.py
--- a/numpy/lib/_datasource.py
+++ b/numpy/lib/_datasource.py
@@ -275,8 +275,12 @@ def _cache(self, path):
         """
         # We import these here because importing urllib2 is slow and
         # a significant fraction of numpy's total import time.
-        from urllib2 import urlopen
-        from urllib2 import URLError
+        if sys.version_info[0] >= 3:
+            from urllib.request import urlopen
+            from urllib.error import URLError
+        else:
+            from urllib2 import urlopen
+            from urllib2 import URLError
 
         upath = self.abspath(path)
 
@@ -421,8 +425,12 @@ def exists(self, path):
         """
         # We import this here because importing urllib2 is slow and
         # a significant fraction of numpy's total import time.
-        from urllib2 import urlopen
-        from urllib2 import URLError
+        if sys.version_info[0] >= 3:
+            from urllib.request import urlopen
+            from urllib.error import URLError
+        else:
+            from urllib2 import urlopen
+            from urllib2 import URLError
 
         # Test local path
         if os.path.exists(path):
diff --git a/tools/py3tool.py b/tools/py3tool.py
--- a/tools/py3tool.py
+++ b/tools/py3tool.py
@@ -90,7 +90,7 @@
     'tuple_params',
 #    'types',
 #    'unicode',
-#    'urllib',
+    'urllib',
 #    'ws_comma',
     'xrange',
     'xreadlines',


Test patch:
diff --git a/numpy/lib/tests/test__datasource.py b/numpy/lib/tests/test__datasource.py
--- a/numpy/lib/tests/test__datasource.py
+++ b/numpy/lib/tests/test__datasource.py
@@ -1,20 +1,21 @@
 from __future__ import division, absolute_import, print_function
 
 import os
-import urllib2
 import sys
 import numpy.lib._datasource as datasource
 from tempfile import mkdtemp, mkstemp, NamedTemporaryFile
 from shutil import rmtree
-from urllib2 import URLError
 from numpy.compat import asbytes
 from numpy.testing import *
 
-
 if sys.version_info[0] >= 3:
+    import urllib.request as urllib_request
     from urllib.parse import urlparse
+    from urllib.error import URLError
 else:
+    import urllib2 as urllib_request
     from urlparse import urlparse
+    from urllib2 import URLError
 
 def urlopen_stub(url, data=None):
     '''Stub to replace urlopen for testing.'''
@@ -24,14 +25,17 @@ def urlopen_stub(url, data=None):
     else:
         raise URLError('Name or service not known')
 
+# setup and teardown
 old_urlopen = None
+
 def setup():
     global old_urlopen
-    old_urlopen = urllib2.urlopen
-    urllib2.urlopen = urlopen_stub
+
+    old_urlopen = urllib_request.urlopen
+    urllib_request.urlopen = urlopen_stub
 
 def teardown():
-    urllib2.urlopen = old_urlopen
+    urllib_request.urlopen = old_urlopen
 
 # A valid website for more robust testing
 http_path = 'http://www.google.com/'
Repository: numpy/numpy

Issue:
MaskedArray record: TypeError: len() of unsized object (Trac #2116)
_Original ticket http://projects.scipy.org/numpy/ticket/2116 on 2012-04-26 by trac user mwtoews, assigned to @pierregm._

I'm getting a inconsistent error while trying to get the length of a record from a masked array, but only when the mask is enabled. See the example:

```
import numpy as np

my_dtype = [('a','i'),('b','f')]
mar = np.ma.zeros(5, my_dtype)

# Length of the first record; no error raised
assert len(mar[0]) == 2

# Change mask for one of the fields
print(mar[0])          # (0, 0.0)
mar.mask[0][0] = True
print(mar[0])          # (--, 0.0)

# Repeat same command as above to reveal this bug
assert len(mar[0]) == 2
```

Raises the error:

```
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
TypeError: len() of unsized object
```

I am using !NumPy version 1.6.1 obtained from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy and the version of Python is 2.5.1 [MSC v.1310 32 bit (Intel)].



Discussion:

Resolving patch:
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -5643,6 +5643,9 @@ def __iter__(self):
                 else:
                     yield d
 
+    def __len__(self):
+        return self._data.__len__()
+
     def filled(self, fill_value=None):
         """
         Return a copy with masked fields filled with a given value.


Test patch:
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -3527,6 +3527,10 @@ def test_setitem(self):
         a[0]['a'] = 2
         assert_equal(a.mask, control)
 
+    def test_element_len(self):
+        # check that len() works for mvoid (Github issue #576)
+        for rec in self.data['base']:
+            assert_equal(len(rec), len(self.data['ddtype']))
 
 #------------------------------------------------------------------------------
Repository: numpy/numpy

Issue:
make sure there aren't any deprecation warnings that incorrectly say stuff will happen in 1.8
There are a number of deprecations that we expected would be finalized in 1.8, but that won't be, e.g. gh-596, gh-456, gh-294. We've bumped them to reconsider for 1.9, but we should run a grep over the source to make sure that we haven't left any behind any messages that say "Warning: blah balh will happen in numpy 1.8", and if there are any we should replace them with something more vague.



Discussion:
Just did a quick grep. It seems that the only occasion that mentions either 1.8. or 1.9. together with deprecations is the diagonal documentation.

There is a `test_diagonal_deprecation` that checks for `FutureWarning`. I believe that warning was for 1.7 and we should be returning a ro view of the diagonal. Need to check that and remove the warning and test.

Here is the FutureWarning message

```
        "Numpy has detected that you (may be) writing to an array returned\n"
        "by numpy.diagonal or by selecting multiple fields in a record\n"
        "array. This code will likely break in the next numpy release --\n"
        "see numpy.diagonal or arrays.indexing reference docs for details.\n"
        "The quick fix is to make an explicit copy (e.g., do\n"
        "arr.diagonal().copy() or arr[['f0','f1']].copy()).";
```

What is the multiple fields thing?

See #3604 for the diagonal fixup.


Resolving patch:
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -1130,10 +1130,10 @@ def diagonal(a, offset=0, axis1=0, axis2=1):
     on this fact is deprecated. Writing to the resulting array continues to
     work as it used to, but a FutureWarning will be issued.
 
-    In NumPy 1.8, it will switch to returning a read-only view on the original
+    In NumPy 1.9, it will switch to returning a read-only view on the original
     array. Attempting to write to the resulting array will produce an error.
 
-    In NumPy 1.9, it will still return a view, but this view will no longer be
+    In NumPy 1.10, it will still return a view, but this view will no longer be
     marked read-only. Writing to the returned array will alter your original
     array as well.
 


Test patch:
Repository: numpy/numpy

Issue:
savetxt with file like objects
savetxt now accepts any object with method "write", which is the only method needed.



Discussion:

Resolving patch:
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -1002,7 +1002,7 @@ def savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='',
                 fh = open(fname, 'wb')
             else:
                 fh = open(fname, 'w')
-    elif hasattr(fname, 'seek'):
+    elif hasattr(fname, 'write'):
         fh = fname
     else:
         raise ValueError('fname must be a string or file handle')


Test patch:
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -401,6 +401,18 @@ def test_complex_arrays(self):
                 [b'(3.142e+00+2.718e+00j) (3.142e+00+2.718e+00j)\n',
                  b'(3.142e+00+2.718e+00j) (3.142e+00+2.718e+00j)\n'])
 
+    def test_custom_writer(self):
+
+        class CustomWriter(list):
+            def write(self, text):
+                self.extend(text.split(b'\n'))
+
+        w = CustomWriter()
+        a = np.array([(1, 2), (3, 4)])
+        np.savetxt(w, a)
+        b = np.loadtxt(w)
+        assert_array_equal(a, b)
+
 
 def _assert_floatstr_lines_equal(actual_lines, expected_lines):
     """A string comparison function that also works on Windows + Python 2.5.
Repository: numpy/numpy

Issue:
mlab import fails.
The imports in `mlab.py` of the type

```
from . import compat
```

fail when doing `from numpy.oldnumeric import mlab`.



Discussion:

Resolving patch:
diff --git a/numpy/oldnumeric/mlab.py b/numpy/oldnumeric/mlab.py
--- a/numpy/oldnumeric/mlab.py
+++ b/numpy/oldnumeric/mlab.py
@@ -15,7 +15,8 @@
      angle, roots, ptp as _Nptp, kaiser, cumprod as _Ncumprod, \
      diag, msort, prod as _Nprod, std as _Nstd, hamming, flipud, \
      amax as _Nmax, amin as _Nmin, blackman, bartlett, \
-     squeeze, sinc, median, fliplr, mean as _Nmean, transpose
+     squeeze, sinc, median, fliplr, mean as _Nmean, transpose, \
+     sqrt, multiply, __version__
 
 from numpy.linalg import eig, svd
 from numpy.random import rand, randn
@@ -92,7 +93,6 @@ def cov(m, y=None, rowvar=0, bias=0):
         fact = N-1.0
     return squeeze(dot(transpose(m), conjugate(y)) / fact)
 
-from numpy import sqrt, multiply
 def corrcoef(x, y=None):
     c = cov(x, y)
     d = diag(c)
@@ -104,25 +104,21 @@ def corrcoef(x, y=None):
 from .ufuncs import *
 from .misc import *
 
-from . import compat
-from . import precision
-from . import functions
-from . import misc
-from . import ufuncs
-
-import numpy
-__version__ = numpy.__version__
-del numpy
+from .compat import __all__ as compat_all
+from .functions import __all__ as functions_all
+from .precision import __all__ as precision_all
+from .ufuncs import __all__ as ufuncs_all
+from .misc import __all__ as misc_all
 
 __all__ += ['__version__']
-__all__ += compat.__all__
-__all__ += precision.__all__
-__all__ += functions.__all__
-__all__ += ufuncs.__all__
-__all__ += misc.__all__
-
-del compat
-del functions
-del precision
-del ufuncs
-del misc
+__all__ += compat_all
+__all__ += precision_all
+__all__ += functions_all
+__all__ += ufuncs_all
+__all__ += misc_all
+
+del compat_all
+del precision_all
+del functions_all
+del ufuncs_all
+del misc_all


Test patch:
diff --git a/numpy/oldnumeric/tests/test_regression.py b/numpy/oldnumeric/tests/test_regression.py
--- a/numpy/oldnumeric/tests/test_regression.py
+++ b/numpy/oldnumeric/tests/test_regression.py
@@ -9,3 +9,12 @@ def test_numeric_random(self, level=rlevel):
         """Ticket #552"""
         from numpy.oldnumeric.random_array import randint
         randint(0, 50, [2, 3])
+
+    def test_mlab_import(self):
+        """gh-3803"""
+        try:
+            from numpy.oldnumeric import mlab
+            import numpy.oldnumeric.mlab as mlab
+        except:
+            raise AssertionError("mlab import failed")
+
Repository: numpy/numpy

Issue:
np.nansum(pandas.Series([1.0, np.nan])) breakage in current 1.8
[copied from mailing list so we don't lose track of it]

With pandas 0.12.0, this code:

```
np.nansum(pandas.Series([1.0, np.nan]))
```

works correctly using current master (74abfa27), but is broken with
current maintenance/1.8.x (f5fe91b9).

Here "correctly" means "returns a scalar" and "broken" means "returns a `Series`".

I bet the difference is:

In master, nansum ultimately calls arr.sum(...), which will be
intercepted by Series.sum.

In 1.8.x, nansum ultimately calls np.add.reduce(...), which can't be
intercepted and will return the wrong thing.

AFAICT the np.add.reduce(a, ...) call could just be replaced with
a.sum(...), but I might be missing something... surely there must have
been some reason it was written that way in the first place?



Discussion:
On Tue, Oct 1, 2013 at 8:16 AM, njsmith notifications@github.com wrote:

> [copied from mailing list so we don't lose track of it]
> 
> With pandas 0.12.0, this code:
> 
> np.nansum(pandas.Series([1.0, np.nan]))
> 
> works correctly using current master (74abfa2https://github.com/numpy/numpy/commit/74abfa27),
> but is broken with
> current maintenance/1.8.x (f5fe91bhttps://github.com/numpy/numpy/commit/f5fe91b9
> ).
> 
> Here "correctly" means "returns a scalar" and "broken" means "returns a
> Series".
> 
> I bet the difference is:
> 
> In master, nansum ultimately calls arr.sum(...), which will be
> intercepted by Series.sum.
> 
> In 1.8.x, nansum ultimately calls np.add.reduce(...), which can't be
> intercepted and will return the wrong thing.
> 
> AFAICT the np.add.reduce(a, ...) call could just be replaced with
> a.sum(...), but I might be missing something... surely there must have
> been some reason it was written that way in the first place?
> 
> Using a.sum does fix the problem.

Chuck


Resolving patch:
diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py
--- a/numpy/lib/nanfunctions.py
+++ b/numpy/lib/nanfunctions.py
@@ -482,7 +482,7 @@ def nansum(a, axis=None, dtype=None, out=None, keepdims=0):
     if mask is None:
         return a.sum(axis, dtype, out, keepdims)
     mask = mask.all(axis, keepdims=keepdims)
-    tot = np.add.reduce(a, axis, dtype, out, keepdims)
+    tot = a.sum(axis, dtype, out, keepdims)
     if mask.any():
         tot = _copyto(tot, np.nan, mask)
         warnings.warn("In Numpy 1.9 the sum along empty slices will be zero.",


Test patch:
Repository: numpy/numpy

Issue:
solve() fails on 0-sized axis
With current 1.8, 5a0d09c:

```
import numpy as np
np.linalg.solve(np.eye(3), np.zeros((3, 0)))
```

gives

```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/njs/src/numpy/.tox/py27/local/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 380, in solve
    r = gufunc(a, b, signature=signature, extobj=extobj)
ValueError: cannot remove a zero-sized axis from an iterator
```

The result should be an array with shape `(3, 0)`.

This is a regression from 1.7, hence marking as a blocker.

Thanks to Jens Jørgen Mortensen for the original report: http://mail.scipy.org/pipermail/numpy-discussion/2013-October/067898.html



Discussion:

Resolving patch:
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -368,10 +368,11 @@ def solve(a, b):
 
         gufunc = _umath_linalg.solve1
     else:
-        if a.shape[-1] == 0 and b.shape[-2] == 0:
-            a = a.reshape(a.shape[:-1] + (1,))
-            bc = broadcast(a, b)
-            return wrap(empty(bc.shape, dtype=result_t))
+        if b.size == 0:
+            if (a.shape[-1] == 0 and b.shape[-2] == 0) or b.shape[-1] == 0:
+                a = a[:,:1].reshape(a.shape[:-1] + (1,))
+                bc = broadcast(a, b)
+                return wrap(empty(bc.shape, dtype=result_t))
 
         gufunc = _umath_linalg.solve
 


Test patch:
diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py
--- a/numpy/linalg/tests/test_linalg.py
+++ b/numpy/linalg/tests/test_linalg.py
@@ -246,6 +246,24 @@ class ArraySubclass(np.ndarray):
         assert_raises(ValueError, linalg.solve, a[0:0], b[0:0])
         assert_raises(ValueError, linalg.solve, a[:, 0:0, 0:0], b)
 
+    def test_0_size_k(self):
+        # test zero multiple equation (K=0) case.
+        class ArraySubclass(np.ndarray):
+            pass
+        a = np.arange(4).reshape(1, 2, 2)
+        b = np.arange(6).reshape(3, 2, 1).view(ArraySubclass)
+
+        expected = linalg.solve(a, b)[:,:, 0:0]
+        result = linalg.solve(a, b[:,:, 0:0])
+        assert_array_equal(result, expected)
+        assert_(isinstance(result, ArraySubclass))
+
+        # test both zero.
+        expected = linalg.solve(a, b)[:, 0:0, 0:0]
+        result = linalg.solve(a[:, 0:0, 0:0], b[:,0:0, 0:0])
+        assert_array_equal(result, expected)
+        assert_(isinstance(result, ArraySubclass))
+
 
 class TestInv(LinalgTestCase, LinalgGeneralizedTestCase, TestCase):
     def do(self, a, b):
Repository: numpy/numpy

Issue:
Bug in docstring for numpy.random: random_sample description is inaccurate.
The top of the docstring for the `numpy.random` module has this description, under the `Utility functions` heading:

```
    random               Uniformly distributed values of a given shape.
    bytes                Uniformly distributed random bytes.
    random_integers      Uniformly distributed integers in a given range.
    random_sample        Uniformly distributed floats in a given range.
```

The description for `random_sample` seems inaccurate:  it suggests that it's possible to specify the range, where in reality the range is fixed to be `[0.0, 1.0)`.  In fact, since `random` and `random_sample` are the same function, the descriptions should probably be identical too.

(Thanks to zakora on the #python IRC channel for pointing this out.)



Discussion:
Fair enough, want to submit a PR?

On Tue, Oct 15, 2013 at 8:03 PM, Mark Dickinson notifications@github.comwrote:

> The top of the docstring for the numpy.random module has this description,
> under the Utility functions heading:
> 
> ```
> random               Uniformly distributed values of a given shape.
> bytes                Uniformly distributed random bytes.
> random_integers      Uniformly distributed integers in a given range.
> random_sample        Uniformly distributed floats in a given range.
> ```
> 
> The description for random_sample seems inaccurate: it suggests that it's
> possible to specify the range, where in reality the range is fixed to be [0.0,
> 1.0). In fact, since random and random_sample are the same function, the
> descriptions should probably be identical too.
> 
> (Thanks to zakora on the #python IRC channel for pointing this out.)
> 
> —
> Reply to this email directly or view it on GitHubhttps://github.com/numpy/numpy/issues/3920
> .


Resolving patch:
diff --git a/numpy/random/info.py b/numpy/random/info.py
--- a/numpy/random/info.py
+++ b/numpy/random/info.py
@@ -6,10 +6,10 @@
 ==================== =========================================================
 Utility functions
 ==============================================================================
-random               Uniformly distributed values of a given shape.
+random_sample        Uniformly distributed floats over ``[0, 1)``.
+random               Alias for `random_sample`.
 bytes                Uniformly distributed random bytes.
 random_integers      Uniformly distributed integers in a given range.
-random_sample        Uniformly distributed floats in a given range.
 permutation          Randomly permute a sequence / generate a random sequence.
 shuffle              Randomly permute a sequence in place.
 seed                 Seed the random number generator.


Test patch: