Module Expr Str ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str Assign NameStore TupleLoad Str FunctionDef arguments args NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Dict Str Str NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If CompareNotIn NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad BinOpMod Str NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareNotIn NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad BinOpMod Str NameLoad Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Call NameLoad NameLoad Return CompareIsNot AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body If SubscriptLoad AttributeLoad NameLoad attr Index Str body Expr Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Str If SubscriptLoad AttributeLoad NameLoad attr Index Str body Expr Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Str If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If AttributeLoad NameLoad attr body Raise Call NameLoad Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If AttributeLoad NameLoad attr body Raise Call NameLoad Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str decorator_list decorator_list For NameStore AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Continue Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list
N/A N/A 
  equip.instrument
  ~~~~~~~~~~~~~~~~

  Main interface to handle the instrumentation and run the visitors.

  :copyright: (c) 2014 by Romain Gaucher (@rgaucher)
  :license: Apache 2, see LICENSE for more details.
 prog Program bytecode BytecodeObject visitors MethodVisitor utils.log logger Instrumentation N/A object N/A N/A 
    Main class for handling the instrumentation. The typical workflow is:
      1. Set the location from the ctor or using the `location` setter
      2. Update options, such as `force-rebuild`
      3. Call `prepare_program` to scan the file system for source/bytecode
      4. Register any `on_enter`/`on_exit` instrumentation callbacks
      5. `apply` the instrumentation using a customer visitor
   N/A KNOWN_OPTIONS N/A force-rebuild __init__ N/A N/A self location N/A None N/A N/A N/A self options N/A N/A N/A self _location location N/A N/A self program None N/A N/A self apply_ran False N/A N/A self wrapping_code N/A on_enter on_exit None None N/A set_option N/A N/A self key value N/A True N/A N/A 
      Sets one of the options used later one by the instrumentation. The available
      options are listed in `KNOWN_OPTIONS`.

      :param key: The name of the option to set.
      :param value: The value of the option. Defaults to ``True``.
     N/A N/A key N/A Instrumentation KNOWN_OPTIONS N/A N/A N/A Exception N/A Unknown option `%s` key N/A N/A N/A self options N/A key value N/A get_option N/A N/A self key N/A N/A N/A 
      Gets the value of an option. Defaults to ``None``.

      :param key: The name of the option.
     N/A N/A key N/A Instrumentation KNOWN_OPTIONS N/A N/A N/A Exception N/A Unknown option `%s` key N/A N/A N/A N/A self options get key None N/A location N/A N/A self N/A N/A N/A 
        The path that contains the bytecode of the application to instrument. The path
        can either be a string or an iterable.
       N/A N/A self _location N/A property location N/A N/A self value N/A N/A N/A N/A self _location value N/A N/A location setter prepare_program N/A N/A self N/A N/A N/A 
      Builds the representation of the program, and compiles all source files
      if it's either necessary (e.g., missing bytecode for existing source) or
      if the ``force-rebuild`` option is set.
     N/A N/A self program N/A Program self N/A N/A N/A self program None N/A apply N/A N/A self visitor rewrite N/A False N/A N/A 
      Runs the visitor over all matching types (e.g., MethodDeclaration, etc.).

      :param visitor: The instance of the visitor to run over the program.
      :param rewrite: Whether the instrumentation should overwrite the bytecode
                      file (pyc) at the end. Default is `False`.
     N/A N/A self apply_ran True N/A bytecode_files N/A N/A self program bytecode_files N/A bc_file bytecode_files N/A N/A N/A N/A self instrument visitor bc_file rewrite N/A instrument N/A N/A self visitor bytecode_file rewrite N/A False N/A N/A 
      Loads the representation of the bytecode in `bytecode_file`, and apply
      the visitor to the representation.

      :param visitor: The instance of the visitor to run over the representation
                      of the bytecode.
      :param bytecode_file: Absolute path of the file containing the bytecode (pyc).
      :param rewrite: Whether the instrumentation should overwrite the bytecode
                      file (pyc) at the end. Default is `False`.
     N/A N/A N/A logger debug File: %s bytecode_file N/A code N/A BytecodeObject bytecode_file N/A N/A N/A code accept visitor N/A rewrite N/A N/A N/A N/A self wrapping_code N/A on_enter N/A N/A N/A N/A code add_enter_code N/A N/A self wrapping_code N/A on_enter N/A N/A N/A self wrapping_code N/A on_exit N/A N/A N/A N/A code add_exit_code N/A N/A self wrapping_code N/A on_exit N/A N/A code has_changes N/A N/A N/A N/A code write N/A on_enter N/A N/A self python_code import_code N/A None N/A N/A 
      Inserts the ``python_code`` at the beginning of the module inside an if statement. The
      resulting injected code looks like this::

        if __name__ == '__main__':
          python_code

      :param python_code: Python code to inject before the module gets executed (if it's executed
                          under main). The code is not executed if it's not under main.
      :param import_code: Python code that contains the import statements that might be required
                          by the injected ``python_code``. Defaults to None.
     N/A N/A self apply_ran N/A N/A N/A Exception on_enter method should be called before `Instrumentation::apply` N/A N/A N/A self wrapping_code N/A on_enter N/A python_code import_code N/A on_exit N/A N/A self python_code import_code N/A None N/A N/A 
      Inserts the ``python_code`` at the end of the module inside an if statement. The
      resulting injected code looks like this::

        if __name__ == '__main__':
          python_code

      :param python_code: Python code to inject after the module gets executed (if it's executed
                          under main). The code is not executed if it's not under main.
      :param import_code: Python code that contains the import statements that might be required
                          by the injected ``python_code``. Defaults to None.
     N/A N/A self apply_ran N/A N/A N/A Exception on_exit method should be called before `Instrumentation::apply` N/A N/A N/A self wrapping_code N/A on_exit N/A python_code import_code N/A validate N/A N/A self N/A N/A N/A 
      Debugging info for the instrumented bytecode. Iterates again over all the bytecode
      and dumps the current (instrmented) bytecode.
     SimpleMethodVisitor N/A MethodVisitor N/A __init__ N/A N/A self N/A N/A N/A N/A N/A MethodVisitor __init__ self N/A visit N/A N/A self methDecl N/A N/A N/A N/A N/A logger debug visit methDecl:=%s methDecl N/A N/A N/A logger debug code object := %s N/A methDecl code_object N/A N/A N/A logger debug N/A get_debug_code_object_info N/A methDecl code_object N/A bc N/A N/A BytecodeObject get_parsed_code N/A methDecl code_object N/A N/A N/A logger debug 
%s N/A show_bytecode bc N/A N/A N/A logger debug End visit N/A N/A N/A bytecode_file N/A N/A self program bytecode_files N/A N/A code N/A BytecodeObject bytecode_file N/A N/A N/A code parse N/A main_module N/A N/A code get_module N/A N/A main_module N/A N/A N/A N/A logger error Cannot find module for %s bytecode_file N/A N/A N/A N/A logger debug Tree:
%s N/A N/A BytecodeObject build_tree main_module N/A N/A N/A logger debug Module bytecode:
%s N/A show_bytecode N/A main_module bytecode N/A simple_visitor N/A SimpleMethodVisitor N/A N/A N/A code accept simple_visitor N/A N/A