Qudi
Public Member Functions | Public Attributes | List of all members
compilerop.CachingCompiler Class Reference

A compiler that caches code compiled from interactive statements. More...

Inheritance diagram for compilerop.CachingCompiler:
Inheritance graph
[legend]
Collaboration diagram for compilerop.CachingCompiler:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self)
 
def ast_parse (self, source, filename='< unknown >', symbol='exec')
 Parse code to an AST with the current compiler flags active. More...
 
def reset_compiler_flags (self)
 Reset compiler flags to default state. More...
 
def compiler_flags (self)
 Flags currently active in the compilation process.
 
def cache (self, code, number=0)
 Make a name for a block of code, and cache the code. More...
 

Public Attributes

 flags
 

Detailed Description

A compiler that caches code compiled from interactive statements.

Member Function Documentation

◆ ast_parse()

def compilerop.CachingCompiler.ast_parse (   self,
  source,
  filename = '<unknown>',
  symbol = 'exec' 
)

Parse code to an AST with the current compiler flags active.

Arguments are exactly the same as ast.parse (in the standard library), and are passed to the built-in compile function.

◆ cache()

def compilerop.CachingCompiler.cache (   self,
  code,
  number = 0 
)

Make a name for a block of code, and cache the code.

Parameters

code str The Python source code to cache. number int A number which forms part of the code's name. Used for the execution counter.

Returns

The name of the cached code (as a string). Pass this as the filename argument to compilation, so that tracebacks are correctly hooked up.

◆ reset_compiler_flags()

def compilerop.CachingCompiler.reset_compiler_flags (   self)

Reset compiler flags to default state.


The documentation for this class was generated from the following file: