Skip to content

Commit 4a264f9

Browse files
committed
Fix mypy issue
1 parent de47ddc commit 4a264f9

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

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())

0 commit comments

Comments
 (0)