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_​Bin​Op 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_​Name​Constant Undocumented
Method visit_​Num Undocumented
Method visit​_raw​_str Undocumented
Method visit_​Slice Undocumented
Method visit_​Str Undocumented
Method visit_​Subscript Undocumented
Method visit_​Tuple Undocumented
Method visit_​Unary​Op Undocumented
Instance Variable assume​_str​_is​_unicode 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, line=-1, override_column=-1, assume_str_is_unicode=True, is_evaluated=True): (source)

Undocumented

Parameters
errors:Optional[Errors]Undocumented
line:intUndocumented
override​_column:intUndocumented
assume​_str​_is​_unicode:boolUndocumented
is​_evaluated:boolUndocumented
def convert_column(self, column): (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.

Parameters
column:intUndocumented
Returns
intUndocumented
def fail(self, msg, line, column): (source)

Undocumented

Parameters
msg:strUndocumented
line:intUndocumented
column:intUndocumented
def invalid_type(self, node, note=None): (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.

Parameters
node:ASTUndocumented
note:Optional[str]Undocumented
Returns
RawExpressionTypeUndocumented
def note(self, msg, line, column): (source)

Undocumented

Parameters
msg:strUndocumented
line:intUndocumented
column:intUndocumented
def numeric_type(self, value, n): (source)

Undocumented

Parameters
value:objectUndocumented
n:ASTUndocumented
Returns
TypeUndocumented
def parent(self): (source)
Return the AST node above the one we are processing
Returns
Optional[AST]Undocumented
def translate_argument_list(self, l): (source)

Undocumented

Parameters
l:Sequence[ast3.expr]Undocumented
Returns
TypeListUndocumented
def translate_expr_list(self, l): (source)

Undocumented

Parameters
l:Sequence[ast3.expr]Undocumented
Returns
List[Type]Undocumented
def visit(self, node): (source)
Modified visit -- keep track of the stack of nodes
Parameters
node:Optional[AST]Undocumented
Returns
Optional[ProperType]Undocumented
def visit_Attribute(self, n): (source)

Undocumented

Parameters
n:AttributeUndocumented
Returns
TypeUndocumented
def visit_BinOp(self, n): (source)

Undocumented

Parameters
n:ast3.BinOpUndocumented
Returns
TypeUndocumented
def visit_Bytes(self, n): (source)

Undocumented

Parameters
n:BytesUndocumented
Returns
TypeUndocumented
def visit_Call(self, e): (source)

Undocumented

Parameters
e:CallUndocumented
Returns
TypeUndocumented
def visit_Constant(self, n): (source)

Undocumented

Parameters
n:ConstantUndocumented
Returns
TypeUndocumented
def visit_Ellipsis(self, n): (source)

Undocumented

Parameters
n:ast3_EllipsisUndocumented
Returns
TypeUndocumented
def visit_Index(self, n): (source)

Undocumented

Parameters
n:ast3.IndexUndocumented
Returns
TypeUndocumented
def visit_List(self, n): (source)

Undocumented

Parameters
n:ast3.ListUndocumented
Returns
TypeUndocumented
def visit_Name(self, n): (source)

Undocumented

Parameters
n:NameUndocumented
Returns
TypeUndocumented
def visit_NameConstant(self, n): (source)

Undocumented

Parameters
n:NameConstantUndocumented
Returns
TypeUndocumented
def visit_Num(self, n): (source)

Undocumented

Parameters
n:NumUndocumented
Returns
TypeUndocumented
def visit_raw_str(self, s): (source)

Undocumented

Parameters
s:strUndocumented
Returns
TypeUndocumented
def visit_Slice(self, n): (source)

Undocumented

Parameters
n:ast3.SliceUndocumented
Returns
TypeUndocumented
def visit_Str(self, n): (source)

Undocumented

Parameters
n:StrUndocumented
Returns
TypeUndocumented
def visit_Subscript(self, n): (source)

Undocumented

Parameters
n:ast3.SubscriptUndocumented
Returns
TypeUndocumented
def visit_Tuple(self, n): (source)

Undocumented

Parameters
n:ast3.TupleUndocumented
Returns
TypeUndocumented
def visit_UnaryOp(self, n): (source)

Undocumented

Parameters
n:UnaryOpUndocumented
Returns
TypeUndocumented
assume_str_is_unicode = (source)

Undocumented

errors = (source)

Undocumented

is_evaluated = (source)

Undocumented

line = (source)

Undocumented

node_stack: List[AST] = (source)

Undocumented

override_column = (source)

Undocumented

def _extract_argument_name(self, n): (source)

Undocumented

Parameters
n:ast3.exprUndocumented
Returns
Optional[str]Undocumented