Download and load the BIDS-fied brainweb 1mm normal

    :param str data_dir: path of the data directory. Used to force data storage
        in a non-standard location.
    :param str url: download URL of the dataset. Overwrite the default URL.
339301
def get_brainweb_1mm_normal(data_dir=None, url=None, resume=True, verbose=1):
    
    warn(DEPRECATION_MSG)
    return get_dataset('brainweb', data_dir=data_dir, url=url,
                       resume=resume, verbose=verbose)
622894
def download(self):
        
        mp3_directory = self._pre_download()
        self.data.swifter.apply(func=lambda arg: self._download(*arg, mp3_directory), axis=1, raw=True)
        return mp3_directory
842660
def download(number=-1, name="", save_dir='./'):
    
    df = load_datasets()

    if number > -1:
        row = df.iloc[[number]]
    elif name:
        row = df.loc[df["Name"] == name]

    url = ''.join(row.URL)
    if not url:
        print('The word vector you specified was not found. Please specify correct name.')

    widgets = ['Test: ', Percentage(), ' ', Bar(marker=RotatingMarker()), ' ', ETA(), ' ', FileTransferSpeed()]
    pbar = ProgressBar(widgets=widgets)

    def dlProgress(count, blockSize, totalSize):
        if pbar.max_value is None:
            pbar.max_value = totalSize
            pbar.start()

        pbar.update(min(count * blockSize, totalSize))

    file_name = url.split('/')[-1]
    if not os.path.exists(save_dir):
        os.makedirs(save_dir)
    save_path = os.path.join(save_dir, file_name)
    path, _ = urlretrieve(url, save_path, reporthook=dlProgress)
    pbar.finish()
    return path
658213
def check_datafile_present_and_download(path, backup_url=None):
    
    path = Path(path)
    if path.is_file(): return True
    if backup_url is None: return False
    logg.info('try downloading from url\n' + backup_url + '\n' +
              '... this may take a while but only happens once')
    if not path.parent.is_dir():
        logg.info('creating directory', str(path.parent) + '/', 'for saving data')
        path.parent.mkdir(parents=True)
    from urllib.request import urlretrieve
    urlretrieve(backup_url, str(path), reporthook=download_progress)
    logg.info('')
    return True
386686
def _join_url_dir(self, url, *args):
        
        for path in args:
            url = url.rstrip('/') + '/'
            url = urljoin(url, path.lstrip('/'))

        return url
1247089
def _get_data_path(data_dir=None):
    
    data_dir = data_dir or ''

    default_dirs = [Path(d).expanduser().resolve()
                    for d in os.getenv('CRN_SHARED_DATA', '').split(os.pathsep)
                    if d.strip()]
    default_dirs += [Path(d).expanduser().resolve()
                     for d in os.getenv('CRN_DATA', '').split(os.pathsep)
                     if d.strip()]
    default_dirs += [NIWORKFLOWS_CACHE_DIR]

    return [Path(d).expanduser()
            for d in data_dir.split(os.pathsep) if d.strip()] or default_dirs
1246003
def download_url_to_path(self, url, path, force=False):
        

        path_exists = isfile(path)
        if not path_exists or force:

            dir = dirname(path)
            if not exists(dir):
                if self.verbose:
                    print("CREATE %s" % dir)
                makedirs(dir)

            try:
                u = urlopen(url)
            except HTTPError as e:
                u = None
                print("HTTP error code %r.  Please check you ~/.netrc has the correct authorization" % e.code)

            if u:
                with open(path, 'wb') as file:
                    meta = u.info()
                    meta_func = meta.getheaders \
                        if hasattr(meta, 'getheaders') else meta.get_all
                    meta_length = meta_func("Content-Length")
                    file_size = None
                    if meta_length:
                        file_size = int(meta_length[0])
                    if self.verbose:
                        print("Downloading: {0} Bytes: {1}".format(url, file_size))

                    file_size_dl = 0
                    block_sz = 8192
                    while True:
                        buffer = u.read(block_sz)
                        if not buffer:
                            break
                        file_size_dl += len(buffer)
                        file.write(buffer)

                if self.verbose:
                    if path_exists:
                        print("OVERWRITING %s" % path)
                    else:
                        print("CREATE %s" % path)

        elif self.verbose:
            print("FOUND %s (already downloaded)" % path)
