#NEWLINE# def run( self , argv ) : #NEWLINE# #INDENT# 'Equivalent to the main program for the application.\n\n        :param argv: input arguments and options\n        :paramtype argv: list of str\n        ' #NEWLINE# try : #NEWLINE# #INDENT# index = 0 #NEWLINE# command_pos = ( - 1 ) #NEWLINE# help_pos = ( - 1 ) #NEWLINE# help_command_pos = ( - 1 ) #NEWLINE# for arg in argv : #NEWLINE# #INDENT# if ( ( arg == 'bash-completion' ) and ( help_command_pos == ( - 1 ) ) ) : #NEWLINE# #INDENT# self . _bash_completion ( ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# if ( arg in self . commands [ self . api_version ] ) : #NEWLINE# #INDENT# if ( command_pos == ( - 1 ) ) : #NEWLINE# #INDENT# command_pos = index #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( arg in ( '-h' , '--help' ) ) : #NEWLINE# #INDENT# if ( help_pos == ( - 1 ) ) : #NEWLINE# #INDENT# help_pos = index #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( arg == 'help' ) : #NEWLINE# #INDENT# if ( help_command_pos == ( - 1 ) ) : #NEWLINE# #INDENT# help_command_pos = index #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# index = ( index + 1 ) #NEWLINE# #UNINDENT# if ( ( command_pos > ( - 1 ) ) and ( help_pos > command_pos ) ) : #NEWLINE# #INDENT# argv = [ 'help' , argv [ command_pos ] ] #NEWLINE# #UNINDENT# if ( ( help_command_pos > ( - 1 ) ) and ( command_pos == ( - 1 ) ) ) : #NEWLINE# #INDENT# argv [ help_command_pos ] = '--help' #NEWLINE# #UNINDENT# ( self . options , remainder ) = self . parser . parse_known_args ( argv ) #NEWLINE# self . configure_logging ( ) #NEWLINE# self . interactive_mode = ( not remainder ) #NEWLINE# self . initialize_app ( _argv ) #NEWLINE# #UNINDENT# except Exception as err : #NEWLINE# #INDENT# if ( self . options . verbose_level >= self . DEBUG_LEVEL ) : #NEWLINE# #INDENT# self . log . exception ( err ) #NEWLINE# raise #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . log . error ( err ) #NEWLINE# #UNINDENT# return 1 #NEWLINE# #UNINDENT# if self . interactive_mode : #NEWLINE# #INDENT# _argv = [ sys . argv [ 0 ] ] #NEWLINE# sys . argv = _argv #NEWLINE# return self . interact ( ) #NEWLINE# #UNINDENT# return self . run_subcommand ( remainder )