def execute(self, block, blockID=None): """Execute the block and return the result. Parameters: block : {str, AST} blockID : any Caller may provide an ID to identify this block. result['blockID'] := blockID Result: Deferred result of self.interpreter.execute """ if (not self.is_complete(block)): raise Exception("Block is not compilable") if (blockID == None): blockID = guid.generate() try: result = self.shell.execute(block) except Exception, e: e = self._add_block_id_for_failure(e, blockID=blockID) e = self.update_cell_prompt(e, blockID=blockID) e = self.render_error(e)
def execute(self, block, blockID=None): """Execute the block and return the deferred result. Parameters: block : {str, AST} blockID : any Caller may provide an ID to identify this block. result['blockID'] := blockID Result: Deferred result of self.interpreter.execute """ if(not self.is_complete(block)): return Failure(Exception("Block is not compilable")) if(blockID == None): blockID = guid.generate() d = self.engine.execute(block) d.addCallback(self._add_history, block=block) d.addCallbacks(self._add_block_id_for_result, errback=self._add_block_id_for_failure, callbackArgs=(blockID,), errbackArgs=(blockID,)) d.addBoth(self.update_cell_prompt, blockID=blockID) d.addCallbacks(self.render_result, errback=self.render_error) return d
def execute(self, block, blockID=None): """Execute the block and return the result. Parameters: block : {str, AST} blockID : any Caller may provide an ID to identify this block. result['blockID'] := blockID Result: Deferred result of self.interpreter.execute """ if(not self.is_complete(block)): raise Exception("Block is not compilable") if(blockID == None): blockID = guid.generate() try: result = self.shell.execute(block) except Exception,e: e = self._add_block_id_for_failure(e, blockID=blockID) e = self.update_cell_prompt(e, blockID=blockID) e = self.render_error(e)
def execute(self, block, blockID=None): """Execute the block and return the deferred result. Parameters: block : {str, AST} blockID : any Caller may provide an ID to identify this block. result['blockID'] := blockID Result: Deferred result of self.interpreter.execute """ if (not self.is_complete(block)): return Failure(Exception("Block is not compilable")) if (blockID == None): blockID = guid.generate() d = self.engine.execute(block) d.addCallback(self._add_history, block=block) d.addCallbacks(self._add_block_id_for_result, errback=self._add_block_id_for_failure, callbackArgs=(blockID, ), errbackArgs=(blockID, )) d.addBoth(self.update_cell_prompt, blockID=blockID) d.addCallbacks(self.render_result, errback=self.render_error) return d
def next_block_ID(self): return guid.generate()
def get_deferred_id(self): return guid.generate()