88c20d965de6342244ba942f8a355ebfb2f8133c,PyInstaller/archive/readers.py,CArchiveReader,checkmagic,#CArchiveReader#,132

Before Change


            self.lib.seek(0, 2)
        filelen = self.lib.tell()
        found = False
        for i in range(4096):
            self.lib.seek(filelen-self._cookie_size, 0)
            (magic, totallen, tocpos, toclen, pyvers, pylib_name) = struct.unpack(
                self._cookie_format, self.lib.read(self._cookie_size))
            if magic != self.MAGIC:
                filelen -= 1
            else:
                found = True
                break
                
                
        if not found:
            raise RuntimeError("%s is not a valid %s archive file" %
                               (self.path, self.__class__.__name__))

After Change


        
        self.lib.seek(max(0, filelen-4096)) 
        searchpos = self.lib.tell()
        buf = self.lib.read(min(filelen, 4096))
        pos = buf.rfind(self.MAGIC)
        if pos == -1:
            raise RuntimeError("%s is not a valid %s archive file" %
                               (self.path, self.__class__.__name__))
        filelen = searchpos + pos + self._cookie_size
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: pyinstaller/pyinstaller
Commit Name: 88c20d965de6342244ba942f8a355ebfb2f8133c
Time: 2016-02-29
Author: garth@garthy.com
File Name: PyInstaller/archive/readers.py
Class Name: CArchiveReader
Method Name: checkmagic


Project Name: nilearn/nilearn
Commit Name: 35c1805993c33e67a394193c7cae9a3f38a7607f
Time: 2014-11-21
Author: danilobzdok@gmail.com
File Name: nilearn/decomposition/canica.py
Class Name: CanICA
Method Name: fit


Project Name: scikit-optimize/scikit-optimize
Commit Name: 9cdd21160f4b4352b05f7b7ce9f0f63506c585c9
Time: 2017-04-17
Author: iaroslav-ai@users.noreply.github.com
File Name: benchmarks/bench_ml.py
Class Name:
Method Name: evaluate_optimizer


Project Name: chartbeat-labs/textacy
Commit Name: eaaf2bad32af4bda1a98d434530926bb6a001230
Time: 2019-08-23
Author: burtdewilde@gmail.com
File Name: textacy/augmentation/transformations.py
Class Name:
Method Name: insert_synonyms