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

Issue:
Regression: InfiniteLines became finite and movable
<!-- In the following, please describe your issue in detail! -->
<!-- If some of the sections do not apply, just remove them. -->

### Short description
<!-- This should summarize the issue. -->
`InfiniteLine`s are movable and finite along their "infinite" direction since PR #1391 (Tagging @jjuod )
. Moving them also moves their labels. PR #1413 only fixes their initial positions.

### Code to reproduce
`examples\InfiniteLine.py`

### Expected behavior
<!-- What should happen? -->
Lines should be infinite and dragging them should not move the label into their "infinite" direction.

![image](https://user-images.githubusercontent.com/31772910/99725346-45987a80-2ab5-11eb-915c-d14eb59ada5e.png)



### Real behavior
<!-- What happens? -->
Lines are finite and moving them also moves their labels.

![image](https://user-images.githubusercontent.com/31772910/99725280-2863ac00-2ab5-11eb-9dfd-122641196bbc.png)



### Tested environment(s)

 * PyQtGraph version: Since commit 39f9c6a
 * Qt Python binding: PyQt5 5.15.1 Qt 5.15.1
 * Python version: 3.8.5
 * NumPy version: 1.19.2
 * Operating system: Linux 5.8.16-2-MANJARO x86_64 20.1.2 Mikah
 * Installation method: Executed in folder


Discussion:
Thanks for making an issue for this @2xB; definitely need this resolved pre-0.11.1 release.

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/InfiniteLine.py b/pyqtgraph/graphicsItems/InfiniteLine.py
--- a/pyqtgraph/graphicsItems/InfiniteLine.py
+++ b/pyqtgraph/graphicsItems/InfiniteLine.py
@@ -249,7 +249,7 @@ def setPos(self, pos):
 
         if self.p != newPos:
             self.p = newPos
-            self._invalidateCache()
+            self.viewTransformChanged()
             GraphicsObject.setPos(self, Point(self.p))
             self.sigPositionChanged.emit(self)
 
@@ -293,9 +293,6 @@ def setSpan(self, mn, mx):
             self.span = (mn, mx)
             self.update()
 
-    def _invalidateCache(self):
-        self._boundingRect = None
-
     def _computeBoundingRect(self):
         #br = UIGraphicsItem.boundingRect(self)
         vr = self.viewRect()  # bounds of containing ViewBox mapped to local coords.
@@ -432,8 +429,8 @@ def viewTransformChanged(self):
         Called whenever the transformation matrix of the view has changed.
         (eg, the view range has changed or the view was resized)
         """
+        self._boundingRect = None
         GraphicsItem.viewTransformChanged(self)
-        self._invalidateCache()
         
     def setName(self, name):
         self._name = name


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
AttributeError: 'InfLineLabel' object has no attribute 'updateText'
When I'm setting the `InfLineLabel` visibility, an attribute error was raised.

It is the function of `InFlineLabel` `setVisible` Line 404, I solved this by comment
```
self.updateText()
self.updatePosition()
```
and use the already exist function `valueChanged`. 

the code is:
```
def setVisible(self, v):
    TextItem.setVisible(self, v)
    if v:
        self.valueChanged()
        # self.updateText()
        # self.updatePosition()
```


Discussion:

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/InfiniteLine.py b/pyqtgraph/graphicsItems/InfiniteLine.py
--- a/pyqtgraph/graphicsItems/InfiniteLine.py
+++ b/pyqtgraph/graphicsItems/InfiniteLine.py
@@ -550,8 +550,7 @@ def updatePosition(self):
     def setVisible(self, v):
         TextItem.setVisible(self, v)
         if v:
-            self.updateText()
-            self.updatePosition()
+            self.valueChanged()
             
     def setMovable(self, m):
         """Set whether this label is movable by dragging along the line.


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
Regression in scrollingPlots example
<!-- In the following, please describe your issue in detail! -->
<!-- If some of the sections do not apply, just remove them. -->

### Short description
<!-- This should summarize the issue. -->

Plot `p3` in `examples/scrollingPlots.py` isn't working correctly as of #1391 (identified via bisect, #1413 doesn't fix it).

### Code to reproduce
<!-- Please provide a minimal working example that reproduces the issue in the code block below.
     Ideally, this should be a full example someone else could run without additional setup. -->

```
$ python examples/scrollingPlots.py
```

### Expected behavior

The left plot on the second row (`p3`) should scroll to the left with continuously updated data, similarly to the plot on the bottom row.

### Real behavior
<!-- What happens? -->

The plot continues to scroll but stops displaying data in the array beyond about 20 samples. Mouse interaction suddenly brings the hidden data into view. Screenshot after about 80 updates below - the left plot on the second row should have a curve extending all the way to x = 0:

![Screenshot_2021-01-09_08-19-29](https://user-images.githubusercontent.com/943602/104102863-e6a0e780-5253-11eb-8b7d-75497b185567.png)

### Tested environment(s)

 * PyQtGraph version: <!-- output of pyqtgraph.__version__ --> 386dcf81
 * Qt Python binding: <!-- output of pyqtgraph.Qt.VERSION_INFO --> PyQt5 5.15.2, PySide2 5.15.2
 * Python version: 3.9.1
 * NumPy version: <!-- output of numpy.__version__ --> 1.19.5
 * Operating system: Linux
 * Installation method: <!-- e.g. pip, conda, system packages, ... --> pip



Discussion:
I can replicate this on the current master branch.

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/PlotDataItem.py b/pyqtgraph/graphicsItems/PlotDataItem.py
--- a/pyqtgraph/graphicsItems/PlotDataItem.py
+++ b/pyqtgraph/graphicsItems/PlotDataItem.py
@@ -217,6 +217,13 @@ def name(self):
     def boundingRect(self):
         return QtCore.QRectF()  ## let child items handle this
 
+    def setPos(self, x, y):
+        GraphicsObject.setPos(self, x, y)
+        # to update viewRect:
+        self.viewTransformChanged()
+        # to update displayed point sets, e.g. when clipping (which uses viewRect):
+        self.viewRangeChanged()
+
     def setAlpha(self, alpha, auto):
         if self.opts['alphaHint'] == alpha and self.opts['alphaMode'] == auto:
             return
@@ -552,7 +559,6 @@ def setData(self, *args, **kargs):
         profiler('emit')
 
     def updateItems(self):
-
         curveArgs = {}
         for k,v in [('pen','pen'), ('shadowPen','shadowPen'), ('fillLevel','fillLevel'), ('fillOutline', 'fillOutline'), ('fillBrush', 'brush'), ('antialias', 'antialias'), ('connect', 'connect'), ('stepMode', 'stepMode')]:
             curveArgs[v] = self.opts[k]


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
opengl\items\GLScatterPlotItem.py, Argument pos
### Description
pos is defined as an **empty list** in line 17 instead of an array which causes for exceptions when `pose.shape`, `pos.transpose()`, and `pos.size` are used.


### Behavior
```
    |==============================>>
    |  Traceback (most recent call last):
    |    File "filename.py", line 358, in <module>
    |      sys.exit(app.exec_())
    |    File "...\AppData\Roaming\Python\Python38\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 193, in paintGL      
    |      self.drawItemTree(useItemNames=useItemNames)
    |    File "...\AppData\Roaming\Python\Python38\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 233, in drawItemTree 
    |      self.drawItemTree(i, useItemNames=useItemNames)
    |    File "...\AppData\Roaming\Python\Python38\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 214, in drawItemTree 
    |      debug.printExc()
    |    --- exception caught here ---
    |    File "...\AppData\Roaming\Python\Python38\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 211, in drawItemTree 
    |      i.paint()
    |    File "...\AppData\Roaming\Python\Python38\site-packages\pyqtgraph\opengl\items\GLScatterPlotItem.py", line 152, in paint
    |      glDrawArrays(GL_POINTS, 0, int(pos.size / pos.shape[-1]))
    |  AttributeError: 'list' object has no attribute 'size'
    |==============================<<
Error while drawing item <pyqtgraph.opengl.items.GLScatterPlotItem.GLScatterPlotItem(0xf20aa30) at 0x101A63A8>.
```

### Additional context
I honestly have no idea how to fix it since I tried some of the trivia fixes, and they did not solve the problem. (
newbie)


Discussion:

Resolving patch:
diff --git a/pyqtgraph/opengl/items/GLScatterPlotItem.py b/pyqtgraph/opengl/items/GLScatterPlotItem.py
--- a/pyqtgraph/opengl/items/GLScatterPlotItem.py
+++ b/pyqtgraph/opengl/items/GLScatterPlotItem.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 from OpenGL.GL import *
 from OpenGL.arrays import vbo
 from .. GLGraphicsItem import GLGraphicsItem
@@ -14,7 +15,7 @@ def __init__(self, **kwds):
         GLGraphicsItem.__init__(self)
         glopts = kwds.pop('glOptions', 'additive')
         self.setGLOptions(glopts)
-        self.pos = []
+        self.pos = None
         self.size = 10
         self.color = [1.0,1.0,1.0,0.5]
         self.pxMode = True
@@ -99,6 +100,9 @@ def fn(x,y):
         ##glPointParameterfv(GL_POINT_SIZE_MIN, (0,))
         
     def paint(self):
+        if self.pos is None:
+            return
+
         self.setupGLState()
         
         glEnable(GL_POINT_SPRITE)


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
GraphItem fails to draw if no edges
The following code errors:

``` py
import numpy as np
import pyqtgraph as pg
from PyQt4.QtGui import QApplication

app = QApplication([])

item = pg.GraphItem()
item.setData(adj=np.array([], dtype=int),
             pos=np.array([[0.1, 0.1],
                           [0.9, 0.9]]))
item.generatePicture()
```

```
Traceback (most recent call last):
  File "/tmp/test_graphitem.py", line 11, in <module>
    item.generatePicture()
  File "/usr/lib/python3/dist-packages/pyqtgraph/graphicsItems/GraphItem.py", line 122, in generatePicture
    pts = pts.reshape((pts.shape[0]*pts.shape[1], pts.shape[2]))
IndexError: tuple index out of range
```

The problem is that empty `pos[adj]` doesn't have three dimensions. To mitigate it, I had to also pass `setData(..., pen=None)`. It makes my code way uglier to have to take care of this in several places, to say the least.

**OT**: I find pyqtgraph's code in general full of really complex invariants, and such an important project would probably benefit hugely from a more dedicated maintainer in the coming era. As you seem to be more passionately invested elsewhere nowadays, have you ever considered searching for your eventual replacement yet? :smiley:



Discussion:

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/GraphItem.py b/pyqtgraph/graphicsItems/GraphItem.py
--- a/pyqtgraph/graphicsItems/GraphItem.py
+++ b/pyqtgraph/graphicsItems/GraphItem.py
@@ -55,7 +55,9 @@ def setData(self, **kwds):
         """
         if 'adj' in kwds:
             self.adjacency = kwds.pop('adj')
-            if self.adjacency is not None and self.adjacency.dtype.kind not in 'iu':
+            if hasattr(self.adjacency, '__len__') and len(self.adjacency) == 0:
+                self.adjacency = None
+            elif self.adjacency is not None and self.adjacency.dtype.kind not in 'iu':
                 raise Exception("adjacency must be None or an array of either int or unsigned type.")
             self._update()
         if 'pos' in kwds:
@@ -140,8 +142,3 @@ def dataBounds(self, *args, **kwds):
     
     def pixelPadding(self):
         return self.scatter.pixelPadding()
-        
-        
-        
-        
-


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
pip installation of pyqtgraph 0.12.0 does not bundle colors/maps directory
<!-- In the following, please describe your issue in detail! -->
<!-- If some of the sections do not apply, just remove them. -->

### Short description
<!-- This should summarize the issue. -->

In a pip install of pyqtgraph 0.12.0, the colors/maps subdirectory is not included in the install.

### Code to reproduce
<!-- Please provide a minimal working example that reproduces the issue in the code block below.
     Ideally, this should be a full example someone else could run without additional setup. -->
```
py -m pyqtgraph.examples.colorMaps
```

### Expected behavior
<!-- What should happen? -->

Color Maps example should execute.

### Real behavior
<!-- What happens? -->

```
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\XYZ\\AppData\\Local\\Programs\Python\\Python38\\lib\\site-packages\\pyqtgraph\\colors\\maps'
```

### Tested environment(s)

 * PyQtGraph version: 0.12.0
 * Qt Python binding: PySide6 6.0.1 Qt 6.0.1
 * Python version: 3.8.8
 * NumPy version: 1.20.1
 * Operating system: Windows
 * Installation method: pip

### Additional context
The user can more easily trigger this by trying to run the Color Maps example from the ExampleApp GUI.



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -140,6 +140,7 @@ def run(self):
     package_dir={'pyqtgraph.examples': 'examples'},  ## install examples along with the rest of the source
     package_data={'pyqtgraph.examples': ['optics/*.gz', 'relativity/presets/*.cfg'],
                   "pyqtgraph.icons": ["*.svg", "*.png"],
+                  "pyqtgraph": ["colors/maps/*.csv", "colors/maps/*.txt"],
                   },
     install_requires = [
         'numpy>=1.17.0',


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
ColorBarItem's bar no color if imageAxisOrder configured to 'row-major'
<!-- In the following, please describe your issue in detail! -->
<!-- If some of the sections do not apply, just remove them. -->

### Short description
<!-- This should summarize the issue. -->
ColorBarItem seems to be affected by ```pg.setConfigOption('imageAxisOrder', 'row-major')``` since the bar itself is rendered as an ImageItem.
A possible fix would be to create the bar's ImageItem as ImageItem(axisOrder='col-major').

### Code to reproduce
<!-- Please provide a minimal working example that reproduces the issue in the code block below.
     Ideally, this should be a full example someone else could run without additional setup. -->

```python
import numpy as np
import pyqtgraph as pg
pg.setConfigOption('imageAxisOrder', 'row-major')

data = np.random.randint(65536, size=(1024,1024), dtype=np.uint16)

app = pg.mkQApp()
glw = pg.GraphicsLayoutWidget()

imgitem = pg.ImageItem(image=data, axisOrder='row-major', autoLevels=False)
plot = glw.addPlot()
plot.addItem(imgitem)

info = np.iinfo(data.dtype)
cmap = pg.colormap.get('CET-L4')
bar = pg.ColorBarItem(
        values=(info.min, info.max),
        limits=(info.min, info.max),
        orientation='horizontal',
        cmap=cmap)
bar.setImageItem(imgitem, insert_in=plot)

glw.show()
app.exec_()
```

### Expected behavior
<!-- What should happen? -->
![with_color](https://user-images.githubusercontent.com/2657027/115098737-3d5d4200-9f64-11eb-90bf-97d81146d64c.png)

### Real behavior
<!-- What happens? -->
![no_color](https://user-images.githubusercontent.com/2657027/115098741-46e6aa00-9f64-11eb-9337-84dfdfe1fcbd.png)

### Tested environment(s)

 * PyQtGraph version: 0.12.1
 * Qt Python binding: PySide6 6.0.2 Qt 6.0.2<!-- output of pyqtgraph.Qt.VERSION_INFO -->
 * Python version: 3.8.9
 * NumPy version: 1.20.2 <!-- output of numpy.__version__ -->
 * Operating system: Windows 10
 * Installation method: pip install -e . <!-- e.g. pip, conda, system packages, ... -->



Discussion:

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/ColorBarItem.py b/pyqtgraph/graphicsItems/ColorBarItem.py
--- a/pyqtgraph/graphicsItems/ColorBarItem.py
+++ b/pyqtgraph/graphicsItems/ColorBarItem.py
@@ -98,7 +98,7 @@ def __init__(self, values=(0,1), width=25, cmap=None, label=None,
         self.axis.unlinkFromView()
         self.axis.setRange( self.values[0], self.values[1] )
 
-        self.bar = ImageItem()
+        self.bar = ImageItem(axisOrder='col-major')
         if self.horizontal:
             self.bar.setImage( np.linspace(0, 1, 256).reshape( (-1,1) ) )
             if label is not None: self.getAxis('bottom').setLabel(label)


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
Int conversion issues when showing plot grid
In '0.11.1.dev0' (and 0.11.1), the following code will issue an error:

```python
import pyqtgraph as pg
from warnings import simplefilter
simplefilter('error', DeprecationWarning)

pw = pg.PlotWindow()
pi = pw.plotItem
pi.showGrid(True, True, alpha=0.5)
#   File "C:\Users\njessurun\AppData\Local\Continuum\anaconda3\envs\py38\lib\site-# packages\pyqtgraph\graphicsItems\PlotItem\PlotItem.py", line 382, in showGrid
#     self.ctrl.gridAlphaSlider.setValue(v)
# TypeError: setValue(self, int): argument 1 has unexpected type 'numpy.float64'
```

Qt library: 'PyQt5 5.14.2 Qt 5.14.2'


Discussion:
Fixed with b058d03
Still seeing this error on 0.12

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/PlotItem/PlotItem.py b/pyqtgraph/graphicsItems/PlotItem/PlotItem.py
--- a/pyqtgraph/graphicsItems/PlotItem/PlotItem.py
+++ b/pyqtgraph/graphicsItems/PlotItem/PlotItem.py
@@ -373,8 +373,8 @@ def showGrid(self, x=None, y=None, alpha=None):
         if y is not None:
             self.ctrl.yGridCheck.setChecked(y)
         if alpha is not None:
-            v = fn.clip_scalar(alpha, 0., 1.)*self.ctrl.gridAlphaSlider.maximum()
-            self.ctrl.gridAlphaSlider.setValue(v)
+            v = fn.clip_scalar(alpha, 0, 1) * self.ctrl.gridAlphaSlider.maximum() # slider range 0 to 255
+            self.ctrl.gridAlphaSlider.setValue( int(v) )
         
     def close(self):
         ## Most of this crap is needed to avoid PySide trouble. 


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
Parameter value equality comparisons fails when values are numpy array-like
In a few places (namely `setLimits` and `valueIsDefault`), direct value comparisons with `==` fail on array-like comparisons. This can be fixed simply by using `pg.eq` instead of `==`. Parameter operations aren't speed-optimized, so there is limited benefit to avoiding rich comparison.
Parameter value equality comparisons fails when values are numpy array-like
In a few places (namely `setLimits` and `valueIsDefault`), direct value comparisons with `==` fail on array-like comparisons. This can be fixed simply by using `pg.eq` instead of `==`. Parameter operations aren't speed-optimized, so there is limited benefit to avoiding rich comparison.


Discussion:

Resolving patch:
diff --git a/pyqtgraph/parametertree/Parameter.py b/pyqtgraph/parametertree/Parameter.py
--- a/pyqtgraph/parametertree/Parameter.py
+++ b/pyqtgraph/parametertree/Parameter.py
@@ -441,13 +441,13 @@ def hasDefault(self):
         
     def valueIsDefault(self):
         """Returns True if this parameter's value is equal to the default value."""
-        return self.value() == self.defaultValue()
+        return fn.eq(self.value(), self.defaultValue())
         
     def setLimits(self, limits):
         """Set limits on the acceptable values for this parameter. 
         The format of limits depends on the type of the parameter and
         some parameters do not make use of limits at all."""
-        if 'limits' in self.opts and self.opts['limits'] == limits:
+        if 'limits' in self.opts and fn.eq(self.opts['limits'], limits):
             return
         self.opts['limits'] = limits
         self.sigLimitsChanged.emit(self, limits)


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
Log mode broken in 0.12.2
<!-- In the following, please describe your issue in detail! -->
<!-- If some of the sections do not apply, just remove them. -->

### Short description
Log mode shows wrong sign in the exponent, completely wrong numbers, and inverted axis.
Everything works as expected in 0.12.1

### Code to reproduce
```
import pyqtgraph as pg

from pyqtgraph.Qt import QtCore, QtGui

app = pg.mkQApp()
pw = pg.PlotWidget(enableMenu=False)

pw.plotItem.setLogMode(x=False, y=True)
x = range(8)
y = [1e-6,2e-6,3e-6,4e-6,5e-6,6e-6,7e-6,8e-6]
pw.plot(x, y, symbol='o')

pw.show()
# Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
```

### Expected behavior
logarithmic y axis

### Real behavior
Wrong sign in the exponent and inverted scale

### Tested environment(s)

 * PyQtGraph version: 0.12.2
 * Qt Python binding: pyqt5
 * Python version: 3.8




Discussion:
bisect points to 314121192ad8661f2db0be0221bfeacfbb50a736
> bisect points to 314121192ad8661f2db0be0221bfeacfbb50a736

Yeah I was thinking this was likely the commit.  Thanks for the git bisect results!

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/PlotDataItem.py b/pyqtgraph/graphicsItems/PlotDataItem.py
--- a/pyqtgraph/graphicsItems/PlotDataItem.py
+++ b/pyqtgraph/graphicsItems/PlotDataItem.py
@@ -701,7 +701,7 @@ def getData(self):
                     eps = np.finfo(y.dtype).eps
                 else:
                     eps = 1
-                y = np.copysign(np.log10(np.abs(y)+eps), y)
+                y = np.sign(y) * np.log10(np.abs(y)+eps)
 
         ds = self.opts['downsample']
         if not isinstance(ds, int):


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
typo in HistogramLUTItem.imageChanged for RGB autoLevel
### Short description
There is a typo in  HistogramLUTItem.imageChanged for RGB autoLevel , i.e.
```patch
diff --git a/pyqtgraph/graphicsItems/HistogramLUTItem.py b/pyqtgraph/graphicsItems/HistogramLUTItem.py
index 5350c16e..6ccdaf97 100644
--- a/pyqtgraph/graphicsItems/HistogramLUTItem.py
+++ b/pyqtgraph/graphicsItems/HistogramLUTItem.py
@@ -363,7 +363,7 @@ class HistogramLUTItem(GraphicsWidget):
                     if autoLevel:
                         mn = h[0][0]
                         mx = h[0][-1]
-                        self.region[i].setRegion([mn, mx])
+                        self.regions[i].setRegion([mn, mx])
                 else:
                     # hide channels not present in image data
                     self.plots[i].setVisible(False)
```

### Expected behavior
autolevel range set automatically

### Real behavior
```
TypeError: 'LinearRegionItem' object is not subscriptable



Discussion:

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/HistogramLUTItem.py b/pyqtgraph/graphicsItems/HistogramLUTItem.py
--- a/pyqtgraph/graphicsItems/HistogramLUTItem.py
+++ b/pyqtgraph/graphicsItems/HistogramLUTItem.py
@@ -363,7 +363,7 @@ def imageChanged(self, autoLevel=False, autoRange=False):
                     if autoLevel:
                         mn = h[0][0]
                         mx = h[0][-1]
-                        self.region[i].setRegion([mn, mx])
+                        self.regions[i].setRegion([mn, mx])
                 else:
                     # hide channels not present in image data
                     self.plots[i].setVisible(False)


Test patch: