<s> """<STR_LIT>""" <EOL> import argparse <EOL> import importlib <EOL> import os <EOL> import fuel <EOL> from fuel import downloaders <EOL> from fuel . downloaders . base import NeedURLPrefix <EOL> url_prefix_message = """<STR_LIT>""" . strip ( ) <EOL> def main ( args = None ) : <EOL> """<STR_LIT>""" <EOL> built_in_datasets = dict ( downloaders . all_downloaders ) <EOL> if fuel . config . extra_downloaders : <EOL> for name in fuel . config . extra_downloaders : <EOL> extra_datasets = dict ( <EOL> importlib . import_module ( name ) . all_downloaders ) <EOL> if any ( key in built_in_datasets for key in extra_datasets . keys ( ) ) : <EOL> raise ValueError ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> built_in_datasets . update ( extra_datasets ) <EOL> parser = argparse . ArgumentParser ( <EOL> description = '<STR_LIT>' ) <EOL> parent_parser = argparse . ArgumentParser ( add_help = False ) <EOL> parent_parser . add_argument ( <EOL> "<STR_LIT>" , "<STR_LIT>" , help = "<STR_LIT>" , <EOL> type = str , default = os . getcwd ( ) ) <EOL> parent_parser . add_argument ( <EOL> "<STR_LIT>" , help = "<STR_LIT>" , action = '<STR_LIT:store_true>' ) <EOL> subparsers = parser . add_subparsers ( ) <EOL> download_functions = { } <EOL> for name , fill_subparser in built_in_datasets . items ( ) : <EOL> subparser = subparsers . add_parser ( <EOL> name , parents = [ parent_parser ] , <EOL> help = '<STR_LIT>' . format ( name ) ) <EOL> subparser . set_defaults ( which_ = name ) <EOL> download_functions [ name ] = fill_subparser ( subparser ) <EOL> args = parser . parse_args ( ) <EOL> args_dict = vars ( args ) <EOL> download_function = download_functions [ args_dict . pop ( '<STR_LIT>' ) ] <EOL> try : <EOL> download_function ( ** args_dict ) <EOL> except NeedURLPrefix : <EOL> parser . error ( url_prefix_message ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
