edcd459b9cf96c3e5ffc8d6965df5f2e731b3b84,src/python/pants/cache/restful_artifact_cache.py,RESTfulArtifactCache,use_cached_files,#RESTfulArtifactCache#Any#,65

Before Change


      with temporary_file() as outfile:
        total_bytes = 0
        // Read the data in a loop.
        for chunk in response.iter_content(self.READ_SIZE_BYTES):
          outfile.write(chunk)
          total_bytes += len(chunk)

        outfile.close()
        self.log.debug("Read %d bytes from artifact cache at %s" %
                       (total_bytes,self._url_string(remote_path)))

After Change


      response = self._request("GET", remote_path)
      if response is not None:
        // Delegate storage and extraction to local cache
        byte_iter = response.iter_content(self.READ_SIZE_BYTES)
        return self._localcache.store_and_use_artifact(cache_key, byte_iter)
    except Exception as e:
      logger.warn("\nError while reading from remote artifact cache: {0}\n".format(e))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: pantsbuild/pants
Commit Name: edcd459b9cf96c3e5ffc8d6965df5f2e731b3b84
Time: 2014-10-30
Author: tinystatemachine@gmail.com
File Name: src/python/pants/cache/restful_artifact_cache.py
Class Name: RESTfulArtifactCache
Method Name: use_cached_files


Project Name: home-assistant/home-assistant
Commit Name: 15e329a5882db608e49f26eded5014645efbac66
Time: 2016-05-21
Author: paulus@paulusschoutsen.nl
File Name: homeassistant/components/camera/mjpeg.py
Class Name: MjpegCamera
Method Name: mjpeg_stream


Project Name: chartbeat-labs/textacy
Commit Name: 9be42b1de4d8054feb24fe54acfe9787e44f5697
Time: 2017-06-03
Author: burton@chartbeat.com
File Name: textacy/fileio/write.py
Class Name:
Method Name: write_streaming_download_file


Project Name: okfn-brasil/serenata-de-amor
Commit Name: e92141ec46e05647107c13c7a362910b7ce89a40
Time: 2017-11-19
Author: cuducos@users.noreply.github.com
File Name: research/src/fetch_campaign_donations.py
Class Name: Donation
Method Name: _download