src/toil_lib/abstractPipelineWrapper.py
def __populate_parser_from_config(self, arg_parser, config_data, prefix=''):
        """
        Populates an ArgumentParser object with arguments where each argument is a key from the
        given config_data dictionary.

        :param str prefix: Prepends the key with this prefix delimited by a single '.' character.
        :param argparse.ArgumentParser arg_parser:
        :param dict config_data: The parsed yaml data from the config.
        >>> pw = AbstractPipelineWrapper('test', 'this is a test')
        >>> parser = argparse.ArgumentParser()
        >>> pw._PipelineWrapperBuilder__populate_parser_from_config(parser, {'a':None, 'b':2})
        >>> vars(parser.parse_args(['--a', '1']))
        {'a': '1', 'b': 2}
        >>> vars(parser.parse_args(['--b', '3']))
        {'a': None, 'b': '3'}

        >>> parser = argparse.ArgumentParser()
        >>> pw._PipelineWrapperBuilder__populate_parser_from_config(parser, {})
        >>> vars(parser.parse_args([]))
        {}

        >>> parser = argparse.ArgumentParser()
        >>> pw._PipelineWrapperBuilder__populate_parser_from_config(parser,
        ...                                                         dict(a={'a':'b', 'c':{'d':'e'}},
        ...                                                              f='g', h={}))
        >>> vars(parser.parse_args([]))
        {'f': 'g', 'a.a': 'b', 'a.c.d': 'e'}
        """
        for k,v in config_data.items():
            k = prefix + '.' + k if prefix else k
            if isinstance(v, dict):
                self.__populate_parser_from_config(arg_parser, v, prefix=k)
            else:
                self._add_option(arg_parser, name=k, default=v)
def __populate_parser_from_config(self, arg_parser, config_data, prefix=''):
        for k,v in config_data.items():
            k = prefix + '.' + k if prefix else k
            if isinstance(v, dict):
                self.__populate_parser_from_config(arg_parser, v, prefix=k)
            else:
                self._add_option(arg_parser, name=k, default=v)
def __populate_parser_from_config ( self , arg_parser , config_data , prefix = '' ) : for k , v in config_data . items ( ) : k = prefix + '.' + k if prefix else k if isinstance ( v , dict ) : self . __populate_parser_from_config ( arg_parser , v , prefix = k ) else : self . _add_option ( arg_parser , name = k , default = v )
Populates an ArgumentParser object with arguments where each argument is a key from the
        given config_data dictionary.

        :param str prefix: Prepends the key with this prefix delimited by a single '.' character.
        :param argparse.ArgumentParser arg_parser:
        :param dict config_data: The parsed yaml data from the config.
        >>> pw = AbstractPipelineWrapper('test', 'this is a test')
        >>> parser = argparse.ArgumentParser()
        >>> pw._PipelineWrapperBuilder__populate_parser_from_config(parser, {'a':None, 'b':2})
        >>> vars(parser.parse_args(['--a', '1']))
        {'a': '1', 'b': 2}
        >>> vars(parser.parse_args(['--b', '3']))
        {'a': None, 'b': '3'}

        >>> parser = argparse.ArgumentParser()
        >>> pw._PipelineWrapperBuilder__populate_parser_from_config(parser, {})
        >>> vars(parser.parse_args([]))
        {}

        >>> parser = argparse.ArgumentParser()
        >>> pw._PipelineWrapperBuilder__populate_parser_from_config(parser,
        ...                                                         dict(a={'a':'b', 'c':{'d':'e'}},
        ...                                                              f='g', h={}))
        >>> vars(parser.parse_args([]))
        {'f': 'g', 'a.a': 'b', 'a.c.d': 'e'}
Populates an ArgumentParser object with arguments where each argument is a key from the given config_data dictionary .