class Function(_instance_base.SimpleValue): (source)
Known subclasses: pytype.abstract._function_base.NativeFunction
, pytype.abstract._function_base.SignedFunction
, pytype.abstract._pytd_function.PyTDFunction
, pytype.overlays.special_builtins.ClassMethodInstance
, pytype.overlays.special_builtins.PropertyInstance
, pytype.overlays.special_builtins.StaticMethodInstance
Base class for function objects (NativeFunction, InterpreterFunction). Attributes: name: Function name. Might just be something like "<lambda>". ctx: context.Context instance.
Method | __init__ |
Initialize a SimpleValue. |
Method | __repr__ |
Undocumented |
Method | match |
Check whether the given arguments can match the function signature. |
Method | property |
Bind this value to the given self or cls. |
Method | set |
Undocumented |
Class Variable | bound |
Undocumented |
Instance Variable | cls |
Undocumented |
Instance Variable | is |
Undocumented |
Instance Variable | is |
Undocumented |
Instance Variable | is |
Undocumented |
Instance Variable | is |
Undocumented |
Method | _extract |
Extracts defaults from a Variable, used by set_function_defaults. |
Method | _get |
Get the python variable name of a pytype Variable. |
Method | _match |
Undocumented |
Inherited from SimpleValue
:
Method | argcount |
Returns the minimum number of arguments needed for a call. |
Method | call |
Call this abstract value with the given arguments. |
Method | cls |
Undocumented |
Method | get |
Undocumented |
Method | get |
Get a cfg.Variable of the instance's values for the type parameter. |
Method | get |
Build a key from the information used to perform type matching. |
Method | has |
Check if the key is in `instance_type_parameters`. |
Method | instantiate |
Create an instance of self. |
Method | maybe |
Undocumented |
Method | merge |
Set the value of a type parameter. |
Method | set |
Set the __class__ of an instance, for code that does "x.__class__ = y. |
Method | update |
Undocumented |
Instance Variable | members |
Undocumented |
Property | instance |
Undocumented |
Property | maybe |
Undocumented |
Method | _call |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _unique |
Get unique parameter subtypes as variables. |
Instance Variable | _cached |
Undocumented |
Instance Variable | _cls |
Undocumented |
Instance Variable | _fullhash |
Undocumented |
Instance Variable | _instance |
Undocumented |
Instance Variable | _maybe |
Undocumented |
Instance Variable | _type |
Undocumented |
Inherited from BaseValue
(via SimpleValue
):
Method | compute |
Undocumented |
Method | default |
Undocumented |
Method | get |
Undocumented |
Method | get |
Gets a default type key. See get_type_key. |
Method | get |
Get the class's type for the type parameter. |
Method | get |
Get the type an instance of us would have. |
Method | get |
Get this value's __new__ method, if it isn't object.__new__. |
Method | get |
Fetch a special attribute (e.g., __get__, __iter__). |
Method | has |
Return True if this is a function and has a **kwargs parameter. |
Method | has |
Return True if this is a function and has a *args parameter. |
Method | init |
Allow metaprogramming via __init_subclass__. |
Method | is |
Undocumented |
Method | module |
Undocumented |
Method | official |
Undocumented |
Method | register |
Treating self as a class definition, register an instance of it. |
Method | should |
Undocumented |
Method | to |
Undocumented |
Method | to |
Undocumented |
Method | to |
Get a PyTD definition for this object. |
Method | to |
Get a PyTD type representing this object, as seen at a node. |
Method | to |
Build a variable out of this abstract value. |
Method | unique |
Get unique parameter subtypes as bindings. |
Method | update |
Update the official name. |
Class Variable | formal |
Undocumented |
Instance Variable | final |
Undocumented |
Instance Variable | from |
Undocumented |
Instance Variable | is |
Undocumented |
Instance Variable | is |
Undocumented |
Instance Variable | mro |
Undocumented |
Instance Variable | name |
Undocumented |
Instance Variable | slots |
Undocumented |
Property | all |
Undocumented |
Property | full |
Undocumented |
Property | module |
Undocumented |
Property | official |
Undocumented |
Property | template |
Undocumented |
Instance Variable | _all |
Undocumented |
Instance Variable | _instance |
Undocumented |
Instance Variable | _module |
Undocumented |
Instance Variable | _official |
Undocumented |
Instance Variable | _template |
Undocumented |
Inherited from ContextWeakrefMixin
(via SimpleValue
, BaseValue
):
Class Variable | __slots__ |
Undocumented |
Instance Variable | ctx |
Undocumented |
Property | ctx |
Undocumented |
pytype.abstract._function_base.NativeFunction
, pytype.abstract._function_base.SignedFunction
, pytype.abstract._pytd_function.PyTDFunction
, pytype.overlays.special_builtins.ClassMethodInstance
, pytype.overlays.special_builtins.PropertyInstance
, pytype.overlays.special_builtins.StaticMethodInstance
Initialize a SimpleValue. Args: name: Name of this value. For debugging and error reporting. ctx: The abstract context.
pytype.abstract._function_base.NativeFunction
, pytype.abstract._interpreter_function.InterpreterFunction
, pytype.abstract._pytd_function.PyTDFunction
Bind this value to the given self or cls. This function is similar to __get__ except at the abstract level. This does not trigger any code execution inside the VM. See __get__ for more details. Args: callself: The Variable that should be passed as self or cls when the call is made. We only need one of self or cls, so having them share a parameter prevents accidentally passing in both. is_class: Whether callself is self or cls. Should be cls only when we want to directly pass in a class to bind a class method to, rather than passing in an instance and calling get_class(). Returns: Another abstract value that should be returned in place of this one. The default implementation returns self, so this can always be called safely.
pytype.abstract._function_base.SignedFunction
, pytype.abstract._pytd_function.PyTDFunction
Undocumented
pytype.abstract._function_base.NativeFunction
, pytype.abstract._function_base.SimpleFunction
, pytype.abstract._interpreter_function.InterpreterFunction
, pytype.abstract._pytd_function.PyTDFunction
, pytype.overlays.special_builtins.ClassMethodInstance
, pytype.overlays.special_builtins.PropertyInstance
, pytype.overlays.special_builtins.StaticMethodInstance
Undocumented
Extracts defaults from a Variable, used by set_function_defaults. Args: defaults_var: Variable containing potential default values. Returns: A tuple of default values, if one could be extracted, or None otherwise.
pytype.abstract._function_base.SignedFunction
, pytype.abstract._pytd_function.PyTDFunction
Undocumented