We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
PlotWidget.__getattr__ raises wrong exception type - but this has a simple fix
`hasattr(widget, "some_non_existing_attribute")` raises `NameError` instead of returning `False` for instances of `PlotWidget`. I think that `PlotWidget.__getattr__` (in PlotWidget.py) should raise `AttributeError` instead of `NameError`, which would be converted correctly to `False` by `hasattr`. I believe the same holds for `TabWindow.__getattr__` (in graphicsWindows.py).


--- 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/graphicsWindows.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 """
3 DEPRECATED:  The classes below are convenience classes that create a new window
4 containting a single, specific widget. These classes are now unnecessary because
5 it is possible to place any widget into its own window by simply calling its
6 show() method.
7 """
8 
9 from .Qt import QtCore, QtGui, mkQApp
10 from .widgets.PlotWidget import *
11 from .imageview import *
12 from .widgets.GraphicsLayoutWidget import GraphicsLayoutWidget
13 from .widgets.GraphicsView import GraphicsView
14 
15 
16 class GraphicsWindow(GraphicsLayoutWidget):
17     """
18     (deprecated; use GraphicsLayoutWidget instead)
19     
20     Convenience subclass of :class:`GraphicsLayoutWidget 
21     <pyqtgraph.GraphicsLayoutWidget>`. This class is intended for use from 
22     the interactive python prompt.
23     """
24     def __init__(self, title=None, size=(800,600), **kargs):
25         mkQApp()
26         GraphicsLayoutWidget.__init__(self, **kargs)
27         self.resize(*size)
28         if title is not None:
29             self.setWindowTitle(title)
30         self.show()
31         
32 
33 class TabWindow(QtGui.QMainWindow):
34     """
35     (deprecated)
36     """
37     def __init__(self, title=None, size=(800,600)):
38         mkQApp()
39         QtGui.QMainWindow.__init__(self)
40         self.resize(*size)
41         self.cw = QtGui.QTabWidget()
42         self.setCentralWidget(self.cw)
43         if title is not None:
44             self.setWindowTitle(title)
45         self.show()
46         
47     def __getattr__(self, attr):
48         if hasattr(self.cw, attr):
49             return getattr(self.cw, attr)
50         else:
51             raise NameError(attr)
52     
53 
54 class PlotWindow(PlotWidget):
55     """
56     (deprecated; use PlotWidget instead)
57     """
58     def __init__(self, title=None, **kargs):
59         mkQApp()
60         self.win = QtGui.QMainWindow()
61         PlotWidget.__init__(self, **kargs)
62         self.win.setCentralWidget(self)
63         for m in ['resize']:
64             setattr(self, m, getattr(self.win, m))
65         if title is not None:
66             self.win.setWindowTitle(title)
67         self.win.show()
68 
69 
70 class ImageWindow(ImageView):
71     """
72     (deprecated; use ImageView instead)
73     """
74     def __init__(self, *args, **kargs):
75         mkQApp()
76         self.win = QtGui.QMainWindow()
77         self.win.resize(800,600)
78         if 'title' in kargs:
79             self.win.setWindowTitle(kargs['title'])
80             del kargs['title']
81         ImageView.__init__(self, self.win)
82         if len(args) > 0 or len(kargs) > 0:
83             self.setImage(*args, **kargs)
84         self.win.setCentralWidget(self)
85         for m in ['resize']:
86             setattr(self, m, getattr(self.win, m))
87         #for m in ['setImage', 'autoRange', 'addItem', 'removeItem', 'blackLevel', 'whiteLevel', 'imageItem']:
88             #setattr(self, m, getattr(self.cw, m))
89         self.win.show()
90
```
--- 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/graphicsWindows.py b/pyqtgraph/graphicsWindows.py
--- a/pyqtgraph/graphicsWindows.py
+++ b/pyqtgraph/graphicsWindows.py
@@ -45,10 +45,7 @@
         self.show()
         
     def __getattr__(self, attr):
-        if hasattr(self.cw, attr):
-            return getattr(self.cw, attr)
-        else:
-            raise NameError(attr)
+        return getattr(self.cw, attr)
     
 
 class PlotWindow(PlotWidget):

{"golden_diff": "diff --git a/pyqtgraph/graphicsWindows.py b/pyqtgraph/graphicsWindows.py\n--- a/pyqtgraph/graphicsWindows.py\n+++ b/pyqtgraph/graphicsWindows.py\n@@ -45,10 +45,7 @@\n         self.show()\n         \n     def __getattr__(self, attr):\n-        if hasattr(self.cw, attr):\n-            return getattr(self.cw, attr)\n-        else:\n-            raise NameError(attr)\n+        return getattr(self.cw, attr)\n     \n \n class PlotWindow(PlotWidget):\n", "issue": "PlotWidget.__getattr__ raises wrong exception type - but this has a simple fix\n`hasattr(widget, \"some_non_existing_attribute\")` raises `NameError` instead of returning `False` for instances of `PlotWidget`. I think that `PlotWidget.__getattr__` (in PlotWidget.py) should raise `AttributeError` instead of `NameError`, which would be converted correctly to `False` by `hasattr`. I believe the same holds for `TabWindow.__getattr__` (in graphicsWindows.py).\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nDEPRECATED:  The classes below are convenience classes that create a new window\ncontainting a single, specific widget. These classes are now unnecessary because\nit is possible to place any widget into its own window by simply calling its\nshow() method.\n\"\"\"\n\nfrom .Qt import QtCore, QtGui, mkQApp\nfrom .widgets.PlotWidget import *\nfrom .imageview import *\nfrom .widgets.GraphicsLayoutWidget import GraphicsLayoutWidget\nfrom .widgets.GraphicsView import GraphicsView\n\n\nclass GraphicsWindow(GraphicsLayoutWidget):\n    \"\"\"\n    (deprecated; use GraphicsLayoutWidget instead)\n    \n    Convenience subclass of :class:`GraphicsLayoutWidget \n    <pyqtgraph.GraphicsLayoutWidget>`. This class is intended for use from \n    the interactive python prompt.\n    \"\"\"\n    def __init__(self, title=None, size=(800,600), **kargs):\n        mkQApp()\n        GraphicsLayoutWidget.__init__(self, **kargs)\n        self.resize(*size)\n        if title is not None:\n            self.setWindowTitle(title)\n        self.show()\n        \n\nclass TabWindow(QtGui.QMainWindow):\n    \"\"\"\n    (deprecated)\n    \"\"\"\n    def __init__(self, title=None, size=(800,600)):\n        mkQApp()\n        QtGui.QMainWindow.__init__(self)\n        self.resize(*size)\n        self.cw = QtGui.QTabWidget()\n        self.setCentralWidget(self.cw)\n        if title is not None:\n            self.setWindowTitle(title)\n        self.show()\n        \n    def __getattr__(self, attr):\n        if hasattr(self.cw, attr):\n            return getattr(self.cw, attr)\n        else:\n            raise NameError(attr)\n    \n\nclass PlotWindow(PlotWidget):\n    \"\"\"\n    (deprecated; use PlotWidget instead)\n    \"\"\"\n    def __init__(self, title=None, **kargs):\n        mkQApp()\n        self.win = QtGui.QMainWindow()\n        PlotWidget.__init__(self, **kargs)\n        self.win.setCentralWidget(self)\n        for m in ['resize']:\n            setattr(self, m, getattr(self.win, m))\n        if title is not None:\n            self.win.setWindowTitle(title)\n        self.win.show()\n\n\nclass ImageWindow(ImageView):\n    \"\"\"\n    (deprecated; use ImageView instead)\n    \"\"\"\n    def __init__(self, *args, **kargs):\n        mkQApp()\n        self.win = QtGui.QMainWindow()\n        self.win.resize(800,600)\n        if 'title' in kargs:\n            self.win.setWindowTitle(kargs['title'])\n            del kargs['title']\n        ImageView.__init__(self, self.win)\n        if len(args) > 0 or len(kargs) > 0:\n            self.setImage(*args, **kargs)\n        self.win.setCentralWidget(self)\n        for m in ['resize']:\n            setattr(self, m, getattr(self.win, m))\n        #for m in ['setImage', 'autoRange', 'addItem', 'removeItem', 'blackLevel', 'whiteLevel', 'imageItem']:\n            #setattr(self, m, getattr(self.cw, m))\n        self.win.show()\n", "path": "pyqtgraph/graphicsWindows.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nDEPRECATED:  The classes below are convenience classes that create a new window\ncontainting a single, specific widget. These classes are now unnecessary because\nit is possible to place any widget into its own window by simply calling its\nshow() method.\n\"\"\"\n\nfrom .Qt import QtCore, QtGui, mkQApp\nfrom .widgets.PlotWidget import *\nfrom .imageview import *\nfrom .widgets.GraphicsLayoutWidget import GraphicsLayoutWidget\nfrom .widgets.GraphicsView import GraphicsView\n\n\nclass GraphicsWindow(GraphicsLayoutWidget):\n    \"\"\"\n    (deprecated; use GraphicsLayoutWidget instead)\n    \n    Convenience subclass of :class:`GraphicsLayoutWidget \n    <pyqtgraph.GraphicsLayoutWidget>`. This class is intended for use from \n    the interactive python prompt.\n    \"\"\"\n    def __init__(self, title=None, size=(800,600), **kargs):\n        mkQApp()\n        GraphicsLayoutWidget.__init__(self, **kargs)\n        self.resize(*size)\n        if title is not None:\n            self.setWindowTitle(title)\n        self.show()\n        \n\nclass TabWindow(QtGui.QMainWindow):\n    \"\"\"\n    (deprecated)\n    \"\"\"\n    def __init__(self, title=None, size=(800,600)):\n        mkQApp()\n        QtGui.QMainWindow.__init__(self)\n        self.resize(*size)\n        self.cw = QtGui.QTabWidget()\n        self.setCentralWidget(self.cw)\n        if title is not None:\n            self.setWindowTitle(title)\n        self.show()\n        \n    def __getattr__(self, attr):\n        return getattr(self.cw, attr)\n    \n\nclass PlotWindow(PlotWidget):\n    \"\"\"\n    (deprecated; use PlotWidget instead)\n    \"\"\"\n    def __init__(self, title=None, **kargs):\n        mkQApp()\n        self.win = QtGui.QMainWindow()\n        PlotWidget.__init__(self, **kargs)\n        self.win.setCentralWidget(self)\n        for m in ['resize']:\n            setattr(self, m, getattr(self.win, m))\n        if title is not None:\n            self.win.setWindowTitle(title)\n        self.win.show()\n\n\nclass ImageWindow(ImageView):\n    \"\"\"\n    (deprecated; use ImageView instead)\n    \"\"\"\n    def __init__(self, *args, **kargs):\n        mkQApp()\n        self.win = QtGui.QMainWindow()\n        self.win.resize(800,600)\n        if 'title' in kargs:\n            self.win.setWindowTitle(kargs['title'])\n            del kargs['title']\n        ImageView.__init__(self, self.win)\n        if len(args) > 0 or len(kargs) > 0:\n            self.setImage(*args, **kargs)\n        self.win.setCentralWidget(self)\n        for m in ['resize']:\n            setattr(self, m, getattr(self.win, m))\n        #for m in ['setImage', 'autoRange', 'addItem', 'removeItem', 'blackLevel', 'whiteLevel', 'imageItem']:\n            #setattr(self, m, getattr(self.cw, m))\n        self.win.show()\n", "path": "pyqtgraph/graphicsWindows.py"}]}