1010"""
1111
1212from __future__ import absolute_import , division , print_function , with_statement
13+
1314import os
1415import copy
1516import logging
17+
1618from . import exc
17- from .util import basestring
19+ from ._compat import string_types
1820
1921logger = logging .getLogger (__name__ )
2022
@@ -60,7 +62,7 @@ def is_config_file(filename, extensions=['.yml', '.yaml', '.json']):
6062 """
6163
6264 extensions = [extensions ] if isinstance (
63- extensions , basestring ) else extensions
65+ extensions , string_types ) else extensions
6466 return any (filename .endswith (e ) for e in extensions )
6567
6668
@@ -174,18 +176,17 @@ def expand(sconf, cwd=None):
174176 start_path = sconf ['start_directory' ]
175177 if any (start_path .startswith (a ) for a in ['.' , './' ]):
176178 start_path = os .path .normpath (os .path .join (cwd , start_path ))
177-
178179 sconf ['start_directory' ] = start_path
179180
180181 if (
181182 'shell_command' in sconf and
182- isinstance (sconf ['shell_command' ], basestring )
183+ isinstance (sconf ['shell_command' ], string_types )
183184 ):
184185 sconf ['shell_command' ] = [sconf ['shell_command' ]]
185186
186187 if (
187188 'shell_command_before' in sconf and
188- isinstance (sconf ['shell_command_before' ], basestring )
189+ isinstance (sconf ['shell_command_before' ], string_types )
189190 ):
190191 sconf ['shell_command_before' ] = [sconf ['shell_command_before' ]]
191192
@@ -201,7 +202,7 @@ def expand(sconf, cwd=None):
201202 p = copy .deepcopy (pconf )
202203 pconf = sconf ['panes' ][p_index ] = {}
203204
204- if isinstance (p , basestring ):
205+ if isinstance (p , string_types ):
205206 p = {
206207 'shell_command' : [p ]
207208 }
@@ -215,7 +216,7 @@ def expand(sconf, cwd=None):
215216 if 'shell_command' in p :
216217 cmd = p ['shell_command' ]
217218
218- if isinstance (p ['shell_command' ], basestring ):
219+ if isinstance (p ['shell_command' ], string_types ):
219220 cmd = [cmd ]
220221
221222 if not cmd or any (a == cmd for a in [None , 'blank' , 'pane' ]):
@@ -343,12 +344,12 @@ def import_tmuxinator(sconf):
343344 if 'pre' in sconf and 'pre_window' in sconf :
344345 tmuxp_config ['shell_command' ] = sconf ['pre' ]
345346
346- if isinstance (sconf ['pre' ], basestring ):
347+ if isinstance (sconf ['pre' ], string_types ):
347348 tmuxp_config ['shell_command_before' ] = [sconf ['pre_window' ]]
348349 else :
349350 tmuxp_config ['shell_command_before' ] = sconf ['pre_window' ]
350351 elif 'pre' in sconf :
351- if isinstance (sconf ['pre' ], basestring ):
352+ if isinstance (sconf ['pre' ], string_types ):
352353 tmuxp_config ['shell_command_before' ] = [sconf ['pre' ]]
353354 else :
354355 tmuxp_config ['shell_command_before' ] = sconf ['pre' ]
@@ -367,7 +368,7 @@ def import_tmuxinator(sconf):
367368
368369 windowdict ['window_name' ] = k
369370
370- if isinstance (v , basestring ) or v is None :
371+ if isinstance (v , string_types ) or v is None :
371372 windowdict ['panes' ] = [v ]
372373 tmuxp_config ['windows' ].append (windowdict )
373374 continue
0 commit comments