Download this file
481679
def download(self, path=None, show_progress=True, resume=True,
                 auto_retry=True, proapi=False):
        """"""
        self.api.download(self, path, show_progress, resume, auto_retry,
                          proapi)
230090
def download(outformat, path, identifier, namespace='cid', domain='compound', operation=None, searchtype=None,
             overwrite=False, **kwargs):
    """"""
    response = get(identifier, namespace, domain, operation, outformat, searchtype, **kwargs)
    if not overwrite and os.path.isfile(path):
        raise IOError("%s already exists. Use 'overwrite=True' to overwrite it." % path)
    with open(path, 'wb') as f:
        f.write(response)
397156
def _download_file(uri, bulk_api):
    """"""
    resp = requests.get(uri, headers=bulk_api.headers(), stream=True)
    with tempfile.TemporaryFile("w+b") as f:
        for chunk in resp.iter_content(chunk_size=None):
            f.write(chunk)
        f.seek(0)
        yield f
938336
def download_object(self, obj_name, directory, structure=True):
        
        return self.download(obj=obj_name, directory=directory,
                structure=structure)
218693
def download
      raise "#{@source_url} is not accessible" unless @url.valid?
      f = open(@file_path,'wb')
      count = 0
      @url.net_http.request_get(@url.path) do |r|
        r.read_body do |s|
          @download_length += s.length
          f.write s
          if block_given?
            count += 1
            if count % 100 == 0
              yield @download_length
            end
          end
        end
      end
      f.close
      downloaded = @download_length
      @download_length = 0
      downloaded
    end
912437
def download_to_file(self, local_file, headers=None, cookies=None,
                         chunk_size=1024):
        

        if not headers:
            headers = HEADERS

        if not cookies:
            cookies = {}

        req = requests.get(self.url, headers=headers, cookies=cookies,
                           stream=True)
        with open(local_file, "wb") as local_download:
            for chunk in req.iter_content(chunk_size):
                if chunk:
                    local_download.write(chunk)
585758
function download(input, output) {
	if (!output) output = input.split("/").pop();
	var file = fs.createWriteStream(output);
	var request = http.get(input, response => { response.pipe(file); });
}
972217
def download_file(self, *args, **kwargs):
        """"""
        return download_file(*args, **self._merge_overrides(**kwargs)).run()
943780
def get(self):
        """"""
        method_name = "_download_" + self.name
        method = getattr(self, method_name)
        return method()
1345148
def download_file(client, bucket, remote_path, local_path, overwrite=False):
    """"""
    bucket = client.get_bucket(bucket)
    if (not overwrite) and os.path.isfile(local_path):
        raise OSError('File already exists!')
    with open(local_path, 'wb') as ofh:
        bucket.get_blob(remote_path).download_to_file(ofh)
480578
def download!
      return download if file.nil?

      file.close
      file.unlink
      self.file = nil
      download
    end
482483
def download(self):
        
        if not os.path.exists(self.data_path):
            # Create if it doesn't exist
            pathlib.Path(self.data_path).mkdir(parents=True, exist_ok=True)

        if not os.path.exists(self.text_path):
            http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())

            with open(self.text_path, 'wt') as fp:
                request = http.request('GET', self.url)
                content = request.data.decode('utf8')
                fp.write(content)

        if not os.path.exists(self.processed_path):
            with open(self.text_path, 'rt') as fp:
                content = fp.read()

            alphabet = sorted(set(content))

            index_to_character = {idx: c for idx, c in enumerate(alphabet, 1)}
            character_to_index = {c: idx for idx, c in enumerate(alphabet, 1)}

            content_encoded = np.array([character_to_index[c] for c in content], dtype=np.uint8)

            data_dict = {
                'alphabet': alphabet,
                'index_to_character': index_to_character,
                'character_to_index': character_to_index,
                'content_encoded': content_encoded
            }

            with open(self.processed_path, 'wb') as fp:
                torch.save(data_dict, fp)
        else:
            with open(self.processed_path, 'rb') as fp:
                data_dict = torch.load(fp)

        return data_dict
329564
def download(self, source, destination):
        """"""
        self._handler.download(posix_path(source), destination)
996331
def download(format=:png)
      connection.get(url(format)).body
    rescue Faraday::Error::TimeoutError
      raise Slate::Error::TimeoutError
    end
807378
def download_file(local_filename, url, clobber=False):
    """"""
    dir_name = os.path.dirname(local_filename)
    mkdirs(dir_name)

    if clobber or not os.path.exists(local_filename):
        i = requests.get(url)

        # if not exists
        if i.status_code == 404:
            print('Failed to download file:', local_filename, url)
            return False

        # write out in 1MB chunks
        chunk_size_in_bytes = 1024*1024  # 1MB
        with open(local_filename, 'wb') as local_file:
            for chunk in i.iter_content(chunk_size=chunk_size_in_bytes):
                local_file.write(chunk)

    return True
1033744
def _needs_download(self, f):
		'''  '''

		@wraps(f)
		def wrapper(self, *args, **kwargs):
			if not self.isdownloaded():
				self.download()
			return f(self, *args, **kwargs)
		return wrapper
631551
public void downloadAndUnzip() {
        URL dataURL = null;
        String fileName = folder + "/" + url.substring(url.lastIndexOf("/") + 1);
        File compressedData = new File(fileName);
        if (!new File(fileName).exists()) {
            try {
                dataURL = new URL(url);
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
            try {
                assert dataURL != null;
                FileUtils.copyURLToFile(dataURL, compressedData);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        try {
            ZipFile zipFile = new ZipFile(compressedData);
            File dataFolder = new File(folder);
            zipFile.extractAll(dataFolder.getCanonicalPath());
        } catch (ZipException | IOException e) {
            e.printStackTrace();
        }
    }