mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-01 07:46:22 +02:00
Fix python 2-3 compatibility
This commit is contained in:
parent
845168af3b
commit
d288341d55
1 changed files with 6 additions and 3 deletions
|
|
@ -206,7 +206,10 @@ def authorize_download(dataset_name=None):
|
|||
|
||||
def download_data(dataset_name=None):
|
||||
"""Check with the user that the are happy with terms and conditions for the data set, then download it."""
|
||||
import itertools
|
||||
try:
|
||||
from itertools import zip_longest
|
||||
except ImportError:
|
||||
from itertools import izip_longest as zip_longest
|
||||
|
||||
dr = data_resources[dataset_name]
|
||||
if not authorize_download(dataset_name):
|
||||
|
|
@ -220,8 +223,8 @@ def download_data(dataset_name=None):
|
|||
if 'suffices' in dr: zip_urls += (dr['suffices'], )
|
||||
else: zip_urls += ([],)
|
||||
|
||||
for url, files, save_names, suffices in itertools.zip_longest(*zip_urls, fillvalue=[]):
|
||||
for f, save_name, suffix in itertools.zip_longest(files, save_names, suffices, fillvalue=None):
|
||||
for url, files, save_names, suffices in zip_longest(*zip_urls, fillvalue=[]):
|
||||
for f, save_name, suffix in zip_longest(files, save_names, suffices, fillvalue=None):
|
||||
download_url(os.path.join(url,f), dataset_name, save_name, suffix=suffix)
|
||||
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue