#NEWLINE# def format_help( self ) : #NEWLINE# #INDENT# msg = '' #NEWLINE# added_config_file_help = False #NEWLINE# added_env_var_help = False #NEWLINE# if self . _add_config_file_help : #NEWLINE# #INDENT# default_config_files = self . _default_config_files #NEWLINE# cc = ( 2 * self . prefix_chars [ 0 ] ) #NEWLINE# config_settable_args = [ ( arg , a ) for a in self . _actions for arg in a . option_strings if ( self . get_possible_config_keys ( a ) and ( not ( ( a . dest == 'help' ) or a . is_config_file_arg or a . is_write_out_config_file_arg ) ) ) ] #NEWLINE# config_path_actions = [ a for a in self . _actions if getattr ( a , 'is_config_file_arg' , False ) ] #NEWLINE# if ( config_settable_args and ( default_config_files or config_path_actions ) ) : #NEWLINE# #INDENT# self . _add_config_file_help = False #NEWLINE# added_config_file_help = True #NEWLINE# msg += ( "Args that start with '%s' (eg. %s) can also be set in a config file" % ( cc , config_settable_args [ 0 ] [ 0 ] ) ) #NEWLINE# config_arg_string = ' or ' . join ( ( a . option_strings [ 0 ] for a in config_path_actions if a . option_strings ) ) #NEWLINE# if config_arg_string : #NEWLINE# #INDENT# config_arg_string = ( 'specified via ' + config_arg_string ) #NEWLINE# #UNINDENT# if ( default_config_files or config_arg_string ) : #NEWLINE# #INDENT# msg += ( ' (%s).' % ' or ' . join ( ( default_config_files + list ( filter ( None , [ config_arg_string ] ) ) ) ) ) #NEWLINE# #UNINDENT# msg += ( ' ' + self . _config_file_parser . get_syntax_description ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# if self . _add_env_var_help : #NEWLINE# #INDENT# env_var_actions = [ ( a . env_var , a ) for a in a . _actions if getattr ( a , 'env_var' , None ) ] #NEWLINE# for ( env_var , a ) in env_var_actions : #NEWLINE# #INDENT# env_var_help_string = ( '   [env var: %s]' % env_var ) #NEWLINE# if ( not a . help ) : #NEWLINE# #INDENT# a . help = '' #NEWLINE# #UNINDENT# if ( env_var_help_string not in a . help ) : #NEWLINE# #INDENT# a . help += env_var_help_string #NEWLINE# added_env_var_help = True #NEWLINE# self . _add_env_var_help = False #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( added_env_var_help or added_config_file_help ) : #NEWLINE# #INDENT# value_sources = [ 'defaults' ] #NEWLINE# if added_config_file_help : #NEWLINE# #INDENT# value_sources = ( [ 'config file values' ] + value_sources ) #NEWLINE# #UNINDENT# if added_env_var_help : #NEWLINE# #INDENT# value_sources = ( [ 'environment variables' ] + value_sources ) #NEWLINE# #UNINDENT# msg += ( ' If an arg is specified in more than one place, then commandline values override %s.' % ' which override ' . join ( value_sources ) ) #NEWLINE# #UNINDENT# if msg : #NEWLINE# #INDENT# self . description = ( ( ( self . description or '' ) + ' ' ) + msg ) #NEWLINE# #UNINDENT# return argparse . ArgumentParser . format_help ( self )