@@ -151,7 +151,7 @@ def cmd(self, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
151151 # if -t is not set in any arg yet
152152 if not any ("-t" in str (x ) for x in args ):
153153 # insert -t immediately after 1st arg, as per tmux format
154- new_args : t .Tuple [str , ...] = tuple ()
154+ new_args : t .Tuple [str , ...] = ()
155155 new_args += (args [0 ],)
156156 assert isinstance (self .session_id , str )
157157 new_args += (
@@ -163,7 +163,6 @@ def cmd(self, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
163163 return self .server .cmd (* args , ** kwargs )
164164
165165 #
166- # Commands (tmux-like)
167166 #
168167 def set_option (
169168 self , option : str , value : t .Union [str , int ], _global : bool = False
@@ -197,7 +196,7 @@ def set_option(
197196 elif isinstance (value , bool ) and not value :
198197 value = "off"
199198
200- tmux_args : t .Tuple [t .Union [str , int ], ...] = tuple ()
199+ tmux_args : t .Tuple [t .Union [str , int ], ...] = ()
201200
202201 if _global :
203202 tmux_args += ("-g" ,)
@@ -240,7 +239,7 @@ def show_options(
240239 Uses ``_global`` for keyword name instead of ``global`` to avoid
241240 colliding with reserved keyword.
242241 """
243- tmux_args : t .Tuple [str , ...] = tuple ()
242+ tmux_args : t .Tuple [str , ...] = ()
244243
245244 if _global :
246245 tmux_args += ("-g" ,)
@@ -288,7 +287,7 @@ def show_option(
288287 Test and return True/False for on/off string.
289288 """
290289
291- tmux_args : t .Tuple [str , ...] = tuple ()
290+ tmux_args : t .Tuple [str , ...] = ()
292291
293292 if _global :
294293 tmux_args += ("-g" ,)
@@ -303,7 +302,7 @@ def show_option(
303302 if not len (cmd .stdout ):
304303 return None
305304
306- value_raw : t .List [str ] = [ item .split (" " ) for item in cmd .stdout ][ 0 ]
305+ value_raw : t .List [str ] = next ( item .split (" " ) for item in cmd .stdout )
307306
308307 assert isinstance (value_raw [0 ], str )
309308 assert isinstance (value_raw [1 ], str )
@@ -362,7 +361,7 @@ def attached_window(self) -> "Window":
362361 active_windows .append (window )
363362
364363 if len (active_windows ) == 1 :
365- return list ( active_windows )[ 0 ]
364+ return next ( iter ( active_windows ))
366365 elif len (active_windows ) == 0 :
367366 raise exc .LibTmuxException ("no active windows found" )
368367 else :
@@ -476,7 +475,7 @@ def new_window(
476475 -------
477476 :class:`Window`
478477 """
479- window_args : t .Tuple [str , ...] = tuple ()
478+ window_args : t .Tuple [str , ...] = ()
480479
481480 if not attach :
482481 window_args += ("-d" ,)
@@ -494,8 +493,7 @@ def new_window(
494493
495494 window_args += (
496495 # empty string for window_index will use the first one available
497- "-t%s:%s"
498- % (self .session_id , window_index ),
496+ f"-t{ self .session_id } :{ window_index } " ,
499497 )
500498
501499 if environment :
0 commit comments