class documentation

class _TypeInference(_EvalBaseVisitor['Type|None']): (source)

Constructor: _TypeInference(state)

View In Hierarchy

Find the L{Type} of an expression.

Method builtin Undocumented
Method get_type Undocumented
Method visit_arg Undocumented
Method visit_Attribute_Load Undocumented
Method visit_BinOp Undocumented
Method visit_BoolOp Undocumented
Method visit_Call Undocumented
Method visit_ClassDef Undocumented
Method visit_Compare Undocumented
Method visit_Constant Undocumented
Method visit_Dict Undocumented
Method visit_DictComp Undocumented
Method visit_FunctionDef Undocumented
Method visit_GeneratorExp Undocumented
Method visit_JoinedStr Undocumented
Method visit_List Undocumented
Method visit_ListComp Undocumented
Method visit_Module Undocumented
Method visit_Name_Load Undocumented
Method visit_Name_Store Undocumented
Method visit_SetComp Undocumented
Method visit_Subscript Undocumented
Method visit_Tuple Undocumented
Method visit_UnaryOp Undocumented
Method _flatten_typedefs Get the definition of each resolvable top-level types in this type instance. Unwrap unions and overloads.
Method _get_type_attribute Get the type of an attribute access attr on the given valuetype.
Method _replace_typevars Replace raw typevars with TypeVariable types.
Instance Variable _state Undocumented

Inherited from _EvalBaseVisitor:

Method __init__ Undocumented
Method visit Undocumented
Method _visit Visit a node.
Method _visit_ctx_dependent Undocumented
Constant _MAX_JUMPS Undocumented
def builtin(self, name) -> Type: (source)

Undocumented

def get_type(self, expr: ast.AST, path: set[object]) -> Type | None: (source)

Undocumented

def visit_arg(self, node: ast.arg, path: set[object], typevars: dict[str, Type] | None = None) -> Type | None: (source)

Undocumented

def visit_Attribute_Load(self, node: ast.Attribute, path: set[object]) -> Type | None: (source)

Undocumented

def visit_BinOp(self, node: ast.BinOp, path: set[object]) -> Type | None: (source)

Undocumented

def visit_BoolOp(self, node: ast.BoolOp, path: set[object]) -> Type | None: (source)

Undocumented

def visit_Call(self, node: ast.Call, path: set[object]) -> Type | None: (source)

Undocumented

def visit_ClassDef(self, node: ast.ClassDef, path: set[object]) -> Type: (source)

Undocumented

def visit_Compare(self, node: ast.Compare, path: set[object]) -> Type | None: (source)

Undocumented

def visit_Constant(self, node: ast.Constant | ast.Str | ast.NameConstant | ast.Bytes | ast.Num, path: set[object]) -> Type: (source)

Undocumented

def visit_Dict(self, node: ast.Dict, path: set[object]) -> Type: (source)

Undocumented

def visit_DictComp(self, node: ast.DictComp, path: set[object]) -> Type | None: (source)

Undocumented

def visit_FunctionDef(self, node: ast.FunctionDef | ast.AsyncFunctionDef, path: set[object], overloads: deque[Type] | None = None, typevars: dict[str, Type] | None = None) -> Type: (source)

Undocumented

def visit_GeneratorExp(self, node: ast.GeneratorExp, path: set[object]) -> Type | None: (source)

Undocumented

def visit_JoinedStr(self, node: ast.JoinedStr, path: set[object]) -> Type: (source)

Undocumented

def visit_List(self, node: ast.List | ast.Set, path: set[object]) -> Type: (source)

Undocumented

def visit_ListComp(self, node: ast.ListComp, path: set[object]) -> Type | None: (source)

Undocumented

def visit_Module(self, node: ast.Module, path: set[object]) -> Type: (source)

Undocumented

def visit_Name_Load(self, node: ast.Name | ast.alias, path: set[object]) -> Type | None: (source)

Undocumented

def visit_Name_Store(self, node: ast.Name | ast.Attribute, path: set[object]) -> Type | None: (source)

Undocumented

def visit_SetComp(self, node: ast.SetComp, path: set[object]) -> Type | None: (source)

Undocumented

def visit_Subscript(self, node: ast.Subscript, path: set[object]) -> Type | None: (source)

Undocumented

def visit_Tuple(self, node: ast.Tuple, path: set[object]) -> Type: (source)

Undocumented

def visit_UnaryOp(self, node: ast.UnaryOp, path: set[object]) -> Type | None: (source)

Undocumented

def _flatten_typedefs(self, valuetype: Type, seen: set[Type]) -> Iterator[tuple[Type, Def | None]]: (source)

Get the definition of each resolvable top-level types in this type instance. Unwrap unions and overloads.

def _get_type_attribute(self, valuetype: Type, attr: str, ctx: ast.AST, path: set[object]) -> Type: (source)

Get the type of an attribute access attr on the given valuetype.

def _replace_typevars(self, type: Type, typevars: dict[str, Type]) -> Type: (source)

Replace raw typevars with TypeVariable types.