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

After Change


        int
            The number of faces that have been renamed
        
        if not filename_mappings:
            return 0

        rename_count = 0
        conflicts = []
        for src, dst in tqdm(filename_mappings, desc="Renaming Faces"):
            old = os.path.join(self._faces.folder, src)
            new = os.path.join(self._faces.folder, dst)

            if os.path.exists(new):
                // Interim add .tmp extension to files that will cause a rename conflict, to
                // process afterwards
                logger.debug("interim renaming file to avoid conflict: (src: "%s", dst: "%s")",
                             src, dst)
                new = new + ".tmp"
                conflicts.append(new)

            logger.verbose("Renaming "%s" to "%s"", old, new)
            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

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

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: sony/nnabla
Commit Name: f965db9932fee3a8fd2cd468ed0fec85fd39232f
Time: 2019-05-30
Author: Takuya.Yashima@sony.com
File Name: python/src/nnabla/utils/nnp_graph.py
Class Name: NnpNetwork
Method Name: _get_variable_or_create


Project Name: Alexander-H-Liu/End-to-end-ASR-Pytorch
Commit Name: 57cf91dbd3d6cdaa1b239320ba693a5b7bfbf02e
Time: 2019-09-25
Author: alexliu36@gmail.com
File Name: bin/train_asr.py
Class Name: Solver
Method Name: exec