Process the variable name to make it more human-readable.
339892
def get_variable_and_source(x: str):
    
    xs = x.replace("\/", "|").split("/")
    xs = [x.replace("|", "/") for x in xs]
    if xs[0] == "FAO":
        return " ".join(xs[2:]), xs[0]
    else:
        return xs[-1], xs[0]
1044703
def normalize(cls, name):
        """"""
        name = name.lower() # lower-case
        for _replace in [' ','-','(',')','?']:
            name = name.replace(_replace,'')
        return name
384356
def prepend_name_scope(name, import_scope):
  """"""
  # Based on tensorflow/python/framework/ops.py implementation.
  if import_scope:
    try:
      str_to_replace = r"([\^]|loc:@|^)(.*)"
      return re.sub(str_to_replace, r"\1" + import_scope + r"/\2",
                    tf.compat.as_str_any(name))
    except TypeError as e:
      # If the name is not of a type we can process, simply return it.
      logging.warning(e)
      return name
  else:
    return name
1367721
def format_vars(args):
    """'"""
    variables = []
    for key, value in args.items():
        if value:
            variables += ['{0}={1}'.format(key, value)]
    return variables
1038334
def _get_unique_variable_name(vname, variables):
    '''
    '''
    count = 2
    vname_base = vname
    while vname in variables:
        vname = '{}_{}'.format(vname_base, count)
        count += 1
    return vname
19684
def _parse_variables_from_code(self):
        
        
        # Get one string of code with comments removed
        code = '\n\n'.join(self._shaders)
        code = re.sub(r'(.*)(//.*)', r'\1', code, re.M)
        
        # Regexp to look for variable names
        var_regexp = ("\s*VARIABLE\s+"  # kind of variable
                      "((highp|mediump|lowp)\s+)?"  # Precision (optional)
                      "(?P<type>\w+)\s+"  # type
                      "(?P<name>\w+)\s*"  # name
                      "(\[(?P<size>\d+)\])?"  # size (optional)
                      "(\s*\=\s*[0-9.]+)?"  # default value (optional)
                      "\s*;"  # end
                      )
        
        # Parse uniforms, attributes and varyings
        self._code_variables = {}
        for kind in ('uniform', 'attribute', 'varying', 'const'):
            regex = re.compile(var_regexp.replace('VARIABLE', kind),
                               flags=re.MULTILINE)
            for m in re.finditer(regex, code):
                gtype = m.group('type')
                size = int(m.group('size')) if m.group('size') else -1
                this_kind = kind
                if size >= 1:
                    # uniform arrays get added both as individuals and full
                    for i in range(size):
                        name = '%s[%d]' % (m.group('name'), i)
                        self._code_variables[name] = kind, gtype, name, -1
                    this_kind = 'uniform_array'
                name = m.group('name')
                self._code_variables[name] = this_kind, gtype, name, size

        # Now that our code variables are up-to date, we can process
        # the variables that were set but yet unknown.
        self._process_pending_variables()
755614
private void saveNestedVariables() {
	if (nestedVars != null) {
	    Iterator iter = nestedVars.iterator();
	    while (iter.hasNext()) {
		String varName = (String) iter.next();
		varName = findAlias(varName);
		Object obj = invokingJspCtxt.getAttribute(varName);
		if (obj != null) {
		    originalNestedVars.put(varName, obj);
		}
	    }
	}
    }
255062
protected void validName(String name) throws SyntaxException {
		for (String varName : automaticVariables) {
			if (varName.equals(name)) {
				throw SyntaxException.create(getSourceRange(),
						MSG_AUTO_VAR_CANNOT_BE_SET, varName);
			}
		}
	}
1321597
function fixVarNames(varObj = {}) {
    const reLeadingHyphens = /^-{2}/;

    return Object.keys(varObj).reduce((obj, value) => {
        const key = reLeadingHyphens.test(value) ? value : `--${value.replace(/^-+/, '')}`;

        obj[key] = varObj[value];

        return obj;
    }, {});
}
942874
def adjust_name_for_printing(name):
    
    if name is not None:
        name2 = name
        name = name.replace(" ", "_").replace(".", "_").replace("-", "_m_")
        name = name.replace("+", "_p_").replace("!", "_I_")
        name = name.replace("**", "_xx_").replace("*", "_x_")
        name = name.replace("/", "_l_").replace("@", '_at_')
        name = name.replace("(", "_of_").replace(")", "")
        if re.match(r'^[a-zA-Z_][a-zA-Z0-9-_]*$', name) is None:
            raise NameError("name {} converted to {} cannot be further converted to valid python variable name!".format(name2, name))
        return name
    return ''
