@@ -28,17 +28,17 @@ def validate_schema(sconf):
2828 """
2929
3030 # verify session_name
31- if not 'session_name' in sconf :
31+ if 'session_name' not in sconf :
3232 raise exc .ConfigError ('config requires "session_name"' )
3333
34- if not 'windows' in sconf :
34+ if 'windows' not in sconf :
3535 raise exc .ConfigError ('config requires list of "windows"' )
3636
3737 for window in sconf ['windows' ]:
38- if not 'window_name' in window :
38+ if 'window_name' not in window :
3939 raise exc .ConfigError ('config window is missing "window_name"' )
4040
41- if not 'panes' in window :
41+ if 'panes' not in window :
4242 raise exc .ConfigError (
4343 'config window %s requires list of panes' %
4444 window ['window_name' ]
@@ -64,8 +64,8 @@ def is_config_file(filename, extensions=['.yml', '.yaml', '.json']):
6464
6565
6666def in_dir (
67- config_dir = os .path .expanduser ('~/.tmuxp' ),
68- extensions = ['.yml' , '.yaml' , '.json' ]
67+ config_dir = os .path .expanduser ('~/.tmuxp' ),
68+ extensions = ['.yml' , '.yaml' , '.json' ]
6969):
7070 """Return a list of configs in ``config_dir``.
7171
@@ -80,7 +80,7 @@ def in_dir(
8080
8181 for filename in os .listdir (config_dir ):
8282 if is_config_file (filename , extensions ) and \
83- not filename .startswith ('.' ):
83+ not filename .startswith ('.' ):
8484 configs .append (filename )
8585
8686 return configs
@@ -102,6 +102,7 @@ def in_cwd():
102102
103103 return configs
104104
105+
105106def expandshell (_path ):
106107 """Return expanded path based on user's ``$HOME`` and ``env``.
107108
@@ -115,6 +116,7 @@ def expandshell(_path):
115116 """
116117 return os .path .expandvars (os .path .expanduser (_path ))
117118
119+
118120def inline (sconf ):
119121 """ Return config in inline form, opposite of :meth:`config.expand`.
120122
@@ -125,26 +127,26 @@ def inline(sconf):
125127 """
126128
127129 if (
128- 'shell_command' in sconf and
129- isinstance (sconf ['shell_command' ], list ) and
130- len (sconf ['shell_command' ]) == 1
130+ 'shell_command' in sconf and
131+ isinstance (sconf ['shell_command' ], list ) and
132+ len (sconf ['shell_command' ]) == 1
131133 ):
132134 sconf ['shell_command' ] = sconf ['shell_command' ][0 ]
133135
134136 if len (sconf .keys ()) == int (1 ):
135137 sconf = sconf ['shell_command' ]
136138 if (
137- 'shell_command_before' in sconf and
138- isinstance (sconf ['shell_command_before' ], list ) and
139- len (sconf ['shell_command_before' ]) == 1
139+ 'shell_command_before' in sconf and
140+ isinstance (sconf ['shell_command_before' ], list ) and
141+ len (sconf ['shell_command_before' ]) == 1
140142 ):
141143 sconf ['shell_command_before' ] = sconf ['shell_command_before' ][0 ]
142144
143145 # recurse into window and pane config items
144146 if 'windows' in sconf :
145147 sconf ['windows' ] = [
146148 inline (window ) for window in sconf ['windows' ]
147- ]
149+ ]
148150 if 'panes' in sconf :
149151 sconf ['panes' ] = [inline (pane ) for pane in sconf ['panes' ]]
150152
@@ -221,30 +223,30 @@ def expand(sconf, cwd=None, parent=None):
221223 )
222224
223225 if (
224- 'shell_command' in sconf and
225- isinstance (sconf ['shell_command' ], string_types )
226+ 'shell_command' in sconf and
227+ isinstance (sconf ['shell_command' ], string_types )
226228 ):
227229 sconf ['shell_command' ] = [sconf ['shell_command' ]]
228230
229231 if (
230- 'shell_command_before' in sconf and
231- isinstance (sconf ['shell_command_before' ], string_types )
232+ 'shell_command_before' in sconf and
233+ isinstance (sconf ['shell_command_before' ], string_types )
232234 ):
233235 sconf ['shell_command_before' ] = [sconf ['shell_command_before' ]]
234236
235237 if (
236- 'shell_command_before' in sconf and
237- isinstance (sconf ['shell_command_before' ], list )
238+ 'shell_command_before' in sconf and
239+ isinstance (sconf ['shell_command_before' ], list )
238240 ):
239241 sconf ['shell_command_before' ] = [
240242 expandshell (scmd ) for scmd in sconf ['shell_command_before' ]
241- ]
243+ ]
242244
243245 # recurse into window and pane config items
244246 if 'windows' in sconf :
245247 sconf ['windows' ] = [
246248 expand (window , parent = sconf ) for window in sconf ['windows' ]
247- ]
249+ ]
248250 elif 'panes' in sconf :
249251
250252 for pconf in sconf ['panes' ]:
@@ -322,8 +324,8 @@ def trickle(sconf):
322324 windowconfig ['start_directory' ] = session_start_directory
323325 else :
324326 if not any (
325- windowconfig ['start_directory' ].startswith (a )
326- for a in ['~' , '/' ]
327+ windowconfig ['start_directory' ].startswith (a )
328+ for a in ['~' , '/' ]
327329 ):
328330 window_start_path = os .path .join (
329331 session_start_directory , windowconfig ['start_directory' ]
@@ -351,7 +353,7 @@ def trickle(sconf):
351353
352354 p_index = windowconfig ['panes' ].index (paneconfig )
353355 windowconfig ['panes' ][p_index ]['shell_command' ] = commands_before
354- #paneconfig['shell_command'] = commands_before
356+ # paneconfig['shell_command'] = commands_before
355357
356358 return sconf
357359
@@ -425,9 +427,7 @@ def import_tmuxinator(sconf):
425427 for w in sconf ['windows' ]:
426428 for k , v in w .items ():
427429
428- windowdict = {}
429-
430- windowdict ['window_name' ] = k
430+ windowdict = {'window_name' : k }
431431
432432 if isinstance (v , string_types ) or v is None :
433433 windowdict ['panes' ] = [v ]
@@ -482,9 +482,8 @@ def import_teamocil(sconf):
482482
483483 for w in sconf ['windows' ]:
484484
485- windowdict = {}
485+ windowdict = {'window_name' : w [ 'name' ] }
486486
487- windowdict ['window_name' ] = w ['name' ]
488487 if 'clear' in w :
489488 windowdict ['clear' ] = w ['clear' ]
490489
0 commit comments