File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import argparse
2- from .download .downloader import download
2+ import sys
3+ from .download .downloader import download as download_datasets
34
45def main ():
56 parser = argparse .ArgumentParser (prog = 'coderdata' )
67 subparsers = parser .add_subparsers (dest = 'command' )
78
89 # Subcommand 'download'
910 parser_download = subparsers .add_parser ('download' , help = 'Download datasets' )
10- parser_download .add_argument ('--prefix' , type = str , default = None ,
11- help = 'Prefix of the dataset to download (e.g., "hcmi"), "all", or leave empty for all files.' )
11+ parser_download .add_argument (
12+ '-n' , '--name' ,
13+ dest = 'DATASET_NAME' ,
14+ type = str ,
15+ default = 'all' ,
16+ help = 'Name of the dataset to download (e.g., "beataml"). '
17+ 'Alternatively "all" will download the full repository of '
18+ 'coderdata datasets. See "coderdata --list" for a complete list '
19+ 'of available datasets. Defaults to "all"'
20+ )
1221 parser_download .set_defaults (func = download )
13-
22+ if len (sys .argv ) == 1 :
23+ parser .print_help (sys .stderr )
24+ sys .exit (0 )
1425 args = parser .parse_args ()
15- if hasattr (args , 'func' ):
16- # Check if 'prefix' argument is present and pass it directly to the function
17- if 'prefix' in args :
18- args .func (args .prefix )
19- else :
20- args .func ()
21- else :
22- parser .print_help ()
26+ args .func (args )
2327
28+ def download (args ):
29+ download_datasets (name = args .DATASET_NAME )
2430if __name__ == '__main__' :
2531 main ()
2632
You can’t perform that action at this time.
0 commit comments