From 92004b2a47db9992d27c235c92c1eec2ca94a475 Mon Sep 17 00:00:00 2001 From: atse Date: Wed, 14 Aug 2024 12:57:42 +0800 Subject: [PATCH] send_command: Use `in` syntax More concisely checks for key existance in `dict` --- pytec/tec_qt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 2393d0a..e6172b2 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -266,7 +266,7 @@ class MainWindow(QtWidgets.QMainWindow): for inner_param, change, data in changes: if change == "value": - if inner_param.opts.get("param", None) is not None: + if "param" in inner_param.opts: if inner_param.opts.get("suffix", None) == "mA": data /= 1000 # Given in mA @@ -282,13 +282,13 @@ class MainWindow(QtWidgets.QMainWindow): await self.client.set_param(*set_param_args) param.child(*param.childPath(inner_param)).setOpts(lock=False) - if inner_param.opts.get("pid_autotune", None) is not None: + if "pid_autotune" in inner_param.opts: auto_tuner_param = inner_param.opts["pid_autotune"][0] if inner_param.opts["pid_autotune"][1] != "ch": ch = inner_param.opts["pid_autotune"][1] self.autotuners.set_params(auto_tuner_param, ch, data) - if inner_param.opts.get("activaters", None) is not None: + if "activaters" in inner_param.opts: activater = inner_param.opts["activaters"][ inner_param.opts["limits"].index(data) ]