module documentation

Match pytd types against each other. "Matching" x against y means roughly: If we have a function f(param: y) and a type x, would we be able to pass (an instance of) x to f. (I.e., "execute f(x)"). So for example, str would "match" against basestring, and list[int] would match against list[Number]. This is used for converting structural types to nominal types during type inference, but could also be used when merging pytd files, to match existing signatures against new inference results.

Class StrictType A type that doesn't allow sub- or superclasses to match.
Class TypeMatch Class for matching types against other types.
Function get_all_subclasses Compute a class->subclasses mapping.
Function is_unknown Return True if this is an ~unknown.
Variable log Undocumented
Type Alias _SubstType Undocumented
Type Alias _UnknownType Undocumented
def get_all_subclasses(asts): (source)

Compute a class->subclasses mapping. Args: asts: A list of ASTs. Returns: A dictionary, mapping instances of pytd.Type (types) to lists of pytd.Class (the derived classes).

def is_unknown(t): (source)

Return True if this is an ~unknown.

Undocumented

_UnknownType = (source)

Undocumented

Value
Union[pytd.ClassType, pytd.NamedType, pytd.Class, 'StrictType']