<commit_before>#!/usr/bin/env python
#########################################################################################
#
# Download data using http.
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2015 Polytechnique Montreal <www.neuro.polymtl.ca>
# Author: <NAME>
#
# About the license: see the file LICENSE.TXT
#########################################################################################

import sys
from os import remove, rename, path
import urllib2
import httplib
import time
# from urllib import urlretrieve
import zipfile
from sct_utils import run, printv, check_folder_exist
from msct_parser import Parser


# PARSER
# ==========================================================================================
def get_parser():
    # parser initialisation
    parser = Parser(__file__)
    parser.usage.set_description('''Download dataset from the web.''')
    parser.add_option(name="-d",
                      type_value="multiple_choice",
                      description="Name of the dataset.",
                      mandatory=True,
                      example=['sct_example_data', 'sct_testing_data', 'PAM50', 'MNI-Poly-AMU', 'gm_model'])
    parser.add_option(name="-v",
                      type_value="multiple_choice",
                      description="""Verbose. 0: nothing. 1: basic. 2: extended.""",
                      mandatory=False,
                      example=['0', '1', '2'])
    parser.add_option(name="-h",
                      type_value=None,
                      description="Display this help",
                      mandatory=False)
    return parser


# MAIN
# ==========================================================================================
def main(args=None):

    if args is None:
        args = sys.argv[1:]

    # initialization
    verbose = 1
    dict_url = {'sct_example_data': 'https://github.com/neuropoly/spinalcordtoolbox/releases/download/v3.0_beta23/sct_example_data.zip',
                'sct_testing_data': 'https://github.com/neuropoly/spinalcordtoolbox/releases/download/v3.0_beta23/sct_testing_data.zip',
                'PAM50': 'https://dl.dropboxusercontent.com/u/20592661/sct/20161008/PAM50.zip',
                'MNI-Poly-AMU': 'https://github.com/neuropoly/spinalcordtoolbox/releases/download/v3.0_beta16/MNI-Poly-AMU.zip',
                'gm_model': 'https://github.com/neuropoly/spinalcordtoolbox/releases/download/v3.0_beta23/gm_model.zip'}
    tmp_file = 'tmp.data.zip'

    # Get parser info
    parser = get_parser()<commit_msg>OPT: download_data: updated URL for PAM50 for info_label<commit_after>#!/usr/bin/env python
#########################################################################################
#
# Download data using http.
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2015 Polytechnique Montreal <www.neuro.polymtl.ca>
# Author: <NAME>
#
# About the license: see the file LICENSE.TXT
#########################################################################################

import sys
from os import remove, rename, path
import urllib2
import httplib
import time
# from urllib import urlretrieve
import zipfile
from sct_utils import run, printv, check_folder_exist
from msct_parser import Parser


# PARSER
# ==========================================================================================
def get_parser():
    # parser initialisation
    parser = Parser(__file__)
    parser.usage.set_description('''Download dataset from the web.''')
    parser.add_option(name="-d",
                      type_value="multiple_choice",
                      description="Name of the dataset.",
                      mandatory=True,
                      example=['sct_example_data', 'sct_testing_data', 'PAM50', 'MNI-Poly-AMU', 'gm_model'])
    parser.add_option(name="-v",
                      type_value="multiple_choice",
                      description="""Verbose. 0: nothing. 1: basic. 2: extended.""",
                      mandatory=False,
                      example=['0', '1', '2'])
    parser.add_option(name="-h",
                      type_value=None,
                      description="Display this help",
                      mandatory=False)
    return parser


# MAIN
# ==========================================================================================
def main(args=None):

    if args is None:
        args = sys.argv[1:]

    # initialization
    verbose = 1
    dict_url = {'sct_example_data': 'https://github.com/neuropoly/spinalcordtoolbox/releases/download/v3.0_beta23/sct_example_data.zip',
                'sct_testing_data': 'https://github.com/neuropoly/spinalcordtoolbox/releases/download/v3.0_beta23/sct_testing_data.zip',
                'PAM50': 'https://dl.dropboxusercontent.com/u/20592661/sct/PAM50_20161121.zip',
                'MNI-Poly-AMU': 'https://github.com/neuropoly/spinalcordtoolbox/releases/download/v3.0_beta16/MNI-Poly-AMU.zip',
                'gm_model': 'https://github.com/neuropoly/spinalcordtoolbox/releases/download/v3.0_beta23/gm_model.zip'}
    tmp_file = 'tmp.data.zip'

    # Get parser info
    parser = get_parser()
{'fraction_non_alphanumeric': 0.2714422158548233, 'fraction_numerical': 0.019866284622731614, 'mean_word_length': 2.710843373493976, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '215739', 'n_tokens_mistral': 1531, 'n_tokens_neox': 1372, 'n_words': 258}