Rename images so that their name is unique
334054
public static ro.nextreports.server.domain.Report renameImagesAsUnique(ro.nextreports.server.domain.Report report) {
        NextContent reportContent = (NextContent) report.getContent();
		try {
			String masterContent = new String(reportContent.getNextFile().getDataProvider().getBytes(), "UTF-8");
			for (JcrFile imageFile : reportContent.getImageFiles()) {
				String oldName = imageFile.getName();
				int index = oldName.lastIndexOf(ro.nextreports.server.report.util.ReportUtil.EXTENSION_SEPARATOR);
				String newName = oldName.substring(0, index) + ro.nextreports.server.report.util.ReportUtil.IMAGE_DELIM
						+ UUID.randomUUID().toString() + oldName.substring(index);
				masterContent = masterContent.replaceAll(oldName, newName);
				imageFile.setName(newName);
			}
			JcrFile templateFile = reportContent.getTemplateFile();
			if (templateFile != null) {
				String oldName = templateFile.getName();
				int index = oldName.lastIndexOf(ro.nextreports.server.report.util.ReportUtil.EXTENSION_SEPARATOR);
				String newName = oldName.substring(0, index) + ro.nextreports.server.report.util.ReportUtil.IMAGE_DELIM
						+ UUID.randomUUID().toString() + oldName.substring(index);
				masterContent = masterContent.replaceAll(oldName, newName);
				templateFile.setName(newName);
			}
			
			reportContent.getNextFile().setDataProvider(new JcrDataProviderImpl(masterContent.getBytes("UTF-8")));
		} catch (UnsupportedEncodingException e) {
			LOG.error("Error inside renameImagesAsUnique: " + e.getMessage(), e);
			e.printStackTrace();
		}

        return report;
    }
176258
function configureImageNames() {
    for (let i = 0; i < this.appsFolders.length; i++) {
        const originalImageName = this.appConfigs[i].baseName.toLowerCase();
        const targetImageName = this.dockerRepositoryName ? `${this.dockerRepositoryName}/${originalImageName}` : originalImageName;
        this.appConfigs[i].targetImageName = targetImageName;
    }
}
272344
def namer(cls, imageUrl, pageUrl):
        """"""
        parts, year, month, stripname = pageUrl.rsplit('/', 3)
        stripname = stripname.rsplit('.', 1)[0]
        parts, imagename = imageUrl.rsplit('/', 1)
        return '%s-%s-%s-%s' % (year, month, stripname, imagename)
992122
def parse_image_name(self, image):
        '''
             

        '''
        self._image = image
        self.uri = self.get_uri(image)
        self.image = self.remove_uri(image)
760415
def rename_gallery_file(self, file_id, new_file_name, scope='content/write'):
        
        return _put(
            token=self.oauth.get_user_token(scope),
            uri='/user/media/file/' + urllib.quote(file_id),
            data=new_file_name
        )
703823
def rename(dct, mapping):
    

    def _block(memo, key):
        if key in dct:
            memo[mapping[key]] = dct[key]
            return memo
        else:
            return memo
    return reduce(_block, mapping, omit(dct, *mapping.keys()))
580704
def names(cls):
        """"""
        if not cls._files:
            for f in os.listdir(cls._image_path):
                if(not f.startswith('.') and
                   os.path.isfile(os.path.join(cls._image_path, f))):
                    cls._files.append(os.path.splitext(f)[0])

        return cls._files
1159041
def rename_snapshot(self, path, oldsnapshotname, snapshotname, **kwargs):
        """"""
        response = self._put(path, 'RENAMESNAPSHOT',
                             oldsnapshotname=oldsnapshotname, snapshotname=snapshotname, **kwargs)
        assert not response.content
1315806
def renameSNPs(inPrefix, updateFileName, outPrefix):
    """"""
    plinkCommand = ["plink", "--noweb", "--bfile", inPrefix, "--update-map",
                    updateFileName, "--update-name", "--make-bed", "--out",
                    outPrefix]
    runCommand(plinkCommand)
351550
public function getUniqueFolderName()
    {
        return sprintf(
            '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
            mt_rand(0, 65535),
            mt_rand(0, 65535),
            mt_rand(0, 65535),
            mt_rand(0, 4095) | 0x4000,
            mt_rand(0, 0x3fff) | 0x8000,
            mt_rand(0, 65535),
            mt_rand(0, 65535),
            mt_rand(0, 65535)
        );
    }
876520
function renameReferenceUniquely(uri) {
  const prefix = uri.substr(0, uri.indexOf('/_components/'));

  return `${prefix}/_components/${getComponentName(uri)}/instances/${uid.get()}`;
}
370141
def change_filename(filehandle, meta):
    
    filename = secure_filename(meta.get('filename', filehandle.filename))
    basename, _ = os.path.splitext(filename)
    meta['original_filename'] = filehandle.filename
    filehandle.filename = filename + '.jpg'
    return filehandle
861125
def rename(self, name):
        """"""
        self.ec2.create_tags(Resources = [self.instance_id],
                             Tags      = [{'Key':   'Name',
                                           'Value':  name}])
        self.refresh_info()
908844
def rename_object(self, old, new):
        """"""
        self._objects.replace(old, new)
        pairs = self._pairs
        pairs |= {(new, p) for p in self._properties
            if (old, p) in pairs and not pairs.remove((old, p))}
1224574
def generate_unique_name(self, basename):
        """"""
        counts = self.__counts
        try:
            count = counts[basename]
            counts[basename] += 1
        except KeyError:
            count = 0
            counts[basename] = 1
            
        prefix = self.Naming_prefix

        if count == 0:
            name = prefix + basename
        else:
            name = prefix + basename + "_" + str(count)
            
        if prefix != "" or count != 0:
            try:
                count = counts[name]
                return self.generate_unique_name(name)
            except KeyError:
                # wasn't already used so return it
                counts[name] = 1
        return name
939294
def parse_image_name(name):
    
    name = name or ""
    if '/' in name:
        repository, other = name.split('/')
    else:
        repository, other = None, name

    if ':' in other:
        name, version = other.split(':')
    else:
        name, version = other, 'latest'

    return repository, name, version
1075021
def _clean_name(self, prefix, obj):
        """"""
        return '{}{}_{}'.format(prefix, self._uid(), ''.join(c for c in obj.name if c.isalnum()))