##// END OF EJS Templates
stubbed zope.interface and Twisted
Barry Wark -
Show More
@@ -24,13 +24,24 b' import string'
24 24 import uuid
25 25 import _ast
26 26
27 import zope.interface as zi
27 try:
28 from zope.interface import Interface, Attribute, implements, classProvides
29 except ImportError:
30 #zope.interface is not available
31 Interface = object
32 def Attribute(name, doc): pass
33 def implements(interface): pass
34 def classProvides(interface): pass
28 35
29 36 from IPython.kernel.core.history import FrontEndHistory
30 37 from IPython.kernel.core.util import Bunch
31 38 from IPython.kernel.engineservice import IEngineCore
32 39
40 try:
33 41 from twisted.python.failure import Failure
42 except ImportError:
43 #Twisted not available
44 Failure = Exception
34 45
35 46 ##############################################################################
36 47 # TEMPORARY!!! fake configuration, while we decide whether to use tconfig or
@@ -43,7 +54,7 b" rc.prompt_out = r'Out [$number]: '"
43 54
44 55 ##############################################################################
45 56
46 class IFrontEndFactory(zi.Interface):
57 class IFrontEndFactory(Interface):
47 58 """Factory interface for frontends."""
48 59
49 60 def __call__(engine=None, history=None):
@@ -56,14 +67,14 b' class IFrontEndFactory(zi.Interface):'
56 67
57 68
58 69
59 class IFrontEnd(zi.Interface):
70 class IFrontEnd(Interface):
60 71 """Interface for frontends. All methods return t.i.d.Deferred"""
61 72
62 zi.Attribute("input_prompt_template", "string.Template instance\
73 Attribute("input_prompt_template", "string.Template instance\
63 74 substituteable with execute result.")
64 zi.Attribute("output_prompt_template", "string.Template instance\
75 Attribute("output_prompt_template", "string.Template instance\
65 76 substituteable with execute result.")
66 zi.Attribute("continuation_prompt_template", "string.Template instance\
77 Attribute("continuation_prompt_template", "string.Template instance\
67 78 substituteable with execute result.")
68 79
69 80 def update_cell_prompt(result, blockID=None):
@@ -350,8 +361,8 b' class AsynchronousFrontEndBase(FrontEndBase):'
350 361 All callbacks are made as callbacks on the deferred result.
351 362 """
352 363
353 zi.implements(IFrontEnd)
354 zi.classProvides(IFrontEndFactory)
364 implements(IFrontEnd)
365 classProvides(IFrontEndFactory)
355 366
356 367 def __init__(self, engine=None, history=None):
357 368 assert(engine==None or IEngineCore.providedBy(engine))
General Comments 0
You need to be logged in to leave comments. Login now