<s> """<STR_LIT>""" <EOL> from __future__ import print_function <EOL> import os <EOL> from subprocess import call <EOL> from nameko . exceptions import CommandError <EOL> from . actions import FlagAction <EOL> def main ( args ) : <EOL> for choice in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> if os . system ( '<STR_LIT>' % choice ) == <NUM_LIT:0> : <EOL> prog = choice <EOL> break <EOL> else : <EOL> raise CommandError ( '<STR_LIT>' ) <EOL> target = args . target <EOL> if '<STR_LIT::>' in target : <EOL> host , port = target . split ( '<STR_LIT::>' , <NUM_LIT:1> ) <EOL> else : <EOL> host , port = '<STR_LIT:localhost>' , target <EOL> rlwrap = args . rlwrap <EOL> cmd = [ prog , str ( host ) , str ( port ) ] <EOL> if prog == '<STR_LIT>' : <EOL> cmd . append ( '<STR_LIT>' ) <EOL> if rlwrap is None : <EOL> rlwrap = os . system ( '<STR_LIT>' ) == <NUM_LIT:0> <EOL> if rlwrap : <EOL> cmd . insert ( <NUM_LIT:0> , '<STR_LIT>' ) <EOL> try : <EOL> if call ( cmd ) != <NUM_LIT:0> : <EOL> raise CommandError ( <EOL> '<STR_LIT>' . format ( target ) <EOL> ) <EOL> except ( EOFError , KeyboardInterrupt ) : <EOL> print ( ) <EOL> if choice == '<STR_LIT>' and rlwrap : <EOL> call ( [ '<STR_LIT>' ] ) <EOL> def init_parser ( parser ) : <EOL> parser . add_argument ( <EOL> '<STR_LIT:target>' , metavar = '<STR_LIT>' , help = "<STR_LIT>" ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , dest = '<STR_LIT>' , action = FlagAction , <EOL> help = '<STR_LIT>' ) <EOL> parser . set_defaults ( feature = True ) <EOL> return parser </s>
