Returns the variable with the provided key from the
    table specified by _State.vars_table_name.
4394
def get_var(name, default=None):
    
    alchemytypes = {"text": lambda x: x.decode('utf-8'),
                    "big_integer": lambda x: int(x),
                    "date": lambda x: x.decode('utf-8'),
                    "datetime": lambda x: x.decode('utf-8'),
                    "float": lambda x: float(x),
                    "large_binary": lambda x: x,
                    "boolean": lambda x: x==b'True'}

    connection = _State.connection()
    _State.new_transaction()

    if _State.vars_table_name not in list(_State.metadata.tables.keys()):
        return None

    table = sqlalchemy.Table(_State.vars_table_name, _State.metadata)
    s = sqlalchemy.select([table.c.value_blob, table.c.type])
    s = s.where(table.c.name == name)
    result = connection.execute(s).fetchone()

    if not result:
        return None

    return alchemytypes[result[1]](result[0])

    # This is to do the variable type conversion through the SQL engine
    execute = connection.execute
    execute("CREATE TEMPORARY TABLE _sw_tmp ('value' {})".format(result.type))
    execute("INSERT INTO _sw_tmp VALUES (:value)", value=result.value_blob)
    var = execute('SELECT value FROM _sw_tmp').fetchone().value
    execute("DROP TABLE _sw_tmp")
    return var.decode('utf-8')
1197614
public Object getValue(String key) {
        if (isExpression(key))
            return evaluate(key);
        else
            return getVariables().get(key);
    }
1123766
def get_state(key, namespace=None, table_name=None, environment=None,
              layer=None, stage=None, shard_id=None, consistent=True,
              deserializer=json.loads, wait_exponential_multiplier=500,
              wait_exponential_max=5000, stop_max_delay=10000):
    """"""
    if table_name is None:
        table_name = _state_table_name(environment=environment, layer=layer,
                                       stage=stage)

    if not table_name:
        msg = ("Can't produce state table name: unable to get state "
               "item '{}'".format(key))
        logger.error(msg)
        raise StateTableError(msg)
        return

    dynamodb = boto3.resource("dynamodb")
    table = dynamodb.Table(table_name)
    logger.info("Getting key '{}' from table '{}'".format(key, table_name))
    if namespace:
        key = "{}:{}".format(namespace, key)

    if shard_id:
        key = "{}:{}".format(shard_id, key)

    @retry(retry_on_exception=_is_critical_exception,
           wait_exponential_multiplier=wait_exponential_multiplier,
           wait_exponential_max=wait_exponential_max,
           stop_max_delay=stop_max_delay)
    def get_item():
        try:
            return table.get_item(
                Key={"id": key}, ConsistentRead=consistent).get(
                    "Item", {}).get("value")
        except Exception as err:
            if _is_dynamodb_critical_exception(err):
                raise CriticalError(err)
            else:
                raise

    value = get_item()

    if not value:
        return

    if deserializer:
        try:
            value = deserializer(value)
        except ValueError:
            # For backwards compatibility: plain strings are allowed
            logger.error("Unable to json-deserialize value '{}'".format(value))
            return value

    return value
1040537
def get_key(cls, k, default=None):
        
        k = cls.__name__ + "__" + k
        if k in session:
            return session[k]
        else:
            return default
1258023
function extractStateVariables (contractName, sourcesList) {
  var states = astHelper.extractStatesDefinitions(sourcesList)
  if (!states[contractName]) {
    return []
  }
  var types = states[contractName].stateVariables
  var offsets = decodeInfo.computeOffsets(types, states, contractName, 'storage')
  if (!offsets) {
    return [] // TODO should maybe return an error
  }
  return offsets.typesOffsets
}
1056215
def _get_table(name):
  
  # If name is a variable referencing a table, use that.
  item = google.datalab.utils.commands.get_notebook_item(name)
  if isinstance(item, bigquery.Table):
    return item
  # Else treat this as a BQ table name and return the (cached) table if it exists.
  try:
    return _existing_table_cache[name]
  except KeyError:
    table = bigquery.Table(name)
    if table.exists():
      _existing_table_cache[name] = table
      return table
  return None
1165708
public boolean containsKey(Object key) {
    if(wrappedBindings.containsKey(key)) {
      return true;
    }
    if (key instanceof String) {
      return variableContext.containsVariable((String) key);
    }
    else {
      return false;
    }
  }
43872
def clean_key(cls, key):
        
        for var_re in cls.VARIABLE_RES:
            key = var_re.sub('#', key)
        return key
