b1cfbe458c0bf123591348c54973d49297fd55ab,tools/alignments/jobs.py,Rename,_rename_faces,#Rename#Any#,1013

Before Change


        
        rename_count = 0
        for src, dst in tqdm(filename_mappings, desc="Renaming Faces"):
            if src == dst:
                logger.debug("Skipping rename of "%s" as destination name is same as souce", src)
                continue
            old = os.path.join(self._faces.folder, src)
            new = os.path.join(self._faces.folder, dst)
            if os.path.exists(new):
                // This should never happen, but is a safety measure to prevent deletion of faces
                // when multiple files have the same hash.
                logger.debug("Skipping renaming to an existing file: (src: "%s", dst: "%s"",
                             src, dst)
                continue
            logger.verbose("Renaming "%s" to "%s"", old, new)
            os.rename(old, new)
            rename_count += 1
        return rename_count

After Change


            os.rename(old, new)
            rename_count += 1
        if conflicts:
            for old in tqdm(conflicts, desc="Renaming Faces"):
                new = old[:-4]  // Remove .tmp extension
                if os.path.exists(new):
                    // This should only be running on faces. If there is still a conflict
                    // then the user has done something stupid, so we will delete the file and
                    // replace. They can always re-extract :/
                    os.remove(new)
                logger.verbose("Renaming "%s" to "%s"", old, new)
                os.rename(old, new)
        return rename_count


class Sort():
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: deepfakes/faceswap
Commit Name: b1cfbe458c0bf123591348c54973d49297fd55ab
Time: 2021-02-14
Author: 36920800+torzdf@users.noreply.github.com
File Name: tools/alignments/jobs.py
Class Name: Rename
Method Name: _rename_faces


Project Name: deepfakes/faceswap
Commit Name: d2dbd440d89d22b4b75f30ddeb4c4ebd3882ecfa
Time: 2019-05-14
Author: 36920800+torzdf@users.noreply.github.com
File Name: tools/sort.py
Class Name: Sort
Method Name: sort_face_dissim


Project Name: deepfakes/faceswap
Commit Name: 25a2ac95c3b788834db0808307073047747998dd
Time: 2019-10-21
Author: 36920800+torzdf@users.noreply.github.com
File Name: tools/lib_alignments/media.py
Class Name: Faces
Method Name: process_folder