Get the local variables some levels back (-1 is top).
197555
def getlocals(back=2):
    """"""
    import inspect
    fr = inspect.currentframe()
    try:
        while fr and back != 0:
            fr1 = fr
            fr = fr.f_back
            back -= 1
    except:
        pass
    return fr1.f_locals
1153188
def _get_value(self, var):
        """"""
        return self._problem._p.getVarByName(self._problem._variables[var]).x
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
542428
def get_locals(f):
    '''  '''
    return pformat({i:f.f_locals[i] for i in f.f_locals if not i.startswith('__')})
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]
678658
def get_variables_by_offset(self, start):
        

        _, container = self._get_container(start)
        if container is None:
            return []
        else:
            return container.internal_objects
515194
def variables(
            self,
            name=None,
            function=None,
            decl_type=None,
            header_dir=None,
            header_file=None,
            recursive=None,
            allow_empty=None):

        """"""
        return (
            self._find_multiple(
                self._impl_matchers[
                    scopedef_t.variable],
                name=name,
                function=function,
                decl_type=decl_type,
                header_dir=header_dir,
                header_file=header_file,
                recursive=recursive,
                allow_empty=allow_empty)
        )
940990
def _level_coords(self):
        
        level_coords = OrderedDict()
        for name, index in self.indexes.items():
            if isinstance(index, pd.MultiIndex):
                level_names = index.names
                (dim,) = self.variables[name].dims
                level_coords.update({lname: dim for lname in level_names})
        return level_coords
1034746
def variables(self):
    """"""
    result = []
    for _, value in sorted(self.variable_map.items()):
      if isinstance(value, list):
        result.extend(value)
      else:
        result.append(value)
    return result
1283437
def _subst_vars(path, local_vars):
    
    def _replacer(matchobj):
        name = matchobj.group(1)
        if name in local_vars:
            return local_vars[name]
        elif name in os.environ:
            return os.environ[name]
        return matchobj.group(0)
    return _VAR_REPL.sub(_replacer, path)
57410
def get_level_value(level):
    """"""
    try:
        # integral constants also work: they are the level value
        return int(level)
    except ValueError:
        try:
            return LEVELS_DICT[level.upper()]
        except KeyError:
            logging.warning("level '%s' cannot be translated to a level value (not present in LEVELS_DICT)" % level)
            return None
175705
def getLevelName(level):
    
    assert isinstance(level, int) and level > 0 and level < 6, \
           TypeError("Bad debug level")
    return getLevelNames()[level - 1]
783194
def lhs(self):
        """"""
        lhs = self._lhs
        i = 0
        while lhs is None:
            i -= 1
            lhs = self._prev_lhs[i]
        return lhs
648314
def levels(self, with_mem=True):
        """"""
        p = self.first_level
        while p is not None:
            yield p
            # FIXME bad hack to include victim caches, need a more general solution, probably
            # involving recursive tree walking
            if p.victims_to is not None and p.victims_to != p.load_from:
                yield p.victims_to
            if p.store_to is not None and p.store_to != p.load_from and p.store_to != p.victims_to:
                yield p.store_to
            p = p.load_from

        if with_mem:
            yield self.main_memory
70662
def values(self, start=None, stop=None):
        """"""
        return (item[1] for item in self.items(start, stop))
613254
def extract_indexes(coords):
    """"""
    for name, variable in coords.items():
        variable = as_variable(variable, name=name)
        if variable.dims == (name,):
            yield name, variable.to_index()
360219
public Variable acquireLocalVariable(String name) {
        int depth = 0;
        LocalVariable variable = findVariable(name, depth);

        if (variable == null) {
            variable = new LocalVariable(name, localVariablesIndex, 0);
            localVariables.put(name, variable);
            localVariablesIndex++;
        }

        return variable;
    }