From eecc7631d65b5b07c8231735f2bcbd7ca3dc11e5 Mon Sep 17 00:00:00 2001 From: "Jens H. Nielsen" Date: Tue, 7 Feb 2023 07:02:44 +0100 Subject: [PATCH 1/2] silence pyright warnings These modules may not be installed at type checking time but we have stubs which is fine --- qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py | 2 +- .../DynaCoolPPMS/private/commandhandler.py | 10 +++++++--- qcodes/utils/qt_helpers.py | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py b/qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py index d1dace34620..ebe32b237e4 100644 --- a/qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py +++ b/qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py @@ -7,7 +7,7 @@ from typing import Any, List, Optional try: - import pywinusb.hid as hid + import pywinusb.hid as hid # pyright: ignorereportMissingModuleSource] imported_hid = True except ImportError: diff --git a/qcodes/instrument_drivers/QuantumDesign/DynaCoolPPMS/private/commandhandler.py b/qcodes/instrument_drivers/QuantumDesign/DynaCoolPPMS/private/commandhandler.py index 44485c11a70..19e7649a172 100644 --- a/qcodes/instrument_drivers/QuantumDesign/DynaCoolPPMS/private/commandhandler.py +++ b/qcodes/instrument_drivers/QuantumDesign/DynaCoolPPMS/private/commandhandler.py @@ -6,9 +6,13 @@ log = logging.getLogger(__name__) try: - import pythoncom - import win32com.client - from pythoncom import VT_BYREF, VT_I4, VT_R8 + import pythoncom # pyright: ignore[reportMissingModuleSource] + import win32com.client # pyright: ignore[reportMissingModuleSource] + from pythoncom import ( # pyright: ignore[reportMissingModuleSource] + VT_BYREF, + VT_I4, + VT_R8, + ) except ImportError as e: message = "To use the DynaCool Driver, please install pywin32." log.exception(message) diff --git a/qcodes/utils/qt_helpers.py b/qcodes/utils/qt_helpers.py index 94cdfad2397..16fcb74e366 100644 --- a/qcodes/utils/qt_helpers.py +++ b/qcodes/utils/qt_helpers.py @@ -19,8 +19,8 @@ def foreground_qt_window(window: "QMainWindow") -> None: >>> Qtplot.qt_helpers.foreground_qt_window(plot.win) """ try: - import win32con - from win32gui import SetWindowPos + import win32con # pyright: ignore[reportMissingModuleSource] + from win32gui import SetWindowPos # pyright: ignore[reportMissingModuleSource] # use the idea from # https://stackoverflow.com/questions/12118939/how-to-make-a-pyqt4-window-jump-to-the-front From 697bf643cf5ce02bfdeebc2f89db9d6389eeb15e Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 7 Feb 2023 07:29:36 +0100 Subject: [PATCH 2/2] fix typo --- qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py b/qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py index ebe32b237e4..01c979568e7 100644 --- a/qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py +++ b/qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py @@ -7,7 +7,7 @@ from typing import Any, List, Optional try: - import pywinusb.hid as hid # pyright: ignorereportMissingModuleSource] + import pywinusb.hid as hid # pyright: ignore[reportMissingModuleSource] imported_hid = True except ImportError: