class documentation

An empty value. These values represent items extracted from empty containers. Because of false positives in flagging containers as empty (consider: x = [] def initialize(): populate(x) def f(): iterate(x) ), we treat these values as placeholders that we can do anything with, similar to Unsolvable, with the difference that they eventually convert to NothingType so that cases in which they are truly empty are discarded (see: x = ... # type: List[nothing] or Dict[int, str] y = [i for i in x] # The type of i is int; y is List[int] ). On the other hand, if Empty is the sole type candidate, we assume that the container was populated elsewhere: x = [] def initialize(): populate(x) def f(): return x[0] # Oops! The return type should be Any rather than nothing. The nothing -> anything conversion happens in convert.Converter._function_to_def and tracer_vm.CallTracer.pytd_for_types.

Method __init__ Basic initializer for all BaseValues.

Inherited from Singleton:

Method __new__ Undocumented
Method call Call this abstract value with the given arguments.
Method compute_mro Undocumented
Method get_special_attribute Fetch a special attribute (e.g., __get__, __iter__).
Method instantiate Create an instance of self.
Class Variable _instance Undocumented

Inherited from BaseValue (via Singleton):

Method __repr__ Undocumented
Method argcount Returns the minimum number of arguments needed for a call.
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_fullhash Undocumented
Method get_instance_type Get the type an instance of us would have.
Method get_instance_type_parameter Get a cfg.Variable of the instance's values for the type parameter.
Method get_own_new Get this value's __new__ method, if it isn't object.__new__.
Method get_type_key Build a key from the information used to perform type matching.
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 cls 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
Method _unique_parameters Get unique parameter subtypes as variables.
Instance Variable _all_template_names Undocumented
Instance Variable _module Undocumented
Instance Variable _official_name Undocumented
Instance Variable _template Undocumented

Inherited from ContextWeakrefMixin (via Singleton, BaseValue):

Class Variable __slots__ Undocumented
Instance Variable ctx_weakref Undocumented
Property ctx Undocumented
def __init__(self, ctx): (source)

Basic initializer for all BaseValues.