Downloads the jruby-complete jar file for `jruby_version` and save in
 ~/.jruby-jar/jruby-complete.jar unless it already exits. If the jar is
 corrupt or an older version, set force to true to delete and re-download
189964
def download_jruby(jruby_version, force=false)
      dist = "#{Dir.home}/.jruby-jar"
      unless force || (File.exists?("#{dist}/jruby-complete-#{jruby_version}.jar") && File.size("#{dist}/jruby-complete-#{jruby_version}.jar") > 0)
        mkdir_p dist
        base_dir = Dir.pwd
        cd dist
        $stderr.puts "JRuby complete jar not found. Downloading... (May take awhile)"
        download(jruby_version)
        cd base_dir
      end
    end
255937
def download_source(version):
        
        local_filename = 'v{}.zip'.format(Spark.svm_version_path(version))
        Spark.download(Spark.spark_versions()['v{}'.format(version)], local_filename)
404461
def download(self, request, **kwargs):
        '''
        
        '''
        # method check to avoid bad requests
        self.method_check(request, allowed=['get'])
        # Must be done otherwise endpoint will be wide open
        self.is_authenticated(request)

        response = None
        file_item_name = kwargs.get('name', None)
        if file_item_name:
            filename_absolute = helpers.get_filename_absolute(file_item_name)
            if os.path.isfile(filename_absolute):
                response = serve(request, os.path.basename(filename_absolute), os.path.dirname(filename_absolute))
                response['Content-Disposition'] = 'attachment; filename="{}"'.format(
                    os.path.basename(filename_absolute))

        if not response:
            response = self.create_response(request, {'status': 'filename not specified'})

        return response
1027967
def download(self, url, filename, resume=False):
        

        try:
            self._start_download(url, filename, resume)
        except KeyboardInterrupt as e:
            # keep the file if resume is True
            if not resume:
                logging.info('Keyboard Interrupt -- Removing partial file: %s',
                             filename)
                try:
                    os.remove(filename)
                except OSError:
                    pass
            raise e
282664
def download(bug, supportconfig_only)
      bug.attachments.each do |attachment|
        filename = "bsc#{bug.id}-#{attachment.id}-#{attachment.props['file_name']}"
        if supportconfig_only
          next unless attachment.content_type == 'application/x-gzip' ||
                      attachment.content_type == 'application/x-bzip-compressed-tar'
          next unless attachment.summary =~ /supportconfig/i
        end
        t.say("Downloading to #{t.color(filename, :even_row)}")
        begin
          data = attachment.data
          File.open(filename, 'w') do |f|
            f.write data.read
          end
        rescue StandardError => e
          t.say("#{t.color('Error:', :error)} Download of #{filename} failed: #{e}")
          raise
        end
      end
    end
1291880
@Override
    protected File getFileForLastModifiedCheck() throws IOException {
        URL url = getURL();
        if (ResourceUtils.isJarURL(url)) {
            URL actualUrl = ResourceUtils.extractArchiveURL(url);
            return ResourceUtils.getFile(actualUrl, "Jar URL");
        } else {
            return getFile();
        }
    }
413470
def download(self, filename, format='sdf', overwrite=False, resolvers=None, **kwargs):
        
        download(self.input, filename, format, overwrite, resolvers, **kwargs)
