From 252724c08ab3f71b70253596f619c1bebc168588 Mon Sep 17 00:00:00 2001 From: Simon Humpohl Date: Mon, 17 May 2021 17:55:07 +0200 Subject: [PATCH] Fail on syntax warning and fix some literal comparisons --- qupulse/hardware/feature_awg/tabor.py | 6 +++--- setup.cfg | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/qupulse/hardware/feature_awg/tabor.py b/qupulse/hardware/feature_awg/tabor.py index 721c8e3a..dd12fac1 100644 --- a/qupulse/hardware/feature_awg/tabor.py +++ b/qupulse/hardware/feature_awg/tabor.py @@ -549,7 +549,7 @@ def set_repetition_mode(self, program_name: str, repetition_mode: str) -> None: Throws: ValueError: this Exception is thrown when an invalid repetition mode is given """ - if repetition_mode is "infinite" or repetition_mode is "once": + if repetition_mode in ("infinite", "once"): self._channel_tuple._known_programs[program_name].program._repetition_mode = repetition_mode else: raise ValueError("{} is no vaild repetition mode".format(repetition_mode)) @@ -721,7 +721,7 @@ def run_current_program(self) -> None: if self._channel_tuple._current_program: repetition_mode = self._channel_tuple._known_programs[ self._channel_tuple._current_program].program._repetition_mode - if repetition_mode is "infinite": + if repetition_mode == "infinite": self._cont_repetition_mode() self._channel_tuple.device[SCPI].send_cmd(':TRIG', paranoia_level=self._channel_tuple.internal_paranoia_level) @@ -737,7 +737,7 @@ def run_current_program(self) -> None: if self._channel_tuple._current_program: repetition_mode = self._channel_tuple._known_programs[ self._channel_tuple._current_program].program._repetition_mode - if repetition_mode is "infinite": + if repetition_mode == "infinite": self._cont_repetition_mode() self._channel_tuple.device[SCPI].send_cmd(':TRIG', paranoia_level=self._channel_tuple.internal_paranoia_level) else: diff --git a/setup.cfg b/setup.cfg index 4a8abc3e..1614c442 100644 --- a/setup.cfg +++ b/setup.cfg @@ -62,6 +62,7 @@ python_files=*_tests.py *_bug.py filterwarnings = # syntax is action:message_regex:category:module_regex:lineno # we fail on all with a whitelist because a dependency might mess-up passing the correct stacklevel + error::SyntaxWarning error::DeprecationWarning # pytest uses readline which uses collections.abc ignore:Using or importing the ABCs from \'collections\' instead of from \'collections\.abc\' is deprecated:DeprecationWarning:.*readline.*