896417
def get_variable(self, variable_name, check_existence = False):
        
        variables = self.variables
        found = variables.get(variable_name)
        if not found and check_existence:
            raise VariableNotFound(variable_name, self)
        return found
718971
def get(self, name, *subkey):
        
        if subkey == []:
            return self.get_atomic(name)
        else:
            return self.get_subkey(name, tuple(subkey))
728381
def create_variable_keys(self):
        
        variable_name = '{}_keys'.format(self._variable)
        if variable_name in self._variables:
            return
        self._variables.add(variable_name)
        self.l('{variable}_keys = set({variable}.keys())')
73860
def get_local(self, variable_name):
        '''
        
        '''
        if variable_name not in self._locals:
            raise UnknownVariable('Unknown variable %s' % variable_name)
        return self._locals[variable_name]
1051392
private Optional<String> getTabletLocation(String table, Key key)
    {
        try {
            // Get the Accumulo table ID so we can scan some fun stuff
            String tableId = connector.tableOperations().tableIdMap().get(table);

            // Create our scanner against the metadata table, fetching 'loc' family
            Scanner scanner = connector.createScanner("accumulo.metadata", auths);
            scanner.fetchColumnFamily(new Text("loc"));

            // Set the scan range to just this table, from the table ID to the default tablet
            // row, which is the last listed tablet
            Key defaultTabletRow = new Key(tableId + '<');
            Key start = new Key(tableId);
            Key end = defaultTabletRow.followingKey(PartialKey.ROW);
            scanner.setRange(new Range(start, end));

            Optional<String> location = Optional.empty();
            if (key == null) {
                // if the key is null, then it is -inf, so get first tablet location
                Iterator<Entry<Key, Value>> iter = scanner.iterator();
                if (iter.hasNext()) {
                    location = Optional.of(iter.next().getValue().toString());
                }
            }
            else {
                // Else, we will need to scan through the tablet location data and find the location

                // Create some text objects to do comparison for what we are looking for
                Text splitCompareKey = new Text();
                key.getRow(splitCompareKey);
                Text scannedCompareKey = new Text();

                // Scan the table!
                for (Entry<Key, Value> entry : scanner) {
                    // Get the bytes of the key
                    byte[] keyBytes = entry.getKey().getRow().copyBytes();

                    // If the last byte is <, then we have hit the default tablet, so use this location
                    if (keyBytes[keyBytes.length - 1] == '<') {
                        location = Optional.of(entry.getValue().toString());
                        break;
                    }
                    else {
                        // Chop off some magic nonsense
                        scannedCompareKey.set(keyBytes, 3, keyBytes.length - 3);

                        // Compare the keys, moving along the tablets until the location is found
                        if (scannedCompareKey.getLength() > 0) {
                            int compareTo = splitCompareKey.compareTo(scannedCompareKey);
                            if (compareTo <= 0) {
                                location = Optional.of(entry.getValue().toString());
                            }
                            else {
                                // all future tablets will be greater than this key
                                break;
                            }
                        }
                    }
                }
                scanner.close();
            }

            // If we were unable to find the location for some reason, return the default tablet
            // location
            return location.isPresent() ? location : getDefaultTabletLocation(table);
        }
        catch (Exception e) {
            // Swallow this exception so the query does not fail due to being unable
            // to locate the tablet server for the provided Key.
            // This is purely an optimization, but we will want to log the error.
            LOG.error("Failed to get tablet location, returning dummy location", e);
            return Optional.empty();
        }
    }
894273
def get_resource_key(self):
        """"""
        model = self.get_model()
        if model:
            return get_model_table(model)
        else:
            return self.get_name()
447982
public function vars($key = null)
    {
        if (null === $this->__vars) {
            $this->setVars(new Variables());
        }

        if (null === $key) {
            return $this->__vars;
        }
        return $this->__vars[$key];
    }
169327
public Object getVariable(Object key) {
		Object object = null;

		for (int i = working.size() - 1; i >= 0; --i) {
			Map<Object, Object> map = working.get(i);
			object = map.get(key);
			if (object != null)
				break;
		}
		if (object == null)
			object = global.get(key);

		return object;
	}
951948
def _read_state_variables(self):
        
        nodes = self.root.iterfind(
            './/ns:stateVariable', namespaces={'ns': self.namespace})
        for node in nodes:
            key = node.find(self.nodename('name')).text
            value = node.find(self.nodename('dataType')).text
            self.state_variables[key] = value