class documentation

A basic abstract value that represents instances. This class implements instances in the Python sense. Instances of the same class may vary. Note that the cls attribute will point to another abstract value that represents the class object itself, not to some special type representation. Attributes: members: A name->value dictionary of the instance's attributes.

Method __init__ Initialize a SimpleValue.
Method __repr__ Undocumented
Method argcount Returns the minimum number of arguments needed for a call.
Method call Call this abstract value with the given arguments.
Method cls.setter Undocumented
Method get_fullhash Undocumented
Method get_instance_type_parameter Get a cfg.Variable of the instance's values for the type parameter.
Method get_type_key Build a key from the information used to perform type matching.
Method has_instance_type_parameter Check if the key is in `instance_type_parameters`.
Method instantiate Create an instance of self.
Method maybe_missing_members.setter Undocumented
Method merge_instance_type_parameter Set the value of a type parameter.
Method set_class Set the __class__ of an instance, for code that does "x.__class__ = y.
Method update_caches Undocumented
Instance Variable members Undocumented
Property cls Undocumented
Property instance_type_parameters Undocumented
Property maybe_missing_members Undocumented
Method _call_helper Undocumented
Method _get_changestamps Undocumented
Method _get_class Undocumented
Method _unique_parameters Get unique parameter subtypes as variables.
Instance Variable _cached_changestamps Undocumented
Instance Variable _cls Undocumented
Instance Variable _fullhash Undocumented
Instance Variable _instance_type_parameters Undocumented
Instance Variable _maybe_missing_members Undocumented
Instance Variable _type_key Undocumented

Inherited from BaseValue:

Method compute_mro Undocumented
Method default_mro Undocumented
Method get_default_fullhash Undocumented
Method get_default_type_key Gets a default type key. See get_type_key.
Method get_formal_type_parameter Get the class's type for the type parameter.
Method get_instance_type Get the type an instance of us would have.
Method get_own_new Get this value's __new__ method, if it isn't object.__new__.
Method get_special_attribute Fetch a special attribute (e.g., __get__, __iter__).
Method has_kwargs Return True if this is a function and has a **kwargs parameter.
Method has_varargs Return True if this is a function and has a *args parameter.
Method init_subclass Allow metaprogramming via __init_subclass__.
Method is_late_annotation Undocumented
Method module.setter Undocumented
Method official_name.setter Undocumented
Method property_get Bind this value to the given self or cls.
Method register_instance Treating self as a class definition, register an instance of it.
Method should_replace_self_annot Undocumented
Method to_annotation_container Undocumented
Method to_binding Undocumented
Method to_pytd_def Get a PyTD definition for this object.
Method to_type Get a PyTD type representing this object, as seen at a node.
Method to_variable Build a variable out of this abstract value.
Method unique_parameter_values Get unique parameter subtypes as bindings.
Method update_official_name Update the official name.
Class Variable formal Undocumented
Instance Variable final Undocumented
Instance Variable from_annotation Undocumented
Instance Variable is_concrete Undocumented
Instance Variable is_decorated Undocumented
Instance Variable mro Undocumented
Instance Variable name Undocumented
Instance Variable slots Undocumented
Property all_template_names Undocumented
Property full_name Undocumented
Property module Undocumented
Property official_name Undocumented
Property template Undocumented
Instance Variable _all_template_names Undocumented
Instance Variable _instance Undocumented
Instance Variable _module Undocumented
Instance Variable _official_name Undocumented
Instance Variable _template Undocumented

Inherited from ContextWeakrefMixin (via BaseValue):

Class Variable __slots__ Undocumented
Instance Variable ctx_weakref Undocumented
Property ctx Undocumented
def call(self, node, func, args, alias_map=None): (source)

Call this abstract value with the given arguments. The posargs and namedargs arguments may be modified by this function. Args: node: The CFGNode calling this function func: The cfg.Binding containing this function. args: Arguments for the call. alias_map: A datatypes.UnionFind, which stores all the type renaming information, mapping of type parameter name to its representative. Returns: A tuple (cfg.Node, cfg.Variable). The CFGNode corresponds to the function's "return" statement(s). Raises: function.FailedFunctionCall Make the call as required by this specific kind of atomic value, and make sure to annotate the results correctly with the origins (val and also other values appearing in the arguments).

@cls.setter
def cls(self, cls): (source)

Undocumented

def get_instance_type_parameter(self, name, node=None): (source)

Get a cfg.Variable of the instance's values for the type parameter. Treating self as an abstract.Instance, gets the variable of its values for the given type parameter. For the real implementation, see SimpleValue.get_instance_type_parameter. Args: name: The name of the type parameter. node: Optionally, the current CFG node. Returns: A Variable which may be empty.

def get_type_key(self, seen=None): (source)

Build a key from the information used to perform type matching. Get a hashable object containing this value's type information. Type keys are only compared amongst themselves, so we don't care what the internals look like, only that values with different types *always* have different type keys and values with the same type preferably have the same type key. Args: seen: The set of values seen before while computing the type key. Returns: A hashable object built from this value's type information.

def has_instance_type_parameter(self, name): (source)

Check if the key is in `instance_type_parameters`.

def instantiate(self, node, container=None): (source)

Create an instance of self. Note that this method does not call __init__, so the instance may be incomplete. If you need a complete instance, use self.ctx.vm.init_class instead. Args: node: The current node. container: Optionally, the value that contains self. (See TypeParameter.) Returns: The instance.

@maybe_missing_members.setter
def maybe_missing_members(self, v): (source)

Undocumented

def merge_instance_type_parameter(self, node, name, value): (source)

Set the value of a type parameter. This will always add to the type parameter unlike set_attribute which will replace value from the same basic block. This is because type parameters may be affected by a side effect so we need to collect all the information regardless of multiple assignments in one basic block. Args: node: Optionally, the current CFG node. name: The name of the type parameter. value: The value that is being used for this type parameter as a Variable.

def set_class(self, node, var): (source)

Set the __class__ of an instance, for code that does "x.__class__ = y.

def update_caches(self, force=False): (source)

Undocumented

@property
instance_type_parameters = (source)

Undocumented

@property
maybe_missing_members = (source)

Undocumented

def _call_helper(self, node, obj, binding, args): (source)

Undocumented

def _get_changestamps(self): (source)

Undocumented

def _unique_parameters(self): (source)

Get unique parameter subtypes as variables. This will retrieve 'children' of this value that contribute to the type of it. So it will retrieve type parameters, but not attributes. To keep the number of possible combinations reasonable, when we encounter multiple instances of the same type, we include only one. Returns: A list of variables.

_cached_changestamps = (source)

Undocumented

Undocumented

_fullhash = (source)

Undocumented

_instance_type_parameters = (source)

Undocumented

_maybe_missing_members = (source)

Undocumented

_type_key = (source)

Undocumented