From b5477e137d5912a1264a819845d52fd73c9086bb Mon Sep 17 00:00:00 2001 From: Lars Gremme Date: Thu, 17 Feb 2022 20:57:13 +0100 Subject: [PATCH] Update for flake8 --- boswatch/inputSource/sdrInput.py | 2 +- plugin/divera.py | 61 ++++++++++++++++---------------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/boswatch/inputSource/sdrInput.py b/boswatch/inputSource/sdrInput.py index cc4e64f..803e658 100644 --- a/boswatch/inputSource/sdrInput.py +++ b/boswatch/inputSource/sdrInput.py @@ -36,7 +36,7 @@ class SdrInput(InputBase): sdrProc.addArgument("-p " + str(sdrConfig.get("error", default="0"))) # frequency error in ppm sdrProc.addArgument("-l " + str(sdrConfig.get("squelch", default="1"))) # squelch sdrProc.addArgument("-g " + str(sdrConfig.get("gain", default="100"))) # gain - if (sdrConfig.get("fir_size") != None): + if (sdrConfig.get("fir_size") is not None): sdrProc.addArgument("-F " + str(sdrConfig.get("fir_size"))) # fir_size sdrProc.addArgument("-M fm") # set mode to fm sdrProc.addArgument("-E DC") # set DC filter diff --git a/plugin/divera.py b/plugin/divera.py index e6d4e25..b3cc39b 100644 --- a/plugin/divera.py +++ b/plugin/divera.py @@ -33,22 +33,21 @@ class BoswatchPlugin(PluginBase): """!Do not change anything here!""" super().__init__(__name__, config) # you can access the config class on 'self.config' - def fms(self, bwPacket): """!Called on FMS alarm @param bwPacket: bwPacket instance Remove if not implemented""" - fms_data = self.config.get("fms") + fms_data = self.config.get("fms") apicall = urllib.parse.urlencode({ - "accesskey": self.config.get("accesskey", default=""), - "vehicle_ric": self.parseWildcards(fms_data.get("vehicle", default="")), - "status_id": bwPacket.get("status"), - "status_note": bwPacket.get("directionText"), - "title": self.parseWildcards(fms_data.get("title", default="{FMS}")), - "text": self.parseWildcards(fms_data.get("message", default="{FMS}")), - "priority": fms_data.get("priority", default="false"), - }) + "accesskey": self.config.get("accesskey", default=""), + "vehicle_ric": self.parseWildcards(fms_data.get("vehicle", default="")), + "status_id": bwPacket.get("status"), + "status_note": bwPacket.get("directionText"), + "title": self.parseWildcards(fms_data.get("title", default="{FMS}")), + "text": self.parseWildcards(fms_data.get("message", default="{FMS}")), + "priority": fms_data.get("priority", default="false"), + }) apipath = "/api/fms" self._makeRequests(apipath, apicall) @@ -57,14 +56,14 @@ class BoswatchPlugin(PluginBase): @param bwPacket: bwPacket instance Remove if not implemented""" - poc_data = self.config.get("pocsag") + poc_data = self.config.get("pocsag") apicall = urllib.parse.urlencode({ - "accesskey": self.config.get("accesskey", default=""), - "title": self.parseWildcards(poc_data.get("title", default="{RIC}({SRIC})\n{MSG}")), - "ric": self.parseWildcards(poc_data.get("ric", default="")), - "text": self.parseWildcards(poc_data.get("message", default="{MSG}")), - "priority": poc_data.get("priority", default="false"), - }) + "accesskey": self.config.get("accesskey", default=""), + "title": self.parseWildcards(poc_data.get("title", default="{RIC}({SRIC})\n{MSG}")), + "ric": self.parseWildcards(poc_data.get("ric", default="")), + "text": self.parseWildcards(poc_data.get("message", default="{MSG}")), + "priority": poc_data.get("priority", default="false"), + }) apipath = "/api/alarm" self._makeRequests(apipath, apicall) @@ -73,14 +72,14 @@ class BoswatchPlugin(PluginBase): @param bwPacket: bwPacket instance Remove if not implemented""" - zvei_data = self.config.get("zvei") + zvei_data = self.config.get("zvei") apicall = urllib.parse.urlencode({ - "accesskey": self.config.get("accesskey", default=""), - "title": self.parseWildcards(zvei_data.get("title", default="{TONE}")), - "ric": self.parseWildcards(zvei_data.get("ric", default="{TONE}")), - "text": self.parseWildcards(zvei_data.get("message", default="{TONE}")), - "priority": zvei_data.get("priority", default="false"), - }) + "accesskey": self.config.get("accesskey", default=""), + "title": self.parseWildcards(zvei_data.get("title", default="{TONE}")), + "ric": self.parseWildcards(zvei_data.get("ric", default="{TONE}")), + "text": self.parseWildcards(zvei_data.get("message", default="{TONE}")), + "priority": zvei_data.get("priority", default="false"), + }) apipath = "/api/alarm" self._makeRequests(apipath, apicall) @@ -89,14 +88,14 @@ class BoswatchPlugin(PluginBase): @param bwPacket: bwPacket instance Remove if not implemented""" - msg_data = self.config.get("msg") + msg_data = self.config.get("msg") apicall = urllib.parse.urlencode({ - "accesskey": self.config.get("accesskey", default=""), - "title": self.parseWildcards(msg_data.get("title", default="{MSG}")), - "ric": self.parseWildcards(msg_data.get("ric", default="")), - "text": self.parseWildcards(msg_data.get("message", default="{MSG}")), - "priority": msg_data.get("priority", default="false"), - }) + "accesskey": self.config.get("accesskey", default=""), + "title": self.parseWildcards(msg_data.get("title", default="{MSG}")), + "ric": self.parseWildcards(msg_data.get("ric", default="")), + "text": self.parseWildcards(msg_data.get("message", default="{MSG}")), + "priority": msg_data.get("priority", default="false"), + }) apipath = "/api/alarm" self._makeRequests(apipath, apicall)