516352
public void setVariable(String name, Object value) {
        TraceState ts = traceState.get();

        if (ts != null) {
            if (log.isLoggable(Level.FINEST)) {
                log.finest("Set variable '" + name + "' value = " + value);
            }
            ts.getVariables().put(name, value);
        } else if (log.isLoggable(Level.FINEST)) {
            log.finest("Set variable '" + name + "' value = " + value + "' requested, but no trace state");
        }
    }
621848
private static String toVariableName(String str) {

	StringBuffer rtn = new StringBuffer();
	char[] chars = str.toCharArray();
	long changes = 0;
	boolean doCorrect = true;
	for (int i = 0; i < chars.length; i++) {
	    char c = chars[i];
	    if (i == 0 && (c >= '0' && c <= '9')) rtn.append("_" + c);
	    else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_' || c == '$') rtn.append(c);
	    else {
		doCorrect = false;
		rtn.append('_');
		changes += (c * (i + 1));
	    }
	}

	if (changes > 0) rtn.append(changes);

	if (doCorrect) return correctReservedWord(rtn.toString());
	return rtn.toString();
    }
1075021
def _clean_name(self, prefix, obj):
        """"""
        return '{}{}_{}'.format(prefix, self._uid(), ''.join(c for c in obj.name if c.isalnum()))
758454
protected function processVariables()
    {
        $this->request->variables = $this->fillVariables();
        $this->request->contentVariables = $this->fillContentVariables();
        $this->request->get = $_GET;
        $this->request->post = $_POST;
    }
65750
private VarNamePattern getValidVarNamePattern( String varNamePattern) throws IllegalArgumentException
    {
    VarNamePattern pattern = new VarNamePattern( varNamePattern);
    if( !pattern.isValid())
      {
      throw new IllegalArgumentException( "\"" + pattern + "\" is not a valid variable name pattern");
      }

    return pattern;
    }
601003
protected void restoreScriptingVars(JavaCodeWriter tagWriter, int scope) {
        if (nestingLevel == 0) {
            return;
        }

        TagVariableInfo[] tagVarInfos = ti.getTagVariableInfos();
        VariableInfo[] varInfos = ti.getVariableInfo(collectedTagData.getTagData());
        
        if (varInfos == null)
            varInfos = new VariableInfo[0];
            
        if ((varInfos.length == 0) && (tagVarInfos.length == 0)) {
            return;
        }

        if (varInfos.length > 0) {
            for (int i = 0; i < varInfos.length; i++) {
                if (varInfos[i].getScope() != scope)
                    continue;
                if (containsVariableInfo(getScriptingVars(scope), varInfos[i])) {
                    continue;
                }
                String varName = varInfos[i].getVarName();
                String tmpVarName = "_jspx_" + varName + "_" + nestingLevel;
                tagWriter.print(varName);
                tagWriter.print(" = ");
                tagWriter.print(tmpVarName);
                tagWriter.println(";");
            }
        }
        else {
            for (int i = 0; i < tagVarInfos.length; i++) {
                if (tagVarInfos[i].getScope() != scope)
                    continue;
                if (containsTagVariableInfo(getScriptingVars(scope),tagVarInfos[i])) {
                    continue;
                }
                String varName = tagVarInfos[i].getNameGiven();
                if (varName == null) {
                    varName = collectedTagData.getTagData().getAttributeString(tagVarInfos[i].getNameFromAttribute());
                }
                else if (tagVarInfos[i].getNameFromAttribute() != null) {
                    // alias
                    continue;
                }
                String tmpVarName = "_jspx_" + varName + "_" + nestingLevel;
                tagWriter.print(varName);
                tagWriter.print(" = ");
                tagWriter.print(tmpVarName);
                tagWriter.println(";");
            }
        }
    }
597092
def private_name_for(var_name, cls):
    """"""
    if not (isinstance(var_name, string_types) and var_name):
        raise TypeError('var_name must be non-empty string')
    if not (isinstance(cls, type) or isinstance(cls, string_types)):  # pylint: disable=consider-merging-isinstance
        raise TypeError('cls not a class or string')
    if __PRIVATE_NAME_PATTERN.match(var_name):
        class_name = cls.__name__ if isinstance(cls, type) else cls
        return '_%s%s' % (class_name.lstrip('_'), var_name)
    else:
        return var_name