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

Issue:
Remove warning about output shape of zoom
For certain zoom sizes, a warning is raised about behaviour that changed in SciPy 0.13. It can probably be silenced now!

### Reproducing code example:

```python
import numpy as np
from scipy import ndimage as ndi

image = np.random.random((7, 7))
smaller = ndi.zoom(image, 0.5)
```

### Error message:

The following warning is raised:

```
/home/jni/miniconda3/envs/cf/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:605: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.
  "the returned array has changed.", UserWarning)
```

### Scipy/Numpy/Python version information:

```
1.2.1 1.16.4 sys.version_info(major=3, minor=6, micro=8, releaselevel='final', serial=0)
```

Happy to submit a PR if people agree removing it is ok.



Discussion:
yes please, PR very welcome!

Resolving patch:
diff --git a/scipy/ndimage/interpolation.py b/scipy/ndimage/interpolation.py
--- a/scipy/ndimage/interpolation.py
+++ b/scipy/ndimage/interpolation.py
@@ -602,14 +602,6 @@ def zoom(input, zoom, output=None, order=3, mode='constant', cval=0.0,
     output_shape = tuple(
             [int(round(ii * jj)) for ii, jj in zip(input.shape, zoom)])
 
-    output_shape_old = tuple(
-            [int(ii * jj) for ii, jj in zip(input.shape, zoom)])
-    if output_shape != output_shape_old:
-        warnings.warn(
-                "From scipy 0.13.0, the output shape of zoom() is calculated "
-                "with round() instead of int() - for these inputs the size of "
-                "the returned array has changed.", UserWarning)
-
     zoom_div = numpy.array(output_shape, float) - 1
     # Zooming to infinite values is unpredictable, so just choose
     # zoom factor 1 instead


Test patch:
diff --git a/scipy/ndimage/tests/test_ndimage.py b/scipy/ndimage/tests/test_ndimage.py
--- a/scipy/ndimage/tests/test_ndimage.py
+++ b/scipy/ndimage/tests/test_ndimage.py
@@ -2152,10 +2152,7 @@ def test_zoom_zoomfactor_one(self):
     def test_zoom_output_shape_roundoff(self):
         arr = numpy.zeros((3, 11, 25))
         zoom = (4.0 / 3, 15.0 / 11, 29.0 / 25)
-        with suppress_warnings() as sup:
-            sup.filter(UserWarning,
-                       "From scipy 0.13.0, the output shape of zoom.. is calculated with round.. instead of int")
-            out = ndimage.zoom(arr, zoom)
+        out = ndimage.zoom(arr, zoom)
         assert_array_equal(out.shape, (4, 15, 29))
 
     def test_rotate01(self):
Repository: scipy/scipy

Issue:
TST: fix a bug in the circular import test.
Apparently we don't run it too often....


Discussion:
This seems to suggest that it is not run by CIs, otherwise it should have failed. Worth looking into/fixing here?
Wild guess: underscore in module name...  **EDIT**: or maybe not if the `_lib` tests run.
yes worth looking into. I think Pauli's guess is right. no time in the next few days though, in proposal writing mode. can leave this open for a bit, it's not super urgent
I think that the tests in `scipy/_lib` work because I saw them fail on CIs recently I think. I suspect the `runtests.py` process does include `scipy/_lib` (it's necessary for `scipy` functionality) in what gets built and then tested, but not `scipy/_build_utils` (because it's presumably only necessary during build time).

If this is the right trail to go down, maybe we should move any tests from `_build_utils` to `_lib`.
@larsoner: yes, the `_build_utils/tests` directory is missing. So should be solvable by some `setup.py` editing.
> So should be solvable by some setup.py editing.

I take this to mean we should change things to include `scipy._build_utils` as a submodule like we include `scipy._lib`. I'm not sure this is the right idea, though, since users shouldn't need this code to actually run SciPy. It seems cleaner to just move the tests to `scipy/_lib/tests` rather than add a module solely for the purposes of getting those tests to run. Unless there are other reasons to include it...?
... never mind, looks like `config.add_subpackage('_build_utils')` is already in `setup.py`. I'll see if I can figure out why the tests are not included.
I think `_build_utils` is missing a `setup.py` file which adds the `tests` folder as a data directory.

Resolving patch:
diff --git a/scipy/_build_utils/setup.py b/scipy/_build_utils/setup.py
new file mode 100644
--- /dev/null
+++ b/scipy/_build_utils/setup.py
@@ -0,0 +1,13 @@
+from __future__ import division, print_function, absolute_import
+
+
+def configuration(parent_package='', top_path=None):
+    from numpy.distutils.misc_util import Configuration
+    config = Configuration('_build_utils', parent_package, top_path)
+    config.add_data_dir('tests')
+    return config
+
+
+if __name__ == '__main__':
+    from numpy.distutils.core import setup
+    setup(**configuration(top_path='').todict())


Test patch:
diff --git a/scipy/_build_utils/tests/test_circular_imports.py b/scipy/_build_utils/tests/test_circular_imports.py
--- a/scipy/_build_utils/tests/test_circular_imports.py
+++ b/scipy/_build_utils/tests/test_circular_imports.py
@@ -9,7 +9,7 @@
     'cluster.hierarchy',
     'cluster.vq',
     'constants',
-    'fft'
+    'fft',
     'fftpack',
     'fftpack.convolve',
     'integrate',
Repository: scipy/scipy

Issue:
wishlist: pep8 and/or pyflakes options for runtests.py
See the off-topic discussion in https://github.com/scipy/scipy/pull/3617.  The idea is to reduce the number of rage-commits required by the pep8 bot.



Discussion:
The PR https://github.com/scipy/scipy/pull/3512 has some debate about the pep8 police.

Makes sense to add to `runtests.py` all types of tests that will be run on TravisCI. So also the doc builds.

@rgommers could we use flake8 instead of pyflakes for this? It makes it easier to exclude files that you don't want to check.

Resolving patch:
diff --git a/runtests.py b/runtests.py
--- a/runtests.py
+++ b/runtests.py
@@ -123,8 +123,18 @@ def main(argv):
                               ))
     parser.add_argument("args", metavar="ARGS", default=[], nargs=REMAINDER,
                         help="Arguments to pass to Nose, Python or shell")
