Skip to content

Commit d8ebc05

Browse files
authored
Merge pull request #445 from toolsforexperiments/dependabot/pip/mypy-1.20.2
Bump mypy from 1.13.0 to 1.20.2
2 parents 460fbbb + 7a60bee commit d8ebc05

7 files changed

Lines changed: 23 additions & 21 deletions

File tree

plottr/apps/inspectr.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,15 @@ def showContextMenu(self, position: QtCore.QPoint) -> None:
158158
copy_action = menu.addAction(copy_icon, "Copy")
159159

160160
window = cast(QCodesDBInspector, self.window())
161-
starAction: QtWidgets.QAction = window.starAction # type: ignore[has-type]
161+
starAction: QtWidgets.QAction = window.starAction
162162

163163
starAction.setText('Star' if current_tag_char != self.tag_dict['star'] else 'Unstar')
164164
menu.addAction(starAction)
165165

166-
crossAction: QtWidgets.QAction = window.crossAction # type: ignore[has-type]
167-
crossAction.setText('Cross' if current_tag_char != self.tag_dict['cross'] else 'Uncross')
166+
crossAction: QtWidgets.QAction = window.crossAction
167+
crossAction.setText(
168+
"Cross" if current_tag_char != self.tag_dict["cross"] else "Uncross"
169+
)
168170
menu.addAction(crossAction)
169171

170172
action = menu.exec_(self.mapToGlobal(position))

plottr/data/datadict.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,23 +1409,23 @@ def combine_datadicts(*dicts: DataDict) -> Union[DataDictBase, DataDict]:
14091409
# axes in the return can be separated even if they match (caused
14101410
# by earlier mismatches)
14111411

1412-
ret = None
1413-
rettype = None
1412+
ret: Union[DataDictBase, None] = None
1413+
rettype: Union[type[DataDictBase], None] = None
14141414

14151415
for d in dicts:
14161416
if ret is None:
14171417
ret = d.copy()
14181418
rettype = type(d)
14191419

14201420
else:
1421-
14221421
# if we don't have a well defined number of records anymore,
14231422
# need to revert the type to DataDictBase
1424-
if hasattr(d, 'nrecords') and hasattr(ret, 'nrecords'):
1423+
if hasattr(d, "nrecords") and hasattr(ret, "nrecords"):
14251424
if d.nrecords() != ret.nrecords():
14261425
rettype = DataDictBase
14271426
else:
14281427
rettype = DataDictBase
1428+
assert rettype is not None
14291429
ret = rettype(**ret)
14301430

14311431
# First, parse the axes in the to-be-added ddict.

plottr/node/autonode.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,26 @@ def connectFloatSpinbox(
4444

4545

4646
class AutoNodeGui(AutoNodeGuiTemplate):
47-
4847
widgetConnection = {
4948
int: connectIntegerSpinbox,
5049
float: connectFloatSpinbox,
5150
}
5251

53-
def __init__(self, parent: Optional[QtWidgets.QWidget] = None,
54-
node: Optional[Node] = None):
52+
def __init__(
53+
self, parent: Optional[QtWidgets.QWidget] = None, node: Optional[Node] = None
54+
):
5555
super().__init__(parent)
5656
layout = QtWidgets.QFormLayout()
5757
self.setLayout(layout)
5858

5959
def addOption(self, name: str, specs: Dict[str, Any], confirm: bool) -> None:
60-
optionType = specs.get('type', None)
60+
optionType: type | None = specs.get("type", None)
6161
widget = None
62-
func = self.widgetConnection.get(optionType, None)
62+
func = (
63+
self.widgetConnection[optionType]
64+
if optionType in self.widgetConnection.keys()
65+
else None
66+
)
6367
if func is not None:
6468
widget = func(self, name, specs, confirm)
6569
layout = cast(QtWidgets.QFormLayout, self.layout())

plottr/node/scaleunits.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
from enum import Enum, unique
2-
from typing import Optional, Dict
2+
from typing import Dict, Optional
33

4-
try:
5-
from qcodes.utils.plotting import find_scale_and_prefix
6-
except ImportError:
7-
# fallback for qcodes < 0.21
8-
from plottr.utils.find_scale_and_prefix import find_scale_and_prefix
4+
from qcodes.plotting import find_scale_and_prefix
95

106
from plottr import QtWidgets, Signal, Slot
11-
from plottr.node import Node, NodeWidget, updateOption
127
from plottr.data.datadict import DataDictBase
8+
from plottr.node import Node, NodeWidget, updateOption
139

1410

1511
@unique

plottr/plot/mpl/autoplot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def plotLine(self, plotItem: PlotItem) -> Optional[List[ScalarMappable]]:
122122
assert len(plotItem.data) == 2
123123
lbl = plotItem.labels[-1] if isinstance(plotItem.labels, list) and len(plotItem.labels) > 0 else ''
124124
x, y = plotItem.data
125+
assert plotItem.plotOptions is not None
125126
return axes[0].plot(x, y, label=lbl, **plotItem.plotOptions)
126127

127128
def plotImage(self, plotItem: PlotItem) -> Optional[ScalarMappable]:

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ warn_unused_configs = true
8484
warn_redundant_casts = true
8585
no_implicit_optional = true
8686
disallow_untyped_defs = true
87-
plugins = "numpy.typing.mypy_plugin"
8887
show_error_codes = true
8988
enable_error_code = "ignore-without-code"
9089

test_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
qcodes
22
pytest
33
pytest-qt
4-
mypy==1.13.0
4+
mypy==1.20.2
55
PyQt5-stubs==5.15.6.0
66
pandas-stubs
77
watchdog

0 commit comments

Comments
 (0)