From 24537f529cdc3ab755ba8fedd714dd08b8ce5664 2008-08-11 22:55:32 From: gvaroquaux Date: 2008-08-11 22:55:32 Subject: [PATCH] Oops, had commited leaving some merge junk behind. --- diff --git a/IPython/frontend/frontendbase.py b/IPython/frontend/frontendbase.py index 916720f..7012ba8 100644 --- a/IPython/frontend/frontendbase.py +++ b/IPython/frontend/frontendbase.py @@ -348,7 +348,6 @@ class FrontEndBase(object): def render_error(self, failure): -<<<<<<< TREE """Subclasses must override to render the failure. In asynchronous frontends, this method will be called as a @@ -357,66 +356,4 @@ class FrontEndBase(object): """ raise NotImplementedError - - - -======= - """Subclasses must override to render the failure. Since this method - will be called as a twisted.internet.defer.Deferred's callback, - implementations should return result when finished. - """ - - return failure - - - -class AsyncFrontEndBase(FrontEndBase): - """ - Overrides FrontEndBase to wrap execute in a deferred result. - All callbacks are made as callbacks on the deferred result. - """ - - implements(IFrontEnd) - classProvides(IFrontEndFactory) - - def __init__(self, engine=None, history=None): - assert(engine==None or IEngineCore.providedBy(engine)) - self.engine = IEngineCore(engine) - if history is None: - self.history = FrontEndHistory(input_cache=['']) - else: - self.history = history - - - 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)): - from twisted.python.failure import Failure - return Failure(Exception("Block is not compilable")) - - if(blockID == None): - blockID = uuid.uuid4() #random UUID - - d = self.engine.execute(block) - d.addCallback(self._add_history, block=block) - d.addCallback(self._add_block_id_for_result, blockID) - d.addErrback(self._add_block_id_for_failure, blockID) - d.addBoth(self.update_cell_prompt, blockID=blockID) - d.addCallbacks(self.render_result, - errback=self.render_error) - - return d - ->>>>>>> MERGE-SOURCE