+    parser.add_argument("--pep8", action="store_true", default=False,
+                        help="Perform pep8 check with pycodestyle.")
     args = parser.parse_args(argv)
 
+    if args.pep8:
+        # os.system("flake8 scipy --ignore=F403,F841,F401,F811,F405,E121,E122,"
+        #           "E123,E125,E126,E127,E128,E226,E231,E251,E265,E266,E302,"
+        #           "E402,E501,E712,E721,E731,E741,W291,W293,W391,W503,W504"
+        #           "--exclude=scipy/_lib/six.py")
+        os.system("pycodestyle scipy benchmarks/benchmarks")
+        sys.exit(0)
+
     if args.bench_compare:
         args.bench = True
         args.no_build = True  # ASV does the building


Test patch:
Repository: scipy/scipy

Issue:
minor 'iprint' documentation error in scipy.optimize.minimize L-BFGS-B
The documentation of L-BFGS-B (http://docs.scipy.org/doc/scipy/reference/optimize.minimize-lbfgsb.html) lists `iprint` as an argument in the signature, but it is missing in the description of the arguments, probably replaced by the seemingly redundant `disp`, itself there twice under two different types (bool and int).



Discussion:
Indeed. Also the order of documented items in the options dict doesn't match the signature on that html doc page.

The documentation here is still incorrect.  In fact, it looks like the iprint variable is actually completely ignored if disp is set.  This is documented in ``scipy/optimize/lbfgsb.py`` but I haven't verified that and the documentation should be propagated up to the userfacing side.  Also,  it would be nice if there was a way to print out the convergence information without getting the iteration info.  From what I can read that's actually not possible right now.

Resolving patch:
diff --git a/scipy/optimize/lbfgsb.py b/scipy/optimize/lbfgsb.py
--- a/scipy/optimize/lbfgsb.py
+++ b/scipy/optimize/lbfgsb.py
@@ -240,6 +240,16 @@ def _minimize_lbfgsb(fun, x0, args=(), jac=None, bounds=None,
         Maximum number of function evaluations.
     maxiter : int
         Maximum number of iterations.
+    iprint : int, optional
+        Controls the frequency of output. ``iprint < 0`` means no output;
+        ``iprint = 0``    print only one line at the last iteration;
+        ``0 < iprint < 99`` print also f and ``|proj g|`` every iprint iterations;
+        ``iprint = 99``   print details of every iteration except n-vectors;
+        ``iprint = 100``  print also the changes of active set and final x;
+        ``iprint > 100``  print details of every iteration including x and g.
+    callback : callable, optional
+        Called after each iteration, as ``callback(xk)``, where ``xk`` is the
+        current parameter vector.
     maxls : int, optional
         Maximum number of line search steps (per iteration). Default is 20.
 


Test patch:
Repository: scipy/scipy

Issue:
BUG: Overflow in stats.kruskal for large samples #7759
Fix bug #7759 and add unit test.
BUG: Overflow in stats.kruskal for large samples #7759
Fix bug #7759 and add unit test.


Discussion:

Resolving patch:
diff --git a/scipy/stats/stats.py b/scipy/stats/stats.py
--- a/scipy/stats/stats.py
+++ b/scipy/stats/stats.py
@@ -5928,7 +5928,7 @@ def kruskal(*args, **kwargs):
     for i in range(num_groups):
         ssbn += _square_of_sums(ranked[j[i]:j[i+1]]) / n[i]
 
-    totaln = np.sum(n)
+    totaln = np.sum(n, dtype=float)
     h = 12.0 / (totaln * (totaln + 1)) * ssbn - 3 * (totaln + 1)
     df = num_groups - 1
     h /= ties


Test patch:
diff --git a/scipy/stats/tests/test_stats.py b/scipy/stats/tests/test_stats.py
--- a/scipy/stats/tests/test_stats.py
+++ b/scipy/stats/tests/test_stats.py
@@ -4527,6 +4527,15 @@ def test_nan_policy(self):
         assert_almost_equal(stats.kruskal(x, x, nan_policy='omit'), (0.0, 1.0))
         assert_raises(ValueError, stats.kruskal, x, x, nan_policy='raise')
         assert_raises(ValueError, stats.kruskal, x, x, nan_policy='foobar')
+    
+    def test_large_no_samples(self):
+        # Test to see if large samples are handled correctly.
+        n = 50000
+        x = np.random.randn(n)
+        y = np.random.randn(n) + 50
+        h, p = stats.kruskal(x, y)
+        expected = 0
+        assert_approx_equal(p, expected)
 
 
 class TestCombinePvalues(object):
Repository: scipy/scipy

Issue:
Typo in sp.stats.wilcoxon docstring
The docstring of [sp.stats.wilcoxon](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wilcoxon.html) has a jumbled sentence: 
> The one-sided test has the null that the median is positive against the alternative that the it is negative (alternative == 'less'), or vice versa (alternative == 'greater.').

#### Scipy/Numpy/Python version information:
scipy v1.3.1


Discussion:

Resolving patch:
diff --git a/scipy/stats/morestats.py b/scipy/stats/morestats.py
--- a/scipy/stats/morestats.py
+++ b/scipy/stats/morestats.py
@@ -2771,9 +2771,9 @@ def wilcoxon(x, y=None, zero_method="wilcox", correction=False,
     is that the differences are symmetric, see [2]_.
     The two-sided test has the null hypothesis that the median of the
     differences is zero against the alternative that it is different from
-    zero. The one-sided test has the null that the median is positive against
-    the alternative that the it is negative (``alternative == 'less'``),
-    or vice versa (``alternative == 'greater.'``).
+    zero. The one-sided test has the null hypothesis that the median is 
+    positive against the alternative that it is negative 
+    (``alternative == 'less'``), or vice versa (``alternative == 'greater.'``).
 
     The test uses a normal approximation to derive the p-value (if
     ``zero_method == 'pratt'``, the approximation is adjusted as in [5]_).


Test patch:
Repository: scipy/scipy

Issue:
Documentation error in optimize.minimize
Hi,
 I've found a wrong statement in 
Documentation of optional parameters for minimize(method=’trust-constr’)
initial_barrier_parameter, initial_barrier_tolerance: float, optional

Current text:
This subproblem is solved for increasing values of barrier_parameter
Correct text:
This subproblem is solved for decreasing values of barrier_parameter

One could also mention here that barrier_parameter and barrier_tolerance are updated with the same prefactor.

See  algorithm 1 (p.3) of the cited paper, found e.g. here
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.39.4793&rep=rep1&type=pdf

Cheers,
Florian


Discussion:

Resolving patch:
diff --git a/scipy/optimize/_trustregion_constr/minimize_trustregion_constr.py b/scipy/optimize/_trustregion_constr/minimize_trustregion_constr.py
--- a/scipy/optimize/_trustregion_constr/minimize_trustregion_constr.py
+++ b/scipy/optimize/_trustregion_constr/minimize_trustregion_constr.py
@@ -177,10 +177,12 @@ def _minimize_trustregion_constr(fun, x0, args, grad,
         ``c(x) <= 0`` the algorithm introduces slack variables, solving the problem
         ``min_(x,s) f(x) + barrier_parameter*sum(ln(s))`` subject to the equality
         constraints  ``c(x) + s = 0`` instead of the original problem. This subproblem
-        is solved for increasing values of ``barrier_parameter`` and with decreasing
+        is solved for decreasing values of ``barrier_parameter`` and with decreasing
         tolerances for the termination, starting with ``initial_barrier_parameter``
         for the barrier parameter and ``initial_barrier_tolerance`` for the
-        barrier subproblem  barrier. Default is 0.1 for both values (recommended in [1]_ p. 19).
+        barrier tolerance. Default is 0.1 for both values (recommended in [1]_ p. 19).
+        Also note that ``barrier_parameter`` and ``barrier_tolerance`` are updated
+        with the same prefactor.
     factorization_method : string or None, optional
         Method to factorize the Jacobian of the constraints. Use None (default)
         for the auto selection or one of:


Test patch:
Repository: scipy/scipy

Issue:
Typo in docstring for `Rotation.from_euler`
<!-- 
Thank you for taking the time to file a bug report. 
Please fill in the fields below, deleting the sections that 
don't apply to your issue. You can view the final output
by clicking the preview button above.
Note: This is a comment, and won't appear in the output.
-->

My issue is about a typo in `Rotation.from_euler`: https://github.com/scipy/scipy/blob/master/scipy/spatial/transform/rotation.py#L709

The docstring should read 

> Rotations in 3 dimensions can be represented by a __sequence__ of 3

not 

> Rotations in 3 dimensions can be represented by a __sequece__ of 3



Discussion:

Resolving patch:
diff --git a/scipy/spatial/transform/rotation.py b/scipy/spatial/transform/rotation.py
--- a/scipy/spatial/transform/rotation.py
+++ b/scipy/spatial/transform/rotation.py
@@ -710,9 +710,9 @@ def from_rotvec(cls, rotvec):
     def from_euler(cls, seq, angles, degrees=False):
         """Initialize from Euler angles.
 
-        Rotations in 3 dimensions can be represented by a sequece of 3
+        Rotations in 3-D can be represented by a sequence of 3
         rotations around a sequence of axes. In theory, any three axes spanning
-        the 3D Euclidean space are enough. In practice the axes of rotation are
+        the 3-D Euclidean space are enough. In practice, the axes of rotation are
         chosen to be the basis vectors.
 
         The three rotations can either be in a global frame of reference


Test patch:
Repository: scipy/scipy

Issue:
ellipord does returns bogus values if gstop or gpass are negative (Trac #928)
_Original ticket http://projects.scipy.org/scipy/ticket/928 on 2009-04-20 by @cournape, assigned to unknown._

```
#!python
from scipy.signal import ellipord
ellipord(0.2, 0.5, -5, -3)
```

Return a minimal order of 0. Potentially similar functions for other types of filters are buggy as well.



Discussion:
This now gives `ValueError: cannot convert float NaN to integer`, which isn't understandable. Could be easily fixed by checking the input values and raising `ValueError`s with informative error messages.

Note, also for positive values if `gpass > gstop`:
```
In [26]: ellipord(0.2, 0.5, 1, 2)                                                     
Out[26]: (1, 0.2)

In [27]: ellipord(0.2, 0.5, 3, 2)                                                     
---------------------------------------------------------------------------
ValueError 
```
And that should apply to `cheb2ord`, etc. too.

Resolving patch:
diff --git a/scipy/signal/filter_design.py b/scipy/signal/filter_design.py
--- a/scipy/signal/filter_design.py
+++ b/scipy/signal/filter_design.py
@@ -3993,6 +3993,14 @@ def ellipord(wp, ws, gpass, gstop, analog=False, fs=None):
     >>> plt.show()
 
     """
+
+    if gpass <= 0.0:
+        raise ValueError("gpass should be larger than 0.0")
+    elif gstop <= 0.0:
+        raise ValueError("gstop should be larger than 0.0")
+    elif gpass > gstop:
+        raise ValueError("gpass should be smaller than gstop")
+
     wp = atleast_1d(wp)
     ws = atleast_1d(ws)
     if fs is not None:


Test patch:
diff --git a/scipy/signal/tests/test_filter_design.py b/scipy/signal/tests/test_filter_design.py
--- a/scipy/signal/tests/test_filter_design.py
+++ b/scipy/signal/tests/test_filter_design.py
@@ -1748,6 +1748,19 @@ def test_fs_param(self):
         assert_equal(N, 7)
         assert_allclose(Wn, [590.3293117737195, 2400], rtol=1e-5)
 
+    def test_invalid_input(self):
+        with pytest.raises(ValueError) as exc_info:
+            ellipord(0.2, 0.5, 3, 2)
+        assert "gpass should be smaller than gstop" in str(exc_info.value)
+
+        with pytest.raises(ValueError) as exc_info:
+            ellipord(0.2, 0.5, -1, 2)
+        assert "gpass should be larger than 0.0" in str(exc_info.value)
+
+        with pytest.raises(ValueError) as exc_info:
+            ellipord(0.2, 0.5, 1, -2)
+        assert "gstop should be larger than 0.0" in str(exc_info.value)
+
 
 class TestBessel(object):
Repository: scipy/scipy

Issue:
linprog: interior-point: Cholmod reordering can be reused
In the MOSEK paper, it states that the matrix M  has a fixed nonzero pattern throughout the solution. 
Scikit-sparse's interface to Cholmod can create a Factor object which stores the reordering information. .   From my tests on some large problems (> 1e6 variables), I am getting a 2-3X speedup by storing this reordering. I would be willing to implement this.

 A similar strategy can be used for the scikit-umfpack solver through the low-level interface.


Discussion:
This sounds great! I'd be happy to review the PR.

Resolving patch:
diff --git a/scipy/optimize/_linprog_ip.py b/scipy/optimize/_linprog_ip.py
--- a/scipy/optimize/_linprog_ip.py
+++ b/scipy/optimize/_linprog_ip.py
@@ -31,6 +31,7 @@
 has_cholmod = True
 try:
     from sksparse.cholmod import cholesky as cholmod
+    from sksparse.cholmod import analyze as cholmod_analyze
 except ImportError:
     has_cholmod = False
 try:
@@ -87,7 +88,14 @@ def _get_solver(M, sparse=False, lstsq=False, sym_pos=True,
                 def solve(r, sym_pos=False):
                     return sps.linalg.lsqr(M, r)[0]
             elif cholesky:
-                solve = cholmod(M)
+                try:
+                    # Will raise an exception in the first call,
+                    # or when the matrix changes due to a new problem
+                    _get_solver.cholmod_factor.cholesky_inplace(M)
+                except Exception:
+                    _get_solver.cholmod_factor = cholmod_analyze(M)
+                    _get_solver.cholmod_factor.cholesky_inplace(M)
+                solve = _get_solver.cholmod_factor
             else:
                 if has_umfpack and sym_pos:
                     solve = sps.linalg.factorized(M)
@@ -229,8 +237,8 @@ def _get_delta(A, b, c, x, y, z, tau, kappa, gamma, eta, sparse=False,
                 # Reference [4] Eq. 8.23
                 rhatxs = ((1 - alpha) * gamma * mu -
                           x * z - alpha**2 * d_x * d_z)
-                rhattk = ((1 - alpha) * gamma * mu - 
-                    tau * kappa - 
+                rhattk = ((1 - alpha) * gamma * mu -
+                    tau * kappa -
                     alpha**2 * d_tau * d_kappa)
             else:  # if the correction is for "predictor-corrector"
                 # Reference [4] Eq. 8.13


Test patch:
Repository: scipy/scipy

Issue:
OverflowError in resample_poly (upfirdn)
scipy.signal.resample_poly fails if the output vector length would be greater than 2^31-1.

```
Traceback (most recent call last):

  File "<ipython-input-1-ac5d2b0a1632>", line 11, in <module>
    yy = resample_poly(y, 128, 1)

  File "F:\Programs\Miniconda3\lib\site-packages\scipy\signal\signaltools.py", line 2424, in resample_poly
    y = upfirdn(h, x, up, down, axis=axis)

  File "F:\Programs\Miniconda3\lib\site-packages\scipy\signal\_upfirdn.py", line 183, in upfirdn
    return ufd.apply_filter(x, axis)

  File "F:\Programs\Miniconda3\lib\site-packages\scipy\signal\_upfirdn.py", line 82, in apply_filter
    output_shape[axis] = output_len

OverflowError: Python int too large to convert to C long
```

output_shape is created on the previous line (81):
`output_shape = np.asarray(x.shape)`

With an unspecified dtype it appears to get np.int32 by default, which is inadequate for specifying large array shapes.

This could be fixed by explicitly specifying the dtype:
`output_shape = np.asarray(x.shape, dtype=np.int64)`


Discussion:
Can you share some more information about your platform and python/NumPy/SciPy versions? I'm able to run the following without a problem both on Scipy 1.3.1 and `master`, with NumPy 1.17.3 and Python 3.7.5
```python
y = np.random.randn(2**25)
yy = sig.resample_poly(y, 2**7, 1)  # Results in yy.size = 2**32
```
They are on windows where a "C long" is 32 bits.
Got it. @patrick984, would you be willing to put together a PR with your suggested fix?

This looks like an occurrence of what is discussed in numpy/numpy#9464, there may be other such occurrences of 32 bit ints lurking around.

Resolving patch:
diff --git a/scipy/signal/_upfirdn.py b/scipy/signal/_upfirdn.py
--- a/scipy/signal/_upfirdn.py
+++ b/scipy/signal/_upfirdn.py
@@ -89,7 +89,9 @@ def apply_filter(self, x, axis=-1, mode='constant', cval=0):
         """Apply the prepared filter to the specified axis of a N-D signal x"""
         output_len = _output_len(len(self._h_trans_flip), x.shape[axis],
                                  self._up, self._down)
-        output_shape = np.asarray(x.shape)
+        # Explicit use of np.int64 for output_shape dtype avoids OverflowError
+        # when allocating large array on platforms where np.int_ is 32 bits
+        output_shape = np.asarray(x.shape, dtype=np.int64)
         output_shape[axis] = output_len
         out = np.zeros(output_shape, dtype=self._output_type, order='C')
         axis = axis % x.ndim


Test patch: