From 3b53afd852d245109b8bdce89d814b3b7b2e3311 Mon Sep 17 00:00:00 2001 From: Brad Walker Date: Sat, 16 May 2020 10:31:22 -0600 Subject: [PATCH] Improve SyntaxWarning for empty string checks --- napalm_vyos/vyos.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/napalm_vyos/vyos.py b/napalm_vyos/vyos.py index e55e097..aa77558 100644 --- a/napalm_vyos/vyos.py +++ b/napalm_vyos/vyos.py @@ -178,7 +178,7 @@ class VyOSDriver(NetworkDriver): self.device.send_command("cp "+self._BOOT_FILENAME+" " + self._BACKUP_FILENAME) self._new_config = f.read() - cfg = [x for x in self._new_config.split("\n") if x is not ""] + cfg = [x for x in self._new_config.split("\n") if x] output_loadcmd = self.device.send_config_set(cfg) match_setfailed = re.findall("Delete failed", output_loadcmd) match_delfailed = re.findall("Set failed", output_loadcmd) @@ -498,7 +498,7 @@ class VyOSDriver(NetworkDriver): bgp_neighbor_data["global"]["peers"] = {} # delete the header and empty element - bgp_info = [i.strip() for i in output[6:-2] if i is not ""] + bgp_info = [i.strip() for i in output[6:-2] if i] for i in bgp_info: if len(i) > 0: @@ -849,7 +849,7 @@ class VyOSDriver(NetworkDriver): else: err = "" - if err is not "": + if err: ping_result["error"] = err else: # 'packet_info' example: