55~~~~~~~~~
66
77"""
8- from __future__ import absolute_import , division , print_function , \
9- with_statement , unicode_literals
8+ from __future__ import ( absolute_import , division , print_function ,
9+ unicode_literals , with_statement )
1010
1111import argparse
1212import logging
1616import argcomplete
1717import kaptan
1818
19- from . import log , util , exc , WorkspaceBuilder , Server , config
19+ from . import Server , WorkspaceBuilder , config , exc , log , util
2020from .__about__ import __version__
2121from ._compat import input , string_types
2222from .workspacebuilder import freeze
2323
24-
2524logger = logging .getLogger (__name__ )
2625
2726config_dir = os .path .expanduser ('~/.tmuxp/' )
@@ -46,10 +45,10 @@ def prompt(name, default=None):
4645
4746 """
4847
49- prompt = name + (default and ' [%s]' % default or '' )
50- prompt += name .endswith ('?' ) and ' ' or ': '
48+ _prompt = name + (default and ' [%s]' % default or '' )
49+ _prompt += name .endswith ('?' ) and ' ' or ': '
5150 while True :
52- rv = input (prompt )
51+ rv = input (_prompt )
5352 if rv :
5453 return rv
5554 if default is not None :
@@ -77,11 +76,11 @@ def prompt_bool(name, default=False, yes_choices=None, no_choices=None):
7776 else :
7877 prompt_choice = 'y/N'
7978
80- prompt = name + ' [%s]' % prompt_choice
81- prompt += name .endswith ('?' ) and ' ' or ': '
79+ _prompt = name + ' [%s]' % prompt_choice
80+ _prompt += name .endswith ('?' ) and ' ' or ': '
8281
8382 while True :
84- rv = input (prompt )
83+ rv = input (_prompt )
8584 if not rv :
8685 return default
8786 if rv .lower () in yes_choices :
@@ -261,7 +260,7 @@ def load_workspace(config_file, args):
261260 logger .error ('%s is empty or parsed no config data' % config_file )
262261 return
263262
264- tmux_bin = util .which ('tmux' )
263+ util .which ('tmux' )
265264
266265 try :
267266 logger .info ('Loading %s.' % config_file )
@@ -576,11 +575,12 @@ def command_import_tmuxinator(args):
576575 else :
577576 sys .exit ('Unknown config format.' )
578577
579- print (newconfig )
580- print (
581- '---------------------------------------------------------------' )
582578 print (
583- 'Configuration import does its best to convert tmuxinator files.\n ' )
579+ newconfig ,
580+ '---------------------------------------------------------------'
581+ 'Configuration import does its best to convert tmuxinator files.'
582+ '\n '
583+ )
584584 if args .answer_yes or prompt_yes_no (
585585 'The new config *WILL* require adjusting afterwards. Save config?'
586586 ):
@@ -633,7 +633,7 @@ def command_convert(args):
633633
634634 if 'json' in ext :
635635 if args .answer_yes or prompt_yes_no (
636- 'convert to <%s> to yaml?' % ( fullfile )
636+ 'convert to <%s> to yaml?' % fullfile
637637 ):
638638 configparser = kaptan .Kaptan ()
639639 configparser .import_config (configfile )
@@ -642,33 +642,32 @@ def command_convert(args):
642642 'yaml' , indent = 2 , default_flow_style = False
643643 )
644644 if args .answer_yes or prompt_yes_no (
645- 'Save config to %s?' % ( newfile )
645+ 'Save config to %s?' % newfile
646646 ):
647647 buf = open (newfile , 'w' )
648648 buf .write (newconfig )
649649 buf .close ()
650- print ('New config saved to %s' % ( newfile ) )
650+ print ('New config saved to %s' % newfile )
651651 elif 'yaml' in ext :
652652 if args .answer_yes or prompt_yes_no (
653- 'convert to <%s> to json?' % ( fullfile )
653+ 'convert to <%s> to json?' % fullfile
654654 ):
655655 configparser = kaptan .Kaptan ()
656656 configparser .import_config (configfile )
657657 newfile = fullfile .replace (ext , '.json' )
658658 newconfig = configparser .export ('json' , indent = 2 )
659659 print (newconfig )
660660 if args .answer_yes or prompt_yes_no (
661- 'Save config to <%s>?' % ( newfile )
661+ 'Save config to <%s>?' % newfile
662662 ):
663663 buf = open (newfile , 'w' )
664664 buf .write (newconfig )
665665 buf .close ()
666- print ('New config saved to <%s>.' % ( newfile ) )
666+ print ('New config saved to <%s>.' % newfile )
667667
668668
669669def command_attach_session (args ):
670670 """Command to attach / switch client to a tmux session."""
671- commands = []
672671 ctext = ' ' .join (args .session_name )
673672
674673 t = Server (
@@ -697,7 +696,6 @@ def command_attach_session(args):
697696
698697def command_kill_session (args ):
699698 """Command to kill a tmux session."""
700- commands = []
701699 ctext = ' ' .join (args .session_name )
702700
703701 t = Server (
@@ -898,7 +896,7 @@ def get_parser():
898896 help = '''\
899897 Checks current ~/.teamocil and current directory for yaml files.
900898 '''
901- ).completer = TeamocilCompleter (allowednames = ( '.yml' ) , directories = False )
899+ ).completer = TeamocilCompleter (allowednames = '.yml' , directories = False )
902900 import_teamocil .set_defaults (callback = command_import_teamocil )
903901
904902 import_tmuxinator = importsubparser .add_parser (
@@ -910,7 +908,9 @@ def get_parser():
910908 required = True )
911909 import_tmuxinatorgroup .add_argument (
912910 '--list' , dest = 'list' , action = 'store_true' ,
913- help = 'List yaml configs in ~/.tmuxinator and current working directory.'
911+ help = (
912+ 'List yaml configs in ~/.tmuxinator and current working directory.'
913+ )
914914 )
915915
916916 import_tmuxinatorgroup .add_argument (
@@ -920,14 +920,16 @@ def get_parser():
920920 help = '''\
921921 Checks current ~/.tmuxinator and current directory for yaml files.
922922 '''
923- ).completer = TmuxinatorCompleter (allowednames = ( '.yml' ) , directories = False )
923+ ).completer = TmuxinatorCompleter (allowednames = '.yml' , directories = False )
924924
925925 import_tmuxinator .set_defaults (callback = command_import_tmuxinator )
926926
927927 parser .add_argument (
928928 '--log-level' , dest = 'log_level' ,
929929 default = None ,
930- help = 'Level of debug verbosity. DEBUG, INFO, WARNING, ERROR, CRITICAL.' ,
930+ help = (
931+ 'Level of debug verbosity. DEBUG, INFO, WARNING, ERROR, CRITICAL.' ,
932+ )
931933 )
932934
933935 parser .add_argument (
@@ -964,7 +966,7 @@ def main():
964966
965967 util .oh_my_zsh_auto_title ()
966968
967- t = Server (
969+ t = Server ( # noqa
968970 socket_name = args .socket_name ,
969971 socket_path = args .socket_path ,
970972 colors = args .colors
0 commit comments