Downloads and extracts the latest App Engine SDK to the given
    destination.
162894
def download_command(args):
    """"""
    latest_two_versions = list(reversed(get_gae_versions()))[:2]

    zip = None
    version_number = None

    for version in latest_two_versions:
        if is_existing_up_to_date(args.destination, version[0]):
            print(
                'App Engine SDK already exists and is up to date '
                'at {}.'.format(args.destination))
            return

        try:
            print('Downloading App Engine SDK {}'.format(
                '.'.join([str(x) for x in version[0]])))
            zip = download_sdk(version[1])
            version_number = version[0]
            break
        except Exception as e:
            print('Failed to download: {}'.format(e))
            continue

    if not zip:
        return

    print('Extracting SDK to {}'.format(args.destination))

    extract_zip(zip, args.destination)
    fixup_version(args.destination, version_number)

    print('App Engine SDK installed.')
19235
def engine_data(engine):
    
    views = ("default", "main", "started", "stopped", "complete",
             "incomplete", "seeding", "leeching", "active", "messages")
    methods = [
        "throttle.global_up.rate", "throttle.global_up.max_rate",
        "throttle.global_down.rate", "throttle.global_down.max_rate",
    ]

    # Get data via multicall
    proxy = engine.open()
    calls = [dict(methodName=method, params=[]) for method in methods] \
          + [dict(methodName="view.size", params=['', view]) for view in views]
    result = proxy.system.multicall(calls, flatten=True)

    # Build result object
    data = dict(
        now         = time.time(),
        engine_id   = engine.engine_id,
        versions    = engine.versions,
        uptime      = engine.uptime,
        upload      = [result[0], result[1]],
        download    = [result[2], result[3]],
        views       = dict([(name, result[4+i])
            for i, name in enumerate(views)
        ]),
    )

    return data
308164
def download(destination, gav)
      raise 'Download destination must not be empty' if destination.empty?
      create_target(destination) # ensure directory path is created
      destination = File.expand_path(destination)
      if File.directory?(destination)
        dstfile = File.expand_path("#{destination}/#{gav.filename}")
      else
        dstfile = File.expand_path(destination)
      end
      # if the file already exists at the destination path than we don't need to download it again
      if sha_match?(dstfile, gav)
        # create a file that stores the sha1 for faster file comparisions later
        # This will only get created when the sha1 matches
        write_sha1("#{dstfile}", gav.sha1)
        if use_cache and not cache.exists?(gav)
          cache.add_file(gav, dstfile)
        end
        return true
      end
      # remove the previous sha1 file if it already exists
      FileUtils.rm("#{dstfile}.sha1") if File.exists?("#{dstfile}.sha1")

      if gav.sha1.nil?
        gav.sha1 = gav_data(gav)['sha1']
      end
      # use the cache if the file is in the cache
      if use_cache and cache.exists?(gav)
        cache_file_path = cache.file_path(gav)
        FileUtils.copy(cache_file_path, dstfile)
        cache.record_hit(gav)
      else
        request = Typhoeus::Request.new(
        "#{host_url}/service/local/artifact/maven/redirect",
        :params  => gav.to_hash,
        :connecttimeout => 5,
        :followlocation => true
        )
        request.on_failure do |response|
          raise("Failed to download #{gav.to_s}")
        end

        # when complete, lets write the data to the file
        # first lets compare the sha matches
        # if the gav we thought we downloaded has the same checksum, were are good
        request.on_complete do |response|
          File.open(dstfile, 'wb') { |f| f.write(response.body) } unless ! response.success?
          if not sha_match?(dstfile, gav, false)
            raise("Error sha1 mismatch gav #{gav.sha1} != #{sha(dstfile)}")
          end
          gav.attributes[:size] =  File.size(dstfile)
          gav.attributes[:total_time] =  response.options[:total_time]

          # lets cache the file if cache is on
          if use_cache
            cache.add_file(gav, dstfile)
          end
          dstfile
        end
        request.run
        dstfile
      end
      dstfile
    end
147118
@TaskAction
    public void download() throws IOException {
        action.execute();
        
        // handle 'upToDate'
        try {
            if (action.isUpToDate()) {
                Method getState = this.getClass().getMethod("getState");
                Object state = getState.invoke(this);
                try {
                    // prior to Gradle 3.2 we needed to do this
                    Method upToDate = state.getClass().getMethod("upToDate");
                    upToDate.invoke(state);
                } catch (NoSuchMethodException e) {
                    // since Gradle 3.2 we need to do this
                    Method setDidWork = state.getClass().getMethod(
                            "setDidWork", boolean.class);
                    setDidWork.invoke(state, false);
                }
            }
        } catch (Exception e) {
            //just ignore
        }
    }
427082
def _download_vswhere():
    
    print('downloading from', _get_latest_release_url())
    try:
        from urllib.request import urlopen
        with urlopen(_get_latest_release_url()) as response, open(DOWNLOAD_PATH, 'wb') as outfile:
            shutil.copyfileobj(response, outfile)
    except ImportError:
        # Python 2
        import urllib
        urllib.urlretrieve(_get_latest_release_url(), DOWNLOAD_PATH)
