INNER CODE UNIT · Python

_is_alias_line

blockscout/blockscout · .agents/skills/openapi-spec/scripts/leaf-schemas-collect-facts.py:172

def _is_alias_line(content: str, short_name: str) -> bool:
    """Heuristic: is this line an `alias` declaration rather than real use?

    Catches both single-line aliases (`alias Foo.NullString`) and entries
    inside multi-line alias blocks (`  NullString,` or `  NullString`).
    """
    stripped = content.strip()
    if _ALIAS_LINE_RE.match(content):
        return True
    # Multi-line `alias Foo.{Bar, Baz}` entries appear as bare-name tokens,
    # optionally with a trailing comma.
    if stripped.rstrip(",") == short_name:
        return True
    return False


if __name__ == "__main__":
    sys.exit(main())

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…