@@ -56,9 +56,9 @@ def get_cwd(session_name):
5656
5757def get (session_name , ** kw ):
5858 """
59- Starts tmux if not running and delivers a srun_in_tmux function,
60- parametrized for that session.
61- """
59+ Starts tmux if not running and delivers a srun_in_tmux function,
60+ parametrized for that session.
61+ """
6262 s = '\n ' + os .popen ('tmux ls' ).read ()
6363 if not '\n %s:' % session_name in s :
6464 create (session_name , kw )
@@ -77,7 +77,7 @@ def configure_tmux_base_index_1(session_name):
7777 """
7878 Seems everybody really using it has 1 (on normal keyboards 0 is far away)
7979 and its a hard to detect or change, especially when the messed with it outside of
80- our control.
80+ our control.
8181
8282 On clean systems it will be just missing or: the user / runner does not care.
8383
@@ -140,7 +140,9 @@ def create(session_name, kw):
140140 configure_tmux_base_index_1 (session_name )
141141 continue
142142
143- msg = 'tmux session start failed. Do you have tmux, configured with'
143+ msg = (
144+ 'tmux session start failed. Do you have tmux, configured with'
145+ )
144146 msg += 'base index 1? 0 is default but will NOT work!!'
145147 raise Exception (msg )
146148
@@ -206,7 +208,9 @@ def srun_in_tmux(cmd, session_name, expect=None, timeout=1, **kw):
206208 sk = 'send-keys:'
207209 if cmd .startswith ('send-keys:' ):
208210 cmd = cmd .split ('#' , 1 )[0 ]
209- lp .spresc ('tmux send-keys -t %s:1 %s' % (n , cmd .split (sk , 1 )[1 ].strip ()))
211+ lp .spresc (
212+ 'tmux send-keys -t %s:1 %s' % (n , cmd .split (sk , 1 )[1 ].strip ())
213+ )
210214 # at ci seen delays after C-c:
211215 wait (0.1 )
212216 return 'silent'
@@ -234,7 +238,7 @@ def srun_in_tmux(cmd, session_name, expect=None, timeout=1, **kw):
234238 if is_lprunner [0 ]:
235239 lprunner .confirm (cmd )
236240 seq = ' ' .join ([hex (ord (b ))[2 :] for b in cmd ])
237- seq += ' a'
241+ seq += ' a' # Enter
238242 # if is_multiline:
239243 # breakpoint() # FIXME BREAKPOINT
240244 # for line in cmd.splitlines():
@@ -268,7 +272,9 @@ def srun_in_tmux(cmd, session_name, expect=None, timeout=1, **kw):
268272 )
269273
270274 if now () - last_msg > 5 :
271- dbg ('%ss[%s] Inspect: tmux att -t %s' % (round (dt , 1 ), timeout , n ))
275+ dbg (
276+ '%ss[%s] Inspect: tmux att -t %s' % (round (dt , 1 ), timeout , n )
277+ )
272278 lst_msg = now ()
273279 wait (wait_dt ) # fast first
274280 wait_dt = min (timeout / 10.0 , max_wait )
@@ -280,7 +286,9 @@ def srun_in_tmux(cmd, session_name, expect=None, timeout=1, **kw):
280286 # expect_echo_out_cmd is empty then
281287 res = res .split (expect , 1 )[0 ].strip ()
282288 a = expect_echo_out_cmd
283- a = a [1 :] if a .startswith ('\n ' ) else a # when \n is the sep we won't see it
289+ a = (
290+ a [1 :] if a .startswith ('\n ' ) else a
291+ ) # when \n is the sep we won't see it
284292 res = res .replace (a , '' )
285293 else :
286294 # the tmux window contains a lot of white space after the last output when
0 commit comments