From c3e9bcc147a766e5cf49a028942547aa0478b8d2 Mon Sep 17 00:00:00 2001 From: Lucas Noki Date: Sat, 25 Jan 2020 02:12:10 +0100 Subject: [PATCH] Remove else because of early return --- modules/swap/module.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/swap/module.py b/modules/swap/module.py index 4d2d064..9f7d370 100644 --- a/modules/swap/module.py +++ b/modules/swap/module.py @@ -117,13 +117,12 @@ class SwapModule(AbstractModule): self._swap_location_check() if self.swap_file is None: return - else: - disable_swapfile = "sudo swapoff {} && ".format(self.swap_file) + \ - "sudo rm {}".format(self.swap_file) + disable_swapfile = "sudo swapoff {} && ".format(self.swap_file) + \ + "sudo rm {}".format(self.swap_file) - subprocess.call(disable_swapfile, shell=True) - output_swapon = subprocess.check_output(['swapon', '--show']).decode("UTF-8") - output_free = subprocess.check_output(['free', '-h']).decode("UTF-8") - if not output_swapon: - print("Swap deleted!") - print(output_free.strip()) + subprocess.call(disable_swapfile, shell=True) + output_swapon = subprocess.check_output(['swapon', '--show']).decode("UTF-8") + output_free = subprocess.check_output(['free', '-h']).decode("UTF-8") + if not output_swapon: + print("Swap deleted!") + print(output_free.strip())