def0dfbfbc6f840484a10cc4e963cfa8686ded69,torchnlp/utils.py,,download_urls,#Any#Any#Any#,154

Before Change


    for url in urls:
        filename = get_filename_from_url(url)
        full_path = os.path.join(directory, filename)
        with tqdm(unit="B", unit_scale=True, miniters=1, desc=filename) as t:
            urllib.request.urlretrieve(url, filename=full_path, reporthook=reporthook(t))

    if check_file is not None and not os.path.isfile(os.path.join(directory, check_file)):
        raise ValueError("[DOWNLOAD FAILED] `check_file` not found")

After Change


    check_file = None if check_file is None else os.path.join(directory, check_file)
    if check_file is None or not os.path.isfile(check_file):
        for file_url in file_urls:
            compressed_filename = download(file_url, directory)
            maybe_extract(compressed_filename, directory)

        if check_file is not None and not os.path.isfile(check_file):
            raise ValueError("[DOWNLOAD FAILED] `check_file` not found")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: PetrochukM/PyTorch-NLP
Commit Name: def0dfbfbc6f840484a10cc4e963cfa8686ded69
Time: 2018-04-01
Author: petrochukm@gmail.com
File Name: torchnlp/utils.py
Class Name:
Method Name: download_urls


Project Name: pantsbuild/pants
Commit Name: 7c0a5eb95efbb0e3e7ca2619cb071f5f5dd748e3
Time: 2016-04-18
Author: john.sirois@gmail.com
File Name: contrib/node/src/python/pants/contrib/node/subsystems/resolvers/node_preinstalled_module_resolver.py
Class Name: NodePreinstalledModuleResolver
Method Name: resolve_target


Project Name: IndicoDataSolutions/finetune
Commit Name: 05931120a95d9be6275736cd22efd0a724adc33c
Time: 2020-01-10
Author: dimidd@gmail.com
File Name: finetune/util/download.py
Class Name:
Method Name: download_data_if_required