def _download_datasets(): """Utility to download datasets into package source""" def filepath(*args): return abspath(join(dirname(__file__), '..', 'vega_datasets', *args)) dataset_listing = {} for name in DATASETS_TO_DOWNLOAD: data = Dataset(name) url = data.url filename = filepath('data', data.filename) print("retrieving data {0} -> {1}".format(url, filename)) urlretrieve(url, filename) dataset_listing[name] = 'data/{0}'.format(data.filename) with open(filepath('local_datasets.json'), 'w') as f: json.dump(dataset_listing, f, indent=2)
def _download_datasets(): """Utility to download datasets into package source""" def filepath(*args): return abspath(join(dirname(__file__), "..", "vega_datasets", *args)) dataset_listing = {} for name in DATASETS_TO_DOWNLOAD: data = Dataset(name) url = data.url filename = filepath("_data", data.filename) print("retrieving data {0} -> {1}".format(url, filename)) urlretrieve(url, filename) dataset_listing[name] = "_data/{0}".format(data.filename) with open(filepath("local_datasets.json"), "w") as f: json.dump(dataset_listing, f, indent=2, sort_keys=True)