Checks syntax and validity of a variable name
351438
def is_valid_varname(varname):
    
    if not isinstance(varname, six.string_types):
        return False
    match_obj = re.match(varname_regex, varname)
    valid_syntax = match_obj is not None
    valid_name = not keyword.iskeyword(varname)
    isvalid = valid_syntax and valid_name
    return isvalid
660881
def _vars_match(self):
        """"""
        return re.compile(
            r'#([A-Za-z]+)'  # match literal (#App) at beginning of String
            r':([\d]+)'  # app id (:7979)
            r':([A-Za-z0-9_\.\-\[\]]+)'  # variable name (:variable_name)
            r'!(StringArray|BinaryArray|KeyValueArray'  # variable type (array)
            r'|TCEntityArray|TCEnhancedEntityArray'  # variable type (array)
            r'|String|Binary|KeyValue|TCEntity|TCEnhancedEntity'  # variable type
            r'|(?:(?!String)(?!Binary)(?!KeyValue)'  # non matching for custom
            r'(?!TCEntity)(?!TCEnhancedEntity)'  # non matching for custom
            r'[A-Za-z0-9_-]+))'  # variable type (custom)
        )
734840
private function _check_format_var()
    {
        if ($this->_format !== false && !$this->_is_root() && !preg_match('/(:|\*)format[^\w]?/', $this->_url)) {
            if ($this->_format === true)
                $this->_url .= '.:format';
            else
                $this->_url .= '(.:format)';
        }
    }
671524
def is_config_var(var):
    

    return (
        isinstance(var, (attr._make.Attribute, attr._make._CountingAttr))
        and hasattr(var, "metadata")
        and CONFIG_KEY in var.metadata
    )
1028510
function checkForDuplicates (params) {
  for (var i = 0; i < params.length - 1; i++) {
    var outer = params[i];
    for (var j = i + 1; j < params.length; j++) {
      var inner = params[j];
      if (outer.name === inner.name && outer.in === inner.in) {
        throw ono.syntax('Validation failed. Found multiple %s parameters named "%s"', outer.in, outer.name);
      }
    }
  }
}
1029860
private static String getVariableName(String value) {
        assert value.charAt(0) == '{';
        assert value.charAt(value.length() - 1) == '}';
        return value.substring(1, value.length() - 1);
    }
315420
def do_indep(self, arg):
        """"""
        if not self._validate_var(arg):
            msg.err("Variable {} is not a valid file name and property combination.".format(arg))
        else:
            self.curargs["independent"] = arg
1105025
public function checkVarName($var_name)
    {
        if (empty($var_name)) {
            return;
        }
        if (array_key_exists($var_name, $this->var_blocks)) {
            $this->logger->warning("Found duplicate definition for $var_name.");
        }
    }
288870
function checkVariable(i) {
  const start = i;
  let l;

  if (i >= tokensLength) return 0;

  // Skip `$`.
  if (tokens[i].type === TokenType.DollarSign) i++;
  else return 0;

  if (l = checkIdent(i)) i += l;
  else return 0;

  return i - start;
}
613742
private boolean weHaveVar( String name )
    {
        // super.variables.containsKey( name ) not any faster, I checked
        try {
            return super.getVariableImpl( name, false ) != null;
        } catch ( UtilEvalError e ) { return false; }
    }
924685
private static boolean isValidBrace(String url) {
        if (null == url || url.trim().length() == 0) {
            return false;
        }

        boolean isInsideVariable = false;
        StringTokenizer tokenizer = new StringTokenizer(url, "{}", true);
        while (tokenizer.hasMoreTokens()) {
            String token = tokenizer.nextToken();
            if (token.equals("{")) {
                // { is not allowed inside of a variable specification
                if (isInsideVariable) {
                    return false;
                }
                isInsideVariable = true;
            } else if (token.equals("}")) {
                // } must be preceded by {;
                if (!isInsideVariable) {
                    return false;
                }
                isInsideVariable = false;
            }
        }
        return true;
    }
24334
def _get_variable_name_or_register(var, variables, names, params, prefix):
    '''
    
    '''
    if var not in variables.values():
        vname = prefix
        if var.data in params:
            vname = params[var.data]
        elif var in names:
            vname = names[var]
        vname = _get_unique_variable_name(vname, variables)
        variables[vname] = var
    else:
        vname = list(variables.keys())[list(variables.values()).index(var)]

    return vname
773654
def real_check(*args, func=None):
    """"""
    func = func or inspect.stack()[2][3]
    for var in args:
        if not isinstance(var, numbers.Real):
            name = type(var).__name__
            raise ComplexError(
                f'Function {func} expected real number, {name} got instead.')
188450
function(parent, name, type) {
			if (/^[0-9]+$/.test(name)) {
        return parent + "[" + name + "]";
      } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
	    	return parent + "." + name;
			}
			else {
				return parent + "['" + name + "']";
      }
    }
113599
def _check_shape(var, name, shape, shape2=None):
    """
    varshape = np.shape(var)
    if shape != varshape:
        if shape2:
            if shape2 != varshape:
                print('* ERROR   :: Parameter ' + name + ' has wrong shape!' +
                      ' : ' + str(varshape) + ' instead of ' + str(shape) +
                      'or' + str(shape2) + '.')
                raise ValueError(name)
        else:
            print('* ERROR   :: Parameter ' + name + ' has wrong shape! : ' +
                  str(varshape) + ' instead of ' + str(shape) + '.')
            raise ValueError(name)
128506
def validate_vars(env):
    """"""
    if 'PCH' in env and env['PCH']:
        if 'PCHSTOP' not in env:
            raise SCons.Errors.UserError("The PCHSTOP construction must be defined if PCH is defined.")
        if not SCons.Util.is_String(env['PCHSTOP']):
            raise SCons.Errors.UserError("The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP'])
105128
def variable(self):
        """"""
        # Use a character invalid in python identifiers to avoid clashing.
        name = "@py_assert" + str(next(self.variable_counter))
        self.variables.append(name)
        return name