class documentation

class TypeSolver: (source)

View In Hierarchy

Class for solving ~unknowns in type inference results.

Method __init__ Undocumented
Method match_call_record Match the record of a method call against the formal signature.
Method match_partial_against_complete Match a partial class (call record) against a complete class.
Method match_unknown_against_protocol Given an ~unknown, match it against a class.
Method solve Solve the equations generated from the pytd.
Instance Variable ast Undocumented
Instance Variable builtins Undocumented
Instance Variable protocols Undocumented
def __init__(self, ast, builtins, protocols): (source)

Undocumented

def match_call_record(self, matcher, solver, call_record, complete): (source)

Match the record of a method call against the formal signature.

def match_partial_against_complete(self, matcher, solver, partial, complete): (source)

Match a partial class (call record) against a complete class. Args: matcher: An instance of pytd.type_match.TypeMatch. solver: An instance of pytd.booleq.Solver. partial: The partial class to match. The class name needs to be prefixed with "~" - the rest of the name is typically the same as complete.name. complete: A complete class to match against. (E.g. a built-in or a user defined class) Returns: An instance of pytd.booleq.BooleanTerm. Raises: FlawedQuery: If this call record is incompatible with the builtin.

def match_unknown_against_protocol(self, matcher, solver, unknown, complete): (source)

Given an ~unknown, match it against a class. Args: matcher: An instance of pytd.type_match.TypeMatch. solver: An instance of pytd.booleq.Solver. unknown: The unknown class to match complete: A complete class to match against. (E.g. a built-in or a user defined class) Returns: An instance of pytd.booleq.BooleanTerm.

def solve(self): (source)

Solve the equations generated from the pytd. Returns: A dictionary (str->str), mapping unknown class names to known class names. Raises: AssertionError: If we detect an internal error.

Undocumented

builtins = (source)

Undocumented

protocols = (source)

Undocumented