class PyTDSignature(utils.ContextWeakrefMixin): (source)
A PyTD function type (signature). This represents instances of functions with specific arguments and return type.
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | call |
Call this signature. Used by PyTDFunction. |
Method | get |
Undocumented |
Method | set |
Set signature's default arguments. Requires rebuilding PyTD signature. |
Method | substitute |
Substitute matching args into this signature. Used by PyTDFunction. |
Instance Variable | mutated |
Undocumented |
Instance Variable | name |
Undocumented |
Instance Variable | param |
Undocumented |
Instance Variable | pytd |
Undocumented |
Instance Variable | signature |
Undocumented |
Class Method | _collect |
Undocumented |
Method | _fill |
Undocumented |
Method | _get |
Mutation for changing the type parameters of mutable arguments. |
Method | _handle |
Construct a new function based on ParamSpec matching. |
Method | _map |
Map the passed arguments to a name->binding dictionary. |
Method | _paramspec |
Undocumented |
Inherited from ContextWeakrefMixin
:
Class Variable | __slots__ |
Undocumented |
Instance Variable | ctx |
Undocumented |
Property | ctx |
Undocumented |
Set signature's default arguments. Requires rebuilding PyTD signature. Args: defaults: An iterable of function argument defaults. Returns: Self with an updated signature.
Mutation for changing the type parameters of mutable arguments. This will adjust the type parameters as needed for pytd functions like: def append_float(x: list[int]): x = list[int or float] This is called after all the signature matching has succeeded, and we know we're actually calling this function. Args: node: The current CFG node. arg_dict: A map of strings to cfg.Variable instances. subst: Current type parameters. retvar: A variable of the return value. Returns: A list of Mutation instances. Raises: ValueError: If the pytd contains invalid information for mutated params.
Map the passed arguments to a name->binding dictionary. Args: node: The current node. args: The passed arguments. Returns: A tuple of: a list of formal arguments, each a (name, abstract value) pair; a name->variable dictionary of the passed arguments. Raises: InvalidParameters: If the passed arguments don't match this signature.