Helper for lookup_symbol that looks for symbols in all namespaces.

        Args:
          symbol: Symbol
435411
def _lookup_in_all_namespaces(self, symbol):
        
        namespace = self.namespaces
        # Create a stack of namespaces.
        namespace_stack = []
        for current in symbol.namespace_stack:
            namespace = namespace.get(current)
            if namespace is None or not isinstance(namespace, dict):
                break
            namespace_stack.append(namespace)

        # Iterate through the stack in reverse order. Need to go from
        # innermost namespace to outermost.
        for namespace in reversed(namespace_stack):
            try:
                return self._lookup_namespace(symbol, namespace)
            except Error:
                pass
        return None
939041
def pseudos_with_symbols(self, symbols):
        
        pseudos = self.select_symbols(symbols, ret_list=True)
        found_symbols = [p.symbol for p in pseudos]
        duplicated_elements = [s for s, o in collections.Counter(found_symbols).items() if o > 1]

        if duplicated_elements:
            raise ValueError("Found multiple occurrences of symbol(s) %s" % ', '.join(duplicated_elements))
        missing_symbols = [s for s in symbols if s not in found_symbols]

        if missing_symbols:
            raise ValueError("Missing data for symbol(s) %s" % ', '.join(missing_symbols))

        return pseudos
103323
def extract_symbol_app(parser, _, args):  # pragma: no cover
    

    parser.add_argument('file', help='ELF file to extract a symbol from')
    parser.add_argument('symbol', help='the symbol to extract')
    args = parser.parse_args(args)
    return ELF(args.file).get_symbol(args.symbol).content
306358
def ns(symbol):
        ''''''
        if symbol.type and symbol.type.is_primitive:
            return ''
        return '{0}::'.format('::'.join(symbol.module.name_parts))
181851
def namespace_for_prefix(self, prefix):
        
        try:
            ni = self.__lookup_prefix(prefix)
        except PrefixNotFoundError:
            return None
        else:
            return ni.uri
183463
def _lookup_unit_symbol(symbol_str, unit_symbol_lut):
    
    if symbol_str in unit_symbol_lut:
        # lookup successful, return the tuple directly
        return unit_symbol_lut[symbol_str]

    # could still be a known symbol with a prefix
    prefix, symbol_wo_prefix = _split_prefix(symbol_str, unit_symbol_lut)

    if prefix:
        # lookup successful, it's a symbol with a prefix
        unit_data = unit_symbol_lut[symbol_wo_prefix]
        prefix_value = unit_prefixes[prefix][0]

        # Need to add some special handling for comoving units
        # this is fine for now, but it wouldn't work for a general
        # unit that has an arbitrary LaTeX representation
        if symbol_wo_prefix != "cm" and symbol_wo_prefix.endswith("cm"):
            sub_symbol_wo_prefix = symbol_wo_prefix[:-2]
            sub_symbol_str = symbol_str[:-2]
        else:
            sub_symbol_wo_prefix = symbol_wo_prefix
            sub_symbol_str = symbol_str
        latex_repr = unit_data[3].replace(
            "{" + sub_symbol_wo_prefix + "}", "{" + sub_symbol_str + "}"
        )

        # Leave offset and dimensions the same, but adjust scale factor and
        # LaTeX representation
        ret = (
            unit_data[0] * prefix_value,
            unit_data[1],
            unit_data[2],
            latex_repr,
            False,
        )

        unit_symbol_lut[symbol_str] = ret

        return ret

    # no dice
    raise UnitParseError(
        "Could not find unit symbol '%s' in the provided " "symbols." % symbol_str
    )
652473
def _iter_symbols(code):
        
        for node in ast.walk(ast.parse(code)):
            if isinstance(node, ast.Name):
                yield node.id
873335
Symbol findIdent(Env<AttrContext> env, Name name, KindSelector kind) {
        Symbol bestSoFar = typeNotFound;
        Symbol sym;

        if (kind.contains(KindSelector.VAL)) {
            sym = findVar(env, name);
            if (sym.exists()) return sym;
            else bestSoFar = bestOf(bestSoFar, sym);
        }

        if (kind.contains(KindSelector.TYP)) {
            sym = findType(env, name);

            if (sym.exists()) return sym;
            else bestSoFar = bestOf(bestSoFar, sym);
        }

        if (kind.contains(KindSelector.PCK))
            return lookupPackage(env, name);
        else return bestSoFar;
    }
120110
def _ExtractSymbols(self, descriptors):
    

    for desc in descriptors:
      yield (_PrefixWithDot(desc.full_name), desc)
      for symbol in self._ExtractSymbols(desc.nested_types):
        yield symbol
      for enum in desc.enum_types:
        yield (_PrefixWithDot(enum.full_name), enum)
720089
def open_ns(symbol):
        ''' '''
        blocks = ['namespace {0} {{'.format(x) for x in symbol.module.name_parts]
        return ' '.join(blocks)
1073138
def get_atom_type_symbol(cls,calc,**kwargs):
        
        parameters = calc.out.output
        dictionary = parameters.get_dict()
        if 'basis_set' not in dictionary.keys():
            return None
        return sorted(dictionary['basis_set'].keys())
77583
def resolve_symbol(resolver, sym, ctx)
      if found = find_symbol(sym.to_sym, ctx)
        resolve_lexically(resolver, found, ctx)
        found
      elsif dynamic = resolver.resolve_symbol(sym)
        dynamic
      else
        fail("Unknown symbol in manifest: #{sym}")
      end
    end
85041
def get_geometry_from_IUPAC_symbol(self, IUPAC_symbol):
        
        for gg in self.cg_list:
            if gg.IUPAC_symbol == IUPAC_symbol:
                return gg
        raise LookupError(
            'No coordination geometry found with IUPAC symbol "{symbol}"'.format(
                symbol=IUPAC_symbol))
1051220
def get_by_symbol(self, symbol: str) -> Commodity:
        
        assert isinstance(symbol, str)

        query = (
            self.currencies_query
                .filter(Commodity.mnemonic == symbol)
        )
        return query.one()
1310116
def get_symbols(self):
        
        return [s if isinstance(s, Symbol) else s.args[0] for s in self.get_literals()]
746169
def next_lookup(self, symbol):
        """"""
        result = []
        if symbol == self.initialsymbol:
            result.append(EndSymbol())
        for production in self.productions:
            if symbol in production.rightside:
                nextindex = production.rightside.index(symbol) + 1
                while nextindex < len(production.rightside):
                    nextsymbol = production.rightside[nextindex]
                    firstlist = self.first_lookup(nextsymbol)
                    cleanfirstlist = Choice([x for x in firstlist if x != NullSymbol()])
                    result.append(cleanfirstlist)
                    if NullSymbol() not in firstlist:
                        break
                else:
                    result += self.next_lookup(production.leftside[0]) #reached the end of the rightside
        return result
973599
function (symbol) {
        return symbolDict[symbol.charCodeAt(0)] && symbolDict[symbol.charCodeAt(0)][symbol.charCodeAt(1)] || symbolDict[symbol.charCodeAt(1)] && symbolDict[symbol.charCodeAt(0)][symbol.charCodeAt(0)];
    }