@@ -136,10 +136,9 @@ def process_event(self, e):
136136 self .repl .run_code_and_maybe_finish ()
137137 elif e in ("<Esc+.>" ,):
138138 self .get_last_word ()
139-
140- elif e in ["<ESC>" ]:
139+ elif e in ("<ESC>" ,):
141140 pass
142- elif e in [ "<Ctrl-d>" ] :
141+ elif e in ( "<Ctrl-d>" ,) :
143142 if self .current_line == "" :
144143 self .repl .send_to_stdin ("\n " )
145144 self .has_focus = False
@@ -148,7 +147,7 @@ def process_event(self, e):
148147 self .repl .run_code_and_maybe_finish (for_code = "" )
149148 else :
150149 pass
151- elif e in [ "\n " , "\r " , "<Ctrl-j>" , "<Ctrl-m>" ] :
150+ elif e in ( "\n " , "\r " , "<Ctrl-j>" , "<Ctrl-m>" ) :
152151 line = self .current_line
153152 self .repl .send_to_stdin (line + "\n " )
154153 self .has_focus = False
@@ -164,7 +163,7 @@ def process_event(self, e):
164163 self .repl .send_to_stdin (self .current_line )
165164
166165 def add_input_character (self , e ):
167- if e == "<SPACE>" :
166+ if e in ( "<SPACE>" ,) :
168167 e = " "
169168 if e .startswith ("<" ) and e .endswith (">" ):
170169 return
@@ -763,7 +762,7 @@ def process_key_event(self, e):
763762 raise SystemExit ()
764763 elif e in ("\n " , "\r " , "<PADENTER>" , "<Ctrl-j>" , "<Ctrl-m>" ):
765764 self .on_enter ()
766- elif e == "<TAB>" : # tab
765+ elif e in ( "<TAB>" ,) : # tab
767766 self .on_tab ()
768767 elif e in ("<Shift-TAB>" ,):
769768 self .on_tab (back = True )
@@ -784,9 +783,9 @@ def process_key_event(self, e):
784783 # TODO add PAD keys hack as in bpython.cli
785784 elif e in key_dispatch [self .config .edit_current_block_key ]:
786785 self .send_current_block_to_external_editor ()
787- elif e in [ "<ESC>" ] :
786+ elif e in ( "<ESC>" ,) :
788787 self .incr_search_mode = None
789- elif e in [ "<SPACE>" ] :
788+ elif e in ( "<SPACE>" ,) :
790789 self .add_normal_character (" " )
791790 else :
792791 self .add_normal_character (e )
@@ -969,7 +968,7 @@ def process_simple_keypress(self, e):
969968 self .process_event (bpythonevents .RefreshRequestEvent ())
970969 elif isinstance (e , events .Event ):
971970 pass # ignore events
972- elif e == "<SPACE>" :
971+ elif e in ( "<SPACE>" ,) :
973972 self .add_normal_character (" " )
974973 else :
975974 self .add_normal_character (e )
@@ -2013,11 +2012,11 @@ def key_help_text(self):
20132012 ["complete history suggestion" , "right arrow at end of line" ]
20142013 )
20152014 pairs .append (["previous match with current line" , "up arrow" ])
2016- for functionality , key in [
2015+ for functionality , key in (
20172016 (attr [:- 4 ].replace ("_" , " " ), getattr (self .config , attr ))
20182017 for attr in self .config .__dict__
20192018 if attr .endswith ("key" )
2020- ] :
2019+ ) :
20212020 if functionality in NOT_IMPLEMENTED :
20222021 key = "Not Implemented"
20232022 if key == "" :
@@ -2070,7 +2069,7 @@ def just_simple_events(event_list):
20702069 simple_events .append ("\n " )
20712070 elif isinstance (e , events .Event ):
20722071 pass # ignore events
2073- elif e == "<SPACE>" :
2072+ elif e in ( "<SPACE>" ,) :
20742073 simple_events .append (" " )
20752074 elif len (e ) > 1 :
20762075 pass # get rid of <Ctrl-a> etc.
0 commit comments