163266
def fetch_package_version(dist_name):
    
    try:
        # Importing pkg_resources can be slow, so only import it
        # if we need it.
        import pkg_resources
    except ImportError:
        # pkg_resource is not available on Google App Engine
        raise NotImplementedError('pkg_resources is not available '
                                  'on this Python install')
    dist = pkg_resources.get_distribution(dist_name)
    return dist.version
285411
function emitDownload(locale, version, destination) {
	events.emit(eventIds.DOWNLOAD, {locale, version, path: destination});
}
458752
def LegacyKextload(self, cf_bundle_url, dependency_kext):
    """"""
    _ = dependency_kext
    error_code = OS_SUCCESS
    cf_path = self.dll.CFURLCopyFileSystemPath(cf_bundle_url, POSIX_PATH_STYLE)
    path = self.CFStringToPystring(cf_path)
    self.dll.CFRelease(cf_path)
    try:
      subprocess.check_call(['/sbin/kextload', path])
    except subprocess.CalledProcessError as cpe:
      logging.debug('failed to load %s:%s', path, str(cpe))
      error_code = -1
    return error_code
1357185
def download_repo(repo_url, destination, commit=None):
    '''
    '''
    command = "git clone %s %s" % (repo_url, destination)
    os.system(command)
    return destination
780767
async function fetch(
  serviceInstance,
  { baseUrl, packageName, includePrereleases = false }
) {
  const json = await serviceInstance._requestJson({
    schema,
    url: await searchQueryServiceUrl(baseUrl),
    options: {
      qs: {
        q: `packageid:${encodeURIComponent(packageName.toLowerCase())}`,
        // Include prerelease versions.
        prerelease: 'true',
        // Include packages with SemVer 2 version numbers.
        semVerLevel: '2',
      },
    },
  })

  if (json.data.length === 1) {
    return json.data[0]
  } else {
    throw new NotFound({ prettyMessage: 'package not found' })
  }
}
329564
def download(self, source, destination):
        """"""
        self._handler.download(posix_path(source), destination)
1223931
public static File extractAppFromURL(URL url) throws IOException {
    String fileName = url.toExternalForm().substring(url.toExternalForm().lastIndexOf('/') + 1);

    File tmpDir = createTmpDir("iosd");
    log.fine("tmpDir: " + tmpDir.getAbsolutePath());

    File downloadedFile = new File(tmpDir, fileName);
    FileUtils.copyURLToFile(url, downloadedFile);

    if (fileName.endsWith(".ipa"))
      return downloadedFile;
    
    unzip(downloadedFile, tmpDir);
    
    for (File file: tmpDir.listFiles()) {
      if (file.getName().endsWith(".app")) {
        return file;
      }
    }
    
    throw new WebDriverException("cannot extract .app/.ipa from " + url);
  }
206345
def fetch(self):
        
        self.limit.set_request_args(self.kwargs)
        data = self.connection.call(*self.args, **self.kwargs)
        self.limit.post_fetch(data)
        self.last_evaluated_key = data.get('LastEvaluatedKey')
        if self.last_evaluated_key is None:
            self.kwargs.pop('ExclusiveStartKey', None)
        else:
            self.kwargs['ExclusiveStartKey'] = self.last_evaluated_key
        self._update_capacity(data)
        if 'consumed_capacity' in data:
            self.consumed_capacity += data['consumed_capacity']
        for raw_item in data['Items']:
            item = self.connection.dynamizer.decode_keys(raw_item)
            if self.limit.accept(item):
                yield item
926785
def download_rec(session, rec_url, target_path):
    """"""
    try:
        resp = session.get(session.auth.base_url + rec_url)
    except RequestException:
        raise VooblyError('failed to connect for download')
    try:
        downloaded = zipfile.ZipFile(io.BytesIO(resp.content))
        downloaded.extractall(target_path)
    except zipfile.BadZipFile:
        raise VooblyError('invalid zip file')
    return downloaded.namelist()[0]
239988
def extract
      begin_connection

      entries.map do |entry|
        local_file = File.join(@local_path, entry.name)
        logger.info "Downloading #{entry.name} to #{local_file}"
        sftp_retry { sftp_session.download!(File.join(@remote_path, entry.name), local_file) }
        local_file
      end
    ensure
      end_connection
    end
544445
def download_and_extract_to_mkdtemp(bucket, key, session=None):
    """"""
    if session:
        s3_client = session.client('s3')
    else:
        s3_client = boto3.client('s3')
    transfer = S3Transfer(s3_client)

    filedes, temp_file = tempfile.mkstemp()
    os.close(filedes)
    transfer.download_file(bucket, key, temp_file)

    output_dir = tempfile.mkdtemp()
    zip_ref = zipfile.ZipFile(temp_file, 'r')
    zip_ref.extractall(output_dir)
    zip_ref.close()
    os.remove(temp_file)
    return output_dir
368237
def check_appcode(sftp, appcode)
      path = remote_path(appcode)
      FastlaneCore::UI.message('Checking APPCODE')
      remote_mkdir(sftp, path)
    end