class documentation

Special VM that remembers which instructions it executed.

Method __init__ Construct a TypegraphVirtualMachine.
Method run_instruction Run a single bytecode instruction.
Instance Variable instructions_executed Undocumented
Instance Variable _call_trace Undocumented
Instance Variable _classes Undocumented
Instance Variable _functions Undocumented
Instance Variable _unknowns Undocumented

Inherited from VirtualMachine:

Exception VirtualMachineRecursionError Undocumented
Method binary_operator Undocumented
Method byte_ASYNC_GEN_WRAP Undocumented
Method byte_BEFORE_ASYNC_WITH Implementation of the BEFORE_ASYNC_WITH opcode.
Method byte_BEFORE_WITH Undocumented
Method byte_BEGIN_FINALLY Undocumented
Method byte_BINARY_ADD Undocumented
Method byte_BINARY_AND Undocumented
Method byte_BINARY_FLOOR_DIVIDE Undocumented
Method byte_BINARY_LSHIFT Undocumented
Method byte_BINARY_MATRIX_MULTIPLY Undocumented
Method byte_BINARY_MODULO Undocumented
Method byte_BINARY_MULTIPLY Undocumented
Method byte_BINARY_OP Undocumented
Method byte_BINARY_OR Undocumented
Method byte_BINARY_POWER Undocumented
Method byte_BINARY_RSHIFT Undocumented
Method byte_BINARY_SUBSCR Undocumented
Method byte_BINARY_SUBTRACT Undocumented
Method byte_BINARY_TRUE_DIVIDE Undocumented
Method byte_BINARY_XOR Undocumented
Method byte_BREAK_LOOP Undocumented
Method byte_BUILD_CONST_KEY_MAP Undocumented
Method byte_BUILD_LIST Undocumented
Method byte_BUILD_LIST_UNPACK Undocumented
Method byte_BUILD_MAP Build a dictionary.
Method byte_BUILD_MAP_UNPACK Undocumented
Method byte_BUILD_MAP_UNPACK_WITH_CALL Undocumented
Method byte_BUILD_SET Undocumented
Method byte_BUILD_SET_UNPACK Undocumented
Method byte_BUILD_SLICE Undocumented
Method byte_BUILD_STRING Undocumented
Method byte_BUILD_TUPLE Undocumented
Method byte_BUILD_TUPLE_UNPACK Undocumented
Method byte_BUILD_TUPLE_UNPACK_WITH_CALL Undocumented
Method byte_CACHE Undocumented
Method byte_CALL Undocumented
Method byte_CALL_FINALLY Undocumented
Method byte_CALL_FUNCTION Undocumented
Method byte_CALL_FUNCTION_EX Call a function.
Method byte_CALL_FUNCTION_KW Undocumented
Method byte_CALL_FUNCTION_VAR Undocumented
Method byte_CALL_FUNCTION_VAR_KW Undocumented
Method byte_CALL_METHOD Undocumented
Method byte_CHECK_EG_MATCH Undocumented
Method byte_CHECK_EXC_MATCH Undocumented
Method byte_COMPARE_OP Undocumented
Method byte_CONTAINS_OP Undocumented
Method byte_CONTINUE_LOOP Undocumented
Method byte_COPY Undocumented
Method byte_COPY_DICT_WITHOUT_KEYS Undocumented
Method byte_COPY_FREE_VARS Undocumented
Method byte_DELETE_ATTR Undocumented
Method byte_DELETE_DEREF Undocumented
Method byte_DELETE_FAST Undocumented
Method byte_DELETE_GLOBAL Undocumented
Method byte_DELETE_NAME Undocumented
Method byte_DELETE_SUBSCR Undocumented
Method byte_DICT_MERGE Undocumented
Method byte_DICT_UPDATE Pops top-of-stack and uses it to update the dict at stack[op.arg].
Method byte_DUP_TOP Undocumented
Method byte_DUP_TOP_TWO Undocumented
Method byte_END_ASYNC_FOR Undocumented
Method byte_END_FINALLY Implementation of the END_FINALLY opcode.
Method byte_FOR_ITER Undocumented
Method byte_FORMAT_VALUE Undocumented
Method byte_GEN_START Undocumented
Method byte_GET_AITER Implementation of the GET_AITER opcode.
Method byte_GET_ANEXT Implementation of the GET_ANEXT opcode.
Method byte_GET_AWAITABLE Implementation of the GET_AWAITABLE opcode.
Method byte_GET_ITER Get the iterator for an object.
Method byte_GET_LEN Undocumented
Method byte_GET_YIELD_FROM_ITER Implementation of the GET_YIELD_FROM_ITER opcode.
Method byte_IMPORT_FROM IMPORT_FROM is mostly like LOAD_ATTR but doesn't pop the container.
Method byte_IMPORT_NAME Import a single module.
Method byte_IMPORT_STAR Pops a module and stores all its contents in locals().
Method byte_INPLACE_ADD Undocumented
Method byte_INPLACE_AND Undocumented
Method byte_INPLACE_FLOOR_DIVIDE Undocumented
Method byte_INPLACE_LSHIFT Undocumented
Method byte_INPLACE_MATRIX_MULTIPLY Undocumented
Method byte_INPLACE_MODULO Undocumented
Method byte_INPLACE_MULTIPLY Undocumented
Method byte_INPLACE_OR Undocumented
Method byte_INPLACE_POWER Undocumented
Method byte_INPLACE_RSHIFT Undocumented
Method byte_INPLACE_SUBTRACT Undocumented
Method byte_INPLACE_TRUE_DIVIDE Undocumented
Method byte_INPLACE_XOR Undocumented
Method byte_IS_OP Undocumented
Method byte_JUMP_ABSOLUTE Undocumented
Method byte_JUMP_BACKWARD Undocumented
Method byte_JUMP_BACKWARD_NO_INTERRUPT Undocumented
Method byte_JUMP_FORWARD Undocumented
Method byte_JUMP_IF_FALSE Undocumented
Method byte_JUMP_IF_FALSE_OR_POP Undocumented
Method byte_JUMP_IF_NOT_EXC_MATCH Undocumented
Method byte_JUMP_IF_TRUE Undocumented
Method byte_JUMP_IF_TRUE_OR_POP Undocumented
Method byte_KW_NAMES Undocumented
Method byte_LIST_APPEND Undocumented
Method byte_LIST_EXTEND Pops top-of-stack and uses it to extend the list at stack[op.arg].
Method byte_LIST_TO_TUPLE Convert the list at the top of the stack to a tuple.
Method byte_LOAD_ASSERTION_ERROR Undocumented
Method byte_LOAD_ATTR Pop an object, and retrieve a named attribute from it.
Method byte_LOAD_BUILD_CLASS Undocumented
Method byte_LOAD_CLASSDEREF Retrieves a value out of either locals or a closure cell.
Method byte_LOAD_CLOSURE Retrieves a value out of a cell.
Method byte_LOAD_CONST Undocumented
Method byte_LOAD_DEREF Retrieves a value out of a cell.
Method byte_LOAD_FAST Load a local. Unlike LOAD_NAME, it doesn't fall back to globals.
Method byte_LOAD_FOLDED_CONST Undocumented
Method byte_LOAD_GLOBAL Load a global variable, or fall back to trying to load a builtin.
Method byte_LOAD_METHOD Implementation of the LOAD_METHOD opcode.
Method byte_LOAD_NAME Load a name. Can be a local, global, or builtin.
Method byte_MAKE_CELL Undocumented
Method byte_MAKE_CLOSURE Make a function that binds local variables.
Method byte_MAKE_FUNCTION Create a function and push it onto the stack.
Method byte_MAP_ADD Implements the MAP_ADD opcode.
Method byte_MATCH_CLASS Implementation of the MATCH_CLASS opcode.
Method byte_MATCH_KEYS Implementation of the MATCH_KEYS opcode.
Method byte_MATCH_MAPPING Undocumented
Method byte_MATCH_SEQUENCE Undocumented
Method byte_NOP Undocumented
Method byte_POP_BLOCK Undocumented
Method byte_POP_EXCEPT Undocumented
Method byte_POP_FINALLY Implements POP_FINALLY.
Method byte_POP_JUMP_BACKWARD_IF_FALSE Undocumented
Method byte_POP_JUMP_BACKWARD_IF_NONE Undocumented
Method byte_POP_JUMP_BACKWARD_IF_NOT_NONE Undocumented
Method byte_POP_JUMP_BACKWARD_IF_TRUE Undocumented
Method byte_POP_JUMP_FORWARD_IF_FALSE Undocumented
Method byte_POP_JUMP_FORWARD_IF_NONE Undocumented
Method byte_POP_JUMP_FORWARD_IF_NOT_NONE Undocumented
Method byte_POP_JUMP_FORWARD_IF_TRUE Undocumented
Method byte_POP_JUMP_IF_FALSE Undocumented
Method byte_POP_JUMP_IF_TRUE Undocumented
Method byte_POP_TOP Undocumented
Method byte_PRECALL Undocumented
Method byte_PREP_RERAISE_STAR Undocumented
Method byte_PRINT_EXPR Undocumented
Method byte_PUSH_EXC_INFO Undocumented
Method byte_PUSH_NULL Undocumented
Method byte_RAISE_VARARGS Raise an exception.
Method byte_RERAISE Undocumented
Method byte_RESUME Undocumented
Method byte_RETURN_GENERATOR Undocumented
Method byte_RETURN_VALUE Get and check the return value.
Method byte_ROT_FOUR Undocumented
Method byte_ROT_N Undocumented
Method byte_ROT_THREE Undocumented
Method byte_ROT_TWO Undocumented
Method byte_SEND Undocumented
Method byte_SET_ADD Undocumented
Method byte_SET_UPDATE Undocumented
Method byte_SETUP_ANNOTATIONS Sets up variable annotations in locals().
Method byte_SETUP_ASYNC_WITH Undocumented
Method byte_SETUP_EXCEPT Undocumented
Method byte_SETUP_FINALLY Implements the SETUP_FINALLY opcode.
Method byte_SETUP_LOOP Undocumented
Method byte_SETUP_WITH Starts a 'with' statement. Will push a block.
Method byte_STORE_ANNOTATION Implementation of the STORE_ANNOTATION opcode.
Method byte_STORE_ATTR Store an attribute.
Method byte_STORE_DEREF Stores a value in a closure cell.
Method byte_STORE_FAST Undocumented
Method byte_STORE_GLOBAL Undocumented
Method byte_STORE_NAME Undocumented
Method byte_STORE_SUBSCR Implement obj[subscr] = val.
Method byte_SWAP Undocumented
Method byte_UNARY_INVERT Undocumented
Method byte_UNARY_NEGATIVE Undocumented
Method byte_UNARY_NOT Implement the UNARY_NOT bytecode.
Method byte_UNARY_POSITIVE Undocumented
Method byte_UNPACK_EX Undocumented
Method byte_UNPACK_SEQUENCE Undocumented
Method byte_WITH_CLEANUP_FINISH Called to finish cleaning up a with block.
Method byte_WITH_CLEANUP_START Called to start cleaning up a with block. Calls the exit handlers etc.
Method byte_WITH_EXCEPT_START Undocumented
Method byte_YIELD_FROM Implementation of the YIELD_FROM opcode.
Method byte_YIELD_VALUE Yield a value from a generator.
Method call_function_from_stack Pop arguments for a function and call it.
Method call_function_with_state Call a function with the given state.
Method call_init Undocumented
Method call_with_fake_args Attempt to call the given function with made-up arguments.
Method compile_src Compile the given source code.
Method del_attr Delete an attribute.
Method del_subscr Undocumented
Method expand_bool_result Common functionality for 'is' and 'is not'.
Method flatten_late_annotation Undocumented
Method generate_late_annotations Undocumented
Method get_all_named_vars Undocumented
Method get_globals_dict Get a real python dict of the globals.
Method get_var_name Get the python variable name corresponding to a Variable.
Method import_module Import a module and return the module object or None.
Method init_class Undocumented
Method inplace_operator Undocumented
Method is_at_maximum_depth Undocumented
Method is_setup_except Check whether op is equivalent to a SETUP_EXCEPT opcode.
Method load_attr Try loading an attribute, and report errors.
Method load_attr_noerror Try loading an attribute, ignore errors.
Method load_builtin Undocumented
Method load_constant Undocumented
Method load_from Load an item out of locals, globals, or builtins.
Method load_global Undocumented
Method load_local Called when a local is loaded onto the stack.
Method load_special_builtin Undocumented
Method make_frame Create a new frame object, using the given args, globals and locals.
Method pop_frame Undocumented
Method pop_kwargs Retrieve a kwargs dictionary from the stack. Used by call_function.
Method pop_varargs Retrieve a varargs tuple from the stack. Used by call_function.
Method push_abstract_exception Undocumented
Method push_frame Undocumented
Method remaining_depth Undocumented
Method resume_frame Undocumented
Method run_bytecode Run the given bytecode.
Method run_frame Run a frame (typically belonging to a method).
Method run_program Run the code and return the CFG nodes.
Method set_var_name Undocumented
Method simple_stack Get a stack of simple frames.
Method stack Get a frame stack for the given function for error reporting.
Method store_attr Set an attribute on an object.
Method store_jump Undocumented
Method store_local Called when a local is written.
Method store_subscr Undocumented
Method trace_call Fired whenever we call a builtin using unknown parameters.
Method trace_classdef Undocumented
Method trace_functiondef Undocumented
Method trace_opcode Record trace data for other tools to use.
Method trace_unknown Fired whenever we create a variable containing 'Unknown'.
Method unary_operator Undocumented
Instance Variable annotated_locals Undocumented
Instance Variable ctx Undocumented
Instance Variable filename Undocumented
Instance Variable frame Undocumented
Instance Variable frames Undocumented
Instance Variable functions_type_params_check Undocumented
Instance Variable has_unknown_wildcard_imports Undocumented
Instance Variable late_annotations Undocumented
Instance Variable loaded_overlays Undocumented
Instance Variable local_ops Undocumented
Instance Variable opcode_traces Undocumented
Property current_annotated_locals Undocumented
Property current_line Undocumented
Property current_local_ops Undocumented
Property current_opcode Undocumented
Method _apply_annotation Applies the type annotation, if any, associated with this object.
Method _attribute_error_detection Undocumented
Method _call Undocumented
Method _check_return Undocumented
Method _check_test_assert Narrow the types of variables based on test assertions.
Method _cmp_in Implementation of CMP_IN/CMP_NOT_IN.
Method _cmp_is_always_supported Checks if the comparison should always succeed.
Method _cmp_rel Implementation of relational operators CMP_(LT|LE|EQ|NE|GE|GT).
Method _coerce_to_bool Coerce the values in a variable to bools.
Method _compare_op Pops and compares the top two stack values and pushes a boolean.
Method _convert_kw_defaults Undocumented
Method _data_is_none Undocumented
Method _del_name Called when a local or global is deleted.
Method _delete_item Undocumented
Method _filter_none_and_paste_bindings Paste the bindings into var, filtering out false positives on None.
Method _get_aiter Get an async iterator from an object.
Method _get_extra_closure_args Get closure annotations and defaults from the stack.
Method _get_extra_function_args Get function annotations and defaults from the stack.
Method _get_iter Get an iterator from a sequence.
Method _get_literal_sequence Helper function for _unpack_sequence.
Method _get_type_of_attr_to_store Grabs the __annotations__ dict, if any, with the attribute type.
Method _has_strict_none_origins Whether the binding has any possible origins, with None filtering.
Method _import_module Import the module and return the module object.
Method _instantiate_exception Instantiate an exception type.
Method _is_classmethod_cls_arg True if var is the first arg of a class method in the current frame.
Method _is_private Undocumented
Method _load_annotation Undocumented
Method _maybe_load_overlay Check if a module path is in the overlay dictionary.
Method _name_error_or_late_annotation Returns a late annotation or returns Any and logs a name error.
Method _narrow Narrow a variable by removing bindings that do not satisfy pred.
Method _pop_and_store Pop a value off the stack and store it in a variable.
Method _process_annotations Process any type annotations in the named value.
Method _record_annotation Undocumented
Method _record_annotation_dict_store Record a store_subscr to an __annotations__ dict.
Method _record_local Record a type annotation on a local variable.
Method _replace_abstract_exception Replace unknowns added by push_abstract_exception with precise values.
Method _restructure_tuple Collapse the middle part of a tuple into a List variable.
Method _retrieve_attr Load an attribute from an object.
Method _revert_state_to Undocumented
Method _set_frame_return Undocumented
Method _set_type_from_assert_isinstance Undocumented
Method _setup_except Sets up an except block.
Method _store_new_var_in_local Assign a new var to a variable in locals.
Method _store_value Store 'value' under 'name'.
Method _suppress_opcode_tracing Undocumented
Method _unpack_sequence Pops a tuple (or other iterable) and pushes it onto the VM's stack.
Method _update_annotations_dict Undocumented
Method _var_is_none Undocumented
Method _with_cleanup_start Implements WITH_CLEANUP_START before Python 3.8.
Method _with_cleanup_start_3_8 Implements WITH_CLEANUP_START in Python 3.8+.
Instance Variable _analyzing Undocumented
Instance Variable _branch_tracker Undocumented
Instance Variable _director Undocumented
Instance Variable _importing Undocumented
Instance Variable _late_annotations_stack Undocumented
Instance Variable _maximum_depth Undocumented
Instance Variable _trace_opcodes Undocumented
Instance Variable _var_names Undocumented
def __init__(self, ctx): (source)

Construct a TypegraphVirtualMachine.

def run_instruction(self, op, state): (source)

Run a single bytecode instruction. Args: op: An opcode. state: The state just before running this instruction. Returns: The state right after this instruction that should roll over to the subsequent instruction. If this opcode aborts this function (e.g. through a 'raise'), then the state's "why" attribute is set to the abort reason. Raises: VirtualMachineError: if a fatal error occurs.

instructions_executed = (source)

Undocumented

_call_trace = (source)

Undocumented

_classes = (source)

Undocumented

_functions = (source)

Undocumented

_unknowns: list = (source)

Undocumented