Generates a valid unique identifier from the given name,
with a suffix attached to it
168393
public static function getIdentifier(string $name) : string
    {
        static $salt;

        $salt   = $salt ?? $salt = self::loadBaseHashSalt();
        $suffix = substr(sha1($name . $salt), 0, 5);

        if (! preg_match(self::VALID_IDENTIFIER_FORMAT, $name)) {
            return self::DEFAULT_IDENTIFIER . $suffix;
        }

        return $name . $suffix;
    }
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
323282
def __filename(self, id):
        """"""
        suffix = self.fnsuffix()
        filename = "%s-%s.%s" % (self.fnprefix, id, suffix)
        return os.path.join(self.location, filename)
1029190
def generate_id():
    """"""
    # TODO: Use six.string_type to Py3 compat
    try:
        return unicode(uuid1()).replace(u"-", u"")
    except NameError:
        return str(uuid1()).replace(u"-", u"")
812944
public String fullyQualifiedSymbolName(String name) {
        if (name.equals(SymbolsTable.ME)) {
            return "$".concat(id());
        } else if (name.startsWith("$")) {
            return "$" + id() + '.' + name.substring(1);
        }
        return id() + '.' + name;
    }
114295
private function generateIdentifierName($identifier)
    {
        // Always generate name for unquoted identifiers to ensure consistency.
        $identifier = new Identifier($identifier);

        return strtoupper(dechex(crc32($identifier->getName())));
    }
814472
def parse_prefix(identifier):
    
    pf, id = (), identifier
    if "|" in identifier:
        pf, id = tuple(identifier.split('|')[:-1]), identifier.split('|')[-1]

    return pf, id
941300
public static String createId(String name, int index) {

        StringBuffer result = new StringBuffer();
        result.append(name);
        result.append('.');
        result.append(index);

        return result.toString();
    }
389002
def get_unique_name(self, prefix):
        '''
        '''
        ident = sum(t.startswith(prefix) for t, _ in self.layers.items()) + 1
        return '%s_%d' % (prefix, ident)
727000
public static String createUniqueIdentifier() {
		String id;
		do {
			id = UUID.randomUUID().toString();
		} while (getSREFromId(id) != null);
		return id;
	}
547064
private String createNewIdentifier(ParseTreeNode productionPart, String suffix)
	    throws TreeException {
	String identifier = "";
	if (productionPart.hasChild("IDENTIFIER")) {
	    identifier = productionPart.getChild("IDENTIFIER").getText();
	} else if (productionPart.hasChild("STRING_LITERAL")) {
	    identifier = productionPart.getChild("STRING_LITERAL").getText();
	}
	return createIdentifierName(identifier, suffix);
    }
979685
def strip_suffix(id):
    
    suffix = get_suffix(id)
    if not suffix:
        return id
    return re.split(suffix, id)[0]
875944
def _unique_names():
    
    characters = ("abcdefghijklmnopqrstuvwxyz"
                  "0123456789")
    characters = [characters[i:i + 1] for i in irange(len(characters))]
    rng = random.Random()
    while True:
        letters = [rng.choice(characters) for i in irange(10)]
        yield ''.join(letters)
209659
private String deriveId(final String idName) {
		// Find parent naming context
		NamingContextable parent = WebUtilities.getParentNamingContext(this);

		// No Parent
		if (parent == null) {
			return idName;
		}

		// Get ID prefix
		String prefix = parent.getNamingContextId();

		// No Prefix, just use id name
		if (prefix.length() == 0) {
			return idName;
		}

		// Add Prefix
		StringBuffer nameBuf = new StringBuffer(prefix.length() + idName.length() + 1);
		nameBuf.append(prefix);
		nameBuf.append(ID_CONTEXT_SEPERATOR);
		nameBuf.append(idName);

		return nameBuf.toString();
	}
1199289
function generateHoistNameBasedOn(path, suffix = "") {
  const names = [];
  if (suffix) {
    names.push(suffix);
  }

  let current = path;
  while (!(current.isIdentifier() || current.isJSXIdentifier())) {
    names.push(current.node.property.name);
    current = current.get("object");
  }
  names.push(current.node.name);

  return path.scope.generateUidIdentifier(names.reverse().join("$"));
}
840986
def id_unique(dict_id, name, lineno):
    """"""
    if dict_id in name_dict:
        global error_occurred
        error_occurred = True
        print(
            "ERROR - {0:s} definition {1:s} at line {2:d} conflicts with {3:s}"
            .format(name, dict_id, lineno, name_dict[dict_id]))
        return False
    else:
        return True
416826
def _generate_identifier():
    
    bit_length = 64
    byte_length = int(bit_length / 8)
    identifier = os.urandom(byte_length)
    return hexlify(identifier).decode('ascii')