Commit a55bc290 by Thierry Moreau Committed by Tianqi Chen

moving module import inside of download function (#1319)

parent 396bd562
...@@ -5,12 +5,6 @@ from __future__ import absolute_import as _abs ...@@ -5,12 +5,6 @@ from __future__ import absolute_import as _abs
import os import os
import sys import sys
import time import time
import requests
if sys.version_info >= (3,):
import urllib.request as urllib2
else:
import urllib2
def download(url, path, overwrite=False, size_compare=False): def download(url, path, overwrite=False, size_compare=False):
"""Downloads the file from the internet. """Downloads the file from the internet.
...@@ -30,6 +24,13 @@ def download(url, path, overwrite=False, size_compare=False): ...@@ -30,6 +24,13 @@ def download(url, path, overwrite=False, size_compare=False):
size_compare : bool, optional size_compare : bool, optional
Whether to do size compare to check downloaded file. Whether to do size compare to check downloaded file.
""" """
import requests
if sys.version_info >= (3,):
import urllib.request as urllib2
else:
import urllib2
if os.path.isfile(path) and not overwrite: if os.path.isfile(path) and not overwrite:
if size_compare: if size_compare:
file_size = os.path.getsize(path) file_size = os.path.getsize(path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment