def mixin_dataset(mixin_metadata, dataset): mixin_dataset_version = tools.find( mixin_metadata["datasets"], lambda d: d.get("merges_into", "") == dataset) if mixin_dataset_version is None: return None # Blah return mixin_dataset_version
def check_and_download_mixin_source(mixin_metadata, group_id, dataset, target_dir, base_download_url=None, replace_existing_files=True): mixin_dataset = tools.find(mixin_metadata["datasets"], lambda d: d.get("merges_into", "") == dataset) if mixin_dataset is None: return None click.echo("Merging mixin dataset {}".format(mixin_dataset["source"])) path = download_a_dataset_source(group_id, mixin_dataset, target_dir, mixin_dataset["source"], base_download_url=base_download_url, replace_existing_files=replace_existing_files) unzipped = os.path.splitext(path)[0] # Strip off the .gz extension, leaving just the unzipped filename unzip(path, unzipped) return unzipped