class TypeMatch(pytd_utils.TypeMatcher): (source)
Class for matching types against other types.
Method | __init__ |
Construct. |
Method | default |
Undocumented |
Method | expand |
Undocumented |
Method | expand |
Undocumented |
Method | get |
Get all classes derived from this type. |
Method | get |
Get all base classes of this type. |
Method | match_ |
Match a pytd.Class against another pytd.Class. |
Method | match_ |
Undocumented |
Method | match_ |
Undocumented |
Method | match_ |
Undocumented |
Method | match_ |
Match a pytd.GenericType against another pytd.GenericType. |
Method | match_ |
Undocumented |
Method | match_ |
Match a typing.Protocol against an unknown class. |
Method | match_ |
Undocumented |
Method | match_ |
Match a pytd.Signature against another pytd.Signature. |
Method | match |
Undocumented |
Method | match_ |
Undocumented |
Method | maybe |
Undocumented |
Method | type |
This generates the type parameter when matching against a generic type. |
Method | unclass |
Prevent further subclass or superclass expansion for this type. |
Instance Variable | any |
Undocumented |
Instance Variable | direct |
Undocumented |
Instance Variable | solver |
Undocumented |
Method | _full |
Undocumented |
Method | _get |
Undocumented |
Method | _match |
Match a pytd.Type against another pytd.Type. |
Instance Variable | _implications |
Undocumented |
Inherited from TypeMatcher
:
Method | match |
Undocumented |
Construct. Args: direct_subclasses: A dictionary, mapping pytd.Type to lists of pytd.Type. any_also_is_bottom: Whether we should, (if True) consider pytd.AnythingType() to also be at the bottom of the type hierarchy, thus making it a subclass of everything, or (if False) to be only at the top.
pytd.GenericType
, t2: pytd.GenericType
, subst: _SubstType
) -> booleq.BooleanTerm
:
(source)
¶
Match a pytd.GenericType against another pytd.GenericType.
Match a pytd.Signature against another pytd.Signature. Args: sig1: The caller sig2: The callee subst: Current type parameters. skip_self: If True, doesn't compare the first parameter, which is considered (and verified) to be "self". Returns: An instance of booleq.BooleanTerm, i.e. a boolean formula.
_UnknownType
, t2: pytd.GenericType
, subst: _SubstType
) -> booleq.BooleanTerm
:
(source)
¶
Undocumented
_UnknownType
, base_class: pytd.Class
, item: pytd.TemplateItem
) -> StrictType
:
(source)
¶
This generates the type parameter when matching against a generic type. For example, when we match ~unknown1 against list[T], we need an additional type to model the T in "~unknown1[T]". This type would have the name "~unknown1.list.T". Args: unknown: An unknown type. This is the type that's matched against base_class[T]. base_class: The base class of the generic we're matching the unknown against. E.g. "list". item: The actual type parameter. ("T" in the examples above). Returns: A type (pytd.Node) to represent this type parameter.