1275857
public void download() {
        URL dataURL = null;
        String fileName = folder + "/" + url.substring(url.lastIndexOf("/") + 1);
        if (new File(fileName).exists()) {
            return;
        }
        try {
            dataURL = new URL(url);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }

        File downloadedData = new File(fileName);
        try {
            assert dataURL != null;
            FileUtils.copyURLToFile(dataURL, downloadedData);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
691314
public void download() throws IOException, InterruptedException {
    if (!Files.exists(destinationFile.getParent())) {
      Files.createDirectories(destinationFile.getParent());
    }

    if (Files.exists(destinationFile)) {
      throw new FileAlreadyExistsException(destinationFile.toString());
    }
    URLConnection connection = address.openConnection();
    connection.setRequestProperty("User-Agent", userAgentString);

    try (InputStream in = connection.getInputStream()) {
      // note : contentLength can potentially be -1 if it is unknown.
      long contentLength = connection.getContentLengthLong();

      logger.info("Downloading " + address + " to " + destinationFile);

      try (BufferedOutputStream out =
          new BufferedOutputStream(
              Files.newOutputStream(destinationFile, StandardOpenOption.CREATE_NEW))) {

        progressListener.start(
            getDownloadStatus(contentLength, Locale.getDefault()), contentLength);

        int bytesRead;
        byte[] buffer = new byte[BUFFER_SIZE];

        while ((bytesRead = in.read(buffer)) != -1) {
          if (Thread.currentThread().isInterrupted()) {
            logger.warning("Download was interrupted\n");
            cleanUp();
            throw new InterruptedException("Download was interrupted");
          }

          out.write(buffer, 0, bytesRead);
          progressListener.update(bytesRead);
        }
      }
    }
    progressListener.done();
  }
5385
public synchronized DownloadResponse getJnlpFile( JnlpResource jnlpres, DownloadRequest dreq )
            throws IOException
    {
        String path = jnlpres.getPath();
        URL resource = jnlpres.getResource();
        long lastModified = jnlpres.getLastModified();

        _log.addDebug( "lastModified: " + lastModified + " " + new Date( lastModified ) );
        if ( lastModified == 0 )
        {
            _log.addWarning( "servlet.log.warning.nolastmodified", path );
        }

        // fix for 4474854:  use the request URL as key to look up jnlp file
        // in hash map
        String reqUrl = HttpUtils.getRequestURL( dreq.getHttpRequest() ).toString();

        // Check if entry already exist in HashMap
        JnlpFileEntry jnlpFile = (JnlpFileEntry) _jnlpFiles.get( reqUrl );

        if ( jnlpFile != null && jnlpFile.getLastModified() == lastModified )
        {
            // Entry found in cache, so return it
            return jnlpFile.getResponse();
        }

        // Read information from WAR file
        long timeStamp = lastModified;
        String mimeType = _servletContext.getMimeType( path );
        if ( mimeType == null )
        {
            mimeType = JNLP_MIME_TYPE;
        }

        StringBuilder jnlpFileTemplate = new StringBuilder();
        URLConnection conn = resource.openConnection();
        BufferedReader br = new BufferedReader( new InputStreamReader( conn.getInputStream(), "UTF-8" ) );
        String line = br.readLine();
        if ( line != null && line.startsWith( "TS:" ) )
        {
            timeStamp = parseTimeStamp( line.substring( 3 ) );
            _log.addDebug( "Timestamp: " + timeStamp + " " + new Date( timeStamp ) );
            if ( timeStamp == 0 )
            {
                _log.addWarning( "servlet.log.warning.notimestamp", path );
                timeStamp = lastModified;
            }
            line = br.readLine();
        }
        while ( line != null )
        {
            jnlpFileTemplate.append( line );
            line = br.readLine();
        }

        String jnlpFileContent = specializeJnlpTemplate( dreq.getHttpRequest(), path, jnlpFileTemplate.toString() );

        // Convert to bytes as a UTF-8 encoding
        byte[] byteContent = jnlpFileContent.getBytes( "UTF-8" );

        // Create entry
        DownloadResponse resp =
                DownloadResponse.getFileDownloadResponse( byteContent, mimeType, timeStamp, jnlpres.getReturnVersionId() );
        jnlpFile = new JnlpFileEntry( resp, lastModified );
        _jnlpFiles.put( reqUrl, jnlpFile );

        return resp;
    }
1190531
def download(self):
        
        if self.url:
            try:
                return requests.get(self.url).content
            except requests.RequestException as e:
                raise GyazoError(str(e))
        return None
208292
def _download(self, dstFile):
        
        for attempt in retry(predicate=lambda e: isinstance(e, HTTPError) and e.code == 400):
            with attempt:
                with closing(urlopen(self.url)) as content:
                    buf = content.read()
        contentHash = hashlib.md5(buf)
        assert contentHash.hexdigest() == self.contentHash
        dstFile.write(buf)
761263
def download
      return io if io.is_a?(Tempfile)

      Tempfile.new(id, binmode: true).tap do |tempfile|
        IO.copy_stream(io, tempfile)
        tempfile.rewind
        tempfile.fsync
      end
    end
1274604
def download_blob_to(file) #:doc:
        file.binmode
        blob.download { |chunk| file.write(chunk) }
        file.flush
        file.rewind
      end
105221
def download(model, direct=False, *pip_args):
    
    dl_tpl = "{m}-{v}/{m}-{v}.tar.gz#egg={m}=={v}"
    if direct:
        components = model.split("-")
        model_name = "".join(components[:-1])
        version = components[-1]
        dl = download_model(dl_tpl.format(m=model_name, v=version), pip_args)
    else:
        shortcuts = get_json(about.__shortcuts__, "available shortcuts")
        model_name = shortcuts.get(model, model)
        compatibility = get_compatibility()
        version = get_version(model_name, compatibility)
        dl = download_model(dl_tpl.format(m=model_name, v=version), pip_args)
        if dl != 0:  # if download subprocess doesn't return 0, exit
            sys.exit(dl)
        msg.good(
            "Download and installation successful",
            "You can now load the model via spacy.load('{}')".format(model_name),
        )
        # Only create symlink if the model is installed via a shortcut like 'en'.
        # There's no real advantage over an additional symlink for en_core_web_sm
        # and if anything, it's more error prone and causes more confusion.
        if model in shortcuts:
            try:
                # Get package path here because link uses
                # pip.get_installed_distributions() to check if model is a
                # package, which fails if model was just installed via
                # subprocess
                package_path = get_package_path(model_name)
                link(model_name, model, force=True, model_path=package_path)
            except:  # noqa: E722
                # Dirty, but since spacy.download and the auto-linking is
                # mostly a convenience wrapper, it's best to show a success
                # message and loading instructions, even if linking fails.
                msg.warn(
                    "Download successful but linking failed",
                    "Creating a shortcut link for '{}' didn't work (maybe you "
                    "don't have admin permissions?), but you can still load "
                    "the model via its full package name: "
                    "nlp = spacy.load('{}')".format(model, model_name),
                )
1006836
def download_to_file(self, file):
        
        con = ConnectionManager().get_connection(self._connection_alias)
        return con.download_to_file(self.file, file, append_base_url=False)
1283558
private JarFile getJarFile()
    throws IOException
  {
    JarFile jarFile = null;

    isCacheValid();

    if (! _backingIsFile) {
      throw new FileNotFoundException(getBacking().getNativePath());
    }
    
    try {
      jarFile = new JarFile(getBacking().getNativePath());

        /*
        if (_backing.getNativePath().indexOf("cssparser.jar") > 0)
          System.out.println("JAR: " + _backing + " " + jarFile);
          */
    }
    catch (IOException ex) {
      if (log.isLoggable(Level.FINE))
        log.log(Level.FINE, L.l("Error opening jar file '{0}'", getBacking().getNativePath()));

      throw ex;
    }

    return jarFile;
  }