We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
SyntaxWarnings
While running an `apt upgrade` I noticed:

```
/usr/lib/python3/dist-packages/pyqtgraph/examples/SpinBox.py:38: SyntaxWarning: invalid escape sequence '\$'
  regex='\$?(?P<number>(-?\d+(\.\d+)?)|(-?\.\d+))$')),
```

The `\$` should be written `\\$` or `r'\$'` since a few Python releases (same for all backslash escape that have no meanings). I don't have the time to search for other occurrences of this fact, but running the tests with `PYTHONDEVMODE=1` should help spotting them :)

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pyqtgraph/examples/SpinBox.py`
Content:
```
1 """
2 This example demonstrates the SpinBox widget, which is an extension of 
3 QDoubleSpinBox providing some advanced features:
4 
5   * SI-prefixed units
6   * Non-linear stepping modes
7   * Bounded/unbounded values
8 
9 """
10 
11 import ast
12 
13 import pyqtgraph as pg
14 from pyqtgraph.Qt import QtWidgets
15 
16 app = pg.mkQApp("SpinBox Example")
17 
18 
19 spins = [
20     ("Floating-point spin box, min=0, no maximum.<br>Non-finite values (nan, inf) are permitted.",
21      pg.SpinBox(value=5.0, bounds=[0, None], finite=False)),
22     ("Integer spin box, dec stepping<br>(1-9, 10-90, 100-900, etc), decimals=4", 
23      pg.SpinBox(value=10, int=True, dec=True, minStep=1, step=1, decimals=4)),
24     ("Float with SI-prefixed units<br>(n, u, m, k, M, etc)", 
25      pg.SpinBox(value=0.9, suffix='V', siPrefix=True)),
26     ("Float with SI-prefixed units,<br>dec step=0.1, minStep=0.1", 
27      pg.SpinBox(value=1.0, suffix='PSI', siPrefix=True, dec=True, step=0.1, minStep=0.1)),
28     ("Float with SI-prefixed units,<br>dec step=0.5, minStep=0.01", 
29      pg.SpinBox(value=1.0, suffix='V', siPrefix=True, dec=True, step=0.5, minStep=0.01)),
30     ("Float with SI-prefixed units,<br>dec step=1.0, minStep=0.001", 
31      pg.SpinBox(value=1.0, suffix='V', siPrefix=True, dec=True, step=1.0, minStep=0.001)),
32     ("Float with SI-prefixed units,<br>scaleAtZero=1e-6, step=1e-9",
33      pg.SpinBox(value=0, suffix='V', siPrefix=True, scaleAtZero=1e-6, step=1e-9)),
34     ("Float with SI prefix but no suffix",
35      pg.SpinBox(value=1e9, siPrefix=True)),
36     ("Float with custom formatting", 
37      pg.SpinBox(value=23.07, format='${value:0.02f}',
38                 regex='\$?(?P<number>(-?\d+(\.\d+)?)|(-?\.\d+))$')),
39     ("Int with suffix",
40      pg.SpinBox(value=999, step=1, int=True, suffix="V")),
41     ("Int with custom formatting", 
42      pg.SpinBox(value=4567, step=1, int=True, bounds=[0,None], format='0x{value:X}', 
43                 regex='(0x)?(?P<number>[0-9a-fA-F]+)$',
44                 evalFunc=lambda s: ast.literal_eval('0x'+s))),
45     ("Integer with bounds=[10, 20] and wrapping",
46      pg.SpinBox(value=10, bounds=[10, 20], int=True, minStep=1, step=1, wrapping=True)),
47 ]
48 
49 
50 win = QtWidgets.QMainWindow()
51 win.setWindowTitle('pyqtgraph example: SpinBox')
52 cw = QtWidgets.QWidget()
53 layout = QtWidgets.QGridLayout()
54 cw.setLayout(layout)
55 win.setCentralWidget(cw)
56 win.show()
57 #win.resize(300, 600)
58 changingLabel = QtWidgets.QLabel()  ## updated immediately
59 changedLabel = QtWidgets.QLabel()   ## updated only when editing is finished or mouse wheel has stopped for 0.3sec
60 changingLabel.setMinimumWidth(200)
61 font = changingLabel.font()
62 font.setBold(True)
63 font.setPointSize(14)
64 changingLabel.setFont(font)
65 changedLabel.setFont(font)
66 labels = []
67 
68 
69 def valueChanged(sb):
70     changedLabel.setText("Final value: %s" % str(sb.value()))
71 
72 def valueChanging(sb, value):
73     changingLabel.setText("Value changing: %s" % str(sb.value()))
74 
75     
76 for text, spin in spins:
77     label = QtWidgets.QLabel(text)
78     labels.append(label)
79     layout.addWidget(label)
80     layout.addWidget(spin)
81     spin.sigValueChanged.connect(valueChanged)
82     spin.sigValueChanging.connect(valueChanging)
83 
84 layout.addWidget(changingLabel, 0, 1)
85 layout.addWidget(changedLabel, 2, 1)
86 
87 
88 #def mkWin():
89     #win = QtWidgets.QMainWindow()
90     #g = QtWidgets.QFormLayout()
91     #w = QtWidgets.QWidget()
92     #w.setLayout(g)
93     #win.setCentralWidget(w)
94     #s1 = SpinBox(value=5, step=0.1, bounds=[-1.5, None], suffix='units')
95     #t1 = QtWidgets.QLineEdit()
96     #g.addRow(s1, t1)
97     #s2 = SpinBox(value=10e-6, dec=True, step=0.1, minStep=1e-6, suffix='A', siPrefix=True)
98     #t2 = QtWidgets.QLineEdit()
99     #g.addRow(s2, t2)
100     #s3 = SpinBox(value=1000, dec=True, step=0.5, minStep=1e-6, bounds=[1, 1e9], suffix='Hz', siPrefix=True)
101     #t3 = QtWidgets.QLineEdit()
102     #g.addRow(s3, t3)
103     #s4 = SpinBox(int=True, dec=True, step=1, minStep=1, bounds=[-10, 1000])
104     #t4 = QtWidgets.QLineEdit()
105     #g.addRow(s4, t4)
106 
107     #win.show()
108 
109     #import sys
110     #for sb in [s1, s2, s3,s4]:
111 
112         ##QtCore.QObject.connect(sb, QtCore.SIGNAL('valueChanged(double)'), lambda v: sys.stdout.write(str(sb) + " valueChanged\n"))
113         ##QtCore.QObject.connect(sb, QtCore.SIGNAL('editingFinished()'), lambda: sys.stdout.write(str(sb) + " editingFinished\n"))
114         #sb.sigValueChanged.connect(valueChanged)
115         #sb.sigValueChanging.connect(valueChanging)
116         #sb.editingFinished.connect(lambda: sys.stdout.write(str(sb) + " editingFinished\n"))
117     #return win, w, [s1, s2, s3, s4]
118 #a = mkWin()
119 
120 
121 #def test(n=100):
122     #for i in range(n):
123         #win, w, sb = mkWin()
124         #for s in sb:
125             #w.setParent(None)
126             #s.setParent(None)
127             #s.valueChanged.disconnect()
128             #s.editingFinished.disconnect()
129 
130 
131 if __name__ == '__main__':
132     pg.exec()
133
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pyqtgraph/examples/SpinBox.py b/pyqtgraph/examples/SpinBox.py
--- a/pyqtgraph/examples/SpinBox.py
+++ b/pyqtgraph/examples/SpinBox.py
@@ -35,7 +35,7 @@
      pg.SpinBox(value=1e9, siPrefix=True)),
     ("Float with custom formatting", 
      pg.SpinBox(value=23.07, format='${value:0.02f}',
-                regex='\$?(?P<number>(-?\d+(\.\d+)?)|(-?\.\d+))$')),
+                regex = r'\$?(?P<number>(-?\d+(\.\d+)?)|(-?\.\d+))$')),
     ("Int with suffix",
      pg.SpinBox(value=999, step=1, int=True, suffix="V")),
     ("Int with custom formatting",

{"golden_diff": "diff --git a/pyqtgraph/examples/SpinBox.py b/pyqtgraph/examples/SpinBox.py\n--- a/pyqtgraph/examples/SpinBox.py\n+++ b/pyqtgraph/examples/SpinBox.py\n@@ -35,7 +35,7 @@\n      pg.SpinBox(value=1e9, siPrefix=True)),\n     (\"Float with custom formatting\", \n      pg.SpinBox(value=23.07, format='${value:0.02f}',\n-                regex='\\$?(?P<number>(-?\\d+(\\.\\d+)?)|(-?\\.\\d+))$')),\n+                regex = r'\\$?(?P<number>(-?\\d+(\\.\\d+)?)|(-?\\.\\d+))$')),\n     (\"Int with suffix\",\n      pg.SpinBox(value=999, step=1, int=True, suffix=\"V\")),\n     (\"Int with custom formatting\",\n", "issue": "SyntaxWarnings\nWhile running an `apt upgrade` I noticed:\r\n\r\n```\r\n/usr/lib/python3/dist-packages/pyqtgraph/examples/SpinBox.py:38: SyntaxWarning: invalid escape sequence '\\$'\r\n  regex='\\$?(?P<number>(-?\\d+(\\.\\d+)?)|(-?\\.\\d+))$')),\r\n```\r\n\r\nThe `\\$` should be written `\\\\$` or `r'\\$'` since a few Python releases (same for all backslash escape that have no meanings). I don't have the time to search for other occurrences of this fact, but running the tests with `PYTHONDEVMODE=1` should help spotting them :)\n", "before_files": [{"content": "\"\"\"\nThis example demonstrates the SpinBox widget, which is an extension of \nQDoubleSpinBox providing some advanced features:\n\n  * SI-prefixed units\n  * Non-linear stepping modes\n  * Bounded/unbounded values\n\n\"\"\"\n\nimport ast\n\nimport pyqtgraph as pg\nfrom pyqtgraph.Qt import QtWidgets\n\napp = pg.mkQApp(\"SpinBox Example\")\n\n\nspins = [\n    (\"Floating-point spin box, min=0, no maximum.<br>Non-finite values (nan, inf) are permitted.\",\n     pg.SpinBox(value=5.0, bounds=[0, None], finite=False)),\n    (\"Integer spin box, dec stepping<br>(1-9, 10-90, 100-900, etc), decimals=4\", \n     pg.SpinBox(value=10, int=True, dec=True, minStep=1, step=1, decimals=4)),\n    (\"Float with SI-prefixed units<br>(n, u, m, k, M, etc)\", \n     pg.SpinBox(value=0.9, suffix='V', siPrefix=True)),\n    (\"Float with SI-prefixed units,<br>dec step=0.1, minStep=0.1\", \n     pg.SpinBox(value=1.0, suffix='PSI', siPrefix=True, dec=True, step=0.1, minStep=0.1)),\n    (\"Float with SI-prefixed units,<br>dec step=0.5, minStep=0.01\", \n     pg.SpinBox(value=1.0, suffix='V', siPrefix=True, dec=True, step=0.5, minStep=0.01)),\n    (\"Float with SI-prefixed units,<br>dec step=1.0, minStep=0.001\", \n     pg.SpinBox(value=1.0, suffix='V', siPrefix=True, dec=True, step=1.0, minStep=0.001)),\n    (\"Float with SI-prefixed units,<br>scaleAtZero=1e-6, step=1e-9\",\n     pg.SpinBox(value=0, suffix='V', siPrefix=True, scaleAtZero=1e-6, step=1e-9)),\n    (\"Float with SI prefix but no suffix\",\n     pg.SpinBox(value=1e9, siPrefix=True)),\n    (\"Float with custom formatting\", \n     pg.SpinBox(value=23.07, format='${value:0.02f}',\n                regex='\\$?(?P<number>(-?\\d+(\\.\\d+)?)|(-?\\.\\d+))$')),\n    (\"Int with suffix\",\n     pg.SpinBox(value=999, step=1, int=True, suffix=\"V\")),\n    (\"Int with custom formatting\", \n     pg.SpinBox(value=4567, step=1, int=True, bounds=[0,None], format='0x{value:X}', \n                regex='(0x)?(?P<number>[0-9a-fA-F]+)$',\n                evalFunc=lambda s: ast.literal_eval('0x'+s))),\n    (\"Integer with bounds=[10, 20] and wrapping\",\n     pg.SpinBox(value=10, bounds=[10, 20], int=True, minStep=1, step=1, wrapping=True)),\n]\n\n\nwin = QtWidgets.QMainWindow()\nwin.setWindowTitle('pyqtgraph example: SpinBox')\ncw = QtWidgets.QWidget()\nlayout = QtWidgets.QGridLayout()\ncw.setLayout(layout)\nwin.setCentralWidget(cw)\nwin.show()\n#win.resize(300, 600)\nchangingLabel = QtWidgets.QLabel()  ## updated immediately\nchangedLabel = QtWidgets.QLabel()   ## updated only when editing is finished or mouse wheel has stopped for 0.3sec\nchangingLabel.setMinimumWidth(200)\nfont = changingLabel.font()\nfont.setBold(True)\nfont.setPointSize(14)\nchangingLabel.setFont(font)\nchangedLabel.setFont(font)\nlabels = []\n\n\ndef valueChanged(sb):\n    changedLabel.setText(\"Final value: %s\" % str(sb.value()))\n\ndef valueChanging(sb, value):\n    changingLabel.setText(\"Value changing: %s\" % str(sb.value()))\n\n    \nfor text, spin in spins:\n    label = QtWidgets.QLabel(text)\n    labels.append(label)\n    layout.addWidget(label)\n    layout.addWidget(spin)\n    spin.sigValueChanged.connect(valueChanged)\n    spin.sigValueChanging.connect(valueChanging)\n\nlayout.addWidget(changingLabel, 0, 1)\nlayout.addWidget(changedLabel, 2, 1)\n\n\n#def mkWin():\n    #win = QtWidgets.QMainWindow()\n    #g = QtWidgets.QFormLayout()\n    #w = QtWidgets.QWidget()\n    #w.setLayout(g)\n    #win.setCentralWidget(w)\n    #s1 = SpinBox(value=5, step=0.1, bounds=[-1.5, None], suffix='units')\n    #t1 = QtWidgets.QLineEdit()\n    #g.addRow(s1, t1)\n    #s2 = SpinBox(value=10e-6, dec=True, step=0.1, minStep=1e-6, suffix='A', siPrefix=True)\n    #t2 = QtWidgets.QLineEdit()\n    #g.addRow(s2, t2)\n    #s3 = SpinBox(value=1000, dec=True, step=0.5, minStep=1e-6, bounds=[1, 1e9], suffix='Hz', siPrefix=True)\n    #t3 = QtWidgets.QLineEdit()\n    #g.addRow(s3, t3)\n    #s4 = SpinBox(int=True, dec=True, step=1, minStep=1, bounds=[-10, 1000])\n    #t4 = QtWidgets.QLineEdit()\n    #g.addRow(s4, t4)\n\n    #win.show()\n\n    #import sys\n    #for sb in [s1, s2, s3,s4]:\n\n        ##QtCore.QObject.connect(sb, QtCore.SIGNAL('valueChanged(double)'), lambda v: sys.stdout.write(str(sb) + \" valueChanged\\n\"))\n        ##QtCore.QObject.connect(sb, QtCore.SIGNAL('editingFinished()'), lambda: sys.stdout.write(str(sb) + \" editingFinished\\n\"))\n        #sb.sigValueChanged.connect(valueChanged)\n        #sb.sigValueChanging.connect(valueChanging)\n        #sb.editingFinished.connect(lambda: sys.stdout.write(str(sb) + \" editingFinished\\n\"))\n    #return win, w, [s1, s2, s3, s4]\n#a = mkWin()\n\n\n#def test(n=100):\n    #for i in range(n):\n        #win, w, sb = mkWin()\n        #for s in sb:\n            #w.setParent(None)\n            #s.setParent(None)\n            #s.valueChanged.disconnect()\n            #s.editingFinished.disconnect()\n\n\nif __name__ == '__main__':\n    pg.exec()\n", "path": "pyqtgraph/examples/SpinBox.py"}], "after_files": [{"content": "\"\"\"\nThis example demonstrates the SpinBox widget, which is an extension of \nQDoubleSpinBox providing some advanced features:\n\n  * SI-prefixed units\n  * Non-linear stepping modes\n  * Bounded/unbounded values\n\n\"\"\"\n\nimport ast\n\nimport pyqtgraph as pg\nfrom pyqtgraph.Qt import QtWidgets\n\napp = pg.mkQApp(\"SpinBox Example\")\n\n\nspins = [\n    (\"Floating-point spin box, min=0, no maximum.<br>Non-finite values (nan, inf) are permitted.\",\n     pg.SpinBox(value=5.0, bounds=[0, None], finite=False)),\n    (\"Integer spin box, dec stepping<br>(1-9, 10-90, 100-900, etc), decimals=4\", \n     pg.SpinBox(value=10, int=True, dec=True, minStep=1, step=1, decimals=4)),\n    (\"Float with SI-prefixed units<br>(n, u, m, k, M, etc)\", \n     pg.SpinBox(value=0.9, suffix='V', siPrefix=True)),\n    (\"Float with SI-prefixed units,<br>dec step=0.1, minStep=0.1\", \n     pg.SpinBox(value=1.0, suffix='PSI', siPrefix=True, dec=True, step=0.1, minStep=0.1)),\n    (\"Float with SI-prefixed units,<br>dec step=0.5, minStep=0.01\", \n     pg.SpinBox(value=1.0, suffix='V', siPrefix=True, dec=True, step=0.5, minStep=0.01)),\n    (\"Float with SI-prefixed units,<br>dec step=1.0, minStep=0.001\", \n     pg.SpinBox(value=1.0, suffix='V', siPrefix=True, dec=True, step=1.0, minStep=0.001)),\n    (\"Float with SI-prefixed units,<br>scaleAtZero=1e-6, step=1e-9\",\n     pg.SpinBox(value=0, suffix='V', siPrefix=True, scaleAtZero=1e-6, step=1e-9)),\n    (\"Float with SI prefix but no suffix\",\n     pg.SpinBox(value=1e9, siPrefix=True)),\n    (\"Float with custom formatting\", \n     pg.SpinBox(value=23.07, format='${value:0.02f}',\n                regex = r'\\$?(?P<number>(-?\\d+(\\.\\d+)?)|(-?\\.\\d+))$')),\n    (\"Int with suffix\",\n     pg.SpinBox(value=999, step=1, int=True, suffix=\"V\")),\n    (\"Int with custom formatting\", \n     pg.SpinBox(value=4567, step=1, int=True, bounds=[0,None], format='0x{value:X}', \n                regex='(0x)?(?P<number>[0-9a-fA-F]+)$',\n                evalFunc=lambda s: ast.literal_eval('0x'+s))),\n    (\"Integer with bounds=[10, 20] and wrapping\",\n     pg.SpinBox(value=10, bounds=[10, 20], int=True, minStep=1, step=1, wrapping=True)),\n]\n\n\nwin = QtWidgets.QMainWindow()\nwin.setWindowTitle('pyqtgraph example: SpinBox')\ncw = QtWidgets.QWidget()\nlayout = QtWidgets.QGridLayout()\ncw.setLayout(layout)\nwin.setCentralWidget(cw)\nwin.show()\n#win.resize(300, 600)\nchangingLabel = QtWidgets.QLabel()  ## updated immediately\nchangedLabel = QtWidgets.QLabel()   ## updated only when editing is finished or mouse wheel has stopped for 0.3sec\nchangingLabel.setMinimumWidth(200)\nfont = changingLabel.font()\nfont.setBold(True)\nfont.setPointSize(14)\nchangingLabel.setFont(font)\nchangedLabel.setFont(font)\nlabels = []\n\n\ndef valueChanged(sb):\n    changedLabel.setText(\"Final value: %s\" % str(sb.value()))\n\ndef valueChanging(sb, value):\n    changingLabel.setText(\"Value changing: %s\" % str(sb.value()))\n\n    \nfor text, spin in spins:\n    label = QtWidgets.QLabel(text)\n    labels.append(label)\n    layout.addWidget(label)\n    layout.addWidget(spin)\n    spin.sigValueChanged.connect(valueChanged)\n    spin.sigValueChanging.connect(valueChanging)\n\nlayout.addWidget(changingLabel, 0, 1)\nlayout.addWidget(changedLabel, 2, 1)\n\n\n#def mkWin():\n    #win = QtWidgets.QMainWindow()\n    #g = QtWidgets.QFormLayout()\n    #w = QtWidgets.QWidget()\n    #w.setLayout(g)\n    #win.setCentralWidget(w)\n    #s1 = SpinBox(value=5, step=0.1, bounds=[-1.5, None], suffix='units')\n    #t1 = QtWidgets.QLineEdit()\n    #g.addRow(s1, t1)\n    #s2 = SpinBox(value=10e-6, dec=True, step=0.1, minStep=1e-6, suffix='A', siPrefix=True)\n    #t2 = QtWidgets.QLineEdit()\n    #g.addRow(s2, t2)\n    #s3 = SpinBox(value=1000, dec=True, step=0.5, minStep=1e-6, bounds=[1, 1e9], suffix='Hz', siPrefix=True)\n    #t3 = QtWidgets.QLineEdit()\n    #g.addRow(s3, t3)\n    #s4 = SpinBox(int=True, dec=True, step=1, minStep=1, bounds=[-10, 1000])\n    #t4 = QtWidgets.QLineEdit()\n    #g.addRow(s4, t4)\n\n    #win.show()\n\n    #import sys\n    #for sb in [s1, s2, s3,s4]:\n\n        ##QtCore.QObject.connect(sb, QtCore.SIGNAL('valueChanged(double)'), lambda v: sys.stdout.write(str(sb) + \" valueChanged\\n\"))\n        ##QtCore.QObject.connect(sb, QtCore.SIGNAL('editingFinished()'), lambda: sys.stdout.write(str(sb) + \" editingFinished\\n\"))\n        #sb.sigValueChanged.connect(valueChanged)\n        #sb.sigValueChanging.connect(valueChanging)\n        #sb.editingFinished.connect(lambda: sys.stdout.write(str(sb) + \" editingFinished\\n\"))\n    #return win, w, [s1, s2, s3, s4]\n#a = mkWin()\n\n\n#def test(n=100):\n    #for i in range(n):\n        #win, w, sb = mkWin()\n        #for s in sb:\n            #w.setParent(None)\n            #s.setParent(None)\n            #s.valueChanged.disconnect()\n            #s.editingFinished.disconnect()\n\n\nif __name__ == '__main__':\n    pg.exec()\n", "path": "pyqtgraph/examples/SpinBox.py"}]}