Get list of nonterminals, what are rewritable from nonterminal passed as parameter
        using only unit rules.
        :param from_symbol: For which symbols to search.
        :return: List of nonterminals.
176594
def reachables(self, from_symbol):
        # type: (Type[Nonterminal]) -> List[Type[Nonterminal]]
        
        if from_symbol not in self.t:
            return []
        reachable = []
        index = self.t[from_symbol]
        for n, i in self.t.items():
            if len(self.f[index][i] or []) > 0:
                reachable.append(n)
        return reachable
1312081
def getSymbols(self):
        """"""
        symbollist = []
        for rule in self.productions:
            for symbol in rule.leftside + rule.rightside:
                if symbol not in symbollist:
                    symbollist.append(symbol)
        symbollist += self.terminal_symbols
        return symbollist
749284
public static ImmutableSet<String> getGeneratedBy(ClassSymbol symbol, VisitorState state) {
    checkNotNull(symbol);
    Optional<Compound> c =
        Stream.of("javax.annotation.Generated", "javax.annotation.processing.Generated")
            .map(state::getSymbolFromString)
            .filter(a -> a != null)
            .map(symbol::attribute)
            .filter(a -> a != null)
            .findFirst();
    if (!c.isPresent()) {
      return ImmutableSet.of();
    }
    Optional<Attribute> values =
        c.get().getElementValues().entrySet().stream()
            .filter(e -> e.getKey().getSimpleName().contentEquals("value"))
            .map(e -> e.getValue())
            .findAny();
    if (!values.isPresent()) {
      return ImmutableSet.of();
    }
    ImmutableSet.Builder<String> suppressions = ImmutableSet.builder();
    values
        .get()
        .accept(
            new SimpleAnnotationValueVisitor8<Void, Void>() {
              @Override
              public Void visitString(String s, Void aVoid) {
                suppressions.add(s);
                return super.visitString(s, aVoid);
              }

              @Override
              public Void visitArray(List<? extends AnnotationValue> vals, Void aVoid) {
                vals.stream().forEachOrdered(v -> v.accept(this, null));
                return super.visitArray(vals, aVoid);
              }
            },
            null);
    return suppressions.build();
  }
1031522
def get_symbols(self, site='Pro'):
        
        assert site in ['Pro', 'HADAX']
        params = {}
        path = f'/v1{"/" if site == "Pro" else "/hadax/"}common/symbols'

        def _wrapper(_func):
            @wraps(_func)
            def handle():
                _func(api_key_get(params, path))

            return handle

        return _wrapper
1938
def _symbols():
    
    global _SYMBOLS
    if _SYMBOLS is None:
        tmp = [(s, 'symbol') for s in _data()['symbol'].keys()]
        tmp += [(s, 'alpha3') for s in _data()['alpha3'].keys()]
        tmp += [(s.name, 'name') for s in _data()['alpha3'].values()]
        _SYMBOLS = sorted(
            tmp,
            key=lambda s: (len(s[0]), ord(s[0][0])),
            reverse=True)

    return _SYMBOLS
1051220
def get_by_symbol(self, symbol: str) -> Commodity:
        
        assert isinstance(symbol, str)

        query = (
            self.currencies_query
                .filter(Commodity.mnemonic == symbol)
        )
        return query.one()
1350166
def _decode_symbols(symbols):
    
    for symbol in symbols:
        data = string_at(zbar_symbol_get_data(symbol))
        # The 'type' int in a value in the ZBarSymbol enumeration
        symbol_type = ZBarSymbol(symbol.contents.type).name
        polygon = convex_hull(
            (
                zbar_symbol_get_loc_x(symbol, index),
                zbar_symbol_get_loc_y(symbol, index)
            )
            for index in _RANGEFN(zbar_symbol_get_loc_size(symbol))
        )

        yield Decoded(
            data=data,
            type=symbol_type,
            rect=bounding_box(polygon),
            polygon=polygon
        )
551270
def indices_from_symbol(self, symbol: str) -> tuple:
        
        return tuple((i for i, specie in enumerate(self.species)
                      if specie.symbol == symbol))
963485
def get_expected_tokens(self, parser, interval_set):
        # type: (QuilParser, IntervalSet) -> Iterator
        
        for tok in interval_set:
            literal_name = parser.literalNames[tok]
            symbolic_name = parser.symbolicNames[tok]

            if literal_name != '<INVALID>':
                yield literal_name
            else:
                yield symbolic_name