1372865
def set_data_dir(path=None, store=None):
    
    import sys
    import os
    import pysat
    if sys.version_info[0] >= 3:
        if sys.version_info[1] < 4:
            import imp
            re_load = imp.reload
        else:
            import importlib
            re_load = importlib.reload
    else:
        re_load = reload
    if store is None:
        store = True    
    if os.path.isdir(path):
        if store:
            with open(os.path.join(os.path.expanduser('~'), '.pysat',
                                   'data_path.txt'), 'w') as f:
                f.write(path)
        pysat.data_dir = path
        pysat._files = re_load(pysat._files)
        pysat._instrument = re_load(pysat._instrument)
    else:
        raise ValueError('Path %s does not lead to a valid directory.' % path)
89460
function download(cvs, data, callback) {
    var mime = data.mime || DEFAULT_MIME;

    root.location.href = cvs.toDataURL(mime).replace(mime, DOWNLOAD_MIME);

    if (typeof callback === 'function') callback();
  }
346109
def download(self, url, location, **kwargs):
        

        doc = self.go(url, **kwargs)
        with open(location, 'wb') as out:
            out.write(doc.body)
        return len(doc.body)
102427
def project_data_dir(self, *args) -> str:
        
        return os.path.normpath(os.path.join(self.project_dir, 'data', *args))
1217777
def download(self, id, directory):
        
        url = (self._base + 'lot/{0}/download').format(id)
        r = requests.get(url, auth=self._auth, stream=True)
        file_name = r.headers['Content-Disposition'].split('"')[-2]

        if len(directory) < 1:
            return

        with open(os.path.join(directory, file_name), 'wb') as file:
            for chunk in r.iter_content(chunk_size=1024):
                if chunk:
                    file.write(chunk)
                    file.flush()
210584
def download_data(url:str, fname:PathOrStr=None, data:bool=True, ext:str='.tgz') -> Path:
    ""
    fname = Path(ifnone(fname, _url2tgz(url, data, ext=ext)))
    os.makedirs(fname.parent, exist_ok=True)
    if not fname.exists():
        print(f'Downloading {url}')
        download_url(f'{url}{ext}', fname)
    return fname
75464
def import_directory(self, datadir):
        

        def json_stream():
            # load all json, mapped by json_id
            for fname in glob.glob(os.path.join(datadir, self._type + '_*.json')):
                with open(fname) as f:
                    yield json.load(f)

        return self.import_data(json_stream())
1053422
def data_dir(default='data'):
    
    if 'OPENSHIFT_DATA_DIR' in os.environ:
        return os.environ['OPENSHIFT_DATA_DIR']
    if 'GONDOR_DATA_DIR' in os.environ:
        return os.environ['GONDOR_DATA_DIR']
    if provider.detect() == provider.DOTCLOUD:
        return os.path.expanduser('~/data')
    return default
218404
def download_data(dataset_name=None):
    """"""
    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):
        raise Exception("Permission to download data set denied.")

    zip_urls = (dr['urls'], dr['files'])

    if 'save_names' in dr: zip_urls += (dr['save_names'], )
    else: zip_urls += ([],)

    if 'suffices' in dr: zip_urls += (dr['suffices'], )
    else: zip_urls += ([],)

    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
1258985
def download(data_dir):
  """"""
  tf.gfile.MakeDirs(data_dir)

  training_file_path = os.path.join(data_dir, TRAINING_FILE)
  if not tf.gfile.Exists(training_file_path):
    _download_and_clean_file(training_file_path, TRAINING_URL)

  eval_file_path = os.path.join(data_dir, EVAL_FILE)
  if not tf.gfile.Exists(eval_file_path):
    _download_and_clean_file(eval_file_path, EVAL_URL)