Completed
Push — master ( 281409...3cec9a )
by Bart
02:23 queued 58s
created

fuel.downloaders.fill_subparser()   B

Complexity

Conditions 1

Size

Total Lines 33

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 33
rs 8.8571
1
from fuel.converters.ilsvrc2010 import IMAGE_TARS
2
from fuel.downloaders.base import default_downloader
3
4
5
def fill_subparser(subparser):
6
    """Sets up a subparser to download the ILSVRC2010 dataset files.
7
8
    Note that you will need to use `--url-prefix` to download the
9
    non-public files (namely, the TARs of images). This is a single
10
    prefix that is common to all distributed files, which you can
11
    obtain by registering at the ImageNet website [DOWNLOAD].
12
13
    Note that these files are quite large and you may be better off
14
    simply downloading them separately and running ``fuel-convert``.
15
16
    .. [DOWNLOAD] http://www.image-net.org/download-images
17
18
19
    Parameters
20
    ----------
21
    subparser : :class:`argparse.ArgumentParser`
22
        Subparser handling the `ilsvrc2010` command.
23
24
    """
25
    urls = [
26
        ('http://www.image-net.org/challenges/LSVRC/2010/'
27
         'ILSVRC2010_test_ground_truth.txt'),
28
        ('http://www.image-net.org/challenges/LSVRC/2010/'
29
         'download/ILSVRC2010_devkit-1.0.tar.gz'),
30
    ] + ([None] * len(IMAGE_TARS))
31
    filenames = [None, None] + list(IMAGE_TARS)
32
    subparser.set_defaults(urls=urls, filenames=filenames)
33
    subparser.add_argument('-P', '--url-prefix', type=str, default=None,
34
                           help="URL prefix to prepend to the filenames of "
35
                                "non-public files, in order to download them. "
36
                                "Be sure to include the trailing slash.")
37
    return default_downloader
38