1012100
def _check_self_nonterminals(self, optimized):
        
        # print 'BFS Dictionary Update - Self Non Terminals'
        find = 0
        for nt in self.grammar.grammar_nonterminals_map:
            for i in self.grammar.grammar_nonterminals_map[nt]:
                if (self.grammar.grammar_rules[i][0] not in self.resolved\
                    or self.grammar.grammar_rules[i][0] == 'S') \
                    and isinstance(self.grammar.grammar_rules[i][1], (set, tuple)):
                    # All rules are in CNF form, so first check the A -> BC rules
                    part_a = None
                    if optimized and self._check_self_to_empty(
                            self.grammar.grammar_rules[i][1][0]):
                        part_a = ''
                    elif self.grammar.grammar_rules[i][1][0] in self.resolved:
                        part_a = self.resolved[self.grammar.grammar_rules[i][1][0]]
                    part_b = None
                    if optimized and self._check_self_to_empty(
                            self.grammar.grammar_rules[i][1][1]):
                        part_b = ''
                    elif self.grammar.grammar_rules[i][1][1] in self.resolved:
                        part_b = self.resolved[self.grammar.grammar_rules[i][1][1]]
                    if part_a is not None and part_b is not None:
                        self.resolved[self.grammar.grammar_rules[i][0]] = part_a + part_b
                        # print 'Non Terminals Resolving
                        # '+self.g.Rules[i][0]+": "+
                        # self.Resolved[self.g.Rules[i][0]]
                        if self._checkfinal(self.grammar.grammar_rules[i][0]):
                            return self.resolved[self.grammar.grammar_rules[i][0]]
                        if self.grammar.grammar_rules[i][0] not in self.bfs_queue:
                            self.bfs_queue.append(self.grammar.grammar_rules[i][0])
                        find = 1

        if find == 1:
            return 1
        return 0
1250443
def symbol_to_id(self, symbol):
        """"""

        if symbol not in self.symbols_to_ids:
            m = 'Could not look up Entrez ID for Geneways symbol ' + symbol
            raise Exception(m)
        return self.symbols_to_ids[symbol]
235228
def _get_regular_expression_of_symbols(self):
        

        regular_expression = None
        for symbol in self.symbols:
            formated_symbol = self._get_formated_symbol(symbol['symbol'])
            if regular_expression is None:
                regular_expression = '(' + formated_symbol + ')'
            else:
                regular_expression = (
                    regular_expression +
                    '|(' +
                    formated_symbol +
                    ')'
                )
        return regular_expression
979410
def list_symbols(self, partial_match=None):
        
        symbols = self._symbols.distinct(SYMBOL)
        if partial_match is None:
            return symbols
        return [x for x in symbols if partial_match in x]
719596
def to_single_symbol_list(self):
        
        symbol_stream = getattr(self,
                                'symbol_stream',
                                [None for symbol in self.segmentation])
        single_symbols = []
        pointlist = self.get_sorted_pointlist()
        for stroke_indices, label in zip(self.segmentation, symbol_stream):
            strokes = []
            for stroke_index in stroke_indices:
                strokes.append(pointlist[stroke_index])
            single_symbols.append(HandwrittenData(json.dumps(strokes),
                                                  formula_id=label))
        return single_symbols
340587
def from_symbol(cls, symbol: str) -> "Piece":
        
        return cls(PIECE_SYMBOLS.index(symbol.lower()), symbol.isupper())
1036179
def cyk(grammar, parse_sequence):
    # type: (Grammar, Iterable[Any]) -> Nonterminal
    
    # check start symbol
    if grammar.start is None:
        raise StartSymbolNotSetException()
    # create variables
    parse_sequence = list(parse_sequence)
    input_length = len(parse_sequence)
    index = input_length - 1
    f = Field(input_length)
    # creating mapping for speedup rules searching
    (termmap, rulemap) = _create_mapping(grammar)
    # fill first line with rules directly rewritable to terminal
    f.fill(termmap, parse_sequence)
    # fill rest of fields
    for y in range(1, input_length):
        for x in range(input_length - y):
            positions = f.positions(x, y)
            pairs_of_rules = [(f.rules(pos[0].x, pos[0].y),
                      f.rules(pos[1].x, pos[1].y))
                     for pos in positions]
            rules = set()
            for pair_of_rule in pairs_of_rules:
                for (first_rule, second_rule) in _all_combinations(pair_of_rule):
                    h = hash((first_rule.fromSymbol, second_rule.fromSymbol))
                    if h in rulemap:
                        for r in rulemap[h]: # list of rules
                            rules.add(PlaceItem(r, first_rule, second_rule))
            f.put(x, y, list(rules))
    # Check if is start symol on the bottom of field
    if grammar.start not in [r.fromSymbol for r in f.rules(0, input_length - 1)]:
        raise NotParsedException()
    # Find init symbol and rule
    start = grammar.start()  # type: Nonterminal
    start_rule = [r for r in f.rules(0, input_length - 1) if grammar.start == r.fromSymbol][0]
    # Prepare buffer for proccess
    to_process = list()
    to_process.append({'n': start, 'r': start_rule})
    # Prepare tree
    while len(to_process) > 0:
        working = to_process.pop()
        rule_class = working['r']
        working_nonterm = working['n']  # type: Nonterminal
        # its middle rule - not rewritable to nonterminal
        if isinstance(rule_class, PlaceItem):
            created_rule = rule_class.rule()  # type: Rule
            working_nonterm._set_to_rule(created_rule)
            created_rule._from_symbols.append(working_nonterm)
            for side in rule_class.to_rule:
                symbol = side.fromSymbol()  # type: Nonterminal
                symbol._set_from_rule(created_rule)
                created_rule._to_symbols.append(symbol)
                to_process.append({'n': symbol, 'r': side})
        # it is rule rewritable to nonterminal
        else:
            created_rule = rule_class()  # type: Rule
            working_nonterm._set_to_rule(created_rule)
            created_rule._from_symbols.append(working_nonterm)
            t = Terminal(parse_sequence[index])
            index -= 1
            created_rule._to_symbols.append(t)
            t._set_from_rule(created_rule)
    return start
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