parameters: (self, code_decorators, code, preparse=True, namespace=None, locals=None)
docstring: salvus.execute_with_code_decorators is used when evaluating
          code blocks that are set to any non-default code_decorator.
docstring_summary: salvus.execute_with_code_decorators is used when evaluating
          code blocks that are set to any non-default code_decorator.
docstring_tokens: salvus . execute_with_code_decorators is used when evaluating code blocks that are set to any non - default code_decorator .
function: def execute_with_code_decorators(self, code_decorators, code, preparse=True, namespace=None, locals=None):
          """
          salvus.execute_with_code_decorators is used when evaluating
          code blocks that are set to any non-default code_decorator.
          """
          import sage  # used below as a code decorator
          if isinstance(code_decorators, (str, unicode)):
              code_decorators = [code_decorators]
  
          if preparse:
              code_decorators = map(sage_parsing.preparse_code, code_decorators)
  
          code_decorators = [eval(code_decorator, self.namespace) for code_decorator in code_decorators]
  
          # The code itself may want to know exactly what code decorators are in effect.
          # For example, r.eval can do extra things when being used as a decorator.
          self.code_decorators = code_decorators
  
          for i, code_decorator in enumerate(code_decorators):
              # eval is for backward compatibility
              if not hasattr(code_decorator, 'eval') and hasattr(code_decorator, 'before'):
                  code_decorators[i] = code_decorator.before(code)
  
          for code_decorator in reversed(code_decorators):
              if hasattr(code_decorator, 'eval'):   # eval is for backward compatibility
                  print code_decorator.eval(code, locals=self.namespace),
                  code = ''
              elif code_decorator is sage:
                  # special case -- the sage module (i.e., %sage) should do nothing.
                  pass
              else:
                  code = code_decorator(code)
              if code is None:
                  code = ''
  
          if code != '' and isinstance(code, (str, unicode)):
              self.execute(code, preparse=preparse, namespace=namespace, locals=locals)
  
          for code_decorator in code_decorators:
              if not hasattr(code_decorator, 'eval') and hasattr(code_decorator, 'after'):
                  code_decorator.after(code)
function_tokens: def execute_with_code_decorators ( self , code_decorators , code , preparse = True , namespace = None , locals = None ) : import sage # used below as a code decorator if isinstance ( code_decorators , ( str , unicode ) ) : code_decorators = [ code_decorators ] if preparse : code_decorators = map ( sage_parsing . preparse_code , code_decorators ) code_decorators = [ eval ( code_decorator , self . namespace ) for code_decorator in code_decorators ] # The code itself may want to know exactly what code decorators are in effect. # For example, r.eval can do extra things when being used as a decorator. self . code_decorators = code_decorators for i , code_decorator in enumerate ( code_decorators ) : # eval is for backward compatibility if not hasattr ( code_decorator , 'eval' ) and hasattr ( code_decorator , 'before' ) : code_decorators [ i ] = code_decorator . before ( code ) for code_decorator in reversed ( code_decorators ) : if hasattr ( code_decorator , 'eval' ) : # eval is for backward compatibility print code_decorator . eval ( code , locals = self . namespace ) , code = '' elif code_decorator is sage : # special case -- the sage module (i.e., %sage) should do nothing. pass else : code = code_decorator ( code ) if code is None : code = '' if code != '' and isinstance ( code , ( str , unicode ) ) : self . execute ( code , preparse = preparse , namespace = namespace , locals = locals ) for code_decorator in code_decorators : if not hasattr ( code_decorator , 'eval' ) and hasattr ( code_decorator , 'after' ) : code_decorator . after ( code )