8bba0fc202e205f30a431e0bd563ea7563224f0e,sounds/models.py,Sound,compute_crc,#Sound#Any#,732

Before Change


        crc = 0
        with open(self.locations("path"), "rb") as fp:
            data = fp.read(settings.CRC_BUFFER_SIZE)
            while len(data) > 0:
                crc = zlib.crc32(data, crc)
                data = fp.read(settings.CRC_BUFFER_SIZE)
        self.crc = "{:0>8x}".format(crc & 0xffffffff)  // right aligned with zero-padding, width of 8 chars

        if commit:
            self.save()

After Change


    def compute_crc(self, commit=True):
        crc = 0
        with open(self.locations("path"), "rb") as fp:
            for data in iter(lambda: fp.read(settings.CRC_BUFFER_SIZE), b""):
                crc = zlib.crc32(data, crc)

        self.crc = "{:0>8x}".format(crc & 0xffffffff)  // right aligned with zero-padding, width of 8 chars
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: MTG/freesound
Commit Name: 8bba0fc202e205f30a431e0bd563ea7563224f0e
Time: 2018-08-06
Author: phil.tgun@gmail.com
File Name: sounds/models.py
Class Name: Sound
Method Name: compute_crc


Project Name: samuelclay/NewsBlur
Commit Name: aee018f39c813bb3ff12f67f19022d5c584f629b
Time: 2017-01-25
Author: samuel@ofbrooklyn.com
File Name: vendor/readability/encoding.py
Class Name:
Method Name: get_encoding


Project Name: dask/distributed
Commit Name: 383ea0326ae103b5d5e0b62ed9c3cb18510c5b9e
Time: 2021-02-17
Author: jakirkham@gmail.com
File Name: distributed/comm/tcp.py
Class Name: TCP
Method Name: write