Return the variable specifier for this variable.

        The specifier can be used to lookup the value of this variable in a computation context.
334040
def variable_specifier(self) -> dict:
        
        if self.value_type is not None:
            return {"type": "variable", "version": 1, "uuid": str(self.uuid), "x-name": self.name, "x-value": self.value}
        else:
            return self.specifier
1279613
private String getVariable(GDLParser.HeaderContext header) {
    if (header != null && header.Identifier() != null) {
      return header.Identifier().getText();
    }
    return null;
  }
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
1225116
def getvariable(name):
    """"""
    import inspect
    fr = inspect.currentframe()
    try:
        while fr:
            fr = fr.f_back
            vars = fr.f_locals
            if name in vars:
                return vars[name]
    except:
        pass
    return None
134261
private Expr determineVariableAliases(GlobalEnvironment environment,
			Set<WyalFile.VariableDeclaration> freeVariables) {
		Expr aliases = null;
		for (WyalFile.VariableDeclaration var : freeVariables) {
			WyalFile.VariableDeclaration parent = environment.getParent(var);
			if (parent != null) {
				// This indicates a variable alias, so construct the necessary
				// equality.
				Expr.VariableAccess lhs = new Expr.VariableAccess(var);
				Expr.VariableAccess rhs = new Expr.VariableAccess(parent);
				Expr aliasEquality = new Expr.Equal(lhs, rhs);
				//
				aliases = and(aliases, aliasEquality);
			}
		}
		return aliases;
	}
901304
def variable(self):
        
        var = Var(self.cur_token)
        self.eat(TokenTypes.VAR)
        if Features.TYPE_ARRAY in self.features:
            while self.cur_token.type == TokenTypes.LBRACKET:
                self.eat(TokenTypes.LBRACKET)
                # Start passed the logical ops.
                expr = self.operator_expression(level=2)
                self.eat(TokenTypes.RBRACKET)
                var = GetArrayItem(left=var, right=expr)
        if Features.FUNC in self.features:
            if self.cur_token.type == TokenTypes.LPAREN:
                self.eat(TokenTypes.LPAREN)
                args = self.arg_list()
                self.eat(TokenTypes.RPAREN)
                var = Call(var, args)
        return var
142339
public final int getVariableByName(String variableName) {
    int index = getVariableIndex(variableName);
    if (index == -1) {
      return index;
    } else {
      return nums[index];
    }
  }
284257
function lookupVariable(context, variableName) {
	const { frames, importantScope } = context

	return tree.Variable.prototype.find(frames, frame => {
		const { value, important } = frame.variable(variableName) || {}

		if (value === undefined)
			return

		if (important && importantScope[importantScope.length - 1])
			importantScope[importantScope.length - 1].important = important

		return value.eval(context)
	})
}
108863
def _get_value(self, var):
        """"""
        return self._problem._p.get_value(self._problem._variables[var])
725223
def get_expr(self, ctx):
        
        varname = ctx.lookup_variable(self.varname)
        if varname is None:
            val = ctx.lookup_constant(self.varname)
            if val:
                try:
                    return val.generate_code(ctx)
                except AttributeError:
                    return val
            raise MuvError(
                "Undeclared identifier '%s'." % self.varname,
                position=self.position
            )
        if len(self.indexing) == 0:
            return "{var} @".format(
                var=varname,
            )
        if len(self.indexing) == 1:
            return "{var} @ {idx} []".format(
                var=varname,
                idx=self.indexing[0],
            )
        return (
            "{var} @ {{ {idx} }}list array_nested_get".format(
                var=varname,
                idx=" ".join(str(x) for x in self.indexing),
            )
        )
384313
function resolveVariable(identifier) {
            if (!resolvedVariableCache.has(identifier)) {
                const surroundingScope = getScope(identifier);

                if (surroundingScope) {
                    resolvedVariableCache.set(identifier, resolveVariableInScope(identifier, surroundingScope));
                } else {
                    resolvedVariableCache.set(identifier, null);
                }
            }

            return resolvedVariableCache.get(identifier);
        }
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()
423279
def _variable_on_cpu(name, shape, initializer):
  
  with tf.device('/cpu:0'):
    dtype = tf.float16 if FLAGS.use_fp16 else tf.float32
    var = tf.get_variable(name, shape, initializer=initializer, dtype=dtype)
  return var
787813
def getVariables(self):
        
        variables = lock_and_call(
            lambda: self._impl.getVariables(),
            self._lock
        )
        return EntityMap(variables, Variable)
158037
def get_variable_ddi(name, shape, initial_value, dtype=tf.float32, init=False,
                     trainable=True):
  """"""
  # If init is a tf bool: w is assigned dynamically at runtime.
  # If init is a python bool: then w is determined during graph construction.
  w = tf.get_variable(name, shape, dtype, None, trainable=trainable)
  if isinstance(init, bool):
    if init:
      return assign(w, initial_value)
    return w
  else:
    return tf.cond(init, lambda: assign(w, initial_value), lambda: w)
142730
def return_value(self):
        
        if self._raises:
            # Handle exceptions
            if inspect.isclass(self._raises):
                raise self._raises()
            else:
                raise self._raises
        else:
            if isinstance(self._returns, tuple):
                return tuple([x.value if isinstance(x, Variable)
                             else x for x in self._returns])
            return self._returns.value if isinstance(self._returns, Variable) \
                else self._returns
1073595
def resolve(var, context):
    
    try:
        return var.resolve(context)
    except template.VariableDoesNotExist:
        return var.var