[totem/wip/hadess/re-enable-pylint: 5/10] pythonconsole: Fix some pylint warnings




commit ab33d9ae4d1de2f07cd1b5a62cf4a3e6fb8f9ee7
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jun 23 16:13:48 2022 +0200

    pythonconsole: Fix some pylint warnings
    
    src/plugins/pythonconsole/console.py:173:13: R1714: Consider merging these comparisons with "in" to 
'event.keyval in (Gdk.KEY_KP_Down, Gdk.KEY_Down)' (consider-using-in)
    src/plugins/pythonconsole/console.py:180:13: R1714: Consider merging these comparisons with "in" to 
'event.keyval in (Gdk.KEY_KP_Up, Gdk.KEY_Up)' (consider-using-in)
    src/plugins/pythonconsole/console.py:187:13: R1714: Consider merging these comparisons with "in" to 
'event.keyval in (Gdk.KEY_KP_Left, Gdk.KEY_Left, Gdk.KEY_BackSpace)' (consider-using-in)

 src/plugins/pythonconsole/console.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/pythonconsole/console.py b/src/plugins/pythonconsole/console.py
index aa8f5a754..7a8114114 100644
--- a/src/plugins/pythonconsole/console.py
+++ b/src/plugins/pythonconsole/console.py
@@ -170,23 +170,21 @@ class PythonConsole(Gtk.ScrolledWindow): # pylint: disable=R0902
             GLib.idle_add(self.scroll_to_end)
             return True
 
-        elif event.keyval == Gdk.KEY_KP_Down or event.keyval == Gdk.KEY_Down:
+        elif event.keyval in (Gdk.KEY_KP_Down, Gdk.KEY_Down):
             # Next entry from history
             view.emit_stop_by_name("key_press_event")
             self.history_down()
             GLib.idle_add(self.scroll_to_end)
             return True
 
-        elif event.keyval == Gdk.KEY_KP_Up or event.keyval == Gdk.KEY_Up:
+        elif event.keyval in (Gdk.KEY_KP_Up, Gdk.KEY_Up):
             # Previous entry from history
             view.emit_stop_by_name("key_press_event")
             self.history_up()
             GLib.idle_add(self.scroll_to_end)
             return True
 
-        elif event.keyval == Gdk.KEY_KP_Left or \
-             event.keyval == Gdk.KEY_Left or \
-             event.keyval == Gdk.KEY_BackSpace:
+        elif event.keyval in (Gdk.KEY_KP_Left, Gdk.KEY_Left, Gdk.KEY_BackSpace):
             buf = view.get_buffer()
             inp = buf.get_iter_at_mark(buf.get_mark("input"))
             cur = buf.get_iter_at_mark(buf.get_insert())


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]