Skip to content

Commit 631f19b

Browse files
authored
Merge pull request #4484 from jenshnielsen/better_type_checking
Only allow missing imports for modules known to not have stubs
2 parents 2f230e4 + 616c8a5 commit 631f19b

5 files changed

Lines changed: 43 additions & 5 deletions

File tree

pyproject.toml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ test = [
7878
"deepdiff>=5.0.2",
7979
"hypothesis>=5.49.0",
8080
"lxml>=4.3.0",
81+
"lxml-stubs>=0.4.0",
8182
"mypy>=0.971",
8283
"pytest>=6.0.0",
8384
"pytest-cov>=3.0.0",
@@ -87,6 +88,7 @@ test = [
8788
"pyqtgraph>=0.11.0", # pyqtgraph tests
8889
"PyQt5>=5.15.0", # pyqtgraph tests
8990
"PyVisa-sim>=0.4.0",
91+
"slack-sdk>=3.4.2", # needed to typecheck slack extension
9092
"sphinx>=4.5.0", # sphinx extension tests
9193
"types_requests>=0.1.8",
9294
"types-setuptools>=57.0.0",
@@ -134,7 +136,6 @@ profile = "black"
134136
strict_optional = true
135137
disallow_untyped_decorators = true
136138
disallow_any_generics = false
137-
ignore_missing_imports = true
138139
show_column_numbers = true
139140
warn_unused_ignores = true
140141
warn_unused_configs = true
@@ -165,6 +166,43 @@ module = [
165166
]
166167
disallow_untyped_defs = false
167168

169+
# these are packages that we import
170+
# but either don't have stubs or we
171+
# dont have them installed.
172+
[[tool.mypy.overrides]]
173+
module = [
174+
"broadbean.*", # can be removed once broadbean 0.11 is available
175+
"clr",
176+
"deepdiff",
177+
"gclib",
178+
"IPython.*",
179+
"ipywidgets",
180+
"h5py",
181+
"h5netcdf",
182+
"hickle",
183+
"jsonschema",
184+
"lomentum.tools",
185+
"matplotlib.*",
186+
"mcl_RF_Switch_Controller64",
187+
"opencensus.ext.azure.*",
188+
"pandas.*",
189+
"pythoncom",
190+
"pyqtgraph.*",
191+
"pywinusb.*",
192+
"ruamel",
193+
"spyder.utils.site",
194+
"spyder_kernels.customize",
195+
"System.IO",
196+
"tqdm.*",
197+
"uncertainties",
198+
"win32com.*",
199+
"win32con",
200+
"win32gui",
201+
"wrapt",
202+
"zhinst.qcodes",
203+
]
204+
ignore_missing_imports = true
205+
168206
[tool.pytest.ini_options]
169207
minversion = "6.0"
170208
junit_family = "legacy"

qcodes/extensions/slack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
from time import sleep
5454

5555
from requests.exceptions import ConnectTimeout, HTTPError, ReadTimeout
56-
from requests.packages.urllib3.exceptions import ReadTimeoutError
5756
from slack_sdk import WebClient
57+
from urllib3.exceptions import ReadTimeoutError
5858

5959
from qcodes import config as qc_config
6060
from qcodes.loops import active_data_set, active_loop

qcodes/instrument/sims/dummy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# terminator='\n', device_clear=False)
55
from typing import Any
66

7-
import validators.validators as vals
7+
import qcodes.validators as vals
88

99
from qcodes.instrument.visa import VisaInstrument
1010

qcodes/instrument_drivers/HP/HP8133A.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Module left for backwards compatibility. Will be deprecated and removed eventually.
33
"""
44

5-
from HP_8133A import HP8133A
5+
from .HP_8133A import HP8133A

qcodes/instrument_drivers/HP/HP8753D.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Module left for backwards compatibility. Will be deprecated and removed eventually.
33
"""
44

5-
from HP_8753D import HP8753D
5+
from .HP_8753D import HP8753D

0 commit comments

Comments
 (0)