Ejemplo n.º 1
0
    def __init__(self,
                 name,
                 usage=None,
                 rc=Struct(opts=None, args=None),
                 user_ns=None,
                 user_global_ns=None,
                 banner2='',
                 **kw):
        """Similar to the normal InteractiveShell, but with threading control"""

        InteractiveShell.__init__(self, name, usage, rc, user_ns,
                                  user_global_ns, banner2)

        # Locking control variable.  We need to use a norma lock, not an RLock
        # here.  I'm not exactly sure why, it seems to me like it should be
        # the opposite, but we deadlock with an RLock.  Puzzled...
        self.thread_ready = threading.Condition(threading.Lock())

        # A queue to hold the code to be executed.  A scalar variable is NOT
        # enough, because uses like macros cause reentrancy.
        self.code_queue = Queue.Queue()

        # Stuff to do at closing time
        self._kill = False
        on_kill = kw.get('on_kill')
        if on_kill is None:
            on_kill = []
        # Check that all things to kill are callable:
        for t in on_kill:
            if not callable(t):
                raise TypeError, 'on_kill must be a list of callables'
        self.on_kill = on_kill
Ejemplo n.º 2
0
    def __init__(self,
                 name,
                 usage=None,
                 rc=Struct(opts=None, args=None),
                 user_ns=None,
                 user_global_ns=None,
                 banner2='',
                 **kw):
        """Similar to the normal InteractiveShell, but with threading control"""

        InteractiveShell.__init__(self, name, usage, rc, user_ns,
                                  user_global_ns, banner2)

        # A queue to hold the code to be executed.
        self.code_queue = Queue.Queue()

        # Stuff to do at closing time
        self._kill = None
        on_kill = kw.get('on_kill', [])
        # Check that all things to kill are callable:
        for t in on_kill:
            if not callable(t):
                raise TypeError, 'on_kill must be a list of callables'
        self.on_kill = on_kill
        # thread identity of the "worker thread" (that may execute code directly)
        self.worker_ident = None
        self.reactor_started = False
        self.first_run = True
Ejemplo n.º 3
0
 def __init__(self,
              name,
              usage=None,
              rc=Struct(opts=None, args=None),
              user_ns=None,
              **kw):
     user_ns, b2 = self._matplotlib_config(name)
     InteractiveShell.__init__(self,
                               name,
                               usage,
                               rc,
                               user_ns,
                               banner2=b2,
                               **kw)
Ejemplo n.º 4
0
    def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
                 user_ns=None,user_global_ns=None,banner2='',**kw):
        """Similar to the normal InteractiveShell, but with threading control"""
        
        InteractiveShell.__init__(self,name,usage,rc,user_ns,
                                  user_global_ns,banner2)


        # A queue to hold the code to be executed. 
        self.code_queue = Queue.Queue()

        # Stuff to do at closing time
        self._kill = None
        on_kill = kw.get('on_kill', [])
        # Check that all things to kill are callable:
        for t in on_kill:
            if not callable(t):
                raise TypeError,'on_kill must be a list of callables'
        self.on_kill = on_kill
        # thread identity of the "worker thread" (that may execute code directly)
        self.worker_ident = None
Ejemplo n.º 5
0
    def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
                 user_ns=None,user_global_ns=None,banner2='',**kw):
        """Similar to the normal InteractiveShell, but with threading control"""
        
        InteractiveShell.__init__(self,name,usage,rc,user_ns,
                                  user_global_ns,banner2)

        # Locking control variable.
        self.thread_ready = threading.Condition(threading.RLock())

        # A queue to hold the code to be executed.  A scalar variable is NOT
        # enough, because uses like macros cause reentrancy.
        self.code_queue = Queue.Queue()

        # Stuff to do at closing time
        self._kill = False
        on_kill = kw.get('on_kill')
        if on_kill is None:
            on_kill = []
        # Check that all things to kill are callable:
        for t in on_kill:
            if not callable(t):
                raise TypeError,'on_kill must be a list of callables'
        self.on_kill = on_kill
Ejemplo n.º 6
0
 def __init__(self, name, **kw):
     self.parentclass = InteractiveShell
     AUTOInteractive.__init__(self, kw["user_ns"], None)
     InteractiveShell.__init__(self, name, **kw)
Ejemplo n.º 7
0
 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
              user_ns=None,user_global_ns=None,**kw):
     user_ns,user_global_ns,b2 = self._matplotlib_config(name,user_ns,user_global_ns)
     InteractiveShell.__init__(self,name,usage,rc,user_ns,user_global_ns,
                               banner2=b2,**kw)