Пример #1
0
 def getVarsInfo(self,vartype,res):
     if self.active or not self.running:
         return res
     ch=self.changed
     self.write('info {}'.format(vartype))
     lines,ok=self.read()
     self.changed=ch
     if not ok:
         #print "Failed to evaluate {}".format(var)
         return res
     if type(lines) is list:
         lines='\n'.join(lines)
     lines=lines.split('\n')
     groups=[]
     for line in lines:
         if line:
             if line[0]!=' ':
                 groups.append([])
             groups[-1].append(line)
     for group in groups:
         all='\n'.join(group)
         import xparse
         #from xparse.xparse import Node
         cur=xparse.parse(all)
         if cur:
             res[cur.name]=cur
Пример #2
0
 def getLocals(self):
     res={}
     if self.active or not self.running:
         return res
     ch=self.changed
     self.write('info locals')
     lines,ok=self.read()
     self.changed=ch
     if not ok: 
         #print "Failed to evaluate {}".format(var)
         return res
     if type(lines) is list:
         lines='\n'.join(lines)
     #open("locals.txt","w").write(lines)
     lines=lines.split('\n')
     groups=[]
     for line in lines:
         if line[0]!=' ':
             groups.append([])
         groups[-1].append(line)
     for group in groups:
         all='\n'.join(group)
         import xparse
         from xparse.xparse import Node
         cur=xparse.parse(all)
         if cur:
             res[cur.name]=cur
     return res
Пример #3
0
 def evaluate(self,var):
     import xparse
     lines=self.printVar(var)
     if globals.dev:
         print "@@@\n{}\n@@@".format(lines)
     return xparse.parse(lines)
Пример #4
0
 def evaluate(self,var):
     import xparse
     from xparse.xparse import Node
     lines=self.printVar(var)
     return xparse.parse(lines)