rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
def makeInnerTiles(self): # inner grid lines group = Group()
7085104ce6ab4adbb19ecef99f88fe6823d23ca2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/7085104ce6ab4adbb19ecef99f88fe6823d23ca2/grids.py
stripe = Rect(x, self.y, self.delta, h)
if x + self.delta > self.x + w: w1 = self.x + w - x else: w1 = self.delta stripe = Rect(x, self.y, w1, h)
def makeInnerTiles(self): # inner grid lines group = Group()
7085104ce6ab4adbb19ecef99f88fe6823d23ca2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/7085104ce6ab4adbb19ecef99f88fe6823d23ca2/grids.py
rmStripe = Rect(self.x + w - self.delta0, self.y, self.delta0, h)
rmStripe = Rect(x, self.y, self.x + w - x, h)
def makeInnerTiles(self): # inner grid lines group = Group()
7085104ce6ab4adbb19ecef99f88fe6823d23ca2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/7085104ce6ab4adbb19ecef99f88fe6823d23ca2/grids.py
def makeInnerTiles(self): # inner grid lines group = Group()
7085104ce6ab4adbb19ecef99f88fe6823d23ca2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/7085104ce6ab4adbb19ecef99f88fe6823d23ca2/grids.py
stripe = Rect(self.x, y, w, self.delta)
if y + self.delta > self.y + w: h1 = self.y + w - y else: h1 = self.delta stripe = Rect(self.x, y, w, h1)
def makeInnerTiles(self): # inner grid lines group = Group()
7085104ce6ab4adbb19ecef99f88fe6823d23ca2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/7085104ce6ab4adbb19ecef99f88fe6823d23ca2/grids.py
umStripe = Rect(self.x, self.y + w - self.delta0, w, self.delta0)
umStripe = Rect(self.x, self.y + w - self.delta0, w, self.y + h - y)
def makeInnerTiles(self): # inner grid lines group = Group()
7085104ce6ab4adbb19ecef99f88fe6823d23ca2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/7085104ce6ab4adbb19ecef99f88fe6823d23ca2/grids.py
D = Drawing(450,650) for row in range(5): y = 530 - row*120
D = Drawing(450, 650) d = 80 s = 60 for row in range(10): y = 530 - row*d
def test(): D = Drawing(450,650) for row in range(5): y = 530 - row*120 if row == 0: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useRects = 0 g.useLines = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 1: for col in range(3): x = 20 + col*120 g = Grid0() g.y = y g.x = x if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 2: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useLines = 1 g.useRects = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 3: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.Color(0, 0, 0) sr.fillColorEnd = colors.Color(1, 1, 1) if col == 0: sr.numShades = 5 elif col == 1: sr.numShades = 2 elif col == 2: sr.numShades = 1 sr.demo() D.add(sr) elif row == 4: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' if col == 0: sr.numShades = 10 elif col == 1: sr.numShades = 20 elif col == 2: sr.numShades = 50 sr.demo() D.add(sr) renderPDF.drawToFile(D, 'grids.pdf', 'grids.py') print 'wrote file: grids.pdf'
7085104ce6ab4adbb19ecef99f88fe6823d23ca2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/7085104ce6ab4adbb19ecef99f88fe6823d23ca2/grids.py
x = 20 + col*120
x = 20 + col*d
def test(): D = Drawing(450,650) for row in range(5): y = 530 - row*120 if row == 0: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useRects = 0 g.useLines = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 1: for col in range(3): x = 20 + col*120 g = Grid0() g.y = y g.x = x if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 2: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useLines = 1 g.useRects = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 3: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.Color(0, 0, 0) sr.fillColorEnd = colors.Color(1, 1, 1) if col == 0: sr.numShades = 5 elif col == 1: sr.numShades = 2 elif col == 2: sr.numShades = 1 sr.demo() D.add(sr) elif row == 4: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' if col == 0: sr.numShades = 10 elif col == 1: sr.numShades = 20 elif col == 2: sr.numShades = 50 sr.demo() D.add(sr) renderPDF.drawToFile(D, 'grids.pdf', 'grids.py') print 'wrote file: grids.pdf'
7085104ce6ab4adbb19ecef99f88fe6823d23ca2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/7085104ce6ab4adbb19ecef99f88fe6823d23ca2/grids.py
x = 20 + col*120
x = 20 + col*d
def test(): D = Drawing(450,650) for row in range(5): y = 530 - row*120 if row == 0: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useRects = 0 g.useLines = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 1: for col in range(3): x = 20 + col*120 g = Grid0() g.y = y g.x = x if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 2: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useLines = 1 g.useRects = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 3: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.Color(0, 0, 0) sr.fillColorEnd = colors.Color(1, 1, 1) if col == 0: sr.numShades = 5 elif col == 1: sr.numShades = 2 elif col == 2: sr.numShades = 1 sr.demo() D.add(sr) elif row == 4: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' if col == 0: sr.numShades = 10 elif col == 1: sr.numShades = 20 elif col == 2: sr.numShades = 50 sr.demo() D.add(sr) renderPDF.drawToFile(D, 'grids.pdf', 'grids.py') print 'wrote file: grids.pdf'
7085104ce6ab4adbb19ecef99f88fe6823d23ca2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/7085104ce6ab4adbb19ecef99f88fe6823d23ca2/grids.py
x = 20 + col*120
x = 20 + col*d
def test(): D = Drawing(450,650) for row in range(5): y = 530 - row*120 if row == 0: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useRects = 0 g.useLines = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 1: for col in range(3): x = 20 + col*120 g = Grid0() g.y = y g.x = x if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 2: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useLines = 1 g.useRects = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 3: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.Color(0, 0, 0) sr.fillColorEnd = colors.Color(1, 1, 1) if col == 0: sr.numShades = 5 elif col == 1: sr.numShades = 2 elif col == 2: sr.numShades = 1 sr.demo() D.add(sr) elif row == 4: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' if col == 0: sr.numShades = 10 elif col == 1: sr.numShades = 20 elif col == 2: sr.numShades = 50 sr.demo() D.add(sr) renderPDF.drawToFile(D, 'grids.pdf', 'grids.py') print 'wrote file: grids.pdf'
7085104ce6ab4adbb19ecef99f88fe6823d23ca2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/7085104ce6ab4adbb19ecef99f88fe6823d23ca2/grids.py
x = 20 + col*120
x = 20 + col*d
def test(): D = Drawing(450,650) for row in range(5): y = 530 - row*120 if row == 0: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useRects = 0 g.useLines = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 1: for col in range(3): x = 20 + col*120 g = Grid0() g.y = y g.x = x if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 2: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useLines = 1 g.useRects = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 3: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.Color(0, 0, 0) sr.fillColorEnd = colors.Color(1, 1, 1) if col == 0: sr.numShades = 5 elif col == 1: sr.numShades = 2 elif col == 2: sr.numShades = 1 sr.demo() D.add(sr) elif row == 4: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' if col == 0: sr.numShades = 10 elif col == 1: sr.numShades = 20 elif col == 2: sr.numShades = 50 sr.demo() D.add(sr) renderPDF.drawToFile(D, 'grids.pdf', 'grids.py') print 'wrote file: grids.pdf'
7085104ce6ab4adbb19ecef99f88fe6823d23ca2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/7085104ce6ab4adbb19ecef99f88fe6823d23ca2/grids.py
x = 20 + col*120
x = 20 + col*d
def test(): D = Drawing(450,650) for row in range(5): y = 530 - row*120 if row == 0: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useRects = 0 g.useLines = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 1: for col in range(3): x = 20 + col*120 g = Grid0() g.y = y g.x = x if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 2: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useLines = 1 g.useRects = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 3: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.Color(0, 0, 0) sr.fillColorEnd = colors.Color(1, 1, 1) if col == 0: sr.numShades = 5 elif col == 1: sr.numShades = 2 elif col == 2: sr.numShades = 1 sr.demo() D.add(sr) elif row == 4: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' if col == 0: sr.numShades = 10 elif col == 1: sr.numShades = 20 elif col == 2: sr.numShades = 50 sr.demo() D.add(sr) renderPDF.drawToFile(D, 'grids.pdf', 'grids.py') print 'wrote file: grids.pdf'
7085104ce6ab4adbb19ecef99f88fe6823d23ca2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/7085104ce6ab4adbb19ecef99f88fe6823d23ca2/grids.py
canv = self.canv
canv = getattr(self,'canv',None)
def _listCellGeom(self, V,w,s,W=None,H=None): aW = w-s.leftPadding-s.rightPadding t = 0 w = 0 canv = self.canv for v in V: vw, vh = v.wrapOn(canv,aW, 72000) if W is not None: W.append(vw) if H is not None: H.append(vh) w = max(w,vw) t = t + vh + v.getSpaceBefore()+v.getSpaceAfter() return w, t - V[0].getSpaceBefore()-V[-1].getSpaceAfter()
ac08b354dfb430e6d5a38148b8b64404beb88ed6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/ac08b354dfb430e6d5a38148b8b64404beb88ed6/tables.py
fp = open(fileName,'rb')
fp = open(fileName,'rb')
def __init__(self, fileName): if not haveImages: warnOnce('Imaging Library not available, unable to import bitmaps') return #start wih lots of null private fields, to be populated by #the relevant engine. self.fileName = fileName self._image = None self._width = None self._height = None self._transparent = None self._data = None
755ef7ca95e1150cbdee6717356f2e5ed349b76c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/755ef7ca95e1150cbdee6717356f2e5ed349b76c/utils.py
fp = fileName
fp = fileName
def __init__(self, fileName): if not haveImages: warnOnce('Imaging Library not available, unable to import bitmaps') return #start wih lots of null private fields, to be populated by #the relevant engine. self.fileName = fileName self._image = None self._width = None self._height = None self._transparent = None self._data = None
755ef7ca95e1150cbdee6717356f2e5ed349b76c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/755ef7ca95e1150cbdee6717356f2e5ed349b76c/utils.py
def recursiveImport(modulename, baseDir=None, noCWD=0, debug=0): """Dynamically imports possible packagized module, or raises ImportError""" import imp parts = string.split(modulename, '.') name = parts[0] #this hosed my brain..redo it slowly (AR). #path = list(baseDir and (type(baseDir) not in SeqTypes and [baseDir] or filter(None,baseDir)) or None) if baseDir is None: path = sys.path[:] else: path = [baseDir] if noCWD: if '.' in path: path.remove('.') abspath = os.path.abspath('.') if abspath in path: path.remove(abspath) else: if '.' not in path: path.insert(0,'.') if debug: import pprint pp = pprint.pprint print 'path=',pp(path) #make import errors a bit more informative fullName = name try: (file, pathname, description) = imp.find_module(name, path) childModule = parentModule = imp.load_module(name, file, pathname, description) if debug: print 'imported module = %s' % parentModule for name in parts[1:]: fullName = fullName + '.' + name if debug: print 'trying part %s' % name (file, pathname, description) = imp.find_module(name, [os.path.dirname(parentModule.__file__)]) childModule = imp.load_module(fullName, file, pathname, description) if debug: print 'imported module = %s' % childModule setattr(parentModule, name, childModule) parentModule = childModule except ImportError: msg = "cannot import '%s' while attempting recursive import of '%s'" % (fullName, modulename) if baseDir: msg = msg + " under paths '%s'" % `path` raise ImportError, msg return childModule
116c72c67c6b27f5b1b2eccc3c09ab2c73dbacc2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/116c72c67c6b27f5b1b2eccc3c09ab2c73dbacc2/utils.py
path = [baseDir]
if type(baseDir) not in SeqTypes path = [baseDir] else: path = list(baseDir) path = filter(None,basDir)
def recursiveImport(modulename, baseDir=None, noCWD=0, debug=0): """Dynamically imports possible packagized module, or raises ImportError""" import imp parts = string.split(modulename, '.') name = parts[0] #this hosed my brain..redo it slowly (AR). #path = list(baseDir and (type(baseDir) not in SeqTypes and [baseDir] or filter(None,baseDir)) or None) if baseDir is None: path = sys.path[:] else: path = [baseDir] if noCWD: if '.' in path: path.remove('.') abspath = os.path.abspath('.') if abspath in path: path.remove(abspath) else: if '.' not in path: path.insert(0,'.') if debug: import pprint pp = pprint.pprint print 'path=',pp(path) #make import errors a bit more informative fullName = name try: (file, pathname, description) = imp.find_module(name, path) childModule = parentModule = imp.load_module(name, file, pathname, description) if debug: print 'imported module = %s' % parentModule for name in parts[1:]: fullName = fullName + '.' + name if debug: print 'trying part %s' % name (file, pathname, description) = imp.find_module(name, [os.path.dirname(parentModule.__file__)]) childModule = imp.load_module(fullName, file, pathname, description) if debug: print 'imported module = %s' % childModule setattr(parentModule, name, childModule) parentModule = childModule except ImportError: msg = "cannot import '%s' while attempting recursive import of '%s'" % (fullName, modulename) if baseDir: msg = msg + " under paths '%s'" % `path` raise ImportError, msg return childModule
116c72c67c6b27f5b1b2eccc3c09ab2c73dbacc2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/116c72c67c6b27f5b1b2eccc3c09ab2c73dbacc2/utils.py
datafile=qpath+job[:-3]+"sff"
fileext="sff" if os.path.splitext(datafilename)[1].lower()==".cff": fileext="cff" datafile=qpath+job[:-3]+fileext
def removejob(user,jobid,cslist): if (checkconfig() == -1) or (checkfaxuser(user,1) == 0): raise CSConfigError if not listtypes.has_key(cslist) or CheckJobID(jobid)==-1: raise -1 qpath=BuildListPath(cslist,user) job ="" if listtypes[cslist][1]==1: job=user+"-" job=job+listtypes[cslist][0]+"-"+jobid+".txt" #job=prefix+"-"+jobid+".txt" if (not os.access(qpath+job,os.W_OK)): print '<p><b> Job file "%s" (ID:%s) is not valid job to remove (List:%s)</b></p>' % (job,jobid,cslist) return -1 control=cs_helpers.readConfig(qpath+job) # in capisuite 0.4.3, the filename options in failed and done store the original file path # (e.g. /var/spool/capisuite/users/me/senq/fax-12.sff). if cslist!="faxdone" and cslist!="faxfailed": datafile=control.get("GLOBAL","filename") else: datafile=qpath+job[:-3]+"sff" if not datafile: return -1 try: lockfile=open(qpath+job[:-3]+"lock","w") # lock so that it isn't deleted while sending (or else) fcntl.lockf(lockfile,fcntl.LOCK_EX | fcntl.LOCK_NB) os.unlink(qpath+job) os.unlink(datafile) fcntl.lockf(lockfile,fcntl.LOCK_UN) os.unlink(qpath+job[:-3]+"lock") except IOError,err: if (err.errno in (errno.EACCES,errno.EAGAIN)): print "<p><b>Job is currently in transmission or in similar use. Can't remove.</b></p>"
3e8516ced1d28098d6a81e516375588e6b019814 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2867/3e8516ced1d28098d6a81e516375588e6b019814/capifaxwm.py
raise CSUserInputError("nvalid input (fax) file")
raise CSUserInputError("Invalid input (fax) file")
def sendfax(user,dialstring,sourcefile,cstarttime="",addressee="",subject="",useprefix=None): if (checkconfig == -1) or (checkfaxuser(user,1) == 0) or (not sourcefile): raise CSConfigError if not dialstring: raise CSUserInputError("empty dialstring") if ((cs_helpers.getOption(CAPI_config,user,"outgoing_MSN","")=="") and \ (CAPI_config.get(user,"fax_numbers","")=="")): raise CSGeneralError("Sorry, your are not allowed to send a fax") filetype = os.path.splitext(sourcefile)[1].lower()[1:] # splittext returns a list of 2, so no "None" check needed if not filetype: raise CSUserInputError("nvalid input (fax) file") # Convert to empty string, if set to "None" if addressee==None: addressee="" if subject==None: subject="" # filter out common separators from dialstring, check it dialstring=dialstring.translate(string.maketrans("",""),"-/ ()") if re.compile("[^0-9\+]+").search(dialstring): raise CSUserInputError("Invalid dialstring") prefix=cs_helpers.getOption(CAPI_config,user,"dial_prefix","") if (useprefix): dialstring=prefix+dialstring if (not os.access(sourcefile,os.R_OK)): raise CSInternalError("Cannot read fax source file:"+cgi.escape(sourcefile,1)) sendq = os.path.join(UsersFax_Path,user,"sendq")+"/" newname=cs_helpers.uniqueName(sendq,"fax",filetype) # --TODO--Error check!!!! shutil.copy(sourcefile,newname) if not cstarttime: cstarttime = time.ctime() cs_helpers.writeDescription(newname,"dialstring=\""+dialstring+"\"\n" +"starttime=\""+cstarttime+"\"\ntries=\"0\"\n" +"user=\""+user+"\"\naddressee=\""+addressee+"\"\nsubject=\"" +subject+"\"\n") os.chmod(newname,0600) os.chmod(newname[:-3]+"txt",0600) if (os.getuid()==0): user_entry=pwd.getpwnam(user) os.chown(newname,user_entry[2],user_entry[3]) os.chown(newname[:-3]+"txt",user_entry[2],user_entry[3]) #print "<p>",sourcefile,"successful enqueued as",newname,"for",dialstring,"</p>"
7949111017f6ca864cb99138b22c8a0c688c166d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2867/7949111017f6ca864cb99138b22c8a0c688c166d/capifaxwm.py
self.SaveRankingData() self.LoadRegattaRanking()
pass
def UpdateRegattaRanking(self): self.SaveRankingData() self.LoadRegattaRanking()
48d330ad5d0c166ff207c0d759fbd7ab4131c638 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2446/48d330ad5d0c166ff207c0d759fbd7ab4131c638/qtclass.py
if str(value) == str(self.T_DetailRanking.item(s, 0).text()) and s != pos: return 0
if self.T_DetailRanking.item(s, 0): newVal = self.T_DetailRanking.item(s, 0).text() if str(value) == str(newVal) and s != pos: return 0
def ChechForSkipper(self, value, pos): for s in range(0, self.T_DetailRanking.rowCount()): if str(value) == str(self.T_DetailRanking.item(s, 0).text()) and s != pos: return 0
ae5b281725cc9d00d153f756429775d079535a44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2446/ae5b281725cc9d00d153f756429775d079535a44/qtclass.py
Ranks = {}
Ranks = {} risultati = datafile.options('result') if len(risultati) == 0: return
def LoadRegattaRanking(self): try: current_class = str(self.L_Regattas.currentItem().text()) if current_class[-1:] == '*': k = self.ShowQuestionDialog("Save data ?") if k == QtGui.QMessageBox.Yes: self.SaveRankingData(Regatta=current_class[:-1]) else: self.L_Regattas.currentItem().setText(current_class[:-1]) except: pass current_class = '' if self.T_DetailRanking.rowCount() > 1: self.ClearRankTable() for c in range(0, self.L_Regattas.count()): if self.L_Regattas.isItemSelected(self.L_Regattas.item(c)) == True: current_class = self.L_Regattas.item(c).text() break if current_class != '': File = self.inputpath+re.sub(' ','_',str(current_class))+".cla" Header = self.tr("Race") try: datafile = ConfigParser.ConfigParser() datafile.readfp(open(File)) except: return x = 0 TableHeader = ["Skipper"] points = {} Ranks = {} for sk in datafile.options('result'): _pt = datafile.get('result', sk) pt = _pt.split(',') tot = 0 Ranks[sk] = pt for p in pt: if p == 'DNF': tot = tot + self.DNF else: tot = tot + int(p) Ranks[sk].append(str(tot)) points[sk] = tot it = points.items() it = [(v, k) for (k, v) in it] it.sort() it = [(k, v) for (v, k) in it] for c in range(0,len(Ranks[sk])): self.T_DetailRanking.insertColumn(c+1) TableHeader.append("%s %d"%(Header,(c+1))) TableHeader.remove(TableHeader[len(TableHeader)-1]) TableHeader.append("Tot") self.T_DetailRanking.setHorizontalHeaderLabels(TableHeader) for sk_ in it: sk = sk_[0] self.T_DetailRanking.insertRow(self.T_DetailRanking.rowCount()) ski = QtGui.QTableWidgetItem(sk) self.T_DetailRanking.setItem(x,0,ski) c = 1 for p in Ranks[sk]: if p == '999': p = 'DNF' pt = QtGui.QTableWidgetItem(p) pt.setTextAlignment(QtCore.Qt.AlignCenter) self.T_DetailRanking.setItem(x,c,pt) c = c + 1 x = x + 1 self.T_DetailRanking.resizeColumnsToContents()
4a6883fa9bdcd802ecec733f487c07f201fcceed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2446/4a6883fa9bdcd802ecec733f487c07f201fcceed/qtclass.py
for c in range(0,len(Ranks[sk])):
lenRanks = len(Ranks[sk]) for c in range(0,lenRanks):
def LoadRegattaRanking(self): try: current_class = str(self.L_Regattas.currentItem().text()) if current_class[-1:] == '*': k = self.ShowQuestionDialog("Save data ?") if k == QtGui.QMessageBox.Yes: self.SaveRankingData(Regatta=current_class[:-1]) else: self.L_Regattas.currentItem().setText(current_class[:-1]) except: pass current_class = '' if self.T_DetailRanking.rowCount() > 1: self.ClearRankTable() for c in range(0, self.L_Regattas.count()): if self.L_Regattas.isItemSelected(self.L_Regattas.item(c)) == True: current_class = self.L_Regattas.item(c).text() break if current_class != '': File = self.inputpath+re.sub(' ','_',str(current_class))+".cla" Header = self.tr("Race") try: datafile = ConfigParser.ConfigParser() datafile.readfp(open(File)) except: return x = 0 TableHeader = ["Skipper"] points = {} Ranks = {} for sk in datafile.options('result'): _pt = datafile.get('result', sk) pt = _pt.split(',') tot = 0 Ranks[sk] = pt for p in pt: if p == 'DNF': tot = tot + self.DNF else: tot = tot + int(p) Ranks[sk].append(str(tot)) points[sk] = tot it = points.items() it = [(v, k) for (k, v) in it] it.sort() it = [(k, v) for (v, k) in it] for c in range(0,len(Ranks[sk])): self.T_DetailRanking.insertColumn(c+1) TableHeader.append("%s %d"%(Header,(c+1))) TableHeader.remove(TableHeader[len(TableHeader)-1]) TableHeader.append("Tot") self.T_DetailRanking.setHorizontalHeaderLabels(TableHeader) for sk_ in it: sk = sk_[0] self.T_DetailRanking.insertRow(self.T_DetailRanking.rowCount()) ski = QtGui.QTableWidgetItem(sk) self.T_DetailRanking.setItem(x,0,ski) c = 1 for p in Ranks[sk]: if p == '999': p = 'DNF' pt = QtGui.QTableWidgetItem(p) pt.setTextAlignment(QtCore.Qt.AlignCenter) self.T_DetailRanking.setItem(x,c,pt) c = c + 1 x = x + 1 self.T_DetailRanking.resizeColumnsToContents()
4a6883fa9bdcd802ecec733f487c07f201fcceed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2446/4a6883fa9bdcd802ecec733f487c07f201fcceed/qtclass.py
self.T_DetailRanking.insertColumn(self.T_DetailRanking.columnCount()-1)
def AddRace(self): self.T_DetailRanking.insertColumn(self.T_DetailRanking.columnCount()-1) cols = self.T_DetailRanking.columnCount() if cols == 2: self.T_DetailRanking.insertColumn(self.T_DetailRanking.columnCount()-1) cols += 1 TableHeader=[] for c in range(0, cols -1): TableHeader.append("%s %d"%("Race",(c))) TableHeader[0] = "Skipper" TableHeader.append("Tot") self.T_DetailRanking.setHorizontalHeaderLabels(TableHeader) self.T_DetailRanking.resizeColumnsToContents()
4a6883fa9bdcd802ecec733f487c07f201fcceed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2446/4a6883fa9bdcd802ecec733f487c07f201fcceed/qtclass.py
self.T_DetailRanking.insertColumn(self.T_DetailRanking.columnCount()-1)
self.T_DetailRanking.insertColumn(self.T_DetailRanking.columnCount() -1)
def AddRace(self): self.T_DetailRanking.insertColumn(self.T_DetailRanking.columnCount()-1) cols = self.T_DetailRanking.columnCount() if cols == 2: self.T_DetailRanking.insertColumn(self.T_DetailRanking.columnCount()-1) cols += 1 TableHeader=[] for c in range(0, cols -1): TableHeader.append("%s %d"%("Race",(c))) TableHeader[0] = "Skipper" TableHeader.append("Tot") self.T_DetailRanking.setHorizontalHeaderLabels(TableHeader) self.T_DetailRanking.resizeColumnsToContents()
4a6883fa9bdcd802ecec733f487c07f201fcceed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2446/4a6883fa9bdcd802ecec733f487c07f201fcceed/qtclass.py
def _element_content(self, element): """ Distill the textual content recursively. Added since I do not know how to use the lib for this. (Tuttle) """ out = "" for child in element.childNodes: if child.nodeType == ELEMENT_NODE: out += self._element_content(child) elif child.nodeType == xml.dom.minidom.Node.TEXT_NODE: out += child.data return out
def _element_content(self, element): """ Distill the textual content recursively. Added since I do not know how to use the lib for this. (Tuttle) """
6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10323/6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0/catalog.py
print >> sys.stderr, 'Assuming rendered msgid in %s, not included:\n%s\n' % \ (self._curr_fn, element.toprettyxml(' '))
print >> sys.stderr, 'Assuming rendered msgid in %s, not included:\n %s\n' % \ (self._curr_fn, element.toprettyxml(' ', '\n '))
def _do_translate(self, element, domain): filename = self._curr_fn excerpt = self._make_excerpt(element) msgid = element.getAttribute('i18n:translate')
6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10323/6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0/catalog.py
msgid = self._element_content(element) print >> sys.stderr, 'Warning: Literal msgids should be avoided in %s, still adding:\n%s\n' % \ (self._curr_fn, element.toprettyxml(' '))
msgid = self._make_msgstr(element, shrink = False) print >> sys.stderr, 'Warning: Literal msgids should be avoided in %s, still adding:\n %s\n' % \ (self._curr_fn, element.toprettyxml(' ', '\n '))
def _do_translate(self, element, domain): filename = self._curr_fn excerpt = self._make_excerpt(element) msgid = element.getAttribute('i18n:translate')
6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10323/6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0/catalog.py
msgstr = self._make_msgstr(element)
msgstr = self._make_msgstr(element, shrink = True)
def _do_translate(self, element, domain): filename = self._curr_fn excerpt = self._make_excerpt(element) msgid = element.getAttribute('i18n:translate')
6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10323/6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0/catalog.py
print >> sys.stderr, 'Assuming rendered msgid in %s:\n%s\n' % \
print >> sys.stderr, 'Assuming rendered msgid in %s, not included:\n%s\n' % \
def _do_attributes(self, element, domain): rendered = [] if element.hasAttribute('tal:attributes'): attrs = element.getAttribute('tal:attributes').split(';') attrs = [attr.strip() for attr in attrs if attr.strip()] rendered = [attr.split()[0] for attr in attrs]
6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10323/6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0/catalog.py
def _make_msgstr(self, element):
def _make_msgstr(self, element, shrink = True):
def _make_msgstr(self, element): node = copy.deepcopy(element) self._make_pretty(node) msgstr = '' for child in node.childNodes: chunk = child.toxml() # XXX Do we need to escape anything else? chunk = chunk.replace('"', '\\"') chunk = ' '.join(chunk.split()) msgstr += chunk + ' '
6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10323/6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0/catalog.py
chunk = ' '.join(chunk.split()) msgstr += chunk + ' '
if shrink: chunk = ' '.join(chunk.split()) + ' ' msgstr += chunk
def _make_msgstr(self, element): node = copy.deepcopy(element) self._make_pretty(node) msgstr = '' for child in node.childNodes: chunk = child.toxml() # XXX Do we need to escape anything else? chunk = chunk.replace('"', '\\"') chunk = ' '.join(chunk.split()) msgstr += chunk + ' '
6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10323/6aa0b0eb22cae9c13a1af7deee19c79ed20b80d0/catalog.py
msgstr = msgstr.strip()
lines = msgstr.split("\n") for i in range(len(lines)): lines[i] = ' ' + lines[i].strip() msgstr = ''.join(lines).strip()
def read(self): """Reads in from all given ZPTs and builds up MessageCatalogs accordingly.
420b7965626388d804af33acc976a2fd3bbb0e06 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10323/420b7965626388d804af33acc976a2fd3bbb0e06/catalog.py
def _do_translate(self, element, domain): filename = self._curr_fn excerpt = self._make_excerpt(element) msgid = element.getAttribute('i18n:translate')
8e6a5c01cded0db142c7abd841f0022b35806c20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10323/8e6a5c01cded0db142c7abd841f0022b35806c20/catalog.py
if msgid:
else:
def _do_translate(self, element, domain): filename = self._curr_fn excerpt = self._make_excerpt(element) msgid = element.getAttribute('i18n:translate')
8e6a5c01cded0db142c7abd841f0022b35806c20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10323/8e6a5c01cded0db142c7abd841f0022b35806c20/catalog.py
attrs['i18n:attributes'].split(';')]
attrs['i18n:attributes'].split(';') if i18nattr]
def _valid_i18ned_attr(attr, attrs): """This returns 1 for attributes attr that are part of attrs and are translated using i18n:attributes. It also returns 1 for any attr that does not exist at all in attrs.""" if attrs.has_key(attr) and _translatable(attrs[attr]): if attrs.has_key('i18n:attributes'): if attrs['i18n:attributes'].find(';') == -1: # old syntax i18nattrs = [i18nattr.strip() for i18nattr in \ attrs['i18n:attributes'].split()] else: # new syntax i18nattrs = [i18nattr.strip().split()[0] for i18nattr in \ attrs['i18n:attributes'].split(';')] if not (attr in i18nattrs): return 0 else: return 1 else: return 0 return 1
f962a6e83b222e7d30b9b05cee0d5718814e4d34 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10323/f962a6e83b222e7d30b9b05cee0d5718814e4d34/untranslated.py
def merge(self,__loc_data__=None,__conflict_solve=None,**kw): """S.merge(data,conflict,k=v1,k=v2,...) -> merge data and k=v into S.
2d6ded9f7d7a6d62ac5b460b7428dd8baa77b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4224/2d6ded9f7d7a6d62ac5b460b7428dd8baa77b458/Struct.py
for key in data_dict.keys():
for key in data_dict:
def merge(self,__loc_data__=None,__conflict_solve=None,**kw): """S.merge(data,conflict,k=v1,k=v2,...) -> merge data and k=v into S.
2d6ded9f7d7a6d62ac5b460b7428dd8baa77b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4224/2d6ded9f7d7a6d62ac5b460b7428dd8baa77b458/Struct.py
origins.append([sx[i]/dar[0], center[1], center[2]])
origins.append([sx[i], center[1], center[2]])
def _add_slices(self, item, sgrid, contours=False): cvector = item.get('cvector') center = sgrid.GetCenter() dar = self._axis.get('daspect') sx, sy, sz = item.get('slices') if len(shape(sx)) == 2 and shape(sx) == shape(sy) == shape(sz): s = Surface(sx,sy,sz) sgrid2 = self._get_2d_structured_grid(s) plane = vtk.vtkStructuredGridGeometryFilter() plane.SetInput(sgrid2) plane.Update() data = self._cut_data(plane) implds = vtk.vtkImplicitDataSet() implds.SetDataSet(data.GetOutput()) implds.Modified() cut = vtk.vtkCutter() cut.SetInput(sgrid) cut.SetCutFunction(implds) cut.GenerateValues(10, -2,2) cut.GenerateCutScalarsOn() cut.Update() mapper = vtk.vtkPolyDataMapper() mapper.SetInput(cut.GetOutput()) mapper.SetLookupTable(self._axis._vtk_colormap) caxis = self._axis.get('caxis') if None in caxis: caxis = data.GetOutput().GetScalarRange() mapper.SetScalarRange(caxis) mapper.Update() actor = vtk.vtkActor() actor.SetMapper(mapper) self._set_shading(item, data, actor) self._set_actor_properties(item, actor) self._axis._renderer.AddActor(actor) self._axis._vtk_apd.AddInput(cut.GetOutput()) self._axis._vtk_apd.AddInput(data.GetOutput()) else: origins = [] normals = [] sx = ravel(sx)/dar[0] sy = ravel(sy)/dar[1] sz = ravel(sz)/dar[2] for i in range(len(sx)): normals.append([1,0,0]) origins.append([sx[i]/dar[0], center[1], center[2]]) for i in range(len(sy)): normals.append([0,1,0]) origins.append([center[0], sy[i]/dar[1], center[2]]) for i in range(len(sz)): normals.append([0,0,1]) origins.append([center[0], center[1], sz[i]/dar[2]]) for i in range(len(normals)): plane = vtk.vtkPlane() plane.SetOrigin(origins[i]) plane.SetNormal(normals[i]) cut = vtk.vtkCutter() cut.SetInput(sgrid) cut.SetCutFunction(plane) cut.Update() data = self._cut_data(cut) mapper = vtk.vtkPolyDataMapper() if contours: iso = vtk.vtkContourFilter() iso.SetInput(data.GetOutput()) if cvector is not None: for i in range(len(cvector)): iso.SetValue(i, cvector[i]) else: zmin, zmax = data.GetOutput().GetScalarRange() iso.GenerateValues(item.get('clevels'), zmin, zmax) iso.Update() mapper.SetInput(iso.GetOutput()) else: mapper.SetInput(data.GetOutput()) mapper.SetLookupTable(self._axis._vtk_colormap) caxis = self._axis.get('caxis') if None in caxis: caxis = sgrid.GetScalarRange() mapper.SetScalarRange(caxis) mapper.Update() actor = vtk.vtkActor() actor.SetMapper(mapper) if not contours: self._set_shading(item, data, actor) self._set_actor_properties(item, actor) self._axis._renderer.AddActor(actor) self._axis._vtk_apd.AddInput(cut.GetOutput())
8c9ac01e2abd6033fd126340689a7f8bfe3e4050 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/8c9ac01e2abd6033fd126340689a7f8bfe3e4050/vtk_.py
origins.append([center[0], sy[i]/dar[1], center[2]])
origins.append([center[0], sy[i], center[2]])
def _add_slices(self, item, sgrid, contours=False): cvector = item.get('cvector') center = sgrid.GetCenter() dar = self._axis.get('daspect') sx, sy, sz = item.get('slices') if len(shape(sx)) == 2 and shape(sx) == shape(sy) == shape(sz): s = Surface(sx,sy,sz) sgrid2 = self._get_2d_structured_grid(s) plane = vtk.vtkStructuredGridGeometryFilter() plane.SetInput(sgrid2) plane.Update() data = self._cut_data(plane) implds = vtk.vtkImplicitDataSet() implds.SetDataSet(data.GetOutput()) implds.Modified() cut = vtk.vtkCutter() cut.SetInput(sgrid) cut.SetCutFunction(implds) cut.GenerateValues(10, -2,2) cut.GenerateCutScalarsOn() cut.Update() mapper = vtk.vtkPolyDataMapper() mapper.SetInput(cut.GetOutput()) mapper.SetLookupTable(self._axis._vtk_colormap) caxis = self._axis.get('caxis') if None in caxis: caxis = data.GetOutput().GetScalarRange() mapper.SetScalarRange(caxis) mapper.Update() actor = vtk.vtkActor() actor.SetMapper(mapper) self._set_shading(item, data, actor) self._set_actor_properties(item, actor) self._axis._renderer.AddActor(actor) self._axis._vtk_apd.AddInput(cut.GetOutput()) self._axis._vtk_apd.AddInput(data.GetOutput()) else: origins = [] normals = [] sx = ravel(sx)/dar[0] sy = ravel(sy)/dar[1] sz = ravel(sz)/dar[2] for i in range(len(sx)): normals.append([1,0,0]) origins.append([sx[i]/dar[0], center[1], center[2]]) for i in range(len(sy)): normals.append([0,1,0]) origins.append([center[0], sy[i]/dar[1], center[2]]) for i in range(len(sz)): normals.append([0,0,1]) origins.append([center[0], center[1], sz[i]/dar[2]]) for i in range(len(normals)): plane = vtk.vtkPlane() plane.SetOrigin(origins[i]) plane.SetNormal(normals[i]) cut = vtk.vtkCutter() cut.SetInput(sgrid) cut.SetCutFunction(plane) cut.Update() data = self._cut_data(cut) mapper = vtk.vtkPolyDataMapper() if contours: iso = vtk.vtkContourFilter() iso.SetInput(data.GetOutput()) if cvector is not None: for i in range(len(cvector)): iso.SetValue(i, cvector[i]) else: zmin, zmax = data.GetOutput().GetScalarRange() iso.GenerateValues(item.get('clevels'), zmin, zmax) iso.Update() mapper.SetInput(iso.GetOutput()) else: mapper.SetInput(data.GetOutput()) mapper.SetLookupTable(self._axis._vtk_colormap) caxis = self._axis.get('caxis') if None in caxis: caxis = sgrid.GetScalarRange() mapper.SetScalarRange(caxis) mapper.Update() actor = vtk.vtkActor() actor.SetMapper(mapper) if not contours: self._set_shading(item, data, actor) self._set_actor_properties(item, actor) self._axis._renderer.AddActor(actor) self._axis._vtk_apd.AddInput(cut.GetOutput())
8c9ac01e2abd6033fd126340689a7f8bfe3e4050 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/8c9ac01e2abd6033fd126340689a7f8bfe3e4050/vtk_.py
origins.append([center[0], center[1], sz[i]/dar[2]])
origins.append([center[0], center[1], sz[i]])
def _add_slices(self, item, sgrid, contours=False): cvector = item.get('cvector') center = sgrid.GetCenter() dar = self._axis.get('daspect') sx, sy, sz = item.get('slices') if len(shape(sx)) == 2 and shape(sx) == shape(sy) == shape(sz): s = Surface(sx,sy,sz) sgrid2 = self._get_2d_structured_grid(s) plane = vtk.vtkStructuredGridGeometryFilter() plane.SetInput(sgrid2) plane.Update() data = self._cut_data(plane) implds = vtk.vtkImplicitDataSet() implds.SetDataSet(data.GetOutput()) implds.Modified() cut = vtk.vtkCutter() cut.SetInput(sgrid) cut.SetCutFunction(implds) cut.GenerateValues(10, -2,2) cut.GenerateCutScalarsOn() cut.Update() mapper = vtk.vtkPolyDataMapper() mapper.SetInput(cut.GetOutput()) mapper.SetLookupTable(self._axis._vtk_colormap) caxis = self._axis.get('caxis') if None in caxis: caxis = data.GetOutput().GetScalarRange() mapper.SetScalarRange(caxis) mapper.Update() actor = vtk.vtkActor() actor.SetMapper(mapper) self._set_shading(item, data, actor) self._set_actor_properties(item, actor) self._axis._renderer.AddActor(actor) self._axis._vtk_apd.AddInput(cut.GetOutput()) self._axis._vtk_apd.AddInput(data.GetOutput()) else: origins = [] normals = [] sx = ravel(sx)/dar[0] sy = ravel(sy)/dar[1] sz = ravel(sz)/dar[2] for i in range(len(sx)): normals.append([1,0,0]) origins.append([sx[i]/dar[0], center[1], center[2]]) for i in range(len(sy)): normals.append([0,1,0]) origins.append([center[0], sy[i]/dar[1], center[2]]) for i in range(len(sz)): normals.append([0,0,1]) origins.append([center[0], center[1], sz[i]/dar[2]]) for i in range(len(normals)): plane = vtk.vtkPlane() plane.SetOrigin(origins[i]) plane.SetNormal(normals[i]) cut = vtk.vtkCutter() cut.SetInput(sgrid) cut.SetCutFunction(plane) cut.Update() data = self._cut_data(cut) mapper = vtk.vtkPolyDataMapper() if contours: iso = vtk.vtkContourFilter() iso.SetInput(data.GetOutput()) if cvector is not None: for i in range(len(cvector)): iso.SetValue(i, cvector[i]) else: zmin, zmax = data.GetOutput().GetScalarRange() iso.GenerateValues(item.get('clevels'), zmin, zmax) iso.Update() mapper.SetInput(iso.GetOutput()) else: mapper.SetInput(data.GetOutput()) mapper.SetLookupTable(self._axis._vtk_colormap) caxis = self._axis.get('caxis') if None in caxis: caxis = sgrid.GetScalarRange() mapper.SetScalarRange(caxis) mapper.Update() actor = vtk.vtkActor() actor.SetMapper(mapper) if not contours: self._set_shading(item, data, actor) self._set_actor_properties(item, actor) self._axis._renderer.AddActor(actor) self._axis._vtk_apd.AddInput(cut.GetOutput())
8c9ac01e2abd6033fd126340689a7f8bfe3e4050 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/8c9ac01e2abd6033fd126340689a7f8bfe3e4050/vtk_.py
assert shape == cdata.shape, \
assert v.shape == cdata.shape, \
def _parseargs_isosurface(self, *args): nargs = len(args) if nargs >= 5 and nargs <= 6: # isosurface(X,Y,Z,V,isovalue) x, y, z, v = _check_xyzv(*args[:4]) isovalue = float(args[4]) elif nargs >= 2 and nargs <= 3: # isosurface(V,isovalue) x, y, z, v = _check_xyzv(args[0]) isovalue = float(args[1]) else: raise TypeError, "Wrong number of arguments"
3d4852610074c49994bb5da6e5c34e0bc7aa82ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/3d4852610074c49994bb5da6e5c34e0bc7aa82ae/common.py
legendcounter=len(ax.get('plotitems'))
def plot(self, *args, **kwargs): """Draw line and scatter plots.
d1440f554464eb2d76f851ece23ca1c31ebe15da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/d1440f554464eb2d76f851ece23ca1c31ebe15da/common.py
legendcounter = len(ax.get('plotitems'))-legendcounter
no_lines = len(lines)
def plot(self, *args, **kwargs): """Draw line and scatter plots.
d1440f554464eb2d76f851ece23ca1c31ebe15da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/d1440f554464eb2d76f851ece23ca1c31ebe15da/common.py
if len(legends) == legendcounter: for i in range(legendcounter): legend = legends[legendcounter-i-1]
if len(legends) == no_lines: for i in range(no_lines): legend = legends[no_lines-i-1]
def plot(self, *args, **kwargs): """Draw line and scatter plots.
d1440f554464eb2d76f851ece23ca1c31ebe15da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/d1440f554464eb2d76f851ece23ca1c31ebe15da/common.py
(len(legends), legendcounter)
(len(legends), no_lines)
def plot(self, *args, **kwargs): """Draw line and scatter plots.
d1440f554464eb2d76f851ece23ca1c31ebe15da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/d1440f554464eb2d76f851ece23ca1c31ebe15da/common.py
for arg in ['--Numeric', '--numarray', ' --numpy']:
for arg in ['--Numeric', '--numarray', '--numpy']: try: __import__(arg[2:]) except: print "You don't have %s installed" %arg[2:] continue
def testMeshGrid_DenseFromNodenseMeshgridOutput(self): # sparse fails for dense output when input has singleton dimensions x = seq(-2,2,0.1) y = seq(-4,4,1) xx, yy = meshgrid(x,y) # xx and yy now has singleton dimension self.assertEqual(rank(xx), 2) self.assertEqual(rank(yy), 2) self.assertEqual(multiply.reduce(xx.shape), size(xx)) self.assertEqual(multiply.reduce(yy.shape), size(yy)) # This one should fail when xx and yy is not flat as well xx, yy = meshgrid(xx.flat, yy.flat, sparse=False) # no singleton self.assertEqual(shape(xx), (size(y), size(x))) self.assertEqual(shape(yy), (size(y), size(x))) xx, yy = meshgrid(x,y) # Add singleton dimensions xx, yy = meshgrid(xx, yy, sparse=False) self.assertEqual(shape(xx), (size(y), size(x))) self.assertEqual(shape(yy), (size(y), size(x)))
cacd98c96f4cb36eb463203a218f6104a67258c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/cacd98c96f4cb36eb463203a218f6104a67258c6/numpytools.py
def NumPy_type(a): """ @param a: NumPy array @return: "Numeric", "numarray", or "numpy", depending on which module that was used to generate the a array """ # check basic_NumPy type first to avoid possible import errors types = {'Numeric': 'Numeric.ArrayType', 'numarray': 'numarray.NumArray', 'numpy': 'numpy.ndarray'} if isinstance(a, eval(types[basic_NumPy])): return basic_NumPy import Numeric if isinstance(a, Numeric.ArrayType): return 'Numeric' import numarray if isinstance(a, numarray.NumArray): return 'numarray' import numpy if isinstance(a, numpy.ndarray): return 'numpy'
c5a8aed6d13cc63474ad134ec4e66c62d02ab165 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/c5a8aed6d13cc63474ad134ec4e66c62d02ab165/numpytools.py
from easyviz.blt_ import *
from scitools.easyviz.blt_ import *
def test1(self): try: if 'pyx_' in _plts: use(_plts['pyx_'], globals()) figure() plot((2, 2, 3, 4), 'kv-', (3, 3, 4, 6), 'kv', x='auto') axis(-1, 5, -1, 10) title('A very long title') legend('line 1', 'line 2') #latextext = r"$2\pi\gamma k\Omega$" #$plt._g.text(0, 0, latextext) hold('on') plot((5, 3, 5, 5)) legend('line 3') hardcopy('testpyx.eps') except: print 'pyx_ error: \nDebugging plt' #debug(plt)
2ae24cd5ae93f874a879dbd976e819a792bad21e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/2ae24cd5ae93f874a879dbd976e819a792bad21e/unittest_.py
from easyviz.matplotlib_ import plt
from scitools.easyviz.matplotlib_ import plt
def test(self): self.setUp() try: figure() plot((1,2,3), (4,6,5), 'ro--') legend('tril') axis(0, 5, 0, 10) hold('on') plot((2,4,5), (4,4,4), '') legend('notrill', 'trill2') plot((1,2,3,4,5,6), (1,3,2,4,3,6), 'k:x') legend('nils') import Numeric x=Numeric.array((1,2,3,4)) plot(x, x**2, 'y') axis(0, 10, 0, 10) hardcopy('blt_test1.ps') figure() plot((1,2,3), 'r:', (2,3,4), 'b-', (3,4,5), 'k-.',\ (4,6,6), 'g--')#, x='auto') legend('dotted', 'solid', 'dotdashed', 'dashed') hardcopy('blt_test2.ps') figure() plot((1,10,100), log='y') hold('on') loglog((1,19,199), (10,100,1000)) legend('loglog', 'loglog') title('one scale') xlabel('x') ylabel('y') hardcopy('blt_test3.ps') except: print "Error: running debug(plt)" #debug(plt)
2ae24cd5ae93f874a879dbd976e819a792bad21e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/2ae24cd5ae93f874a879dbd976e819a792bad21e/unittest_.py
from easyviz.examples import *
from scitools.easyviz.examples import *
def test(self): self.setUp() try: figure() plot((1,2,3), (4,6,5), 'ro--') legend('tril') axis(0, 5, 0, 10) hold('on') plot((2,4,5), (4,4,4), '') legend('notrill', 'trill2') plot((1,2,3,4,5,6), (1,3,2,4,3,6), 'k:x') legend('nils') import Numeric x=Numeric.array((1,2,3,4)) plot(x, x**2, 'y') axis(0, 10, 0, 10) hardcopy('blt_test1.ps') figure() plot((1,2,3), 'r:', (2,3,4), 'b-', (3,4,5), 'k-.',\ (4,6,6), 'g--')#, x='auto') legend('dotted', 'solid', 'dotdashed', 'dashed') hardcopy('blt_test2.ps') figure() plot((1,10,100), log='y') hold('on') loglog((1,19,199), (10,100,1000)) legend('loglog', 'loglog') title('one scale') xlabel('x') ylabel('y') hardcopy('blt_test3.ps') except: print "Error: running debug(plt)" #debug(plt)
2ae24cd5ae93f874a879dbd976e819a792bad21e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/2ae24cd5ae93f874a879dbd976e819a792bad21e/unittest_.py
"python -c '''from easyviz.unittest_ import *;unittest.main()'''")
"python -c '''from scitools.easyviz.unittest_ import *;unittest.main()'''")
def main(): postscriptfiles = '' + \ " ".join(glob.glob('*.eps')) + \ " ".join(glob.glob('*.ps')) if len(postscriptfiles) > 0: print "Warning: you have old ps/eps files in testdir." print "These files might be overwritten by this test" print "The files are: ",postscriptfiles #rm *.ps *.eps *.pyc *~ -f #unittest.main() # There is a sys.exit() inside here.... if False: os.system( "python -c '''from easyviz.unittest_ import *;unittest.main()'''") suite = unittest.makeSuite(easyvizTest, 'test') suite = unittest.makeSuite(bltTest, 'test') suite = unittest.makeSuite(gnuplotTest, 'test') else: unittest.TextTestRunner(verbosity=2).run( unittest.makeSuite(easyvizTest)) if False: if os.uname()[0] == 'Linux': psviewer = 'gv' for file in glob.glob('*.ps'): os.system('%s %s &' %(psviewer, file)) for file in glob.glob('*.eps'): os.system('%s %s &' %(psviewer, file)) #raw_input('Press return when files are examined') else: show()
2ae24cd5ae93f874a879dbd976e819a792bad21e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/2ae24cd5ae93f874a879dbd976e819a792bad21e/unittest_.py
self.set(**kwargs)
def __init__(self, *args, **kwargs): PlotProperties.__init__(self, **kwargs) self._prop.update(Streams._local_prop) self._parseargs(*args) self.set(**kwargs)
b0aa04868c378158bd3e704a89c6441c72f1b5be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/b0aa04868c378158bd3e704a89c6441c72f1b5be/common.py
for key in 'stepsize tubescale ribbonwith'.split():
for key in 'stepsize tubescale ribbonwidth'.split():
def set(self, **kwargs): PlotProperties.set(self, **kwargs)
b0aa04868c378158bd3e704a89c6441c72f1b5be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/b0aa04868c378158bd3e704a89c6441c72f1b5be/common.py
def system(command, verbose=True, failure_handling='exit')
def system(command, verbose=True, failure_handling='exit'):
def system(command, verbose=True, failure_handling='exit') """ Wrapping of the os.system command. Actually, the commands.getstatusoutput function is used, and the output from the system command is fetched. @param command: operating system command to be executed. @param verbose: False: no output, True: print command. @param failure_handling: one of 'exit', 'warning', 'exception', or 'silent'. In case of failure, the output from the command is always displayed. @return: the same as commands.getstatusoutput, i.e., a boolean failure variable and the output string (result of command). """ if verbose: print 'Running operating system command\n %s' % command failure, output = commands.getstatusoutput(command) if failure: msg = 'Failure when running operating system command'\ '\n %s\nOutput:\n%s' % (command, output) if failure_handling == 'exit': print msg, '\nExecution aborted!' sys.exit(1) if failure_handling == 'warning': print 'Warning:', msg elif failure_handling == 'exception': raise OSError, msg elif failure_handling == 'silent': pass else: raise ValueError, 'wrong value "%s" of failure_handling' % \ failure_handling return failure, output
7186d5f9afc13560062bcd4cbe80b91c25dd3969 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/7186d5f9afc13560062bcd4cbe80b91c25dd3969/misc.py
- plot(y1,...,x=x)
- plot(y1,y2,...,x=x)
def plot(self, *args, **kwargs): """Draw line and scatter plots.
3d6a03460d3fcdf67eb332ad64f531dca7d361d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/3d6a03460d3fcdf67eb332ad64f531dca7d361d1/common.py
for i in range(len(args)-1): if not isinstance(args[i], str): if isinstance(args[i+1], str): lines.append(Line(x=kwargs['x'], y=args[i], format=args[1+i])) else: lines.append(Line(x=kwargs['x'], y=args[i], format='')) if i == nargs-2:
if nargs == 1 or (nargs == 2 and isinstance(args[1], str)): if nargs == 1: lines.append(Line(x=kwargs['x'], y=args[0], format='')) else: lines.append(Line(x=kwargs['x'], y=args[0], format=args[1])) else: for i in range(len(args)-1): if not isinstance(args[i], str): if isinstance(args[i+1], str):
def plot(self, *args, **kwargs): """Draw line and scatter plots.
3d6a03460d3fcdf67eb332ad64f531dca7d361d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/3d6a03460d3fcdf67eb332ad64f531dca7d361d1/common.py
y=args[i+1],
y=args[i], format=args[1+i])) else: lines.append(Line(x=kwargs['x'], y=args[i],
def plot(self, *args, **kwargs): """Draw line and scatter plots.
3d6a03460d3fcdf67eb332ad64f531dca7d361d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/3d6a03460d3fcdf67eb332ad64f531dca7d361d1/common.py
for i in range(len(args)-1): if not isinstance(args[i], str): if isinstance(args[i+1], str): lines.append(Line(x=kwargs['x'], y=kwargs['y'], z=args[i], format=args[1+i])) else: lines.append(Line(x=kwargs['x'], y=kwargs['y'], z=args[i], format='')) if i == nargs-2:
if nargs == 1 or (nargs == 2 and isinstance(args[1], str)): if nargs == 1: lines.append(Line(x=kwargs['x'], y=kwargs['y'], z=args[0], format='')) else: lines.append(Line(x=kwargs['x'], y=kwargs['y'], z=args[0], format=args[1])) else: for i in range(len(args)-1): if not isinstance(args[i], str): if isinstance(args[i+1], str):
def plot3(self, *args, **kwargs): """Draw lines and points in 3D space.
3d6a03460d3fcdf67eb332ad64f531dca7d361d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/3d6a03460d3fcdf67eb332ad64f531dca7d361d1/common.py
z=args[i+1],
z=args[i], format=args[1+i])) else: lines.append(Line(x=kwargs['x'], y=kwargs['y'], z=args[i],
def plot3(self, *args, **kwargs): """Draw lines and points in 3D space.
3d6a03460d3fcdf67eb332ad64f531dca7d361d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4727/3d6a03460d3fcdf67eb332ad64f531dca7d361d1/common.py
self._browser = WebBrowser()
self._browser = WebView()
def __init__(self, browser=None): Activity.__init__(self)
8946f4e47fa34eab98c9b86bf7d960fc567018da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6905/8946f4e47fa34eab98c9b86bf7d960fc567018da/webactivity.py
s = re.sub('&[A-Za-z.-]*;', ' ', s) s = re.sub('<[a-zA-Z0-9 =\\\\":/.-_?]*>', ' ', s) s = re.sub('<[a-zA-Z0-9 =\\\\":/.-_?]*/>', ' ', s) s = re.sub('</[a-zA-Z0-9]*>', ' ', s)
s = re.sub('&[^;]*;', ' ', s) s = re.sub('<[^>]*>', ' ', s) s = re.sub('<[^>]*/>', ' ', s) s = re.sub('</[^>]*>', ' ', s)
def getCleanMsgstr(self): s = self.getMsgstr() space = ('\\n', '\\t') empty = ('&',) import re s = re.sub('&[A-Za-z.-]*;', ' ', s) s = re.sub('<[a-zA-Z0-9 =\\\\":/.-_?]*>', ' ', s) s = re.sub('<[a-zA-Z0-9 =\\\\":/.-_?]*/>', ' ', s) s = re.sub('</[a-zA-Z0-9]*>', ' ', s) for t in space: s = s.replace(t, ' ') for t in empty: s = s.replace(t, '') return s
88a1cba5ce0a6a8c69383456ac6248279556d765 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/13181/88a1cba5ce0a6a8c69383456ac6248279556d765/POFile.py
if x < lts - lwf + 1 and textToSearch[x + lwf] in string.letters:
if x < lts - lwf - 1 and textToSearch[x + lwf] in string.letters:
def searchWordInText(self, wordToFind, textToSearch, context, index): x = textToSearch.find(wordToFind, index) if x < 0: return (x, None) lwf = len(wordToFind) lts = len(textToSearch) if x > 0 and textToSearch[x - 1] in string.letters: return (x, None) if x < lts - lwf + 1 and textToSearch[x + lwf] in string.letters: return (x, None) xa, ea = x - context, '...' if xa < 0: xa, ea = 0, '' xb, eb = x + lwf + context, '...' if xb > lts: xb, eb = lts, '' return (x, ea + textToSearch[xa:xb] + eb)
665f0f099af255ae9f2a0d89a171ad7faab69c3a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/13181/665f0f099af255ae9f2a0d89a171ad7faab69c3a/POFile.py
print "usage: %s connstring [-d dblib] outdir [propsfile]" % progname
print "usage: %s [-d dbmodule] connstring outdir [propsfile]" % progname
def usage_exit(progname, msg=None): if msg: print msg print print "usage: %s connstring [-d dblib] outdir [propsfile]" % progname sys.exit(2)
b7faa9968d0f0a325d29adbb8ce038e16354a472 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4243/b7faa9968d0f0a325d29adbb8ce038e16354a472/pgdbdoc.py
def get_columns(self): return map(self.get_column, self._colnames)
0e0ee7904b1aeaa8825b9dcf8017a6e10f67bc82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4243/0e0ee7904b1aeaa8825b9dcf8017a6e10f67bc82/pgschema.py
def get_column_names(self): return self._col_names
0e0ee7904b1aeaa8825b9dcf8017a6e10f67bc82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4243/0e0ee7904b1aeaa8825b9dcf8017a6e10f67bc82/pgschema.py
nullable = (notnull != 't')
assert notnull in ('t', 'f', 1, 0), notnull nullable = (notnull not in ('t', 1))
def _get_column_info(conn): Q = """SELECT c.relname, a.attname, t.typname, a.attlen, a.attnotnull, a.atthasdef, a.atttypmod FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname !~ '^pg_' and c.relname !~ '^Inv' and c.relkind = 'r' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid""" tables = {} for table, attr, typ, length, notnull, hasdef, typmod in _query(conn, Q): t = tables.get(table, None) if not t: t = [] tables[table] = t nullable = (notnull != 't') hasdef = (hasdef == 't') if length == -1: length = typmod t.append((attr, typ, nullable, hasdef, length)) return tables
0e0ee7904b1aeaa8825b9dcf8017a6e10f67bc82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4243/0e0ee7904b1aeaa8825b9dcf8017a6e10f67bc82/pgschema.py
self._index_items.append((table.name, "table", tablefilename))
self._index_items.append((table.name, "table", "table-%s.html" % table.name))
def _generate_table_pages(self): for table in self.tables: print "doing table", table.name tablefilename = os.path.join(self.outdir, "table-%s.html" % table.name) self._index_items.append((table.name, "table", tablefilename)) f = open(tablefilename, 'w') nav = '<a href="index.html">Table index</a> | <a href="symbol-index.html">Symbol index</a> | %s' % table.name f.write(self._standard_header(table.name, nav)) f.write('<h1>Table %s</h1>\n' % table.name) f.write('<hr noshade size=1>\n') shortdesc = self.descs.get('table.%s.shortdesc' % table.name, None) if shortdesc: f.write('<p>%s</p>\n' % shortdesc) notes = self.descs.get('table.%s.notes' % table.name, None) if notes: f.write('<h2>Notes</h2>\n') f.write(notes) # allows html f.write('<h2>Columns</h2>\n') f.write('<table border=1>\n<tr bgcolor="%s"><th>Column</th><th>Type</th><th>Nullable</th><th>Default</th><th>Description</th></tr>\n' % self.heading_bg_colour) for col in table.get_columns(): self._index_items.append((col.name, "column in table %s" % table.name, "table-%s.html#col-%s" % (table.name, col.name))) f.write('<tr>') pkey = (col.name == table.primary_key_name) if pkey: name_str = '<strong>%s</strong>' % col.name else: name_str = col.name if col.references is not None: other_table, other_col = col.references f.write('<td><a href="table-%s.html#col-%s">%s</a></td>' % (other_table, other_col, name_str)) else: f.write('<td>%s</td>' % name_str) f.write('<td>%s (%s)</td>' % (col.type, col.length)) f.write('<td>%s</td>' % (col.nullable and 'yes' or 'no')) f.write('<td>%s</td>' % (col.default_value)) col_desc = self.descs.get('table.%s.column.%s.shortdesc' % (table.name, col.name), "&nbsp;") f.write('<td>%s</td>' % col_desc) f.write('</tr>\n')
55145ff960540f212d14478508c2b47ce0c3ec0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4243/55145ff960540f212d14478508c2b47ce0c3ec0b/dbdoc.py
tgargs = string.split(tgargs, '\\000')
if string.find(tgargs, '\000') != -1: tgargs = string.split(tgargs, '\000') else: tgargs = string.split(tgargs, '\\000') if len(tgargs) != 7: raise RuntimeError, "error parsing trigger args for foreign key: %s" \ % repr(tgargs)
def _get_foreign_keys(conn): """Find foreign keys by looking at triggers. (Query adapted from query posted to pgsql-general by Michael Fork according to http://www.geocrawler.com/mail/msg.php3?msg_id=4895586&list=12) """ fkeys = {} for (tgargs,) in _query(conn, ''' SELECT pt.tgargs FROM pg_class pc, pg_proc pg_proc, pg_proc pg_proc_1, pg_trigger pg_trigger, pg_trigger pg_trigger_1, pg_proc pp, pg_trigger pt WHERE pt.tgrelid = pc.oid AND pp.oid = pt.tgfoid AND pg_trigger.tgconstrrelid = pc.oid AND pg_proc.oid = pg_trigger.tgfoid AND pg_trigger_1.tgfoid = pg_proc_1.oid AND pg_trigger_1.tgconstrrelid = pc.oid AND ((pp.proname LIKE '%ins') AND (pg_proc.proname LIKE '%upd') AND (pg_proc_1.proname LIKE '%del') AND (pg_trigger.tgrelid=pt.tgconstrrelid) AND (pg_trigger_1.tgrelid = pt.tgconstrrelid))'''): tgargs = string.split(tgargs, '\\000') (name, owner_table, referenced_table, unknown, column, referenced_table_pkey, blank) = tgargs t = fkeys.get(owner_table, None) if not t: t = {} fkeys[owner_table] = t t[column] = (referenced_table, referenced_table_pkey) return fkeys
0509e814fcecf4c755d5c98cbee943439ce01c0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4243/0509e814fcecf4c755d5c98cbee943439ce01c0c/pgschema.py
cols = string.replace(cols, ' ', ',')
def first(row): return row[0]
0509e814fcecf4c755d5c98cbee943439ce01c0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4243/0509e814fcecf4c755d5c98cbee943439ce01c0c/pgschema.py
decode(data_type, 'DATE', 11,
decode(data_type, 'DATE', '11',
def _get_column_info(conn): "Get a dictionary of (table, [list of column details]) tuples for all tables" # AJT 13.11.2001 - Note date is hard coded to '11'. Probably should special # case this in the documentation class to ignore the length of dates. stmt = """SELECT table_name, column_name, data_type, nullable, decode(default_length, NULL, 0, 1) hasdef, decode(data_type, 'DATE', 11, 'NUMBER', nvl(data_precision,38)||'.'||data_scale, data_length) data_length FROM user_tab_columns""" tables = {} for table, attr, typ, notnull, hasdef, length in _query(conn, stmt): t = tables.get(table, None) if not t: t = [] tables[table] = t # If notnull is not one of 'Y' or 'N' raise AssertionError assert notnull in ('Y', 'N'), notnull nullable = (notnull == 'Y') t.append((attr, typ, nullable, hasdef, length)) return tables
b0381eb0deed5317a5e4c83a4ecea7abc5e74dcc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4243/b0381eb0deed5317a5e4c83a4ecea7abc5e74dcc/oraschema.py
for table, attr, typ, notnull, hasdef, length in _query(conn, stmt):
for table, attr, typ, nullable, hasdef, length in _query(conn, stmt):
def _get_column_info(conn): "Get a dictionary of (table, [list of column details]) tuples for all tables" # AJT 13.11.2001 - Note date is hard coded to '11'. Probably should special # case this in the documentation class to ignore the length of dates. stmt = """SELECT table_name, column_name, data_type, nullable, decode(default_length, NULL, 0, 1) hasdef, decode(data_type, 'DATE', 11, 'NUMBER', nvl(data_precision,38)||'.'||data_scale, data_length) data_length FROM user_tab_columns""" tables = {} for table, attr, typ, notnull, hasdef, length in _query(conn, stmt): t = tables.get(table, None) if not t: t = [] tables[table] = t # If notnull is not one of 'Y' or 'N' raise AssertionError assert notnull in ('Y', 'N'), notnull nullable = (notnull == 'Y') t.append((attr, typ, nullable, hasdef, length)) return tables
b0381eb0deed5317a5e4c83a4ecea7abc5e74dcc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4243/b0381eb0deed5317a5e4c83a4ecea7abc5e74dcc/oraschema.py
assert notnull in ('Y', 'N'), notnull nullable = (notnull == 'Y')
assert nullable in ('Y', 'N'), nullable nullable = (nullable == 'Y')
def _get_column_info(conn): "Get a dictionary of (table, [list of column details]) tuples for all tables" # AJT 13.11.2001 - Note date is hard coded to '11'. Probably should special # case this in the documentation class to ignore the length of dates. stmt = """SELECT table_name, column_name, data_type, nullable, decode(default_length, NULL, 0, 1) hasdef, decode(data_type, 'DATE', 11, 'NUMBER', nvl(data_precision,38)||'.'||data_scale, data_length) data_length FROM user_tab_columns""" tables = {} for table, attr, typ, notnull, hasdef, length in _query(conn, stmt): t = tables.get(table, None) if not t: t = [] tables[table] = t # If notnull is not one of 'Y' or 'N' raise AssertionError assert notnull in ('Y', 'N'), notnull nullable = (notnull == 'Y') t.append((attr, typ, nullable, hasdef, length)) return tables
b0381eb0deed5317a5e4c83a4ecea7abc5e74dcc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4243/b0381eb0deed5317a5e4c83a4ecea7abc5e74dcc/oraschema.py
if self.protocol not in [ '1910' ] :
if self.protocol not in [ '0014' ] :
def __init__( self , host = '127.0.0.1' , port = 5154 ) :
45d4f996af16b74a08c47af45bd03809288e613d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4604/45d4f996af16b74a08c47af45bd03809288e613d/bzfquery.py
data = struct.unpack( '>18H' , data )
data = struct.unpack( '>21H' , data )
def queryGame( self ) :
45d4f996af16b74a08c47af45bd03809288e613d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4604/45d4f996af16b74a08c47af45bd03809288e613d/bzfquery.py
redSize , greenSize , blueSize , purpleSize , rogueMax , \ redMax , greenMax , blueMax , purpleMax , shakeWins , \ shakeTimeout , maxPlayerScore , maxTeamScore , maxTime \
redSize , greenSize , blueSize , purpleSize , obsSize, \ rogueMax , redMax , greenMax , blueMax , purpleMax , obsMax, \ shakeWins , shakeTimeout , maxPlayerScore , maxTeamScore , \ maxTime , elapsedTime \
def queryGame( self ) :
45d4f996af16b74a08c47af45bd03809288e613d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4604/45d4f996af16b74a08c47af45bd03809288e613d/bzfquery.py
'rogue' : ( rogueSize , rogueMax ) , 'red' : ( redSize , redMax ) , 'green' : ( greenSize , greenMax ) , 'blue' : ( blueSize , blueMax ) , 'purple' : ( purpleSize , purpleMax ) ,
'rogue' : ( rogueSize , rogueMax ) , 'red' : ( redSize , redMax ) , 'green' : ( greenSize , greenMax ) , 'blue' : ( blueSize , blueMax ) , 'purple' : ( purpleSize , purpleMax ) , 'observer' : ( obsSize , obsMax ) ,
def queryGame( self ) :
45d4f996af16b74a08c47af45bd03809288e613d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4604/45d4f996af16b74a08c47af45bd03809288e613d/bzfquery.py
'maxTime' : maxTime / 10.
'maxTime' : maxTime / 10 , 'elapsedTime' : elapsedTime / 10 ,
def queryGame( self ) :
45d4f996af16b74a08c47af45bd03809288e613d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4604/45d4f996af16b74a08c47af45bd03809288e613d/bzfquery.py
sys.stderr.write(filename + '\n')
def check_file(filename, lines): sys.stderr.write(filename + '\n') line_checks = [ check_tab_characters, check_long_lines ] token_checks = [ check_double_semicolons, check_missing_spaces_around, check_missing_spaces_after, check_extra_spaces_after, check_missing_spaces_before, check_extra_spaces_before, check_spaced_unary_pm, check_singlular_opening_braces, check_keyword_spacing, check_multistatements, check_oneliners, check_eol_operators, check_function_call_spaces, check_return_case_parentheses, check_boolean_comparisons, check_boolean_arguments ] # Check trailing spaces and then pre-rstrip lines, after tokenization # we can lstrip them too warnings = [] check_trailing_spaces(lines, warnings) lines = [l.rstrip() for l in lines] for check in line_checks: check(lines, warnings) tokens = tokenize(lines, warnings) find_matching_parentheses(tokens) lines = [l.lstrip() for l in lines] for check in token_checks: check(tokens, lines, warnings) warnings.sort() for w in warnings: print '%s:%d: %s' % (filename, w[0]+1, w[1])
a5f7b4634641d427bf087aa72f85d5dcceb025ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/a5f7b4634641d427bf087aa72f85d5dcceb025ef/check-coding-style.py
line = re.sub(r'[bB]ug '<a href="' + bugzilla_url + '\\1">\\g<0></a>', line)
def format_date(d): # Don't depend on locale months = (None, 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') d = time.strptime(d, '%Y-%m-%d') return '%s %d, %d' % (months[d.tm_mon], d.tm_mday, d.tm_year)
d298711b9a325b8a808cc15c7dbfada5395f6b17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/d298711b9a325b8a808cc15c7dbfada5395f6b17/gen-news.py
re_enum = re.compile(r'^\s+(?P<ident>[A-Z][A-Z0-9_]+)\s*=', re.M)
re_enum = re.compile(r'^\s+(?P<ident>[A-Z][A-Z0-9_]+)\s*[=,]', re.M)
command -nargs=+ HiLink hi def link <args>
f7d9779be336dd165ada7dd3923f3f7d87d4a728 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/f7d9779be336dd165ada7dd3923f3f7d87d4a728/vim-syn-gen.py
def print_decls(decldict):
def print_decls(decldict, value):
def print_decls(decldict): for t, d in decldict.items(): d = d.keys() if not d: continue d.sort() print 'syn keyword %s%s %s' % (syntax_name, normalize(t), ' '.join(d))
f7d9779be336dd165ada7dd3923f3f7d87d4a728 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/f7d9779be336dd165ada7dd3923f3f7d87d4a728/vim-syn-gen.py
d = d.keys()
d = [k for k, v in d.items() if v == value]
def print_decls(decldict): for t, d in decldict.items(): d = d.keys() if not d: continue d.sort() print 'syn keyword %s%s %s' % (syntax_name, normalize(t), ' '.join(d))
f7d9779be336dd165ada7dd3923f3f7d87d4a728 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/f7d9779be336dd165ada7dd3923f3f7d87d4a728/vim-syn-gen.py
depdecls = dict([(x, {}) for x in types])
deprecated_found = False identdefs = {}
def override(decldict, overides): for o, v in overides.items(): v = v.upper() has_it = False for k, d in decldict.items(): if d.has_key(o): has_it = True del d[o] if has_it: decldict[v][o] = 1
f7d9779be336dd165ada7dd3923f3f7d87d4a728 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/f7d9779be336dd165ada7dd3923f3f7d87d4a728/vim-syn-gen.py
insert_to = depdecls
value = 'deprecated' deprecated_found = True
def override(decldict, overides): for o, v in overides.items(): v = v.upper() has_it = False for k, d in decldict.items(): if d.has_key(o): has_it = True del d[o] if has_it: decldict[v][o] = 1
f7d9779be336dd165ada7dd3923f3f7d87d4a728 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/f7d9779be336dd165ada7dd3923f3f7d87d4a728/vim-syn-gen.py
insert_to = decls
value = None
def override(decldict, overides): for o, v in overides.items(): v = v.upper() has_it = False for k, d in decldict.items(): if d.has_key(o): has_it = True del d[o] if has_it: decldict[v][o] = 1
f7d9779be336dd165ada7dd3923f3f7d87d4a728 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/f7d9779be336dd165ada7dd3923f3f7d87d4a728/vim-syn-gen.py
insert_to[d['type']][d['ident']] = 1
m = re_ident_macro.search(d['body']) if m: identdefs[d['ident']] = m.group('ident') decls[d['type']][d['ident']] = value
def override(decldict, overides): for o, v in overides.items(): v = v.upper() has_it = False for k, d in decldict.items(): if d.has_key(o): has_it = True del d[o] if has_it: decldict[v][o] = 1
f7d9779be336dd165ada7dd3923f3f7d87d4a728 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/f7d9779be336dd165ada7dd3923f3f7d87d4a728/vim-syn-gen.py
insert_to['CONSTANT'][e.group('ident')] = 1
decls['CONSTANT'][e.group('ident')] = value for macro, body in identdefs.items(): for k, d in decls.items(): if not d.has_key(body): continue if k == 'FUNCTION' or k == 'MACRO': decls['MACRO'][macro] = decls['DEFINE'][macro] del decls['DEFINE'][macro]
def override(decldict, overides): for o, v in overides.items(): v = v.upper() has_it = False for k, d in decldict.items(): if d.has_key(o): has_it = True del d[o] if has_it: decldict[v][o] = 1
f7d9779be336dd165ada7dd3923f3f7d87d4a728 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/f7d9779be336dd165ada7dd3923f3f7d87d4a728/vim-syn-gen.py
override(depdecls, options['override'])
def override(decldict, overides): for o, v in overides.items(): v = v.upper() has_it = False for k, d in decldict.items(): if d.has_key(o): has_it = True del d[o] if has_it: decldict[v][o] = 1
f7d9779be336dd165ada7dd3923f3f7d87d4a728 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/f7d9779be336dd165ada7dd3923f3f7d87d4a728/vim-syn-gen.py
print_decls(decls) if [x for x in depdecls.values() if x]:
print_decls(decls, None) if deprecated_found:
def override(decldict, overides): for o, v in overides.items(): v = v.upper() has_it = False for k, d in decldict.items(): if d.has_key(o): has_it = True del d[o] if has_it: decldict[v][o] = 1
f7d9779be336dd165ada7dd3923f3f7d87d4a728 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/f7d9779be336dd165ada7dd3923f3f7d87d4a728/vim-syn-gen.py
print_decls(depdecls)
print_decls(decls, 'deprecated')
def override(decldict, overides): for o, v in overides.items(): v = v.upper() has_it = False for k, d in decldict.items(): if d.has_key(o): has_it = True del d[o] if has_it: decldict[v][o] = 1
f7d9779be336dd165ada7dd3923f3f7d87d4a728 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/f7d9779be336dd165ada7dd3923f3f7d87d4a728/vim-syn-gen.py
if not export_deprecated and d.body.find('<DEPRECATED/>'):
if not export_deprecated and d.body.find('<DEPRECATED/>') > -1:
def __init__(self, mapping): self.__dict__.update(mapping)
3b3a16de35cc2eb71cf93cfcc152c886b02127f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/3b3a16de35cc2eb71cf93cfcc152c886b02127f9/vim-syn-gen.py
mean_value = (min(a) + max(a))/2.0
mirror = min(a) + max(a)
def run(args): run_mode = args.pop(0) assert run_mode in run_modes filename = args.pop(0) data = Gwyddion.dump.read(filename) dfield = data['/0/data'] a = dfield['data'] n = len(a) mean_value = (min(a) + max(a))/2.0 for i in range(n): a[i] = mean_value - a[i] Gwyddion.dump.write(data, filename)
2a985203d3906454fb40e78992e5a6a752fd3300 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/2a985203d3906454fb40e78992e5a6a752fd3300/invert_python.py
a[i] = mean_value - a[i]
a[i] = mirror - a[i]
def run(args): run_mode = args.pop(0) assert run_mode in run_modes filename = args.pop(0) data = Gwyddion.dump.read(filename) dfield = data['/0/data'] a = dfield['data'] n = len(a) mean_value = (min(a) + max(a))/2.0 for i in range(n): a[i] = mean_value - a[i] Gwyddion.dump.write(data, filename)
2a985203d3906454fb40e78992e5a6a752fd3300 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/2a985203d3906454fb40e78992e5a6a752fd3300/invert_python.py
makefile = get_file('Makefile.am')
try: makefile = get_file('Makefile.am') except IOError: return
def recurse(each): cwd = os.getcwd() makefile = get_file('Makefile.am') each(makefile) subdirs = get_list(makefile, 'SUBDIRS') for s in subdirs: os.chdir(s) recurse(each) os.chdir(cwd)
b41841f0a546a718e653ddee5491445caf99992d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/b41841f0a546a718e653ddee5491445caf99992d/update-msvc.py
for i, t in enumerate(tokens):
for t in tokens:
def check_missing_spaces_around(tokens, lines, warnings): "Check for missing spaces around <, >, =, etc." operators = '<', '>', '&&', '||', '?', '{' for i, t in enumerate(tokens): if t.typ != Token.punct: continue if t.string not in operators and t.string.find('=') == -1: continue prec = tokens[i-1] mbefore = prec.line == t.line and prec.end == t.col succ = tokens[i+1] mafter = succ.line == t.line and t.end == succ.col w = (None, 'Missing space before `%s\' (col %d): %s', 'Missing space after `%s\' (col %d): %s', 'Missing spaces around `%s\' (col %d): %s')[mbefore + 2*mafter] if w: warnings.append((t.line, w % (t.string, t.col, lines[t.line])))
ecf9bde6b618739f9ef7098da2a7ad267a2f3d5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/ecf9bde6b618739f9ef7098da2a7ad267a2f3d5f/check-coding-style.py
prec = tokens[i-1] mbefore = prec.line == t.line and prec.end == t.col succ = tokens[i+1] mafter = succ.line == t.line and t.end == succ.col
mbefore = t.prec.line == t.line and t.prec.end == t.col mafter = t.succ.line == t.line and t.end == t.succ.col
def check_missing_spaces_around(tokens, lines, warnings): "Check for missing spaces around <, >, =, etc." operators = '<', '>', '&&', '||', '?', '{' for i, t in enumerate(tokens): if t.typ != Token.punct: continue if t.string not in operators and t.string.find('=') == -1: continue prec = tokens[i-1] mbefore = prec.line == t.line and prec.end == t.col succ = tokens[i+1] mafter = succ.line == t.line and t.end == succ.col w = (None, 'Missing space before `%s\' (col %d): %s', 'Missing space after `%s\' (col %d): %s', 'Missing spaces around `%s\' (col %d): %s')[mbefore + 2*mafter] if w: warnings.append((t.line, w % (t.string, t.col, lines[t.line])))
ecf9bde6b618739f9ef7098da2a7ad267a2f3d5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/ecf9bde6b618739f9ef7098da2a7ad267a2f3d5f/check-coding-style.py
for i, t in enumerate(tokens):
for t in tokens:
def check_missing_spaces_after(tokens, lines, warnings): "Check for missing spaces after comma, colon" operators = ',', ':' for i, t in enumerate(tokens): if t.typ != Token.punct or t.string not in operators: continue succ = tokens[i+1] if succ.line == t.line and t.end == succ.col: w = 'Missing space after `%s\' (col %d): %s' warnings.append((t.line, w % (t.string, t.col, lines[t.line])))
ecf9bde6b618739f9ef7098da2a7ad267a2f3d5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/ecf9bde6b618739f9ef7098da2a7ad267a2f3d5f/check-coding-style.py
succ = tokens[i+1] if succ.line == t.line and t.end == succ.col:
if t.succ.line == t.line and t.end == t.succ.col:
def check_missing_spaces_after(tokens, lines, warnings): "Check for missing spaces after comma, colon" operators = ',', ':' for i, t in enumerate(tokens): if t.typ != Token.punct or t.string not in operators: continue succ = tokens[i+1] if succ.line == t.line and t.end == succ.col: w = 'Missing space after `%s\' (col %d): %s' warnings.append((t.line, w % (t.string, t.col, lines[t.line])))
ecf9bde6b618739f9ef7098da2a7ad267a2f3d5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/ecf9bde6b618739f9ef7098da2a7ad267a2f3d5f/check-coding-style.py
for i, t in enumerate(tokens):
for t in tokens:
def check_missing_spaces_before(tokens, lines, warnings): "Check for missing spaces before }" operators = '}', for i, t in enumerate(tokens): if t.typ != Token.punct or t.string not in operators: continue prec = tokens[i-1] if prec.line == t.line and prec.end == t.col: w = 'Missing space before `%s\' (col %d): %s' warnings.append((t.line, w % (t.string, t.col, lines[t.line])))
ecf9bde6b618739f9ef7098da2a7ad267a2f3d5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6171/ecf9bde6b618739f9ef7098da2a7ad267a2f3d5f/check-coding-style.py