rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
y = thisy+(dy-leading*0.5)*0.5 | y = thisy+(dy-ascent)*0.5 | def gAdd(t,g=g,fontName=fontName,fontSize=fontSize,fillColor=fillColor): t.fontName = fontName t.fontSize = fontSize t.fillColor = fillColor return g.add(t) | 030d1df2dc08e0680a9f483f0a28a57ca1b14ebe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/030d1df2dc08e0680a9f483f0a28a57ca1b14ebe/legends.py |
y = y - leading | y = y-leading | def gAdd(t,g=g,fontName=fontName,fontSize=fontSize,fillColor=fillColor): t.fontName = fontName t.fontSize = fontSize t.fillColor = fillColor return g.add(t) | 030d1df2dc08e0680a9f483f0a28a57ca1b14ebe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/030d1df2dc08e0680a9f483f0a28a57ca1b14ebe/legends.py |
y = y - leading | y = y-leading | def gAdd(t,g=g,fontName=fontName,fontSize=fontSize,fillColor=fillColor): t.fontName = fontName t.fontSize = fontSize t.fillColor = fillColor return g.add(t) | 030d1df2dc08e0680a9f483f0a28a57ca1b14ebe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/030d1df2dc08e0680a9f483f0a28a57ca1b14ebe/legends.py |
canv.scale(0.67, 0.67) canv.translate(self.pageWidth / 6.0, self.pageHeight / 3.0) | scale_amt = (min(pageSize)/float(max(pageSize)))*.95 canv.translate(.025*self.pageHeight, (self.pageWidth/2.0) + 5) canv.scale(scale_amt, scale_amt) | def saveAsPresentation(self): """Write the PDF document, one slide per page.""" if self.verbose: print 'saving presentation...' pageSize = (self.pageWidth, self.pageHeight) if self.sourceFilename: filename = os.path.splitext(self.sourceFilename)[0] + '.pdf' if self.outDir: filename = os.path.join(self.outDir,os.path.basename(filename)) if self.verbose: print filename #canv = canvas.Canvas(filename, pagesize = pageSize) outfile = getStringIO() canv = canvas.Canvas(outfile, pagesize = pageSize) canv.setPageCompression(self.compression) canv.setPageDuration(self.pageDuration) if self.title: canv.setTitle(self.title) if self.author: canv.setAuthor(self.author) if self.subject: canv.setSubject(self.subject) | 603b9f0c568d5af53fb64a9ccfd5a1475379dfed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/603b9f0c568d5af53fb64a9ccfd5a1475379dfed/pythonpoint.py |
'bulletIndent':0 | 'bulletIndent':0, 'textColor': black | def listAttrs(self): print 'name =', self.name print 'parent =', self.parent keylist = self.defaults.keys() keylist.sort() for key in keylist: value = self.attributes.get(key, None) if value: print '%s = %s (direct)' % (key, value) else: #try for inherited value = getattr(self.parent, key, None) if value: print '%s = %s (inherited)' % (key, value) else: value = self.defaults[key] print '%s = %s (class default)' % (key, value) | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
'color': (0,0,0) | 'color': black | def listAttrs(self): print 'name =', self.name print 'parent =', self.parent keylist = self.defaults.keys() keylist.sort() for key in keylist: value = self.attributes.get(key, None) if value: print '%s = %s (direct)' % (key, value) else: #try for inherited value = getattr(self.parent, key, None) if value: print '%s = %s (inherited)' % (key, value) else: value = self.defaults[key] print '%s = %s (class default)' % (key, value) | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
'color':(1,1,1), | 'color':white, | def prepareCanvas(self, canvas): """You can ask a LineStyle to set up the canvas for drawing the lines.""" canvas.setLineWidth(1) #etc. etc. | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
self.text = cleanBlockQuotedText(text) | text = cleanBlockQuotedText(text) self.text = text | def __init__(self, text, style, bulletText = None): self.text = cleanBlockQuotedText(text) self.style = style self.bulletText = bulletText self.debug = 0 #turn this on to see a pretty one with all the margins etc. | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
text = cleanBlockQuotedText(self.text) | def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text) | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
|
text = self.text | def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text) | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
|
def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text) | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
||
canvas.setFillColorRGB(0.9,0.9,0.9) | canvas.setFillColor(Color(0.9,0.9,0.9)) | def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text) | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
canvas.setFillColorRGB(1.0,1.0,0.0) | canvas.setFillColor(Color(1.0,1.0,0.0)) | def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text) | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text) | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
||
def __init__(self, text, style, bulletText = None, dedent=0): self.style = style self.bulletText = bulletText | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
||
def draw(self): #call another method for historical reasons. Besides, I #suspect I will be playing with alternate drawing routines #so not doing it here makes it easier to switch. | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
||
canvas.setStrokeColorRGB(1,0,0) | canvas.setStrokeColor(red) | def myFirstPage(canvas, doc): canvas.saveState() canvas.setStrokeColorRGB(1,0,0) canvas.setLineWidth(5) canvas.line(66,72,66,PAGE_HEIGHT-72) canvas.setFont('Times-Bold',24) canvas.drawString(108, PAGE_HEIGHT-108, "PLATYPUS") canvas.setFont('Times-Roman',12) canvas.drawString(4 * inch, 0.75 * inch, "First Page") canvas.restoreState() | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
canvas.setStrokeColorRGB(1,0,0) | canvas.setStrokeColor(red) | def myLaterPages(canvas, doc): #canvas.drawImage("snkanim.gif", 36, 36) canvas.saveState() canvas.setStrokeColorRGB(1,0,0) canvas.setLineWidth(5) canvas.line(66,72,66,PAGE_HEIGHT-72) canvas.setFont('Times-Roman',12) canvas.drawString(4 * inch, 0.75 * inch, "Page %d" % doc.page) canvas.restoreState() | 4dd2d12518353ba3030029bc130c21d5f071c2c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4dd2d12518353ba3030029bc130c21d5f071c2c9/layout.py |
fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d') | fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) | def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): "Saves copies of self in desired location and formats" ext = '' if not fnRoot: fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d') try: fnRoot = % getattr(self,'chartId',0) except TypeError, err: if err != 'not all arguments converted': raise | cfa79c7ddbdf6eff45d09f8333995feca09e5403 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/cfa79c7ddbdf6eff45d09f8333995feca09e5403/shapes.py |
fnRoot = % getattr(self,'chartId',0) | fnRoot = fnRoot % getattr(self,'chartId',0) | def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): "Saves copies of self in desired location and formats" ext = '' if not fnRoot: fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d') try: fnRoot = % getattr(self,'chartId',0) except TypeError, err: if err != 'not all arguments converted': raise | cfa79c7ddbdf6eff45d09f8333995feca09e5403 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/cfa79c7ddbdf6eff45d09f8333995feca09e5403/shapes.py |
fnroot = os.path.normpath(os.path.join(outDir,fnRoot)) | def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): "Saves copies of self in desired location and formats" ext = '' if not fnRoot: fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d') try: fnRoot = % getattr(self,'chartId',0) except TypeError, err: if err != 'not all arguments converted': raise | cfa79c7ddbdf6eff45d09f8333995feca09e5403 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/cfa79c7ddbdf6eff45d09f8333995feca09e5403/shapes.py |
|
return 0.001 * reduce(operator_add,map(width,text)) * size | return 0.001 * reduce(operator_add,map(width,text), 0) * size | def stringWidth(self, text, size, encoding='utf-8'): "Calculate text width" if type(text) is not UnicodeType: text = unicode(text, encoding or 'utf-8') # encoding defaults to utf-8 width = lambda x,f=self.face.getCharWidth: f(ord(x)) return 0.001 * reduce(operator_add,map(width,text)) * size | f88185801154b6a79b39a6a254f1e9c638b0b406 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/f88185801154b6a79b39a6a254f1e9c638b0b406/ttfonts.py |
self._curweight = self._curcolor = self._curcellstyle = None | def __init__(self, data, colWidths=None, rowHeights=None, style=None, repeatRows=0, repeatCols=0, splitByRow=1): #print "colWidths", colWidths self.hAlign = 'CENTER' self._nrows = nrows = len(data) if len(data)==0 or type(data) not in _SeqTypes: raise ValueError, "%s must have at least 1 row" % self.identity() ncols = max(map(_rowLen,data)) if not ncols: raise ValueError, "%s must have at least 1 column" % self.identity() if colWidths is None: colWidths = ncols*[None] elif len(colWidths) != ncols: raise ValueError, "%s data error - %d columns in data but %d in grid" % (self.identity(),ncols, len(colWidths)) if rowHeights is None: rowHeights = nrows*[None] elif len(rowHeights) != nrows: raise ValueError, "%s data error - %d rows in data but %d in grid" % (self.identity(),nrows, len(rowHeights)) ncols = len(colWidths) for i in range(nrows): if len(data[i]) != ncols: raise ValueError, "%s not enough data points in row %d!" % (self.identity(),i) self._ncols = ncols self._rowHeights = self._argH = rowHeights self._colWidths = self._argW = colWidths self._cellvalues = data | 45177a43813f218e1a50e84b773577294dd354fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/45177a43813f218e1a50e84b773577294dd354fb/tables.py |
|
lib = import_zlib() | zlib = import_zlib() | def PIL_imagedata(self): lib = import_zlib() if not zlib: return image = self.image myimage = image.convert('RGB') imgwidth, imgheight = myimage.size | 1deb885c062e767ce391a604434e933446d7d723 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/1deb885c062e767ce391a604434e933446d7d723/pdfimages.py |
rawdata = open(pfbFileName, 'rb').read() self._binaryData = rawdata firstPS = string.find(rawdata, '%!PS') self._length = len(rawdata) self._length1 = string.find(rawdata, 'eexec') pos2 = string.find(rawdata, 'cleartomark') if pos2 < 0: rawdata = rawdata + '0'*256 + 'cleartomark' pos2 = string.find(rawdata, 'cleartomark') zeroes = 0 while zeroes < 512: pos2 = pos2 - 1 if rawdata[pos2] == '0': zeroes = zeroes + 1 self._length2 = pos2 - self._length1 self._length3 = len(rawdata) - pos2 | d = open(pfbFileName, 'rb').read() s1, l1 = _pfbCheck(0,d,PFB_ASCII,pfbFileName) s2, l2 = _pfbCheck(l1,d,PFB_BINARY,pfbFileName) s3, l3 = _pfbCheck(l2,d,PFB_ASCII,pfbFileName) _pfbCheck(l3,d,PFB_EOF,pfbFileName) self._binaryData = d[s1:l1]+d[s2:l2]+d[s3:l3] self._length = len(self._binaryData) self._length1 = l1-s1 self._length2 = l2-s2 self._length3 = l3-s3 | def _loadGlyphs(self, pfbFileName): """Loads in binary glyph data, and finds the four length measurements needed for the font descriptor""" assert os.path.isfile(pfbFileName), 'file %s not found' % pfbFileName rawdata = open(pfbFileName, 'rb').read() self._binaryData = rawdata firstPS = string.find(rawdata, '%!PS') self._length = len(rawdata) self._length1 = string.find(rawdata, 'eexec') pos2 = string.find(rawdata, 'cleartomark') if pos2 < 0: # need to append the zeros rawdata = rawdata + '0'*256 + 'cleartomark' pos2 = string.find(rawdata, 'cleartomark') zeroes = 0 while zeroes < 512: pos2 = pos2 - 1 if rawdata[pos2] == '0': zeroes = zeroes + 1 self._length2 = pos2 - self._length1 self._length3 = len(rawdata) - pos2 | 4e33df4471089c2e09251cfe195e9b5884a74f3a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4e33df4471089c2e09251cfe195e9b5884a74f3a/pdfmetrics.py |
'FontFile': fontFileRef | 'FontFile': fontFileRef, | def addObjects(self, doc): """Add whatever needed to PDF file, and return a FontDescriptor reference""" from reportlab.pdfbase import pdfdoc | 4e33df4471089c2e09251cfe195e9b5884a74f3a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4e33df4471089c2e09251cfe195e9b5884a74f3a/pdfmetrics.py |
x2 = x_cen + r | def circle(self, x_cen, y_cen, r): """adds a circle to the path""" x1 = x_cen - r x2 = x_cen + r y1 = y_cen - r y2 = y_cen + r self.ellipse(x_cen - r, y_cen - r, x_cen + r, y_cen + r) | 006b27e9c4eaf5cf868d6ecad87922afbcd94fd9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/006b27e9c4eaf5cf868d6ecad87922afbcd94fd9/pathobject.py |
|
y2 = y_cen + r self.ellipse(x_cen - r, y_cen - r, x_cen + r, y_cen + r) | width = height = 2*r self.ellipse(x1, y1, width, height) | def circle(self, x_cen, y_cen, r): """adds a circle to the path""" x1 = x_cen - r x2 = x_cen + r y1 = y_cen - r y2 = y_cen + r self.ellipse(x_cen - r, y_cen - r, x_cen + r, y_cen + r) | 006b27e9c4eaf5cf868d6ecad87922afbcd94fd9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/006b27e9c4eaf5cf868d6ecad87922afbcd94fd9/pathobject.py |
def recursiveImport(modulename, baseDir=None): | def recursiveImport(modulename, baseDir=None, noCWD=0): | def recursiveImport(modulename, baseDir=None): """Dynamically imports possible packagized module, or raises ImportError""" import imp parts = string.split(modulename, '.') part = parts[0] path = list(baseDir and (type(baseDir) not in SeqTypes and [baseDir] or filter(None,baseDir)) or None) if '.' not in path: path.insert(0,'.') #make import errors a bit more informative try: (file, pathname, description) = imp.find_module(part, path) childModule = parentModule = imp.load_module(part, file, pathname, description) for name in parts[1:]: (file, pathname, description) = imp.find_module(name, parentModule.__path__) childModule = imp.load_module(name, file, pathname, description) setattr(parentModule, name, childModule) parentModule = childModule except ImportError: msg = "cannot import '%s' while attempting recursive import of '%s'" % (part, modulename) if baseDir: msg = msg + " under paths '%s'" % `path` raise ImportError, msg return childModule | 523bad38145a0961601736e24b1bef20c19fd585 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/523bad38145a0961601736e24b1bef20c19fd585/utils.py |
if '.' not in path: path.insert(0,'.') | if not noCWD and '.' not in path: path.insert(0,'.') | def recursiveImport(modulename, baseDir=None): """Dynamically imports possible packagized module, or raises ImportError""" import imp parts = string.split(modulename, '.') part = parts[0] path = list(baseDir and (type(baseDir) not in SeqTypes and [baseDir] or filter(None,baseDir)) or None) if '.' not in path: path.insert(0,'.') #make import errors a bit more informative try: (file, pathname, description) = imp.find_module(part, path) childModule = parentModule = imp.load_module(part, file, pathname, description) for name in parts[1:]: (file, pathname, description) = imp.find_module(name, parentModule.__path__) childModule = imp.load_module(name, file, pathname, description) setattr(parentModule, name, childModule) parentModule = childModule except ImportError: msg = "cannot import '%s' while attempting recursive import of '%s'" % (part, modulename) if baseDir: msg = msg + " under paths '%s'" % `path` raise ImportError, msg return childModule | 523bad38145a0961601736e24b1bef20c19fd585 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/523bad38145a0961601736e24b1bef20c19fd585/utils.py |
if os.path.isfile(f): os.remove(f) elif os.path.isdir(f): rmdir(f) elif '*' in f: map(kill,glob.glob(f)) | if '*' in f: map(kill,glob.glob(f)) else: if verbose>=2: print 'kill(%s)' % f if os.path.isfile(f): os.remove(f) elif os.path.isdir(f): rmdir(f) | def kill(f): 'remove directory or file unconditionally' if os.path.isfile(f): os.remove(f) elif os.path.isdir(f): rmdir(f) elif '*' in f: map(kill,glob.glob(f)) | c258160e5347c9a6c26750a829c6309944154151 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/c258160e5347c9a6c26750a829c6309944154151/daily.py |
if os.path.isdir(dst): dst = os.path.join(dst,os.path.basename(src)) if os.path.isfile(dst): kill(dst) if os.path.isfile(src): shutil.copy2(src,dst) elif os.path.isdir(src): shutil.copyTree(src,dst) elif '*' in src: map(lambda f,dst=dst: copy(f,dst),glob.glob(src)) | if '*' in src: map(lambda f,dst=dst: copy(f,dst),glob.glob(src)) else: if os.path.isdir(dst): dst = os.path.join(dst,os.path.basename(src)) if verbose>=2: print 'copy(%s,%s)' % (src,dst) if os.path.isfile(src): remove(dst) shutil.copy2(src,dst) elif os.path.isdir(src): shutil.copyTree(src,dst) | def copy(src,dst): if os.path.isdir(dst): dst = os.path.join(dst,os.path.basename(src)) if os.path.isfile(dst): kill(dst) if os.path.isfile(src): shutil.copy2(src,dst) elif os.path.isdir(src): shutil.copyTree(src,dst) elif '*' in src: map(lambda f,dst=dst: copy(f,dst),glob.glob(src)) | c258160e5347c9a6c26750a829c6309944154151 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/c258160e5347c9a6c26750a829c6309944154151/daily.py |
genAll()(quiet='-s') | genAll()(verbose=verbose) os.chdir(dst) | def cvs_checkout(d): os.chdir(d) cvsdir = os.path.join(d,projdir) rmdir(cvsdir) rmdir('docs') cvs = find_exe('cvs') python = find_exe('python') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%[email protected]:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s %s' % (tagname,projdir)), 'the export phase') else: do_exec(cvs+' co -P %s' % projdir, 'the checkout phase') if py2pdf: # now we need to move the files & delete those we don't need dst = py2pdf_dir rmdir(dst) os.mkdir(dst) for f in ("py2pdf.py", "PyFontify.py", "idle_print.py"): move(os.path.join('reportlab/demos/py2pdf',f),dst) for f in ('reportlab/demos', 'reportlab/platypus', 'reportlab/lib/styles.py', 'reportlab/README.pdfgen.txt', 'reportlab/pdfgen/test', 'reportlab/tools','reportlab/test', 'reportlab/docs'): kill(f) move(projdir,dst) for f in ('py2pdf.py','idle_print.py'): os.chmod(os.path.join(dst,f),0775) #rwxrwxr-x CVS_remove(dst) else: dst = os.path.join(d,"reportlab","docs") PP = "%s" % (d,) #add our reportlab parent to the path so we import from there if os.environ.has_key('PYTHONPATH'): opp = os.environ['PYTHONPATH'] os.environ['PYTHONPATH']='%s:%s' % (PP,opp) else: opp = None os.environ['PYTHONPATH']=PP if '-pythonpath' in sys.argv: print 'PYTHONPATH=%s'%os.environ['PYTHONPATH'] os.chdir(dst) try: # this creates PDFs in each manual's directory, and copies them to reportlab/docs genAll()(quiet='-s') # we copy them out to our html area copy(os.path.join(dst,'*.pdf'),htmldir) # and then delete them for f in ('*.pdf', 'userguide/*.pdf', 'graphguide/*.pdf' 'reference/*.pdf'): kill(f) except: print '????????????????????????????????' print 'Failed to run genAll.py, cwd=%s' % os.getcwd() do_exec('ls -l') print '????????????????????????????????' os.chdir(d) pyc_remove(cvsdir) #restore the python path if opp is None: del os.environ['PYTHONPATH'] else: os.environ['PYTHONPATH'] = opp | c258160e5347c9a6c26750a829c6309944154151 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/c258160e5347c9a6c26750a829c6309944154151/daily.py |
copy(os.path.join(dst,'*.pdf'),htmldir) | copy('*.pdf',htmldir) | def cvs_checkout(d): os.chdir(d) cvsdir = os.path.join(d,projdir) rmdir(cvsdir) rmdir('docs') cvs = find_exe('cvs') python = find_exe('python') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%[email protected]:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s %s' % (tagname,projdir)), 'the export phase') else: do_exec(cvs+' co -P %s' % projdir, 'the checkout phase') if py2pdf: # now we need to move the files & delete those we don't need dst = py2pdf_dir rmdir(dst) os.mkdir(dst) for f in ("py2pdf.py", "PyFontify.py", "idle_print.py"): move(os.path.join('reportlab/demos/py2pdf',f),dst) for f in ('reportlab/demos', 'reportlab/platypus', 'reportlab/lib/styles.py', 'reportlab/README.pdfgen.txt', 'reportlab/pdfgen/test', 'reportlab/tools','reportlab/test', 'reportlab/docs'): kill(f) move(projdir,dst) for f in ('py2pdf.py','idle_print.py'): os.chmod(os.path.join(dst,f),0775) #rwxrwxr-x CVS_remove(dst) else: dst = os.path.join(d,"reportlab","docs") PP = "%s" % (d,) #add our reportlab parent to the path so we import from there if os.environ.has_key('PYTHONPATH'): opp = os.environ['PYTHONPATH'] os.environ['PYTHONPATH']='%s:%s' % (PP,opp) else: opp = None os.environ['PYTHONPATH']=PP if '-pythonpath' in sys.argv: print 'PYTHONPATH=%s'%os.environ['PYTHONPATH'] os.chdir(dst) try: # this creates PDFs in each manual's directory, and copies them to reportlab/docs genAll()(quiet='-s') # we copy them out to our html area copy(os.path.join(dst,'*.pdf'),htmldir) # and then delete them for f in ('*.pdf', 'userguide/*.pdf', 'graphguide/*.pdf' 'reference/*.pdf'): kill(f) except: print '????????????????????????????????' print 'Failed to run genAll.py, cwd=%s' % os.getcwd() do_exec('ls -l') print '????????????????????????????????' os.chdir(d) pyc_remove(cvsdir) #restore the python path if opp is None: del os.environ['PYTHONPATH'] else: os.environ['PYTHONPATH'] = opp | c258160e5347c9a6c26750a829c6309944154151 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/c258160e5347c9a6c26750a829c6309944154151/daily.py |
g = Group() g.add(Rect(self.x, self.y, self.width, self.height, strokeColor = self.strokeColor, fillColor= self.fillColor)) return g | strokeColor,strokeWidth,fillColor=self.strokeColor, self.strokeWidth, self.fillColor if (strokeWidth and strokeColor) or fillColor: g = Group() g.add(Rect(self.x, self.y, self.width, self.height, strokeColor=strokeColor, strokeWidth=strokeWidth, fillColor=fillColor)) return g else: return None | def makeBackground(self): g = Group() g.add(Rect(self.x, self.y, self.width, self.height, strokeColor = self.strokeColor, fillColor= self.fillColor)) return g | 1376f327b76d1252a0043c261a66cf448d35bd9f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/1376f327b76d1252a0043c261a66cf448d35bd9f/barcharts.py |
def save(self, file): file.write(self.template % (self.keyname, self.fontname, self.encoding) + LINEEND) | 39dab6b923fd3f70064993aee943cc1640108580 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/39dab6b923fd3f70064993aee943cc1640108580/pdfdoc.py |
||
def save(self, file): file.write(self.template % (self.keyname, self.fontname, self.encoding) + LINEEND) | 39dab6b923fd3f70064993aee943cc1640108580 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/39dab6b923fd3f70064993aee943cc1640108580/pdfdoc.py |
||
def MakeType1Fonts(encoding): "returns a list of all the standard font objects" fonts = [] pos = 1 for fontname in StandardEnglishFonts: #Symbol is almost empty in WinAnsi, no choice! if fontname in ['Symbol', 'ZapfDingbats']: encUsed = 'MacRomanEncoding' else: encUsed = encoding font = PDFType1Font('F'+str(pos), fontname, encUsed) fonts.append(font) pos = pos + 1 return fonts | 39dab6b923fd3f70064993aee943cc1640108580 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/39dab6b923fd3f70064993aee943cc1640108580/pdfdoc.py |
||
encUsed = 'MacRomanEncoding' | encUsed = 'StandardEncoding' | def MakeType1Fonts(encoding): "returns a list of all the standard font objects" fonts = [] pos = 1 for fontname in StandardEnglishFonts: #Symbol is almost empty in WinAnsi, no choice! if fontname in ['Symbol', 'ZapfDingbats']: encUsed = 'MacRomanEncoding' else: encUsed = encoding font = PDFType1Font('F'+str(pos), fontname, encUsed) fonts.append(font) pos = pos + 1 return fonts | 39dab6b923fd3f70064993aee943cc1640108580 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/39dab6b923fd3f70064993aee943cc1640108580/pdfdoc.py |
stripe.fillColor = cols[i % len(cols)] | stripe.fillColor = cols[i % len(cols)] | def makeInnerTiles(self): # inner grid lines group = Group() | 27b6bffb56ecaf66dee61eab61c6828d35de4558 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/27b6bffb56ecaf66dee61eab61c6828d35de4558/grids.py |
g.draw() | def demo(self): D = Drawing(100, 100) | 27b6bffb56ecaf66dee61eab61c6828d35de4558 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/27b6bffb56ecaf66dee61eab61c6828d35de4558/grids.py |
|
if self.width < 0: | if self.width < 0 and self.height > 0: | def _flipRectCorners(self): "Flip rectangle's corners if width or height is negative." if self.width < 0: self.x = self.x + self.width self.width = -self.width if self.orientation == 'vertical': self.fillColorStart, self.fillColorEnd = self.fillColorEnd, self.fillColorStart | 27b6bffb56ecaf66dee61eab61c6828d35de4558 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/27b6bffb56ecaf66dee61eab61c6828d35de4558/grids.py |
if self.height < 0: | elif self.height < 0 and self.width > 0: | def _flipRectCorners(self): "Flip rectangle's corners if width or height is negative." if self.width < 0: self.x = self.x + self.width self.width = -self.width if self.orientation == 'vertical': self.fillColorStart, self.fillColorEnd = self.fillColorEnd, self.fillColorStart | 27b6bffb56ecaf66dee61eab61c6828d35de4558 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/27b6bffb56ecaf66dee61eab61c6828d35de4558/grids.py |
r, g, b = c0.red, c0.green, c0.green | r, g, b = c0.red, c0.green, c0.blue | def draw(self): # general widget bits group = Group() | 27b6bffb56ecaf66dee61eab61c6828d35de4558 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/27b6bffb56ecaf66dee61eab61c6828d35de4558/grids.py |
sr.x = x+s | sr.x = x | def test(): D = Drawing(450, 650) d = 80 s = 60 for row in range(10): y = 530 - row*d if row == 0: for col in range(3): x = 20 + col*d g = Grid0() g.x = x g.y = y g.width = s g.height = s 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*d g = Grid0() g.y = y g.x = x g.width = s g.height = s 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*d g = Grid0() g.x = x g.y = y g.width = s g.height = s 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*d sr = ShadedRect0() sr.x = x sr.y = y sr.width = s sr.height = s 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*d sr = ShadedRect0() sr.x = x sr.y = y sr.width = s sr.height = s 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) elif row == 5: for col in range(3): x = 20 + col*d sr = ShadedRect0() sr.x = x sr.y = y sr.width = s sr.height = s sr.fillColorStart = colors.white sr.fillColorEnd = colors.green sr.orientation = 'horizontal' if col == 0: sr.numShades = 10 elif col == 1: sr.numShades = 20 sr.orientation = 'vertical' elif col == 2: sr.numShades = 50 sr.demo() D.add(sr) elif row == 6: for col in range(3): x = 20 + col*d sr = ShadedRect0() sr.x = x+s sr.y = y+s sr.width = -s sr.height = -s sr.fillColorStart = colors.white sr.fillColorEnd = colors.green sr.orientation = 'horizontal' if col == 0: sr.numShades = 10 elif col == 1: sr.numShades = 20 sr.orientation = 'vertical' elif col == 2: sr.numShades = 50 sr.demo() D.add(sr) renderPDF.drawToFile(D, 'grids.pdf', 'grids.py') print 'wrote file: grids.pdf' | 27b6bffb56ecaf66dee61eab61c6828d35de4558 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/27b6bffb56ecaf66dee61eab61c6828d35de4558/grids.py |
sr.width = -s | sr.width = s | def test(): D = Drawing(450, 650) d = 80 s = 60 for row in range(10): y = 530 - row*d if row == 0: for col in range(3): x = 20 + col*d g = Grid0() g.x = x g.y = y g.width = s g.height = s 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*d g = Grid0() g.y = y g.x = x g.width = s g.height = s 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*d g = Grid0() g.x = x g.y = y g.width = s g.height = s 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*d sr = ShadedRect0() sr.x = x sr.y = y sr.width = s sr.height = s 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*d sr = ShadedRect0() sr.x = x sr.y = y sr.width = s sr.height = s 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) elif row == 5: for col in range(3): x = 20 + col*d sr = ShadedRect0() sr.x = x sr.y = y sr.width = s sr.height = s sr.fillColorStart = colors.white sr.fillColorEnd = colors.green sr.orientation = 'horizontal' if col == 0: sr.numShades = 10 elif col == 1: sr.numShades = 20 sr.orientation = 'vertical' elif col == 2: sr.numShades = 50 sr.demo() D.add(sr) elif row == 6: for col in range(3): x = 20 + col*d sr = ShadedRect0() sr.x = x+s sr.y = y+s sr.width = -s sr.height = -s sr.fillColorStart = colors.white sr.fillColorEnd = colors.green sr.orientation = 'horizontal' if col == 0: sr.numShades = 10 elif col == 1: sr.numShades = 20 sr.orientation = 'vertical' elif col == 2: sr.numShades = 50 sr.demo() D.add(sr) renderPDF.drawToFile(D, 'grids.pdf', 'grids.py') print 'wrote file: grids.pdf' | 27b6bffb56ecaf66dee61eab61c6828d35de4558 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/27b6bffb56ecaf66dee61eab61c6828d35de4558/grids.py |
for k in ['gif','tiff']: | for k in ['gif','tiff', 'png', 'jpg']: | def test(): #grab all drawings from the test module and write out. #make a page of links in HTML to assist viewing. import os from reportlab.graphics import testshapes drawings = [] if not os.path.isdir('pmout'): os.mkdir('pmout') htmlTop = """<html><head><title>renderGD output results</title></head> <body> <h1>renderPM results of output</h1> """ htmlBottom = """</body> </html> """ html = [htmlTop] for funcname in dir(testshapes): #if funcname[0:12] == 'getDrawing10': if funcname[0:10] == 'getDrawing': drawing = eval('testshapes.' + funcname + '()') #execute it docstring = eval('testshapes.' + funcname + '.__doc__') drawings.append((drawing, docstring)) | 74e55e0d638e3c6f42854501c712539d8480731f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/74e55e0d638e3c6f42854501c712539d8480731f/renderPM.py |
y = rowpos + (cellstyle.bottomPadding + rowheight-cellstyle.topPadding+(n-1)*leading)/2.0 | y = rowpos + (cellstyle.bottomPadding + rowheight-cellstyle.topPadding+n*leading)/2.0 - fontsize | def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle | cdb0cfc04bf8f02532bbaea19a48b6a89b53f196 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/cdb0cfc04bf8f02532bbaea19a48b6a89b53f196/tables.py |
from java.io import File fp = File(fileName) | 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 | b232871229ec463da8e9e807bce8e7f1251cbe5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b232871229ec463da8e9e807bce8e7f1251cbe5c/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 | b232871229ec463da8e9e807bce8e7f1251cbe5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b232871229ec463da8e9e807bce8e7f1251cbe5c/utils.py |
a((rgb>>16)&0xff) a((rgb>>8)&0xff) | a(chr((rgb>>16)&0xff)) a(chr((rgb>>8)&0xff)) | def getRGBData(self): "Return byte array of RGB data as string" if self._data is None: if sys.platform[0:4] == 'java': import jarray from java.awt.image import PixelGrabber width, height = self.getSize() buffer = jarray.zeros(width*height, 'i') pg = PixelGrabber(self._image, 0,0,width,height,buffer,0,width) pg.grabPixels() # there must be a way to do this with a cast not a byte-level loop, # I just haven't found it yet... pixels = [] a = pixels.append for i in range(len(buffer)): rgb = buffer[i] a((rgb>>16)&0xff) a((rgb>>8)&0xff) a(chr(rgb&0xff)) self._data = ''.join(pixels) else: rgb = self._image.convert('RGB') self._data = rgb.tostring() return self._data | b232871229ec463da8e9e807bce8e7f1251cbe5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b232871229ec463da8e9e807bce8e7f1251cbe5c/utils.py |
space_available = maxWidth - (currentWidth + spaceWidth + wordWidth) if space_available > 0 or len(cLine)==0: | newWidth = currentWidth + spaceWidth + wordWidth if newWidth<=maxWidth or len(cLine)==0: | def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word list | 753058fb29c9fc34ce3c17955b30b1c279a9da66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/753058fb29c9fc34ce3c17955b30b1c279a9da66/paragraph.py |
currentWidth = currentWidth + spaceWidth + wordWidth | currentWidth = newWidth | def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word list | 753058fb29c9fc34ce3c17955b30b1c279a9da66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/753058fb29c9fc34ce3c17955b30b1c279a9da66/paragraph.py |
space_available = maxWidth - (currentWidth + spaceWidth + wordWidth) if space_available > 0 or n==0: | if wordWidth>0: newWidth = currentWidth + spaceWidth + wordWidth else: newWidth = currentWidth if newWidth<=maxWidth or n==0: | def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word list | 753058fb29c9fc34ce3c17955b30b1c279a9da66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/753058fb29c9fc34ce3c17955b30b1c279a9da66/paragraph.py |
currentWidth = currentWidth + spaceWidth + wordWidth | currentWidth = newWidth | def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word list | 753058fb29c9fc34ce3c17955b30b1c279a9da66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/753058fb29c9fc34ce3c17955b30b1c279a9da66/paragraph.py |
I.drawWidth = 9.25*inch | def test(): from reportlab.lib.units import inch rowheights = (24, 16, 16, 16, 16) rowheights2 = (24, 16, 16, 16, 30) colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32) data = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), ('Hats', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') ) data2 = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), ('Hats\nLarge', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') ) styleSheet = getSampleStyleSheet() lst = [] lst.append(Paragraph("Tables", styleSheet['Heading1'])) lst.append(Paragraph(__doc__, styleSheet['BodyText'])) lst.append(Paragraph("The Tables (shown in different styles below) were created using the following code:", styleSheet['BodyText'])) lst.append(Preformatted(""" colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32) rowheights = (24, 16, 16, 16, 16) data = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), ('Hats', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') ) t = Table(data, colwidths, rowheights) """, styleSheet['Code'], dedent=4)) lst.append(Paragraph(""" You can then give the Table a TableStyle object to control its format. The first TableStyle used was created as follows: """, styleSheet['BodyText'])) lst.append(Preformatted(""" | d14e3a1bf1f9b8a1b4967b695edeea8395a0f5c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d14e3a1bf1f9b8a1b4967b695edeea8395a0f5c0/tables.py |
|
self.setFillColorCMYK(self, aColor[0], aColor[1], aColor[2], aColor[3]) | self.setFillColorCMYK(aColor[0], aColor[1], aColor[2], aColor[3]) | def setFillColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if isinstance(aColor, CMYKColor): c,m,y,k = (aColor.cyan, aColor.magenta, aColor.yellow, aColor.black) self._fillColorCMYK = (c, m, y, k) self._code.append('%s k' % fp_str(c, m, y, k)) elif isinstance(aColor, Color): #if type(aColor) == ColorType: rgb = (aColor.red, aColor.green, aColor.blue) self._fillColorRGB = rgb self._code.append('%s rg' % fp_str(rgb) ) elif type(aColor) in _SeqTypes: l = len(aColor) if l==3: self._fillColorRGB = aColor self._code.append('%s rg' % fp_str(aColor) ) elif l==4: self.setFillColorCMYK(self, aColor[0], aColor[1], aColor[2], aColor[3]) else: raise 'Unknown color', str(aColor) elif type(aColor) is StringType: self.setFillColor(toColor(aColor)) else: raise 'Unknown color', str(aColor) | e1b14858ba6327ed5796ca3955a0387922d1df19 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/e1b14858ba6327ed5796ca3955a0387922d1df19/canvas.py |
self.setStrokeColorCMYK(self, aColor[0], aColor[1], aColor[2], aColor[3]) | self.setStrokeColorCMYK(aColor[0], aColor[1], aColor[2], aColor[3]) | def setStrokeColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if isinstance(aColor, CMYKColor): c,m,y,k = (aColor.cyan, aColor.magenta, aColor.yellow, aColor.black) self._strokeColorCMYK = (c, m, y, k) self._code.append('%s K' % fp_str(c, m, y, k)) elif isinstance(aColor, Color): #if type(aColor) == ColorType: rgb = (aColor.red, aColor.green, aColor.blue) self._strokeColorRGB = rgb self._code.append('%s RG' % fp_str(rgb) ) elif type(aColor) in _SeqTypes: l = len(aColor) if l==3: self._strokeColorRGB = aColor self._code.append('%s RG' % fp_str(aColor) ) elif l==4: self.setStrokeColorCMYK(self, aColor[0], aColor[1], aColor[2], aColor[3]) else: raise 'Unknown color', str(aColor) elif type(aColor) is StringType: self.setFillColor(toColor(aColor)) else: raise 'Unknown color', str(aColor) | e1b14858ba6327ed5796ca3955a0387922d1df19 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/e1b14858ba6327ed5796ca3955a0387922d1df19/canvas.py |
self.setFillColor(toColor(aColor)) | self.setStrokeColor(toColor(aColor)) | def setStrokeColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if isinstance(aColor, CMYKColor): c,m,y,k = (aColor.cyan, aColor.magenta, aColor.yellow, aColor.black) self._strokeColorCMYK = (c, m, y, k) self._code.append('%s K' % fp_str(c, m, y, k)) elif isinstance(aColor, Color): #if type(aColor) == ColorType: rgb = (aColor.red, aColor.green, aColor.blue) self._strokeColorRGB = rgb self._code.append('%s RG' % fp_str(rgb) ) elif type(aColor) in _SeqTypes: l = len(aColor) if l==3: self._strokeColorRGB = aColor self._code.append('%s RG' % fp_str(aColor) ) elif l==4: self.setStrokeColorCMYK(self, aColor[0], aColor[1], aColor[2], aColor[3]) else: raise 'Unknown color', str(aColor) elif type(aColor) is StringType: self.setFillColor(toColor(aColor)) else: raise 'Unknown color', str(aColor) | e1b14858ba6327ed5796ca3955a0387922d1df19 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/e1b14858ba6327ed5796ca3955a0387922d1df19/canvas.py |
apply(self._push,(),A) | apply(self._push,(),A) | def start_font(self,attr): A = {} for i, j in self._fontAttrMap.items(): if attr.has_key(i): func = j[1] val = attr[i] try: A[j[0]] = (func is None) and val or apply(func,(val,)) except: self.syntax_error('%s: invalid value %s'%(i,val)) apply(self._push,(),A) | b2e42478396f760e6aa557bdaeb655939d54f2f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b2e42478396f760e6aa557bdaeb655939d54f2f5/paraparser.py |
after he had sacked the famous town of Troy. Many cities did he visit, | after</font> he had sacked the famous town of Troy. Many cities did he visit, | def parse(self, text, style): """Given a formatted string will return a list of ParaFrag objects with their calculated widths. If errors occur None will be returned and the self.errors holds a list of the error messages. """ | b2e42478396f760e6aa557bdaeb655939d54f2f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b2e42478396f760e6aa557bdaeb655939d54f2f5/paraparser.py |
of Jove, from whatsoever source you may know them.</font> | of Jove, from whatsoever source you may know them. | def parse(self, text, style): """Given a formatted string will return a list of ParaFrag objects with their calculated widths. If errors occur None will be returned and the self.errors holds a list of the error messages. """ | b2e42478396f760e6aa557bdaeb655939d54f2f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b2e42478396f760e6aa557bdaeb655939d54f2f5/paraparser.py |
self.canv.translate(nudge, 0) | if DO_NUDGE: self.canv.translate(nudge, 0) OLD_DO_NUDGE = DO_NUDGE DO_NUDGE = 0 | def draw(self): nudge = 0.5 * (self.availWidth - self._width) self.canv.translate(nudge, 0) self._drawBkgrnd() self._drawLines() for row, rowstyle, rowpos, rowheight in map(None, self._cellvalues, self._cellStyles, self._rowpositions[1:], self._rowHeights): for cellval, cellstyle, colpos, colwidth in map(None, row, rowstyle, self._colpositions[:-1], self._colWidths): self._drawCell(cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)) | f9066891f0e5bd403355fc100fbcd3a3e1f04549 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/f9066891f0e5bd403355fc100fbcd3a3e1f04549/tables.py |
num = ((85L**4) * c1) + ((85**3) * c2) + ((85**2) * c3) + (85*c4) + c5 | num = (((85*c1+c2)*85+c3)*85+c4)*85L + (c5 +(0,0,0xFFFFFF,0xFFFF,0xFF)[remainder_size]) | def _AsciiBase85Decode(input): """This is not used - Acrobat Reader decodes for you - but a round trip is essential for testing.""" outstream = cStringIO.StringIO() #strip all whitespace stripped = string.join(string.split(input),'') #check end assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Base 85 Stream' stripped = stripped[:-2] #chop off terminator #may have 'z' in it which complicates matters - expand them stripped = string.replace(stripped,'z','!!!!!') # special rules apply if not a multiple of five bytes. whole_word_count, remainder_size = divmod(len(stripped), 5) #print '%d words, %d leftover' % (whole_word_count, remainder_size) assert remainder_size <> 1, 'invalid Ascii 85 stream!' cut = 5 * whole_word_count body, lastbit = stripped[0:cut], stripped[cut:] for i in range(whole_word_count): offset = i*5 c1 = ord(body[offset]) - 33 c2 = ord(body[offset+1]) - 33 c3 = ord(body[offset+2]) - 33 c4 = ord(body[offset+3]) - 33 c5 = ord(body[offset+4]) - 33 num = ((85L**4) * c1) + ((85**3) * c2) + ((85**2) * c3) + (85*c4) + c5 temp, b4 = divmod(num,256) temp, b3 = divmod(temp,256) b1, b2 = divmod(temp, 256) assert num == 16777216 * b1 + 65536 * b2 + 256 * b3 + b4, 'dodgy code!' outstream.write(chr(b1)) outstream.write(chr(b2)) outstream.write(chr(b3)) outstream.write(chr(b4)) #decode however many bytes we have as usual if remainder_size > 0: while len(lastbit) < 5: lastbit = lastbit + '!' c1 = ord(lastbit[0]) - 33 c2 = ord(lastbit[1]) - 33 c3 = ord(lastbit[2]) - 33 c4 = ord(lastbit[3]) - 33 c5 = ord(lastbit[4]) - 33 num = ((85L**4) * c1) + ((85**3) * c2) + ((85**2) * c3) + (85*c4) + c5 temp, b4 = divmod(num,256) temp, b3 = divmod(temp,256) b1, b2 = divmod(temp, 256) assert num == 16777216 * b1 + 65536 * b2 + 256 * b3 + b4, 'dodgy code!' #print 'decoding: %d %d %d %d %d -> %d -> %d %d %d %d' % ( # c1,c2,c3,c4,c5,num,b1,b2,b3,b4) #the last character needs 1 adding; the encoding loses #data by rounding the number to x bytes, and when #divided repeatedly we get one less if remainder_size == 2: lastword = chr(b1+1) elif remainder_size == 3: lastword = chr(b1) + chr(b2+1) elif remainder_size == 4: lastword = chr(b1) + chr(b2) + chr(b3+1) outstream.write(lastword) #terminator code for ascii 85 outstream.reset() return outstream.read() | 6748d1bacd48f8a3352b590669847ada45ea1e8d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6748d1bacd48f8a3352b590669847ada45ea1e8d/pdfutils.py |
lastword = chr(b1+1) | lastword = chr(b1) | def _AsciiBase85Decode(input): """This is not used - Acrobat Reader decodes for you - but a round trip is essential for testing.""" outstream = cStringIO.StringIO() #strip all whitespace stripped = string.join(string.split(input),'') #check end assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Base 85 Stream' stripped = stripped[:-2] #chop off terminator #may have 'z' in it which complicates matters - expand them stripped = string.replace(stripped,'z','!!!!!') # special rules apply if not a multiple of five bytes. whole_word_count, remainder_size = divmod(len(stripped), 5) #print '%d words, %d leftover' % (whole_word_count, remainder_size) assert remainder_size <> 1, 'invalid Ascii 85 stream!' cut = 5 * whole_word_count body, lastbit = stripped[0:cut], stripped[cut:] for i in range(whole_word_count): offset = i*5 c1 = ord(body[offset]) - 33 c2 = ord(body[offset+1]) - 33 c3 = ord(body[offset+2]) - 33 c4 = ord(body[offset+3]) - 33 c5 = ord(body[offset+4]) - 33 num = ((85L**4) * c1) + ((85**3) * c2) + ((85**2) * c3) + (85*c4) + c5 temp, b4 = divmod(num,256) temp, b3 = divmod(temp,256) b1, b2 = divmod(temp, 256) assert num == 16777216 * b1 + 65536 * b2 + 256 * b3 + b4, 'dodgy code!' outstream.write(chr(b1)) outstream.write(chr(b2)) outstream.write(chr(b3)) outstream.write(chr(b4)) #decode however many bytes we have as usual if remainder_size > 0: while len(lastbit) < 5: lastbit = lastbit + '!' c1 = ord(lastbit[0]) - 33 c2 = ord(lastbit[1]) - 33 c3 = ord(lastbit[2]) - 33 c4 = ord(lastbit[3]) - 33 c5 = ord(lastbit[4]) - 33 num = ((85L**4) * c1) + ((85**3) * c2) + ((85**2) * c3) + (85*c4) + c5 temp, b4 = divmod(num,256) temp, b3 = divmod(temp,256) b1, b2 = divmod(temp, 256) assert num == 16777216 * b1 + 65536 * b2 + 256 * b3 + b4, 'dodgy code!' #print 'decoding: %d %d %d %d %d -> %d -> %d %d %d %d' % ( # c1,c2,c3,c4,c5,num,b1,b2,b3,b4) #the last character needs 1 adding; the encoding loses #data by rounding the number to x bytes, and when #divided repeatedly we get one less if remainder_size == 2: lastword = chr(b1+1) elif remainder_size == 3: lastword = chr(b1) + chr(b2+1) elif remainder_size == 4: lastword = chr(b1) + chr(b2) + chr(b3+1) outstream.write(lastword) #terminator code for ascii 85 outstream.reset() return outstream.read() | 6748d1bacd48f8a3352b590669847ada45ea1e8d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6748d1bacd48f8a3352b590669847ada45ea1e8d/pdfutils.py |
lastword = chr(b1) + chr(b2+1) | lastword = chr(b1) + chr(b2) | def _AsciiBase85Decode(input): """This is not used - Acrobat Reader decodes for you - but a round trip is essential for testing.""" outstream = cStringIO.StringIO() #strip all whitespace stripped = string.join(string.split(input),'') #check end assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Base 85 Stream' stripped = stripped[:-2] #chop off terminator #may have 'z' in it which complicates matters - expand them stripped = string.replace(stripped,'z','!!!!!') # special rules apply if not a multiple of five bytes. whole_word_count, remainder_size = divmod(len(stripped), 5) #print '%d words, %d leftover' % (whole_word_count, remainder_size) assert remainder_size <> 1, 'invalid Ascii 85 stream!' cut = 5 * whole_word_count body, lastbit = stripped[0:cut], stripped[cut:] for i in range(whole_word_count): offset = i*5 c1 = ord(body[offset]) - 33 c2 = ord(body[offset+1]) - 33 c3 = ord(body[offset+2]) - 33 c4 = ord(body[offset+3]) - 33 c5 = ord(body[offset+4]) - 33 num = ((85L**4) * c1) + ((85**3) * c2) + ((85**2) * c3) + (85*c4) + c5 temp, b4 = divmod(num,256) temp, b3 = divmod(temp,256) b1, b2 = divmod(temp, 256) assert num == 16777216 * b1 + 65536 * b2 + 256 * b3 + b4, 'dodgy code!' outstream.write(chr(b1)) outstream.write(chr(b2)) outstream.write(chr(b3)) outstream.write(chr(b4)) #decode however many bytes we have as usual if remainder_size > 0: while len(lastbit) < 5: lastbit = lastbit + '!' c1 = ord(lastbit[0]) - 33 c2 = ord(lastbit[1]) - 33 c3 = ord(lastbit[2]) - 33 c4 = ord(lastbit[3]) - 33 c5 = ord(lastbit[4]) - 33 num = ((85L**4) * c1) + ((85**3) * c2) + ((85**2) * c3) + (85*c4) + c5 temp, b4 = divmod(num,256) temp, b3 = divmod(temp,256) b1, b2 = divmod(temp, 256) assert num == 16777216 * b1 + 65536 * b2 + 256 * b3 + b4, 'dodgy code!' #print 'decoding: %d %d %d %d %d -> %d -> %d %d %d %d' % ( # c1,c2,c3,c4,c5,num,b1,b2,b3,b4) #the last character needs 1 adding; the encoding loses #data by rounding the number to x bytes, and when #divided repeatedly we get one less if remainder_size == 2: lastword = chr(b1+1) elif remainder_size == 3: lastword = chr(b1) + chr(b2+1) elif remainder_size == 4: lastword = chr(b1) + chr(b2) + chr(b3+1) outstream.write(lastword) #terminator code for ascii 85 outstream.reset() return outstream.read() | 6748d1bacd48f8a3352b590669847ada45ea1e8d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6748d1bacd48f8a3352b590669847ada45ea1e8d/pdfutils.py |
lastword = chr(b1) + chr(b2) + chr(b3+1) | lastword = chr(b1) + chr(b2) + chr(b3) | def _AsciiBase85Decode(input): """This is not used - Acrobat Reader decodes for you - but a round trip is essential for testing.""" outstream = cStringIO.StringIO() #strip all whitespace stripped = string.join(string.split(input),'') #check end assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Base 85 Stream' stripped = stripped[:-2] #chop off terminator #may have 'z' in it which complicates matters - expand them stripped = string.replace(stripped,'z','!!!!!') # special rules apply if not a multiple of five bytes. whole_word_count, remainder_size = divmod(len(stripped), 5) #print '%d words, %d leftover' % (whole_word_count, remainder_size) assert remainder_size <> 1, 'invalid Ascii 85 stream!' cut = 5 * whole_word_count body, lastbit = stripped[0:cut], stripped[cut:] for i in range(whole_word_count): offset = i*5 c1 = ord(body[offset]) - 33 c2 = ord(body[offset+1]) - 33 c3 = ord(body[offset+2]) - 33 c4 = ord(body[offset+3]) - 33 c5 = ord(body[offset+4]) - 33 num = ((85L**4) * c1) + ((85**3) * c2) + ((85**2) * c3) + (85*c4) + c5 temp, b4 = divmod(num,256) temp, b3 = divmod(temp,256) b1, b2 = divmod(temp, 256) assert num == 16777216 * b1 + 65536 * b2 + 256 * b3 + b4, 'dodgy code!' outstream.write(chr(b1)) outstream.write(chr(b2)) outstream.write(chr(b3)) outstream.write(chr(b4)) #decode however many bytes we have as usual if remainder_size > 0: while len(lastbit) < 5: lastbit = lastbit + '!' c1 = ord(lastbit[0]) - 33 c2 = ord(lastbit[1]) - 33 c3 = ord(lastbit[2]) - 33 c4 = ord(lastbit[3]) - 33 c5 = ord(lastbit[4]) - 33 num = ((85L**4) * c1) + ((85**3) * c2) + ((85**2) * c3) + (85*c4) + c5 temp, b4 = divmod(num,256) temp, b3 = divmod(temp,256) b1, b2 = divmod(temp, 256) assert num == 16777216 * b1 + 65536 * b2 + 256 * b3 + b4, 'dodgy code!' #print 'decoding: %d %d %d %d %d -> %d -> %d %d %d %d' % ( # c1,c2,c3,c4,c5,num,b1,b2,b3,b4) #the last character needs 1 adding; the encoding loses #data by rounding the number to x bytes, and when #divided repeatedly we get one less if remainder_size == 2: lastword = chr(b1+1) elif remainder_size == 3: lastword = chr(b1) + chr(b2+1) elif remainder_size == 4: lastword = chr(b1) + chr(b2) + chr(b3+1) outstream.write(lastword) #terminator code for ascii 85 outstream.reset() return outstream.read() | 6748d1bacd48f8a3352b590669847ada45ea1e8d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6748d1bacd48f8a3352b590669847ada45ea1e8d/pdfutils.py |
a = angle * pi /180 | a = angle * pi/180 | def rotate(angle): a = angle * pi /180 return (cos(a), sin(a), -sin(a), cos(a), 0, 0) | e782559a76d2e264c554ae263ee1e19daf9f7e15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/e782559a76d2e264c554ae263ee1e19daf9f7e15/shapes.py |
a = angle * 180 / pi | a = angle * pi/180 | def skewX(angle): a = angle * 180 / pi return (1, 0, tan(a), 1, 0, 0) | e782559a76d2e264c554ae263ee1e19daf9f7e15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/e782559a76d2e264c554ae263ee1e19daf9f7e15/shapes.py |
a = angle * 180 / pi | a = angle * pi/180 | def skewY(angle): a = angle * 180 / pi return (1, tan(a), 0, 1, 0, 0) | e782559a76d2e264c554ae263ee1e19daf9f7e15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/e782559a76d2e264c554ae263ee1e19daf9f7e15/shapes.py |
y = y+cellval[0].getSpaceBefore() | if cellval: y += cellval[0].getSpaceBefore() | def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle | 3689154847bca3bcf3e8d8fecbbd4c9190123964 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/3689154847bca3bcf3e8d8fecbbd4c9190123964/tables.py |
y = y - v.getSpaceBefore() y = y - h | y -= v.getSpaceBefore() y -= h | def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle | 3689154847bca3bcf3e8d8fecbbd4c9190123964 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/3689154847bca3bcf3e8d8fecbbd4c9190123964/tables.py |
y = y - v.getSpaceAfter() | y -= v.getSpaceAfter() | def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle | 3689154847bca3bcf3e8d8fecbbd4c9190123964 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/3689154847bca3bcf3e8d8fecbbd4c9190123964/tables.py |
y = y-leading | y -= leading | def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle | 3689154847bca3bcf3e8d8fecbbd4c9190123964 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/3689154847bca3bcf3e8d8fecbbd4c9190123964/tables.py |
isFile = getattr(filename,'write',None) if isFile: hasSeek = getattr(filename,'seek',None) if hasSeek: fLoc = filename.tell() else: class _DUMMYFILE: def __init__(self,filename): self._filename = filename def write(self,bytes): pass def close(self): pass filename = _DUMMYFILE(filename) | self._doSave = 0 | def multiBuild(self, story, filename=None, canvasmaker=canvas.Canvas, maxPasses = 10): """Makes multiple passes until all indexing flowables are happy.""" self._indexingFlowables = [] #scan the story and keep a copy for thing in story: if thing.isIndexing(): self._indexingFlowables.append(thing) #print 'scanned story, found these indexing flowables:\n' #print self._indexingFlowables | 1f913885a2682e6d2c430cc7d291a626db3ec80d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/1f913885a2682e6d2c430cc7d291a626db3ec80d/doctemplate.py |
if passes and isFile and hasSeek: filename.seek(fLoc) | def close(self): pass | 1f913885a2682e6d2c430cc7d291a626db3ec80d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/1f913885a2682e6d2c430cc7d291a626db3ec80d/doctemplate.py |
|
if isFile and not hasSeek: filename = filename._filename | self._doSave = 0 self.canv.save() | def close(self): pass | 1f913885a2682e6d2c430cc7d291a626db3ec80d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/1f913885a2682e6d2c430cc7d291a626db3ec80d/doctemplate.py |
w, h = drawable.wrap(self.width, self.y - self.bottomMargin - self.bottomPadding) | y = self.y p = self.bottomMargin + self.bottomPadding w, h = drawable.wrap(self.width, y - p ) | def add(self, drawable): """ Draws the object at the current position. Returns 1 if successful, 0 if it would not fit. Raises a LayoutError if the object is too wide, or if it is too high for a totally empty frame, to avoid infinite loops""" w, h = drawable.wrap(self.width, self.y - self.bottomMargin - self.bottomPadding) | b84d697ebfdc6a6adcb88bc03a632af5167c1e5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b84d697ebfdc6a6adcb88bc03a632af5167c1e5d/layout.py |
if self.y - h < (self.bottomMargin - self.bottomPadding): | y = y - h if y < p: | def add(self, drawable): """ Draws the object at the current position. Returns 1 if successful, 0 if it would not fit. Raises a LayoutError if the object is too wide, or if it is too high for a totally empty frame, to avoid infinite loops""" w, h = drawable.wrap(self.width, self.y - self.bottomMargin - self.bottomPadding) | b84d697ebfdc6a6adcb88bc03a632af5167c1e5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b84d697ebfdc6a6adcb88bc03a632af5167c1e5d/layout.py |
drawable.drawOn(self.canvas, self.x, self.y - h) self.y = self.y - h | drawable.drawOn(self.canvas, self.x, y) self.y = y | def add(self, drawable): """ Draws the object at the current position. Returns 1 if successful, 0 if it would not fit. Raises a LayoutError if the object is too wide, or if it is too high for a totally empty frame, to avoid infinite loops""" w, h = drawable.wrap(self.width, self.y - self.bottomMargin - self.bottomPadding) | b84d697ebfdc6a6adcb88bc03a632af5167c1e5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b84d697ebfdc6a6adcb88bc03a632af5167c1e5d/layout.py |
if not (categoryNames is None): | if categoryNames is not None: | def makeTickLabels(self): g = Group() | ff4bd3d5d8f4df03034034d1148192aea23523bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/ff4bd3d5d8f4df03034034d1148192aea23523bb/axes.py |
s.append('%0.2f' % i) | s.append('%0.6f' % i) | def fp_str(*a): if len(a)==1 and type(a[0]) in SeqTypes: a = a[0] s = [] for i in a: s.append('%0.2f' % i) return string.join(s) | 25e5994b3abd804c374bcce9e405636b8f252f7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/25e5994b3abd804c374bcce9e405636b8f252f7d/utils.py |
self._x = x * 1.0 self._y = y * 1.0 self._length = length * 1.0 def configure(self, multiSeries): self._catCount = len(multiSeries[0]) self._barWidth = self._length / (self._catCount or 1) | self._x = x self._y = y self._length = length def configure(self, multiSeries,barWidth=None): self._catCount = max(map(len,multiSeries)) self._barWidth = barWidth or (self._length/float(self._catCount or 1)) | def setPosition(self, x, y, length): # ensure floating point self._x = x * 1.0 self._y = y * 1.0 self._length = length * 1.0 | e424b45d1de44e4552113d92af4baf18bb783441 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/e424b45d1de44e4552113d92af4baf18bb783441/axes.py |
__version__ = '$Id: ttfonts.py,v 1.21 2004/03/23 16:18:29 rgbecker Exp $' | __version__ = '$Id: ttfonts.py,v 1.22 2004/04/05 14:17:29 rgbecker Exp $' | def getSubsetInternalName(self, subset, doc): '''Returns the name of a PDF Font object corresponding to a given subset of this dynamic font. Use this function instead of PDFDocument.getInternalFontName.''' | aa0d50a54c0641f63f0ec7acd3202e2dee7880e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/aa0d50a54c0641f63f0ec7acd3202e2dee7880e3/ttfonts.py |
def latin1_to_utf8(text): "helper to convert when needed from latin input" return utf_8_encode(latin_1_decode(text)[0])[0] | aa0d50a54c0641f63f0ec7acd3202e2dee7880e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/aa0d50a54c0641f63f0ec7acd3202e2dee7880e3/ttfonts.py |
||
return '0X%8.8X' % i | return '0X%8.8X' % (long(i)&0xFFFFFFFFL) try: add32 = _rl_accel.add32 except: if sys.hexversion>=0x02030000: def add32(x, y): "Calculate (x + y) modulo 2**32" return _L2U32((long(x)+y) & 0xffffffffL) else: def add32(x, y): "Calculate (x + y) modulo 2**32" lo = (x & 0xFFFF) + (y & 0xFFFF) hi = (x >> 16) + (y >> 16) + (lo >> 16) return (hi << 16) | (lo & 0xFFFF) | def hex32(i): return '0X%8.8X' % i | aa0d50a54c0641f63f0ec7acd3202e2dee7880e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/aa0d50a54c0641f63f0ec7acd3202e2dee7880e3/ttfonts.py |
lo = (sum & 0xFFFF) + (n & 0xFFFF) hi = (sum >> 16) + (n >> 16) + (lo >> 16) sum = (hi << 16) | (lo & 0xFFFF) | sum = add32(sum,n) | def calcChecksum(data): """Calculates PDF-style checksums""" if len(data)&3: data = data + (4-(len(data)&3))*"\0" sum = 0 for n in unpack(">%dl" % (len(data)>>2), data): lo = (sum & 0xFFFF) + (n & 0xFFFF) hi = (sum >> 16) + (n >> 16) + (lo >> 16) sum = (hi << 16) | (lo & 0xFFFF) return sum | aa0d50a54c0641f63f0ec7acd3202e2dee7880e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/aa0d50a54c0641f63f0ec7acd3202e2dee7880e3/ttfonts.py |
try: add32 = _rl_accel.add32 except: def add32(x, y): "Calculate (x + y) modulo 2**32" lo = (x & 0xFFFF) + (y & 0xFFFF) hi = (x >> 16) + (y >> 16) + (lo >> 16) return (hi << 16) | (lo & 0xFFFF) del _rl_accel | del _rl_accel, sys | def calcChecksum(data): """Calculates PDF-style checksums""" if len(data)&3: data = data + (4-(len(data)&3))*"\0" sum = 0 for n in unpack(">%dl" % (len(data)>>2), data): lo = (sum & 0xFFFF) + (n & 0xFFFF) hi = (sum >> 16) + (n >> 16) + (lo >> 16) sum = (hi << 16) | (lo & 0xFFFF) return sum | aa0d50a54c0641f63f0ec7acd3202e2dee7880e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/aa0d50a54c0641f63f0ec7acd3202e2dee7880e3/ttfonts.py |
def makeStream(self): "Finishes the generation and returns the TTF file as a string" stm = StringIO() | aa0d50a54c0641f63f0ec7acd3202e2dee7880e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/aa0d50a54c0641f63f0ec7acd3202e2dee7880e3/ttfonts.py |
||
import time | def __init__(self, normalDate=None): """ Accept 1 of 4 values to initialize a NormalDate: 1. None - creates a NormalDate for the current day 2. integer in yyyymmdd format 3. string in yyyymmdd format 4. tuple in (yyyy, mm, dd) - localtime/gmtime can also be used """ if normalDate is None: import time self.setNormalDate(time.localtime(time.time())) else: self.setNormalDate(normalDate) | 20c17cf292181b6a2681fc63333ea2aad9074d45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/20c17cf292181b6a2681fc63333ea2aad9074d45/normalDate.py |
|
elif tn in _SeqTypes: | elif tn in _DateSeqTypes: | def setNormalDate(self, normalDate): """ accepts date as scalar string/integer (yyyymmdd) or tuple (year, month, day, ...)""" tn=type(normalDate) if tn is IntType: self.normalDate = normalDate elif tn is StringType: try: self.normalDate = int(normalDate) except: m = _iso_re.match(normalDate) if m: self.setNormalDate(m.group(1)+m.group(2)+m.group(3)) else: raise NormalDateException("unable to setNormalDate(%s)" % `normalDate`) elif tn in _SeqTypes: self.normalDate = int("%04d%02d%02d" % normalDate[:3]) elif tn is _NDType: self.normalDate = normalDate.normalDate if not self._isValidNormalDate(self.normalDate): raise NormalDateException("unable to setNormalDate(%s)" % `normalDate`) | 20c17cf292181b6a2681fc63333ea2aad9074d45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/20c17cf292181b6a2681fc63333ea2aad9074d45/normalDate.py |
et = ETriangle0() | et = RTriangle0() | def demo(self): D = shapes.Drawing(200, 100) et = ETriangle0() et.x=50 et.y=0 et.draw() D.add(et) labelFontSize = 10 D.add(shapes.String(et.x+(et.size/2),(et.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D | fcb7fc9a14eb9752921ec276b720befd2c4e3839 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/fcb7fc9a14eb9752921ec276b720befd2c4e3839/signsandsymbols.py |
D = shapes.Drawing(200, 200) | D = shapes.Drawing(200, 100) | def demo(self): D = shapes.Drawing(200, 200) labelFontSize = 10 cb = Crossbox0() cb.x=50 cb.y=0 cb.draw() D.add(cb) D.add(shapes.String(cb.x+(cb.size/2),(cb.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D | fcb7fc9a14eb9752921ec276b720befd2c4e3839 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/fcb7fc9a14eb9752921ec276b720befd2c4e3839/signsandsymbols.py |
na = NoSmoking0() na.x=50 na.y=0 na.draw() D.add(na) labelFontSize = 10 D.add(shapes.String(na.x+(na.size/2),(na.y-(1.2*labelFontSize)), | ns = NoSmoking0() ns.x=50 ns.y=0 ns.draw() D.add(ns) labelFontSize = 10 D.add(shapes.String(ns.x+(ns.size/2),(ns.y-(1.2*labelFontSize)), | def demo(self): D = shapes.Drawing(200, 100) na = NoSmoking0() na.x=50 na.y=0 na.draw() D.add(na) labelFontSize = 10 D.add(shapes.String(na.x+(na.size/2),(na.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D | fcb7fc9a14eb9752921ec276b720befd2c4e3839 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/fcb7fc9a14eb9752921ec276b720befd2c4e3839/signsandsymbols.py |
yn.x = 50 yn.y = 0 yn.testValue = 1 | yn.x = 15 yn.y = 25 yn.size = 70 yn.testValue = 0 | def demo(self): D = shapes.Drawing(200, 100) yn = YesNo0() yn.x = 50 yn.y = 0 yn.testValue = 1 yn.draw() D.add(yn) labelFontSize = 10 D.add(shapes.String(yn.x+(yn.size/2),(yn.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D | fcb7fc9a14eb9752921ec276b720befd2c4e3839 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/fcb7fc9a14eb9752921ec276b720befd2c4e3839/signsandsymbols.py |
labelFontSize = 10 | yn2 = YesNo0() yn2.x = 120 yn2.y = 25 yn2.size = 70 yn2.testValue = 1 yn2.draw() D.add(yn2) labelFontSize = 8 | def demo(self): D = shapes.Drawing(200, 100) yn = YesNo0() yn.x = 50 yn.y = 0 yn.testValue = 1 yn.draw() D.add(yn) labelFontSize = 10 D.add(shapes.String(yn.x+(yn.size/2),(yn.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D | fcb7fc9a14eb9752921ec276b720befd2c4e3839 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/fcb7fc9a14eb9752921ec276b720befd2c4e3839/signsandsymbols.py |
a2 = ArrowOne0() | a2 = ArrowTwo0() | def demo(self): D = shapes.Drawing(200, 100) a2 = ArrowOne0() a2.x=50 a2.y=0 a2.draw() D.add(a2) labelFontSize = 10 D.add(shapes.String(a2.x+(a2.size/2),(a2.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D | fcb7fc9a14eb9752921ec276b720befd2c4e3839 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/fcb7fc9a14eb9752921ec276b720befd2c4e3839/signsandsymbols.py |
absNum = abs(num) if absNum == num: sign = 1 else: sign = -1 intPart, fracPart = divmod(absNum, 1.0) strInt = str(long(intPart)) | sign=num<0 if sign: num = -num places, sep = self.decimalPlaces, self.decimalSeparator strip = places<=0 if places and strip: places = -places strInt, strFrac = (('%.' + str(places) + 'f') % num).split('.') | def format(self, num): # positivize the numbers absNum = abs(num) if absNum == num: sign = 1 else: sign = -1 intPart, fracPart = divmod(absNum, 1.0) strInt = str(long(intPart)) if self.thousandSeparator is not None: strNew = '' while strInt: left, right = strInt[0:-3], strInt[-3:] if left == '': #strNew = self.thousandSeparator + right + strNew strNew = right + strNew else: strNew = self.thousandSeparator + right + strNew strInt = left strInt = strNew places, sep = self.decimalPlaces, self.decimalSeparator strip = places<=0 if places and strip: places = -places pattern = '%0.' + str(places) + 'f' strFrac = sep + (pattern % fracPart)[2:] if strip: while strFrac and strFrac[-1] in ['0',sep]: strFrac = strFrac[:-1] strBody = strInt + strFrac if sign == -1: strBody = '-' + strBody if self.prefix: strBody = self.prefix + strBody if self.suffix: strBody = strBody + self.suffix return strBody | cbd179ea41441d305bf7b364d9c61173d2c55564 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/cbd179ea41441d305bf7b364d9c61173d2c55564/formatters.py |
places, sep = self.decimalPlaces, self.decimalSeparator strip = places<=0 if places and strip: places = -places pattern = '%0.' + str(places) + 'f' strFrac = sep + (pattern % fracPart)[2:] | strFrac = sep + strFrac | def format(self, num): # positivize the numbers absNum = abs(num) if absNum == num: sign = 1 else: sign = -1 intPart, fracPart = divmod(absNum, 1.0) strInt = str(long(intPart)) if self.thousandSeparator is not None: strNew = '' while strInt: left, right = strInt[0:-3], strInt[-3:] if left == '': #strNew = self.thousandSeparator + right + strNew strNew = right + strNew else: strNew = self.thousandSeparator + right + strNew strInt = left strInt = strNew places, sep = self.decimalPlaces, self.decimalSeparator strip = places<=0 if places and strip: places = -places pattern = '%0.' + str(places) + 'f' strFrac = sep + (pattern % fracPart)[2:] if strip: while strFrac and strFrac[-1] in ['0',sep]: strFrac = strFrac[:-1] strBody = strInt + strFrac if sign == -1: strBody = '-' + strBody if self.prefix: strBody = self.prefix + strBody if self.suffix: strBody = strBody + self.suffix return strBody | cbd179ea41441d305bf7b364d9c61173d2c55564 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/cbd179ea41441d305bf7b364d9c61173d2c55564/formatters.py |
if sign == -1: strBody = '-' + strBody | if sign: strBody = '-' + strBody | def format(self, num): # positivize the numbers absNum = abs(num) if absNum == num: sign = 1 else: sign = -1 intPart, fracPart = divmod(absNum, 1.0) strInt = str(long(intPart)) if self.thousandSeparator is not None: strNew = '' while strInt: left, right = strInt[0:-3], strInt[-3:] if left == '': #strNew = self.thousandSeparator + right + strNew strNew = right + strNew else: strNew = self.thousandSeparator + right + strNew strInt = left strInt = strNew places, sep = self.decimalPlaces, self.decimalSeparator strip = places<=0 if places and strip: places = -places pattern = '%0.' + str(places) + 'f' strFrac = sep + (pattern % fracPart)[2:] if strip: while strFrac and strFrac[-1] in ['0',sep]: strFrac = strFrac[:-1] strBody = strInt + strFrac if sign == -1: strBody = '-' + strBody if self.prefix: strBody = self.prefix + strBody if self.suffix: strBody = strBody + self.suffix return strBody | cbd179ea41441d305bf7b364d9c61173d2c55564 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/cbd179ea41441d305bf7b364d9c61173d2c55564/formatters.py |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.