class documentation

class TypeConverter: (source)

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method convert_column Apply column override if defined; otherwise return column.
Method fail Undocumented
Method invalid_type Constructs a type representing some expression that normally forms an invalid type. For example, if we see a type hint that says "3 + 4", we would transform that expression into a RawExpressionType.
Method note Undocumented
Method numeric_type Undocumented
Method parent Return the AST node above the one we are processing
Method translate_argument_list Undocumented
Method translate_expr_list Undocumented
Method visit Modified visit -- keep track of the stack of nodes
Method visit_Attribute Undocumented
Method visit_BinOp Undocumented
Method visit_Bytes Undocumented
Method visit_Call Undocumented
Method visit_Constant Undocumented
Method visit_Ellipsis Undocumented
Method visit_Index Undocumented
Method visit_List Undocumented
Method visit_Name Undocumented
Method visit_NameConstant Undocumented
Method visit_Num Undocumented
Method visit_Slice Undocumented
Method visit_Str Undocumented
Method visit_Subscript Undocumented
Method visit_Tuple Undocumented
Method visit_UnaryOp Undocumented
Instance Variable errors Undocumented
Instance Variable is_evaluated Undocumented
Instance Variable line Undocumented
Instance Variable node_stack Undocumented
Instance Variable override_column Undocumented
Method _extract_argument_name Undocumented
def __init__(self, errors: Errors|None, line: int = -1, override_column: int = -1, is_evaluated: bool = True): (source)

Undocumented

def convert_column(self, column: int) -> int: (source)

Apply column override if defined; otherwise return column. Column numbers are sometimes incorrect in the AST and the column override can be used to work around that.

def fail(self, msg: str, line: int, column: int): (source)

Undocumented

def invalid_type(self, node: AST, note: str|None = None) -> RawExpressionType: (source)

Constructs a type representing some expression that normally forms an invalid type. For example, if we see a type hint that says "3 + 4", we would transform that expression into a RawExpressionType. The semantic analysis layer will report an "Invalid type" error when it encounters this type, along with the given note if one is provided. See RawExpressionType's docstring for more details on how it's used.

def note(self, msg: str, line: int, column: int): (source)

Undocumented

def numeric_type(self, value: object, n: AST) -> Type: (source)

Undocumented

def parent(self) -> AST|None: (source)

Return the AST node above the one we are processing

def translate_argument_list(self, l: Sequence[ast3.expr]) -> TypeList: (source)

Undocumented

def translate_expr_list(self, l: Sequence[ast3.expr]) -> list[Type]: (source)

Undocumented

@overload
def visit(self, node: ast3.expr) -> ProperType:
@overload
def visit(self, node: AST|None) -> ProperType|None:
(source)

Modified visit -- keep track of the stack of nodes

def visit_Attribute(self, n: Attribute) -> Type: (source)

Undocumented

def visit_BinOp(self, n: ast3.BinOp) -> Type: (source)

Undocumented

def visit_Bytes(self, n: Bytes) -> Type: (source)

Undocumented

def visit_Call(self, e: Call) -> Type: (source)

Undocumented

def visit_Constant(self, n: Constant) -> Type: (source)

Undocumented

def visit_Ellipsis(self, n: ast3_Ellipsis) -> Type: (source)

Undocumented

def visit_Index(self, n: ast3.Index) -> Type: (source)

Undocumented

def visit_List(self, n: ast3.List) -> Type: (source)

Undocumented

def visit_Name(self, n: Name) -> Type: (source)

Undocumented

def visit_NameConstant(self, n: NameConstant) -> Type: (source)

Undocumented

def visit_Num(self, n: Num) -> Type: (source)

Undocumented

def visit_Slice(self, n: ast3.Slice) -> Type: (source)

Undocumented

def visit_Str(self, n: Str) -> Type: (source)

Undocumented

def visit_Subscript(self, n: ast3.Subscript) -> Type: (source)

Undocumented

def visit_Tuple(self, n: ast3.Tuple) -> Type: (source)

Undocumented

def visit_UnaryOp(self, n: UnaryOp) -> Type: (source)

Undocumented

Undocumented

is_evaluated = (source)

Undocumented

Undocumented

node_stack: list[AST] = (source)

Undocumented

override_column = (source)

Undocumented

def _extract_argument_name(self, n: ast3.expr) -> str|None: (source)

Undocumented