def __init__(self,
        add_config_file_help=True,
        add_env_var_help=True,
        auto_env_var_prefix=None,
        default_config_files=[],
        ignore_unknown_config_file_keys=False,
        config_file_parser_class=DefaultConfigFileParser,
        args_for_setting_config_path=[],
        config_arg_is_required=False,
        config_arg_help_message="config file path",
        args_for_writing_out_config_file=[],
        write_out_config_file_arg_help_message="takes the current command line "
            "args and writes them out to a config file at the given path, then "
            "exits",
        **kwargs
        ):

        """Supports args of the argparse.ArgumentParser constructor
        as **kwargs, as well as the following additional args.

        Additional Args:
            add_config_file_help: Whether to add a description of config file
                syntax to the help message.
            add_env_var_help: Whether to add something to the help message for
                args that can be set through environment variables.
            auto_env_var_prefix: If set to a string instead of None, all config-
                file-settable options will become also settable via environment
                variables whose names are this prefix followed by the config
                file key, all in upper case. (eg. setting this to "foo_" will
                allow an arg like "--my-arg" to also be set via the FOO_MY_ARG
                environment variable)
            default_config_files: When specified, this list of config files will
                be parsed in order, with the values from each config file
                taking precedence over pervious ones. This allows an application
                to look for config files in multiple standard locations such as
                the install directory, home directory, and current directory.
                Also, shell * syntax can be used to specify all conf files in a
                directory. For exmaple:
                ["/etc/conf/app_config.ini",
                 "/etc/conf/conf-enabled/*.ini",
                "~/.my_app_config.ini",
                "./app_config.txt"]
            ignore_unknown_config_file_keys: If true, settings that are found
                in a config file but don't correspond to any defined
                configargparse args will be ignored. If false, they will be
                processed and appended to the commandline like other args, and
                can be retrieved using parse_known_args() instead of parse_args()
            config_file_parser_class: configargparse.ConfigFileParser subclass
                which determines the config file format. configargparse comes
                with DefaultConfigFileParser and YAMLConfigFileParser.
            args_for_setting_config_path: A list of one or more command line
                args to be used for specifying the config file path
                (eg. ["-c", "--config-file"]). Default: []
            config_arg_is_required: When args_for_setting_config_path is set,
                set this to True to always require users to provide a config path.
            config_arg_help_message: the help message to use for the
                args listed in args_for_setting_config_path.
            args_for_writing_out_config_file: A list of one or more command line
                args to use for specifying a config file output path. If
                provided, these args cause configargparse to write out a config
                file with settings based on the other provided commandline args,
                environment variants and defaults, and then to exit.
                (eg. ["-w", "--write-out-config-file"]). Default: []
            write_out_config_file_arg_help_message: The help message to use for
                the args in args_for_writing_out_config_file.
        """
        self._add_config_file_help = add_config_file_help
        self._add_env_var_help = add_env_var_help
        self._auto_env_var_prefix = auto_env_var_prefix

        argparse.ArgumentParser.__init__(self, **kwargs)

        # parse the additional args
        if config_file_parser_class is None:
            self._config_file_parser = DefaultConfigFileParser()
        else:
            self._config_file_parser = config_file_parser_class()

        self._default_config_files = default_config_files
        self._ignore_unknown_config_file_keys = ignore_unknown_config_file_keys
        if args_for_setting_config_path:
            self.add_argument(*args_for_setting_config_path, dest="config_file",
                required=config_arg_is_required, help=config_arg_help_message,
                is_config_file_arg=True)

        if args_for_writing_out_config_file:
            self.add_argument(*args_for_writing_out_config_file,
                dest="write_out_config_file_to_this_path",
                metavar="CONFIG_OUTPUT_PATH",
                help=write_out_config_file_arg_help_message,
                is_write_out_config_file_arg=True)
def __init__ ( self , add_config_file_help = True , add_env_var_help = True , auto_env_var_prefix = None , default_config_files = [ ] , ignore_unknown_config_file_keys = False , config_file_parser_class = DefaultConfigFileParser , args_for_setting_config_path = [ ] , config_arg_is_required = False , config_arg_help_message = "config file path" , args_for_writing_out_config_file = [ ] , write_out_config_file_arg_help_message = "takes the current command line " "args and writes them out to a config file at the given path, then " "exits" , ** kwargs ) : self . _add_config_file_help = add_config_file_help self . _add_env_var_help = add_env_var_help self . _auto_env_var_prefix = auto_env_var_prefix argparse . ArgumentParser . __init__ ( self , ** kwargs ) if config_file_parser_class is None : self . _config_file_parser = DefaultConfigFileParser ( ) else : self . _config_file_parser = config_file_parser_class ( ) self . _default_config_files = default_config_files self . _ignore_unknown_config_file_keys = ignore_unknown_config_file_keys if args_for_setting_config_path : self . add_argument ( * args_for_setting_config_path , dest = "config_file" , required = config_arg_is_required , help = config_arg_help_message , is_config_file_arg = True ) if args_for_writing_out_config_file : self . add_argument ( * args_for_writing_out_config_file , dest = "write_out_config_file_to_this_path" , metavar = "CONFIG_OUTPUT_PATH" , help = write_out_config_file_arg_help_message , is_write_out_config_file_arg = True )
Supports args of the argparse.ArgumentParser constructor
        as **kwargs, as well as the following additional args.

        Additional Args:
            add_config_file_help: Whether to add a description of config file
                syntax to the help message.
            add_env_var_help: Whether to add something to the help message for
                args that can be set through environment variables.
            auto_env_var_prefix: If set to a string instead of None, all config-
                file-settable options will become also settable via environment
                variables whose names are this prefix followed by the config
                file key, all in upper case. (eg. setting this to "foo_" will
                allow an arg like "--my-arg" to also be set via the FOO_MY_ARG
                environment variable)
            default_config_files: When specified, this list of config files will
                be parsed in order, with the values from each config file
                taking precedence over pervious ones. This allows an application
                to look for config files in multiple standard locations such as
                the install directory, home directory, and current directory.
                Also, shell * syntax can be used to specify all conf files in a
                directory. For exmaple:
                ["/etc/conf/app_config.ini",
                 "/etc/conf/conf-enabled/*.ini",
                "~/.my_app_config.ini",
                "./app_config.txt"]
            ignore_unknown_config_file_keys: If true, settings that are found
                in a config file but don't correspond to any defined
                configargparse args will be ignored. If false, they will be
                processed and appended to the commandline like other args, and
                can be retrieved using parse_known_args() instead of parse_args()
            config_file_parser_class: configargparse.ConfigFileParser subclass
                which determines the config file format. configargparse comes
                with DefaultConfigFileParser and YAMLConfigFileParser.
            args_for_setting_config_path: A list of one or more command line
                args to be used for specifying the config file path
                (eg. ["-c", "--config-file"]). Default: []
            config_arg_is_required: When args_for_setting_config_path is set,
                set this to True to always require users to provide a config path.
            config_arg_help_message: the help message to use for the
                args listed in args_for_setting_config_path.
            args_for_writing_out_config_file: A list of one or more command line
                args to use for specifying a config file output path. If
                provided, these args cause configargparse to write out a config
                file with settings based on the other provided commandline args,
                environment variants and defaults, and then to exit.
                (eg. ["-w", "--write-out-config-file"]). Default: []
            write_out_config_file_arg_help_message: The help message to use for
                the args in args_for_writing_out_config_file.