code: def get_terminal_names(terminals, rules, ignore_names):
      """Get names of all terminals in the grammar.
  
      The arguments are the results of calling ``Lark.grammar.compile()``,
      so you would think that the ``terminals`` and ``ignore_names`` would
      have it all... but they omit terminals created with ``@declare``,
      which appear only in the expansion(s) of nonterminals.
      """
      names = {t.name for t in terminals} | set(ignore_names)
      for rule in rules:
          names |= {
              t.name for t in rule.expansion if isinstance(t, Terminal)
          }
      return names
  
file_path: catboost/contrib/python/hypothesis/py3/hypothesis/extra/lark.py
imports: from inspect import signature
  from typing import Dict, Optional
  import lark
  from lark.grammar import NonTerminal, Terminal
  from hypothesis import strategies
  from hypothesis.errors import InvalidArgument
  from hypothesis.internal.conjecture.utils import calc_label_from_name
  from hypothesis.internal.validation import check_type
  from hypothesis.strategies._internal.utils import cacheable, defines_strategy
label_desc: Use image node_id 1 for calling a global function with example usage: get_terminal_names(terminals, rules, ignore_names) and returns: names