Given on courseid, fullname and shortname, calculate the correct fullname/shortname to avoid dupes
435606
public static function calculate_course_names($courseid, $fullname, $shortname) {
        global $CFG, $DB;

        $currentfullname = '';
        $currentshortname = '';
        $counter = 0;
        // Iteratere while the name exists
        do {
            if ($counter) {
                $suffixfull  = ' ' . get_string('copyasnoun') . ' ' . $counter;
                $suffixshort = '_' . $counter;
            } else {
                $suffixfull  = '';
                $suffixshort = '';
            }
            $currentfullname = $fullname.$suffixfull;
            $currentshortname = substr($shortname, 0, 100 - strlen($suffixshort)).$suffixshort; // < 100cc
            $coursefull  = $DB->get_record_select('course', 'fullname = ? AND id != ?',
                    array($currentfullname, $courseid), '*', IGNORE_MULTIPLE);
            $courseshort = $DB->get_record_select('course', 'shortname = ? AND id != ?', array($currentshortname, $courseid));
            $counter++;
        } while ($coursefull || $courseshort);

        // Return results
        return array($currentfullname, $currentshortname);
    }
1030072
def register_proper_name(self, name):
        """"""
        with self.proper_names_db_path.open("a") as f:
            f.write(u"{0}\n".format(name))
177741
def unique(self, name):
    """"""
    # Make sure the name is valid
    name = self.valid(name)
    # Make sure it's not too long
    name = self.trim(name)
    # Now make sure it's unique
    unique_name = name
    i = 2
    while unique_name in self.names:
      unique_name = name + str(i)
      i += 1
    self.names.add(unique_name)
    return unique_name
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("$"));
}
319159
def full_name(self):
        
        full_name = self.first_name
        if self.last_name:
            full_name += ' ' + self.last_name
        return full_name
29724
def valid_qname(val):
    

    try:
        (prefix, localpart) = val.split(":")
        return valid_ncname(prefix) and valid_ncname(localpart)
    except ValueError:
        return valid_ncname(val)
432587
def full_name(gender = :any)
      case gender
      when :any then rand(0..1) == 0 ? male_full_name : female_full_name
      when :male then male_full_name
      when :female then female_full_name
      else raise ArgumentError, 'Invalid gender, must be one of :any, :male, :female'
      end
    end
393488
function getUniqueName(dirName, shortened, buildTypeSuffix) {
		if (!usedBundleNames[dirName + shortened + buildTypeSuffix]) {
			return dirName + shortened + buildTypeSuffix + "";
		}else {
			return dirName + shortened + "-" + (bundleCounter++) + buildTypeSuffix + "";
		}
	}
467342
def full_name(self):
        
        formatted_user = []
        if self.user.first_name is not None:
            formatted_user.append(self.user.first_name)
        if self.user.last_name is not None:
            formatted_user.append(self.user.last_name)
        return " ".join(formatted_user)
1212958
function compareNames(a, b) {
	if (!isArray(a)) a = splitAuthorString(a);
	if (!isArray(b)) b = splitAuthorString(b);

	var aPos = 0, bPos = 0;
	var authorLimit = Math.min(a.length, b.length);
	var failed = false;

	while (aPos < authorLimit && bPos < authorLimit) {
		if (fuzzyStringCompare(a[aPos], b[bPos])) { // Direct or fuzzy matching of entire strings
			aPos++;
			bPos++;
		} else {
			var aAuth = splitAuthor(a[aPos]);
			var bAuth = splitAuthor(b[bPos]);
			var nameLimit = Math.min(aAuth.length, bAuth.length);
			var nameMatches = 0;
			for (var n = 0; n < nameLimit; n++) {
				if (
					aAuth[n] == bAuth[n] || // Direct match
					aAuth[n].length == 1 && bAuth[n].substr(0, 1) || // A is initial and B is full name
					bAuth[n].length == 1 && aAuth[n].substr(0, 1) ||
					(aAuth[n].length > 1 && bAuth[n].length > 1 && fuzzyStringCompare(aAuth[n], bAuth[n], 3))
				) {
					nameMatches++;
				}
			}

			if (nameMatches >= nameLimit) {
				aPos++;
				bPos++;
			} else {
				failed = true;
			}
			break;
		}
	}
	return !failed;
}
739066
function _getName(fullname, extension) {
        return extension !== "" ? fullname.substring(0, fullname.length - extension.length - 1) : fullname;
    }
1032912
def full_name(self):
        """"""
        if self.first_name and self.middle_name and self.last_name:
            return "%s %s %s" % (self.first_name, self.middle_name, self.last_name)
        if self.first_name and self.last_name:
            return "%s %s" % (self.first_name, self.last_name)
1281901
private boolean doesMatchFullName(String firstName, String fullName){
        boolean matching = false;
        if(firstName != null && !firstName.isEmpty() && fullName != null && !fullName.isEmpty()){
            String firstFromCMDB;
            String[] array = fullName.split(" ");

            firstName = firstName.toLowerCase();
            firstFromCMDB = array[0];
            firstFromCMDB = firstFromCMDB.toLowerCase();
            if(firstFromCMDB.length() < firstName.length()){
                if(firstName.indexOf(firstFromCMDB) != -1){
                    matching = true;
                }
            }else if (firstFromCMDB.indexOf(firstName) != -1){
                matching = true;
            }
        }
        return matching;
    }
1310537
protected function helper_fullname_format() {
        $fake = new stdClass();
        $fake->lastname = 'LLLL';
        $fake->firstname = 'FFFF';
        $fullname = get_string('fullnamedisplay', '', $fake);
        if (strpos($fullname, 'LLLL') < strpos($fullname, 'FFFF')) {
            return 'lf';
        } else {
            return 'fl';
        }
    }
1208673
def full_name(self):
        
        name, parameters, _ = self.signature
        return name+'('+','.join(parameters)+')'
570224
def make_id(name):
    
    name = re.sub(r'[^a-zA-Z0-9]', '', name)
    r = get_rand_string(12)
    if len(name) > 22:
        name = name[:22]
    return name + "-" + r
1077061
def validate_name(ctx, param, value):
    """"""
    if not value:
        value = os.path.basename(ctx.params['directory'].rstrip(os.path.sep))
    return value