#NEWLINE# @ staticmethod #NEWLINE# def _build_parser( root_task = None , help_all = False ) : #NEWLINE# #INDENT# parser = argparse . ArgumentParser ( add_help = False ) #NEWLINE# parser . add_argument ( 'root_task' , nargs = '?' , help = 'Task family to run. Is not optional.' , metavar = 'Required root task' ) #NEWLINE# for ( task_name , is_without_section , param_name , param_obj ) in Register . get_all_params ( ) : #NEWLINE# #INDENT# is_the_root_task = ( task_name == root_task ) #NEWLINE# help = ( param_obj . description if any ( ( is_the_root_task , help_all , param_obj . always_in_help ) ) else argparse . SUPPRESS ) #NEWLINE# flag_name_underscores = ( param_name if is_without_section else ( ( task_name + '_' ) + param_name ) ) #NEWLINE# global_flag_name = ( '--' + flag_name_underscores . replace ( '_' , '-' ) ) #NEWLINE# parser . add_argument ( global_flag_name , help = help , action = param_obj . _parser_action ( ) , dest = param_obj . _parser_global_dest ( param_name , task_name ) ) #NEWLINE# if local_flag_name : #NEWLINE# #INDENT# local_flag_name = ( '--' + param_name . replace ( '_' , '-' ) ) #NEWLINE# parser . add_argument ( local_flag_name , help = help , action = param_obj . _parser_action ( ) , dest = param_name ) #NEWLINE# #UNINDENT# #UNINDENT# return parser