From def0dc260d56186d84aa54d2b6b2526d841ddc6b Mon Sep 17 00:00:00 2001 From: Andrei Lando Date: Tue, 12 Sep 2023 18:02:19 +0400 Subject: [PATCH] fixing codeclimate complains --- bumblebee_status/modules/contrib/shell.py | 26 +++++++++-------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/bumblebee_status/modules/contrib/shell.py b/bumblebee_status/modules/contrib/shell.py index 5ce41d1..5bdfc32 100644 --- a/bumblebee_status/modules/contrib/shell.py +++ b/bumblebee_status/modules/contrib/shell.py @@ -65,22 +65,16 @@ class Module(core.module.Module): if self.parameter("scrolling.makewide") is None: self.set("scrolling.makewide", False) - if self.__left_click_command is not None: - core.input.register( - self.widget, - button=core.input.LEFT_MOUSE, - cmd=functools.partial( - self.click_command, command=self.__left_click_command - ), - ) - if self.__right_click_command is not None: - core.input.register( - self.widget, - button=core.input.RIGHT_MOUSE, - cmd=functools.partial( - self.click_command, command=self.__right_click_command - ), - ) + for command, button in ( + (self.__left_click_command, core.input.LEFT_MOUSE), + (self.__right_click_command, core.input.RIGHT_MOUSE), + ): + if command is not None: + core.input.register( + self.widget, + button=button, + cmd=functools.partial(self.click_command, command=command), + ) def set_output(self, value): self.__output = value