Ejemplo n.º 1
0
 def __del__(self):
     print "deleting"
     for x in os.listdir(self.__tmp_dir):
         os.remove("%s/%s" % (self.__tmp_dir, x))
     os.removedirs(self.__tmp_dir)
     if not (self._expect is None):
         cmd = "kill -9 %s" % self._expect.pid
         print cmd
         os.system(cmd)
     Sage.__del__(self)
Ejemplo n.º 2
0
 def __del__(self):
     print "deleting"
     for x in os.listdir(self.__tmp_dir):
         os.remove('%s/%s' % (self.__tmp_dir, x))
     os.removedirs(self.__tmp_dir)
     if not (self._expect is None):
         cmd = 'kill -9 %s' % self._expect.pid
         print cmd
         os.system(cmd)
     Sage.__del__(self)
Ejemplo n.º 3
0
    def __init__(self, **kwds):
        if kwds.has_key('server'):
            raise NotImplementedError, "PSage doesn't work on remote server yet."
        Sage.__init__(self, **kwds)
        import sage.misc.misc
        T = sage.misc.misc.tmp_dir('sage_smp')
        self.__tmp_dir = T
        self.__tmp = '%s/lock' % T
        self._unlock()
        self._unlock_code = "open('%s','w').write('__unlocked__')" % self.__tmp

        global number
        self._number = number
        number += 1
Ejemplo n.º 4
0
    def __init__(self,  **kwds):
        if kwds.has_key('server'):
            raise NotImplementedError, "PSage doesn't work on remote server yet."
        Sage.__init__(self, **kwds)
        import sage.misc.misc
        T = sage.misc.misc.tmp_dir('sage_smp')
        self.__tmp_dir = T
        self.__tmp = '%s/lock'%T
        self._unlock()
        self._unlock_code = "open('%s','w').write('__unlocked__')"%self.__tmp

        global number
        self._number = number
        number += 1
Ejemplo n.º 5
0
 def eval(self, x, strip=True, **kwds):
     """
         x -- code
         strip --ignored
     """
     if self.is_locked():
         return "<<currently executing code>>"
     if self._locked:
         self._locked = False
         # self._expect.expect('__unlocked__')
         self.expect().send("\n")
         self.expect().expect(self._prompt)
         self.expect().expect(self._prompt)
     try:
         return Sage.eval(self, x, **kwds)
     except:
         return "<<currently executing code>>"
Ejemplo n.º 6
0
 def eval(self, x, strip=True, **kwds):
     """
         x -- code
         strip --ignored
     """
     if self.is_locked():
         return "<<currently executing code>>"
     if self._locked:
         self._locked = False
         #self._expect.expect('__unlocked__')
         self.expect().send('\n')
         self.expect().expect(self._prompt)
         self.expect().expect(self._prompt)
     try:
         return Sage.eval(self, x, **kwds)
     except:
         return "<<currently executing code>>"
Ejemplo n.º 7
0
 def _start(self):
     Sage._start(self)
     self.expect().timeout = 0.25
     self.expect().delaybeforesend = 0.01
Ejemplo n.º 8
0
 def _start(self):
     Sage._start(self)
     self.expect().timeout = 0.25
     self.expect().delaybeforesend = 0.01