14 lines
734 B
Python
14 lines
734 B
Python
from typing import TypeAlias
|
|
|
|
from .vendor.antlr4.ParserRuleContext import ParserRuleContext
|
|
|
|
# The antlr4 class `ParserRulerContext` is not a valid type for static type checkers
|
|
# for a number of reasons, including lack of strict typing in antlr4-python3-runtime
|
|
# and dynamically generated attributes that can only be checked at runtime.
|
|
# To be able to use the class for type hinting without raising `valid-type` errors,
|
|
# we define a type alias that we can use throughout the code.
|
|
# Note that type aliases cannot shadow the name of the class they are aliasing,
|
|
# so we need to name the aliased class something different from `ParserRuleContext`
|
|
|
|
Antlr4ParserRuleContext: TypeAlias = ParserRuleContext # type: ignore[valid-type]
|