class Converter(utils.ContextWeakrefMixin): (source)
Functions for creating the classes in abstract.py.
Exception |
|
Undocumented |
Method | __init__ |
Undocumented |
Method | build |
Undocumented |
Method | build |
Create a collection Typ[T] with T derived from the given variable. |
Method | build |
Undocumented |
Method | build |
Undocumented |
Method | build |
Create a VM list from the given sequence. |
Method | build |
Create a VM list with element type derived from the given variable. |
Method | build |
Create an empty VM dict. |
Method | build |
Undocumented |
Method | build |
Undocumented |
Method | build |
Create a VM set from the given sequence. |
Method | build |
Undocumented |
Method | build |
Undocumented |
Method | build |
Create a VM tuple from the given sequence. |
Method | constant |
Undocumented |
Method | constant |
Like constant_to_var, but convert to an abstract.BaseValue. |
Method | constant |
Convert a constant to a Variable. |
Method | convert |
Undocumented |
Method | create |
Create a new variable containing unknown. |
Method | get |
Extract the element type of a vararg or kwarg. |
Method | get |
Get an instance of the same type as the given data, abstract if possible. |
Method | make |
Make a namedtuple class from a pytd class. |
Method | make |
Make a namedtuple builder. |
Method | make |
Make a typed dict from a pytd class. |
Method | make |
Make a typed dict builder. |
Method | merge |
Merge the classes of the given instances. |
Method | merge |
Merge a collection of values into a single one. |
Method | name |
Undocumented |
Method | tuple |
Create a VM tuple from the given sequence. |
Method | value |
Undocumented |
Method | widen |
Widen a tuple to an iterable, or a dict to a mapping. |
Instance Variable | async |
Undocumented |
Instance Variable | awaitable |
Undocumented |
Instance Variable | bool |
Undocumented |
Instance Variable | bool |
Undocumented |
Instance Variable | bytes |
Undocumented |
Instance Variable | coroutine |
Undocumented |
Instance Variable | dict |
Undocumented |
Instance Variable | ellipsis |
Undocumented |
Instance Variable | empty |
Undocumented |
Instance Variable | false |
Undocumented |
Instance Variable | frozenset |
Undocumented |
Instance Variable | function |
Undocumented |
Instance Variable | generator |
Undocumented |
Instance Variable | int |
Undocumented |
Instance Variable | iterator |
Undocumented |
Instance Variable | list |
Undocumented |
Instance Variable | module |
Undocumented |
Instance Variable | no |
Undocumented |
Instance Variable | none |
Undocumented |
Instance Variable | none |
Undocumented |
Instance Variable | object |
Undocumented |
Instance Variable | primitive |
Undocumented |
Instance Variable | primitive |
Undocumented |
Instance Variable | primitive |
Undocumented |
Instance Variable | set |
Undocumented |
Instance Variable | str |
Undocumented |
Instance Variable | super |
Undocumented |
Instance Variable | true |
Undocumented |
Instance Variable | tuple |
Undocumented |
Instance Variable | type |
Undocumented |
Instance Variable | unsolvable |
Undocumented |
Method | _apply |
Undocumented |
Method | _constant |
Create a BaseValue that represents a python constant. |
Method | _copy |
Undocumented |
Method | _create |
Undocumented |
Method | _create |
Undocumented |
Method | _get |
Extract and convert the value of a pytd.Literal. |
Method | _load |
Resolve a late type, possibly by loading a module. |
Method | _load |
Undocumented |
Method | _maybe |
Undocumented |
Method | _special |
Special-case construction of some pytd values. |
Method | _type |
Convert a type to its name. |
Instance Variable | _convert |
Undocumented |
Instance Variable | _resolved |
Undocumented |
Inherited from ContextWeakrefMixin
:
Class Variable | __slots__ |
Undocumented |
Instance Variable | ctx |
Undocumented |
Property | ctx |
Undocumented |
Like constant_to_var, but convert to an abstract.BaseValue. This also memoizes the results. We don't memoize on name, as builtin types like str or list might be reinitialized under different names (e.g. "param 1"), but we want the canonical name and type. We *do* memoize on the type as well, to make sure that e.g. "1.0" and "1" get converted to different constants. Memoization is an optimization, but an important one - mapping constants like "None" to the same AbstractValue greatly simplifies the cfg structures we're building. Args: pyval: The constant to convert. subst: The current type parameters. node: The current CFG node. (For instances) Returns: The converted constant. (Instance of BaseValue)
Convert a constant to a Variable. This converts a constant to a cfg.Variable. Unlike constant_to_value, it can handle things that need to be represented as a Variable with multiple possible values (i.e., a union type), like pytd.Function. Args: pyval: The Python constant to convert. Can be a PyTD definition or a builtin constant. subst: The current type parameters. node: The current CFG node. (For instances) source_sets: An iterator over instances of SourceSet (or just tuples). discard_concrete_values: Whether concrete values should be discarded from type parameters. Returns: A cfg.Variable. Raises: TypeParameterError: if conversion is attempted on a type parameter without a substitution. ValueError: if pytype is not of a known type.
Get an instance of the same type as the given data, abstract if possible. Get an abstract instance of primitive data stored as a ConcreteValue. Return any other data as-is. This is used by constant_to_var to discard concrete values that have been kept around for InterpreterFunction. Arguments: data: The data. Returns: An instance of the same type as the data, abstract if possible.
Merge the classes of the given instances. Args: instances: An iterable of instances. Returns: An abstract.BaseValue created by merging the instances' classes.
Create a BaseValue that represents a python constant. This supports both constant from code constant pools and PyTD constants such as classes. This also supports builtin python objects such as int and float. Args: pyval: The python or PyTD value to convert. subst: The current type parameters. get_node: A getter function for the current node. Returns: A Value that represents the constant, or None if we couldn't convert. Raises: NotImplementedError: If we don't know how to convert a value. TypeParameterError: If we can't find a substitution for a type parameter.
abstract.Class
, new_container_name: str
) -> abstract.BaseValue
:
(source)
¶
Undocumented