rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
def handle_flowable(self,flowables): '''try to handle one flowable from the front of list flowables.''' #allow document a chance to look at, modify or ignore #the object(s) about to be processed self.filterFlowables(flowables) self.handle_breakBefore(flowables) self.handle_keepWithNext(flowables) f = flowables[0] del flowables[0] if f is None: return | d1aabcf72bbf242f8bc12882a244d43b2c2c4740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d1aabcf72bbf242f8bc12882a244d43b2c2c4740/doctemplate.py |
||
def handle_flowable(self,flowables): '''try to handle one flowable from the front of list flowables.''' #allow document a chance to look at, modify or ignore #the object(s) about to be processed self.filterFlowables(flowables) self.handle_breakBefore(flowables) self.handle_keepWithNext(flowables) f = flowables[0] del flowables[0] if f is None: return | d1aabcf72bbf242f8bc12882a244d43b2c2c4740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d1aabcf72bbf242f8bc12882a244d43b2c2c4740/doctemplate.py |
||
return allHappy | return allHappy | def _allSatisfied0(self): """Called by multi-build - are all cross-references resolved?""" allHappy = 1 for f in self._indexingFlowables: if not f.isSatisfied(): allHappy = 0 break return allHappy | d1aabcf72bbf242f8bc12882a244d43b2c2c4740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d1aabcf72bbf242f8bc12882a244d43b2c2c4740/doctemplate.py |
def notify0(self, kind, stuff): """"Forward to any listeners""" for l in self._indexingFlowables: l.notify(kind, stuff) | d1aabcf72bbf242f8bc12882a244d43b2c2c4740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d1aabcf72bbf242f8bc12882a244d43b2c2c4740/doctemplate.py |
||
def pageRef0(self, label): """hook to register a page number""" if _verbose: print "pageRef called with label '%s' on page %d" % ( label, self.page) self._pageRefs[label] = self.page | d1aabcf72bbf242f8bc12882a244d43b2c2c4740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d1aabcf72bbf242f8bc12882a244d43b2c2c4740/doctemplate.py |
||
def multiBuild0(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 | d1aabcf72bbf242f8bc12882a244d43b2c2c4740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d1aabcf72bbf242f8bc12882a244d43b2c2c4740/doctemplate.py |
||
def filterFlowables(self,flowables): '''called to filter flowables at the start of the main handle_flowable method. Upon return if flowables[0] has been set to None it is discarded and the main method returns. ''' pass | d1aabcf72bbf242f8bc12882a244d43b2c2c4740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d1aabcf72bbf242f8bc12882a244d43b2c2c4740/doctemplate.py |
||
See documentation for BaseDocTemplate. No pageTemplates are required | See documentation for BaseDocTemplate. No pageTemplates are required | def afterFlowable(self, flowable): '''called after a flowable has been rendered''' pass | d1aabcf72bbf242f8bc12882a244d43b2c2c4740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d1aabcf72bbf242f8bc12882a244d43b2c2c4740/doctemplate.py |
def afterFlowable(self, flowable): '''called after a flowable has been rendered''' pass | d1aabcf72bbf242f8bc12882a244d43b2c2c4740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d1aabcf72bbf242f8bc12882a244d43b2c2c4740/doctemplate.py |
||
def build(self,flowables,onFirstPage=_doNothing, onLaterPages=_doNothing): """build the document using the flowables. Annotate the first page using the onFirstPage function and later pages using the onLaterPages function. The onXXX pages should follow the signature def myOnFirstPage(canvas, document): # do annotations and modify the document ... The functions can do things like draw logos, page numbers, footers, etcetera. They can use external variables to vary the look (for example providing page numbering or section names). """ self._calc() #in case we changed margins sizes etc frameT = Frame(self.leftMargin, self.bottomMargin, self.width, self.height, id='normal') self.addPageTemplates([PageTemplate(id='First',frames=frameT, onPage=onFirstPage,pagesize=self.pagesize), PageTemplate(id='Later',frames=frameT, onPage=onLaterPages,pagesize=self.pagesize)]) if onFirstPage is _doNothing and hasattr(self,'onFirstPage'): self.pageTemplates[0].beforeDrawPage = self.onFirstPage if onLaterPages is _doNothing and hasattr(self,'onLaterPages'): self.pageTemplates[1].beforeDrawPage = self.onLaterPages BaseDocTemplate.build(self,flowables) | d1aabcf72bbf242f8bc12882a244d43b2c2c4740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d1aabcf72bbf242f8bc12882a244d43b2c2c4740/doctemplate.py |
||
def myOnFirstPage(canvas, document): # do annotations and modify the document ... | d1aabcf72bbf242f8bc12882a244d43b2c2c4740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d1aabcf72bbf242f8bc12882a244d43b2c2c4740/doctemplate.py |
||
if self.invariant: s = PDFString('constantconstant') self._ID = PDFArray([s,s]) else: digest = self.signature.digest() doc = DummyDoc() ID = PDFString(digest) IDs = ID.format(doc) self._ID = "%s %% ReportLab generated PDF document -- digest (http://www.reportlab.com) %s [%s %s] %s" % ( | digest = self.signature.digest() doc = DummyDoc() ID = PDFString(digest) IDs = ID.format(doc) self._ID = "%s %% ReportLab generated PDF document -- digest (http://www.reportlab.com) %s [%s %s] %s" % ( | def ID(self): "A unique fingerprint for the file (unless in invariant mode)" if self._ID: return self._ID if self.invariant: s = PDFString('constantconstant') self._ID = PDFArray([s,s]) else: digest = self.signature.digest() doc = DummyDoc() ID = PDFString(digest) IDs = ID.format(doc) self._ID = "%s %% ReportLab generated PDF document -- digest (http://www.reportlab.com) %s [%s %s] %s" % ( LINEEND, LINEEND, IDs, IDs, LINEEND) return self._ID | ac46cc9741821f75ae93c3dc546594d4a16dd322 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/ac46cc9741821f75ae93c3dc546594d4a16dd322/pdfdoc.py |
(tred, tgreen, tblue) = map(ord, PILImage.palette.data[transparency:transparency+3]) | palette = PILImage.palette try: palette = palette.palette except: palette = palette.data (tred, tgreen, tblue) = map(ord, palette[transparency:transparency+3]) | def _checkTransparency(self,PILImage): if self.mask=='auto': if PILImage.info.has_key("transparency") : transparency = PILImage.info["transparency"] * 3 (tred, tgreen, tblue) = map(ord, PILImage.palette.data[transparency:transparency+3]) self.mask = (tred, tred, tgreen, tgreen, tblue, tblue) else: self.mask = None elif hasattr(self.mask,'rgb'): self.mask = self.mask.rgb()+self.mask.rgb() | ac46cc9741821f75ae93c3dc546594d4a16dd322 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/ac46cc9741821f75ae93c3dc546594d4a16dd322/pdfdoc.py |
def package_home(globals_dict): __name__=globals_dict['__name__'] m=sys.modules[__name__] r=os.path.split(m.__path__[0])[0] return r | eb71b841d97414236851befcbe6ee9fa0bd38866 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/eb71b841d97414236851befcbe6ee9fa0bd38866/setup.py |
||
version="1.17", | version=get_version(), | def run(): LIBS = [] setup( name="Reportlab", version="1.17", licence="BSD license (see license.txt for details), Copyright (c) 2000-2003, ReportLab Inc.", description="The Reportlab Toolkit", long_description="""The ReportLab Toolkit. | eb71b841d97414236851befcbe6ee9fa0bd38866 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/eb71b841d97414236851befcbe6ee9fa0bd38866/setup.py |
cur_x = style.leftIndent | leftIndent = style.leftIndent cur_x = leftIndent | 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.""" | 6c7e147d9130dacadd2fe093bd3e271add7cebe3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6c7e147d9130dacadd2fe093bd3e271add7cebe3/paragraph.py |
canvas.rect(style.leftIndent, | canvas.rect(leftIndent, | 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.""" | 6c7e147d9130dacadd2fe093bd3e271add7cebe3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6c7e147d9130dacadd2fe093bd3e271add7cebe3/paragraph.py |
canvas.rect(0, 0, style.leftIndent, self.height) | canvas.rect(0, 0, leftIndent, self.height) | 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.""" | 6c7e147d9130dacadd2fe093bd3e271add7cebe3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6c7e147d9130dacadd2fe093bd3e271add7cebe3/paragraph.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.""" | 6c7e147d9130dacadd2fe093bd3e271add7cebe3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6c7e147d9130dacadd2fe093bd3e271add7cebe3/paragraph.py |
||
_do_under_lines(0, t_off, tx) | _do_under_lines(0, t_off+leftIndent, tx) | 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.""" | 6c7e147d9130dacadd2fe093bd3e271add7cebe3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6c7e147d9130dacadd2fe093bd3e271add7cebe3/paragraph.py |
_do_under_lines(i, t_off, tx) | _do_under_lines(i, t_off+leftIndent, tx) | 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.""" | 6c7e147d9130dacadd2fe093bd3e271add7cebe3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6c7e147d9130dacadd2fe093bd3e271add7cebe3/paragraph.py |
_do_under(0, t_off, tx) | _do_under(0, t_off+leftIndent, tx) | 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.""" | 6c7e147d9130dacadd2fe093bd3e271add7cebe3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6c7e147d9130dacadd2fe093bd3e271add7cebe3/paragraph.py |
_do_under(i, t_off, tx) | _do_under(i, t_off+leftIndent, tx) | 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.""" | 6c7e147d9130dacadd2fe093bd3e271add7cebe3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6c7e147d9130dacadd2fe093bd3e271add7cebe3/paragraph.py |
img1 = PIL_Image.open(filename) img = img1.convert('RGB') imgwidth, imgheight = img.size code = [] code.append('BI') code.append('/W %s /H %s /BPC 8 /CS /RGB /F [/A85 /Fl]' % (imgwidth, imgheight)) code.append('ID') raw = img.tostring() assert(len(raw) == imgwidth * imgheight, "Wrong amount of data for image") compressed = zlib.compress(raw) encoded = _AsciiBase85Encode(compressed) outstream = cStringIO.StringIO(encoded) dataline = outstream.read(60) while dataline <> "": code.append(dataline) | cachedname = os.path.splitext(filename)[0] + '.a85' if filename==cachedname: if cachedImageExists(filename): if returnInMemory: return split(open(cachedname,'rb').read(),LINEEND)[:-1] else: raise IOError, 'No such cached image %s' % filename else: img1 = PIL_Image.open(filename) img = img1.convert('RGB') imgwidth, imgheight = img.size code = [] code.append('BI') code.append('/W %s /H %s /BPC 8 /CS /RGB /F [/A85 /Fl]' % (imgwidth, imgheight)) code.append('ID') raw = img.tostring() assert(len(raw) == imgwidth * imgheight, "Wrong amount of data for image") compressed = zlib.compress(raw) encoded = _AsciiBase85Encode(compressed) outstream = cStringIO.StringIO(encoded) | def cacheImageFile(filename, returnInMemory=0): "Processes image as if for encoding, saves to a file with .a85 extension." from reportlab.lib.utils import PIL_Image import zlib img1 = PIL_Image.open(filename) img = img1.convert('RGB') imgwidth, imgheight = img.size code = [] code.append('BI') # begin image # this describes what is in the image itself code.append('/W %s /H %s /BPC 8 /CS /RGB /F [/A85 /Fl]' % (imgwidth, imgheight)) code.append('ID') #use a flate filter and Ascii Base 85 raw = img.tostring() assert(len(raw) == imgwidth * imgheight, "Wrong amount of data for image") compressed = zlib.compress(raw) #this bit is very fast... encoded = _AsciiBase85Encode(compressed) #...sadly this isn't #write in blocks of 60 characters per line outstream = cStringIO.StringIO(encoded) dataline = outstream.read(60) while dataline <> "": code.append(dataline) dataline = outstream.read(60) code.append('EI') if returnInMemory: return code #save it to a file cachedname = os.path.splitext(filename)[0] + '.a85' f = open(cachedname,'wb') f.write(join(code, LINEEND)+LINEEND) f.close() if rl_config._verbose: print 'cached image as %s' % cachedname | 5e8d456a5a0c47210cb8fdc91f075186c02909d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/5e8d456a5a0c47210cb8fdc91f075186c02909d6/pdfutils.py |
code.append('EI') if returnInMemory: return code cachedname = os.path.splitext(filename)[0] + '.a85' f = open(cachedname,'wb') f.write(join(code, LINEEND)+LINEEND) f.close() if rl_config._verbose: print 'cached image as %s' % cachedname | while dataline <> "": code.append(dataline) dataline = outstream.read(60) code.append('EI') if returnInMemory: return code f = open(cachedname,'wb') f.write(join(code, LINEEND)+LINEEND) f.close() if rl_config._verbose: print 'cached image as %s' % cachedname | def cacheImageFile(filename, returnInMemory=0): "Processes image as if for encoding, saves to a file with .a85 extension." from reportlab.lib.utils import PIL_Image import zlib img1 = PIL_Image.open(filename) img = img1.convert('RGB') imgwidth, imgheight = img.size code = [] code.append('BI') # begin image # this describes what is in the image itself code.append('/W %s /H %s /BPC 8 /CS /RGB /F [/A85 /Fl]' % (imgwidth, imgheight)) code.append('ID') #use a flate filter and Ascii Base 85 raw = img.tostring() assert(len(raw) == imgwidth * imgheight, "Wrong amount of data for image") compressed = zlib.compress(raw) #this bit is very fast... encoded = _AsciiBase85Encode(compressed) #...sadly this isn't #write in blocks of 60 characters per line outstream = cStringIO.StringIO(encoded) dataline = outstream.read(60) while dataline <> "": code.append(dataline) dataline = outstream.read(60) code.append('EI') if returnInMemory: return code #save it to a file cachedname = os.path.splitext(filename)[0] + '.a85' f = open(cachedname,'wb') f.write(join(code, LINEEND)+LINEEND) f.close() if rl_config._verbose: print 'cached image as %s' % cachedname | 5e8d456a5a0c47210cb8fdc91f075186c02909d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/5e8d456a5a0c47210cb8fdc91f075186c02909d6/pdfutils.py |
plains.append(frag.text) | if hasattr(frag, 'text'): plains.append(frag.text) | def getPlainText(self,identify=None): """Convenience function for templates which want access to the raw text, without XML tags. """ frags = getattr(self,'frags',None) if frags: plains = [] for frag in frags: plains.append(frag.text) return join(plains, '') elif identify: text = getattr(self,'text',None) if text is None: text = repr(self) return text else: return '' | bd1dfec63e301dc3f9c86b37591c4a3af318a458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bd1dfec63e301dc3f9c86b37591c4a3af318a458/paragraph.py |
os.system("%s %s %s %s" % (sys.executable,pp,xml, quiet)) | os.system(_quote(sys.executable,pp,xml, quiet)) | def test1(self): "Test if pythonpoint.pdf can be created from pythonpoint.xml." import reportlab rlDir = os.path.dirname(reportlab.__file__) ppDir = os.path.join(rlDir, 'tools', 'pythonpoint') pdf = os.path.join(ppDir,'demos','pythonpoint.pdf') xml = os.path.join(ppDir,'demos','pythonpoint.xml') pp = os.path.join(ppDir,'pythonpoint.py') exe = os.path.abspath(os.path.join(rlDir,'..','pythonpoint.exe')) | 3687553969c6f6aaf960aa90c0441d87cd36b24b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/3687553969c6f6aaf960aa90c0441d87cd36b24b/test_tools_pythonpoint.py |
os.system("%s %s %s" % (exe,xml, quiet)) | print _quote(exe,xml,quiet) os.system(_quote(exe,xml,quiet)) | def test1(self): "Test if pythonpoint.pdf can be created from pythonpoint.xml." import reportlab rlDir = os.path.dirname(reportlab.__file__) ppDir = os.path.join(rlDir, 'tools', 'pythonpoint') pdf = os.path.join(ppDir,'demos','pythonpoint.pdf') xml = os.path.join(ppDir,'demos','pythonpoint.xml') pp = os.path.join(ppDir,'pythonpoint.py') exe = os.path.abspath(os.path.join(rlDir,'..','pythonpoint.exe')) | 3687553969c6f6aaf960aa90c0441d87cd36b24b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/3687553969c6f6aaf960aa90c0441d87cd36b24b/test_tools_pythonpoint.py |
intPart, fracPart = divmod(num, 1.0) | absNum = abs(num) if absNum == num: sign = 1 else: sign = -1 intPart, fracPart = divmod(absNum, 1.0) | def format(self, num): intPart, fracPart = divmod(num, 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 pattern = '%0.' + str(self.decimalPlaces) + 'f' strFrac = (pattern % fracPart)[2:] strBody = strInt + self.decimalSeparator + strFrac if self.prefix: strBody = self.prefix + strBody if self.suffix: strBody = strBody + self.suffix return strBody | 81b65de4871c8ca05fc36389598f838a181b5edc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/81b65de4871c8ca05fc36389598f838a181b5edc/formatters.py |
self._barWidth = self._length / self._catCount | self._barWidth = self._length / (self._catCount or 1) | def configure(self, multiSeries): self._catCount = len(multiSeries[0]) self._barWidth = self._length / self._catCount | f369f400476d73be76504929be686bc95957d3ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/f369f400476d73be76504929be686bc95957d3ba/axes0.py |
self.linesep = os.linesep | self.linesep = '\n' | def __init__(self,stream): self.stream = stream if _isJPython: import java.lang.System self.linesep = java.lang.System.getProperty("line.separator") else: self.linesep = os.linesep | 02a119f9f43cf3e620d7d70d223a4aca10d9c201 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/02a119f9f43cf3e620d7d70d223a4aca10d9c201/unittest.py |
def copy(self): """Returns a deep copy""" obj = self.Drawing(self.width, self.height) | def _copy(self,obj): """copies to obj""" | def copy(self): """Returns a deep copy""" obj = self.Drawing(self.width, self.height) obj._attrMap = self._attrMap.clone() | 0bfc41659527a3f18e120b3c5c4f1a9ef5dc73f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/0bfc41659527a3f18e120b3c5c4f1a9ef5dc73f4/shapes.py |
image = PIL_Image.open(cStringIO.StringIO(logo.data)) | image = PIL_Image.open(cStringIO.StringIO(str(logo.data))) | def getImageFromZODB(self, name) : """Retrieves an Image from the ZODB, converts it to PIL, and makes it 0.75 inch high. """ try : # try to get it from ZODB logo = getattr(self.parent.context, name) except AttributeError : # not found ! return None | a92f5e65d9bd9a762451c3cdf959dd9912842827 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a92f5e65d9bd9a762451c3cdf959dd9912842827/rlzope.py |
if __name__=='__main__': | def test(): | def drawToString(d,fmt='GIF', dpi=72, bg=0xfffffff, configPIL=None, showBoundary=rl_config.showBoundary): s = getStringIO() drawToFile(d,s,fmt=fmt, dpi=dpi, bg=bg, configPIL=configPIL) return s.getvalue() | 57278f9d510735cd95902dac2b3e0110df78e4bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/57278f9d510735cd95902dac2b3e0110df78e4bc/renderPM.py |
def test(): import os from reportlab.graphics.testshapes import getAllTestDrawings drawings = [] if not os.path.isdir('pmout'): os.mkdir('pmout') htmlTop = """<html><head><title>renderPM output results</title></head> <body> <h1>renderPM results of output</h1> """ htmlBottom = """</body> </html> """ html = [htmlTop] i = 0 for (drawing, docstring, name) in getAllTestDrawings(): if 1 or i==10: w = int(drawing.width) h = int(drawing.height) html.append('<hr><h2>Drawing %s %d</h2>\n<pre>%s</pre>' % (name, i, docstring)) for k in ['gif','tiff', 'png', 'jpg', 'pct']: | import os from reportlab.graphics.testshapes import getAllTestDrawings drawings = [] if not os.path.isdir('pmout'): os.mkdir('pmout') htmlTop = """<html><head><title>renderPM output results</title></head> <body> <h1>renderPM results of output</h1> """ htmlBottom = """</body> </html> """ html = [htmlTop] i = 0 for (drawing, docstring, name) in getAllTestDrawings(): if 1 or i==10: w = int(drawing.width) h = int(drawing.height) html.append('<hr><h2>Drawing %s %d</h2>\n<pre>%s</pre>' % (name, i, docstring)) for k in ['gif','tiff', 'png', 'jpg', 'pct']: if k in ['gif','png','jpg','pct']: html.append('<p>%s format</p>\n' % string.upper(k)) try: filename = 'renderPM%d.%s' % (i, ext(k)) fullpath = os.path.join('pmout', filename) if os.path.isfile(fullpath): os.remove(fullpath) drawToFile(drawing,fullpath,fmt=k) | def ext(x): if x=='tiff': x='tif' return x | 57278f9d510735cd95902dac2b3e0110df78e4bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/57278f9d510735cd95902dac2b3e0110df78e4bc/renderPM.py |
html.append('<p>%s format</p>\n' % string.upper(k)) try: filename = 'renderPM%d.%s' % (i, ext(k)) fullpath = os.path.join('pmout', filename) if os.path.isfile(fullpath): os.remove(fullpath) drawToFile(drawing,fullpath,fmt=k) if k in ['gif','png','jpg','pct']: html.append('<img src="%s" border="1"><br>\n' % filename) print 'wrote',fullpath except AttributeError: print 'Problem drawing %s file'%k raise i = i + 1 html.append(htmlBottom) htmlFileName = os.path.join('pmout', 'index.html') open(htmlFileName, 'w').writelines(html) print 'wrote %s' % htmlFileName | html.append('<img src="%s" border="1"><br>\n' % filename) print 'wrote',fullpath except AttributeError: print 'Problem drawing %s file'%k raise i = i + 1 html.append(htmlBottom) htmlFileName = os.path.join('pmout', 'index.html') open(htmlFileName, 'w').writelines(html) print 'wrote %s' % htmlFileName if __name__=='__main__': | 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.testshapes import getAllTestDrawings drawings = [] if not os.path.isdir('pmout'): os.mkdir('pmout') htmlTop = """<html><head><title>renderPM output results</title></head> <body> <h1>renderPM results of output</h1> """ htmlBottom = """</body> </html> """ html = [htmlTop] | 57278f9d510735cd95902dac2b3e0110df78e4bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/57278f9d510735cd95902dac2b3e0110df78e4bc/renderPM.py |
lines = string.split(lines,'\r') | if lines: lines = string.split(lines[0],'\r') | def parseAFMFile(afmFileName): """Quick and dirty - gives back a top-level dictionary with top-level items, and a 'widths' key containing a dictionary of glyph names and widths. Just enough needed for embedding. A better parser would accept options for what data you wwanted, and preserve the order.""" lines = open_and_readlines(afmFileName, 'r') if len(lines)<=1: #likely to be a MAC file lines = string.split(lines,'\r') if len(lines)<=1: raise ValueError, 'AFM file %s hasn\'t enough data' % afmFileName topLevel = {} glyphLevel = [] lines = map(string.strip, lines) #pass 1 - get the widths inMetrics = 0 # os 'TOP', or 'CHARMETRICS' for line in lines: if line[0:16] == 'StartCharMetrics': inMetrics = 1 elif line[0:14] == 'EndCharMetrics': inMetrics = 0 elif inMetrics: chunks = string.split(line, ';') chunks = map(string.strip, chunks) cidChunk, widthChunk, nameChunk = chunks[0:3] # character ID l, r = string.split(cidChunk) assert l == 'C', 'bad line in font file %s' % line cid = string.atoi(r) # width l, r = string.split(widthChunk) assert l == 'WX', 'bad line in font file %s' % line width = string.atoi(r) # name l, r = string.split(nameChunk) assert l == 'N', 'bad line in font file %s' % line name = r glyphLevel.append((cid, width, name)) # pass 2 font info inHeader = 0 for line in lines: if line[0:16] == 'StartFontMetrics': inHeader = 1 if line[0:16] == 'StartCharMetrics': inHeader = 0 elif inHeader: if line[0:7] == 'Comment': pass try: left, right = string.split(line,' ',1) except: raise ValueError, "Header information error in afm %s: line='%s'" % (afmFileName, line) try: right = string.atoi(right) except: pass topLevel[left] = right return (topLevel, glyphLevel) | 187c4b97bd91a954a724165d1563ca5d7ebcf81f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/187c4b97bd91a954a724165d1563ca5d7ebcf81f/pdfmetrics.py |
if not os.path.isdir(dirname): continue | if not rl_isdir(dirname): continue | def bruteForceSearchForAFM(faceName): """Looks in all AFM files on path for face with given name. Returns AFM file name or None. Ouch!""" import glob from reportlab.rl_config import T1SearchPath for dirname in T1SearchPath: if not os.path.isdir(dirname): continue possibles = glob.glob(dirname + os.sep + '*.[aA][fF][mM]') for possible in possibles: (topDict, glyphDict) = parseAFMFile(possible) if topDict['FontName'] == faceName: return possible return None | 187c4b97bd91a954a724165d1563ca5d7ebcf81f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/187c4b97bd91a954a724165d1563ca5d7ebcf81f/pdfmetrics.py |
def bruteForceSearchForAFM(faceName): """Looks in all AFM files on path for face with given name. Returns AFM file name or None. Ouch!""" import glob from reportlab.rl_config import T1SearchPath for dirname in T1SearchPath: if not os.path.isdir(dirname): continue possibles = glob.glob(dirname + os.sep + '*.[aA][fF][mM]') for possible in possibles: (topDict, glyphDict) = parseAFMFile(possible) if topDict['FontName'] == faceName: return possible return None | 187c4b97bd91a954a724165d1563ca5d7ebcf81f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/187c4b97bd91a954a724165d1563ca5d7ebcf81f/pdfmetrics.py |
||
if _rl_accel.version<'0.59': raise ValueError add32 = _rl_accel.add32 calcChecksum = _rl_accel.calcChecksum | add32 = _rl_accel.add32L calcChecksum = _rl_accel.calcChecksumL | def hex32(i): return '0X%8.8X' % (long(i)&0xFFFFFFFFL) | aa3454c4f24d90edebb584b2ca5e33c454d2b8ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/aa3454c4f24d90edebb584b2ca5e33c454d2b8ab/ttfonts.py |
return ((x&0xFFFFFFFFL)+(y&0xFFFFFFFFL)) & 0xffffffffL | return (x+y) & 0xFFFFFFFFL | def add32(x, y): "Calculate (x + y) modulo 2**32" return ((x&0xFFFFFFFFL)+(y&0xFFFFFFFFL)) & 0xffffffffL | aa3454c4f24d90edebb584b2ca5e33c454d2b8ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/aa3454c4f24d90edebb584b2ca5e33c454d2b8ab/ttfonts.py |
sum = 0 for n in unpack(">%dl" % (len(data)>>2), data): sum = add32(sum,n) return sum | return sum(unpack(">%dl" % (len(data)>>2), data)) & 0xFFFFFFFFL | def calcChecksum(data): """Calculates TTF-style checksums""" if len(data)&3: data = data + (4-(len(data)&3))*"\0" sum = 0 for n in unpack(">%dl" % (len(data)>>2), data): sum = add32(sum,n) return sum | aa3454c4f24d90edebb584b2ca5e33c454d2b8ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/aa3454c4f24d90edebb584b2ca5e33c454d2b8ab/ttfonts.py |
or (type(uSymbol)==ClassType and issubclass(uSymbol,Widget)) | or (type(x)==ClassType and issubclass(x,Widget)) | def test(self,x): return callable(x) or isinstance(x,Marker) or isinstance(x,Flag) \ or (type(uSymbol)==ClassType and issubclass(uSymbol,Widget)) | 565e8db0942d39b3ade10fd450e16582bc3f51f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/565e8db0942d39b3ade10fd450e16582bc3f51f0/markers.py |
_attrMap.update(_xtraAttrMap) | _attrMap.update(_xtraAttrMap) | def asDrawing(self, width, height): """Convenience function to make a drawing from a group""" self.__class__ = Drawing self._attrMap.update(self._xtraAttrMap) self.width = width self.height = height | 50a857d23e4fd66199dca9c4705885e00388364a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/50a857d23e4fd66199dca9c4705885e00388364a/shapes.py |
self._pos = self._pos + 4 | self._pos += 4 | def read_tag(self): "Read a 4-character tag" self._pos = self._pos + 4 return self._ttf_data[self._pos - 4:self._pos] | 777650c46535c7f8d8c273db3ebb732aec256c29 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/777650c46535c7f8d8c273db3ebb732aec256c29/ttfonts.py |
self._pos = self._pos + 2 return (ord(self._ttf_data[self._pos - 2]) << 8) + \ (ord(self._ttf_data[self._pos - 1])) | self._pos += 2 return unpack('>H',self._ttf_data[self._pos-2:self._pos])[0] | def read_ushort(self): "Reads an unsigned short" self._pos = self._pos + 2 return (ord(self._ttf_data[self._pos - 2]) << 8) + \ (ord(self._ttf_data[self._pos - 1])) | 777650c46535c7f8d8c273db3ebb732aec256c29 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/777650c46535c7f8d8c273db3ebb732aec256c29/ttfonts.py |
self._pos = self._pos + 4 | self._pos += 4 | def read_ulong(self): "Reads an unsigned long" self._pos = self._pos + 4 return unpack('>l',self._ttf_data[self._pos - 4:self._pos])[0] | 777650c46535c7f8d8c273db3ebb732aec256c29 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/777650c46535c7f8d8c273db3ebb732aec256c29/ttfonts.py |
us = self.read_ushort() if us >= 0x8000: return us - 0x10000 else: return us | self._pos += 2 return unpack('>h',self._ttf_data[self._pos-2:self._pos])[0] | def read_short(self): "Reads a signed short" us = self.read_ushort() if us >= 0x8000: return us - 0x10000 else: return us | 777650c46535c7f8d8c273db3ebb732aec256c29 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/777650c46535c7f8d8c273db3ebb732aec256c29/ttfonts.py |
return (ord(self._ttf_data[pos]) << 8) + \ (ord(self._ttf_data[pos + 1])) | return unpack('>H',self._ttf_data[pos:pos+2])[0] | def get_ushort(self, pos): "Return an unsigned short at given position" return (ord(self._ttf_data[pos]) << 8) + \ (ord(self._ttf_data[pos + 1])) | 777650c46535c7f8d8c273db3ebb732aec256c29 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/777650c46535c7f8d8c273db3ebb732aec256c29/ttfonts.py |
def get_table(self, tag): "Return the given TTF table" pos, length = self.get_table_pos(tag) return self._ttf_data[pos:pos+length] | 777650c46535c7f8d8c273db3ebb732aec256c29 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/777650c46535c7f8d8c273db3ebb732aec256c29/ttfonts.py |
||
self.skip(11*2 + 10 + 4*4 + 4 + 3*2) | self.skip(58) | def extractInfo(self, charInfo=1): """Extract typographic information from the loaded font file. | 777650c46535c7f8d8c273db3ebb732aec256c29 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/777650c46535c7f8d8c273db3ebb732aec256c29/ttfonts.py |
self.skip(3*2 + 2*4 + 2) | self.skip(16) | def extractInfo(self, charInfo=1): """Extract typographic information from the loaded font file. | 777650c46535c7f8d8c273db3ebb732aec256c29 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/777650c46535c7f8d8c273db3ebb732aec256c29/ttfonts.py |
self.skip(2*2) | self.skip(4) | def extractInfo(self, charInfo=1): """Extract typographic information from the loaded font file. | 777650c46535c7f8d8c273db3ebb732aec256c29 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/777650c46535c7f8d8c273db3ebb732aec256c29/ttfonts.py |
if labels[0]==labels[1]: | if labels[0] and labels[0]==labels[1]: | def addTick(i, xVals=xVals, formatter=formatter, ticks=ticks, labels=labels): ticks.insert(0,xVals[i]) labels.insert(0,formatter(xVals[i])) | 2c2b9b81cab3cb7d535c717c80a3be7675c2a4de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2c2b9b81cab3cb7d535c717c80a3be7675c2a4de/axes.py |
self.valueSteps = steps | self._tickValues = steps | def configure(self, data): self._convertXV(data) xVals = map(lambda dv: dv[0], data[0]) if self.dailyFreq: xEOM = [] pm = 0 px = xVals[0] for x in xVals: m = x.month() if pm!=m: if pm: xEOM.append(px) pm = m px = x px = xVals[-1] if xEOM[-1]!=x: xEOM.append(px) steps, labels = self._xAxisTicker(xEOM) else: steps, labels = self._xAxisTicker(xVals) valueMin, valueMax = self.valueMin, self.valueMax if valueMin is None: valueMin = xVals[0] if valueMax is None: valueMax = xVals[-1] self._valueMin, self._valueMax = valueMin, valueMax self.valueSteps = steps self.labelTextFormat = labels | 2c2b9b81cab3cb7d535c717c80a3be7675c2a4de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2c2b9b81cab3cb7d535c717c80a3be7675c2a4de/axes.py |
y1, y2, None = find_good_grid(y_min, y_max,grid=valueStep) | y1, y2, None = find_good_grid(y_min, y_max,n=n,grid=valueStep) | def _rangeAdjust(self): "Adjusts the value range of the axis." | 2c2b9b81cab3cb7d535c717c80a3be7675c2a4de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2c2b9b81cab3cb7d535c717c80a3be7675c2a4de/axes.py |
T, L = ticks(self._valueMin, self._valueMax, split=1, percent=self.leftAxisPercent,grid=valueStep) | T, L = ticks(self._valueMin, self._valueMax, split=1, n=n, percent=self.leftAxisPercent,grid=valueStep) | def _rangeAdjust(self): "Adjusts the value range of the axis." | 2c2b9b81cab3cb7d535c717c80a3be7675c2a4de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2c2b9b81cab3cb7d535c717c80a3be7675c2a4de/axes.py |
T, L = ticks(self._valueMin, self._valueMax, split=1, percent=self.leftAxisPercent,grid=valueStep) | T, L = ticks(self._valueMin, self._valueMax, split=1, n=n, percent=self.leftAxisPercent,grid=valueStep) | def _rangeAdjust(self): "Adjusts the value range of the axis." | 2c2b9b81cab3cb7d535c717c80a3be7675c2a4de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2c2b9b81cab3cb7d535c717c80a3be7675c2a4de/axes.py |
self.valueSteps = T | self._tickValues = self.valueSteps = T | def _rangeAdjust(self): "Adjusts the value range of the axis." | 2c2b9b81cab3cb7d535c717c80a3be7675c2a4de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2c2b9b81cab3cb7d535c717c80a3be7675c2a4de/axes.py |
c.bookmarkPage("P2_XYZ",fitType="XYZ",top=7*inch,left=3*inch,zoom=2) | c.bookmarkPage("P2_XYZ",fit="XYZ",top=7*inch,left=3*inch,zoom=2) | def test1(self): | b3e8a12158cd0879ec0ae788465c6732c3f6ea3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b3e8a12158cd0879ec0ae788465c6732c3f6ea3f/test_pdfgen_links.py |
c.bookmarkPage("P2_FIT",fitType="Fit") | c.bookmarkPage("P2_FIT",fit="Fit") | def test1(self): | b3e8a12158cd0879ec0ae788465c6732c3f6ea3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b3e8a12158cd0879ec0ae788465c6732c3f6ea3f/test_pdfgen_links.py |
c.bookmarkPage("P2_FITH",fitType="FitH",top=2*inch) | c.bookmarkPage("P2_FITH",fit="FitH",top=2*inch) | def test1(self): | b3e8a12158cd0879ec0ae788465c6732c3f6ea3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b3e8a12158cd0879ec0ae788465c6732c3f6ea3f/test_pdfgen_links.py |
c.bookmarkPage("P2_FITV",fitType="FitV",left=10*inch) | c.bookmarkPage("P2_FITV",fit="FitV",left=10*inch) | def test1(self): | b3e8a12158cd0879ec0ae788465c6732c3f6ea3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b3e8a12158cd0879ec0ae788465c6732c3f6ea3f/test_pdfgen_links.py |
c.bookmarkPage("P2_FITR",fitType="FitR",left=1*inch,bottom=2*inch,right=5*inch,top=6*inch) | c.bookmarkPage("P2_FITR",fit="FitR",left=1*inch,bottom=2*inch,right=5*inch,top=6*inch) | def test1(self): | b3e8a12158cd0879ec0ae788465c6732c3f6ea3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b3e8a12158cd0879ec0ae788465c6732c3f6ea3f/test_pdfgen_links.py |
c.bookmarkPage("HYPER_1",fitType="XYZ",top=2.5*inch,bottom=2*inch) | c.bookmarkPage("HYPER_1",fit="XYZ",top=2.5*inch,bottom=2*inch) | def test1(self): | b3e8a12158cd0879ec0ae788465c6732c3f6ea3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b3e8a12158cd0879ec0ae788465c6732c3f6ea3f/test_pdfgen_links.py |
c.bookmarkPage("P3_XYZ",fitType="XYZ",top=7*inch,left=3*inch,zoom=0) | c.bookmarkPage("P3_XYZ",fit="XYZ",top=7*inch,left=3*inch,zoom=0) | def test1(self): | b3e8a12158cd0879ec0ae788465c6732c3f6ea3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b3e8a12158cd0879ec0ae788465c6732c3f6ea3f/test_pdfgen_links.py |
c.bookmarkPage("P3_FITV",fitType="FitV",left=10*inch) | c.bookmarkPage("P3_FITV",fit="FitV",left=10*inch) | def test1(self): | b3e8a12158cd0879ec0ae788465c6732c3f6ea3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b3e8a12158cd0879ec0ae788465c6732c3f6ea3f/test_pdfgen_links.py |
c.bookmarkPage("MOL",fitType="FitR",left=4*inch,top=7*inch,bottom=4*inch,right=6*inch) | c.bookmarkPage("MOL",fit="FitR",left=4*inch,top=7*inch,bottom=4*inch,right=6*inch) | def test1(self): | b3e8a12158cd0879ec0ae788465c6732c3f6ea3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b3e8a12158cd0879ec0ae788465c6732c3f6ea3f/test_pdfgen_links.py |
class SpiderChart(Widget): _attrMap = AttrMap( x = AttrMapValue(isNumber, desc='X position of the chart within its container.'), y = AttrMapValue(isNumber, desc='Y position of the chart within its container.'), width = AttrMapValue(isNumber, desc='width of spider bounding box. Need not be same as width.'), height = AttrMapValue(isNumber, desc='height of spider bounding box. Need not be same as height.'), | self.fontName = STATE_DEFAULTS["fontName"] self.fontSize = STATE_DEFAULTS["fontSize"] self.fontColor = STATE_DEFAULTS["fillColor"] self.labelRadius = 1.2 class SpiderChart(PlotArea): _attrMap = AttrMap(BASE=PlotArea, | def __init__(self): self.strokeWidth = 0 self.fillColor = None self.strokeColor = STATE_DEFAULTS["strokeColor"] self.strokeDashArray = STATE_DEFAULTS["strokeDashArray"] | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
self.x = 0 self.y = 0 self.width = 100 self.height = 100 | PlotArea.__init__(self) | def __init__(self): self.x = 0 self.y = 0 self.width = 100 self.height = 100 self.data = [[10,12,14,16,14,12], [6,8,10,12,9,11]] self.labels = None # or list of strings self.startAngle = 90 self.direction = "clockwise" | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
and 1.0 = maximum radius. Adds 10% at outside edge by default""" | and 1.0 = maximum radius. Adds 10% at outside edge by default""" | def normalizeData(self, outer = 0.0): """Turns data into normalized ones where each datum is < 1.0, and 1.0 = maximum radius. Adds 10% at outside edge by default""" data = self.data theMax = 0.0 for row in data: for element in row: assert element >=0, "Cannot do spider plots of negative numbers!" if element > theMax: theMax = element theMax = theMax * (1.0+outer) | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
def polarToRect(self, r, theta): "Convert to rectangular based on current size" return (self._centerx + r * sin(theta),self._centery + r * cos(theta)) | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
||
g = Group() g.add(Rect(self.x, self.y, self.width, self.height, strokeColor=colors.red, fillColor=None)) | g = self.makeBackground() or Group() | def draw(self): # normalize slice data g = Group() | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
def draw(self): # normalize slice data g = Group() | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
||
def draw(self): # normalize slice data g = Group() | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
||
print '%d slices each of %0.2f radians here: %s' % (n, angleBetween, repr(angles)) | def draw(self): # normalize slice data g = Group() | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
|
print 'added spoke (%0.2f, %0.2f) -> (%0.2f, %0.2f)' % (spoke.x1, spoke.y1, spoke.x2, spoke.y2) | def draw(self): # normalize slice data g = Group() | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
|
rowIdx = 0 | rowIdx = 0 | def draw(self): # normalize slice data g = Group() | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
def draw(self): # normalize slice data g = Group() | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
||
def draw(self): # normalize slice data g = Group() | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
||
pc.data = [[10,12,14,16,14,12], [6,8,10,12,9,11]] | pc.data = [[10,12,14,16,14,12], [6,8,10,12,9,15],[7,8,17,4,12,8,3]] | def sample1(): "Make a simple spider chart" d = Drawing(400, 400) pc = SpiderChart() pc.x = 50 pc.y = 50 pc.width = 300 pc.height = 300 pc.data = [[10,12,14,16,14,12], [6,8,10,12,9,11]] pc.labels = ['a','b','c','d','e','f'] d.add(pc) return d | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
pc.strands[2].fillColor=colors.palegreen | def sample1(): "Make a simple spider chart" d = Drawing(400, 400) pc = SpiderChart() pc.x = 50 pc.y = 50 pc.width = 300 pc.height = 300 pc.data = [[10,12,14,16,14,12], [6,8,10,12,9,11]] pc.labels = ['a','b','c','d','e','f'] d.add(pc) return d | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
|
print 'saved spider.pdf' | def sample1(): "Make a simple spider chart" d = Drawing(400, 400) pc = SpiderChart() pc.x = 50 pc.y = 50 pc.width = 300 pc.height = 300 pc.data = [[10,12,14,16,14,12], [6,8,10,12,9,11]] pc.labels = ['a','b','c','d','e','f'] d.add(pc) return d | bc401eccaecda1f7c0fa807f2550dc7992d6f227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bc401eccaecda1f7c0fa807f2550dc7992d6f227/spider.py |
|
def run(verbose=1, outDir=None): | def run(verbose=None, outDir=None): | def run(verbose=1, outDir=None): import os, sys, shutil from reportlab.tools.docco import yaml2pdf from reportlab.lib.utils import _RL_DIR yaml2pdf.run('reference.yml','reference.pdf') if verbose: print 'Saved reference.pdf' docdir = os.path.join(_RL_DIR,'docs') if outDir: docDir = outDir destfn = docdir + os.sep + 'reference.pdf' shutil.copyfile('reference.pdf', destfn) if verbose: print 'copied to %s' % destfn | 675bde20c55b4167a8de0e8c47035f11460f3141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/675bde20c55b4167a8de0e8c47035f11460f3141/genreference.py |
run(verbose=('-s' not in sys.argv)) | run() | def makeSuite(): "standard test harness support - run self as separate process" from reportlab.test.utils import ScriptThatMakesFileTest return ScriptThatMakesFileTest('../docs/reference', 'genreference.py', 'reference.pdf') | 675bde20c55b4167a8de0e8c47035f11460f3141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/675bde20c55b4167a8de0e8c47035f11460f3141/genreference.py |
elif frag.sub: | elif frag.super: | def handle_data(self,data): "Creates an intermediate representation of string segments." | 5c52853c4b3cf0d4032f9da62cecd454d1ee482a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/5c52853c4b3cf0d4032f9da62cecd454d1ee482a/paraparser.py |
frag.fontSize = min(frag.fontSize-sizeDelta,3) | frag.fontSize = max(frag.fontSize-sizeDelta,3) | def handle_data(self,data): "Creates an intermediate representation of string segments." | 5c52853c4b3cf0d4032f9da62cecd454d1ee482a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/5c52853c4b3cf0d4032f9da62cecd454d1ee482a/paraparser.py |
of Jove, from whatsoever source you may know them. | of Jove, from whatsoever source you<super>1</super> 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. """ | 5c52853c4b3cf0d4032f9da62cecd454d1ee482a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/5c52853c4b3cf0d4032f9da62cecd454d1ee482a/paraparser.py |
print l.fontName,l.fontSize,l.textColor,l.bold, l.text[:25] | print l.fontName,l.fontSize,l.textColor,l.bold, l.rise, l.text[:25] | 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. """ | 5c52853c4b3cf0d4032f9da62cecd454d1ee482a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/5c52853c4b3cf0d4032f9da62cecd454d1ee482a/paraparser.py |
if availableHeight<=needatleast: | if availableHeight < needatleast: | def wrap(self, availableWidth, availableHeight): if debug: print "WRAPPING", id(self), availableWidth, availableHeight print " ", self.formattedProgram print " ", self.program self.availableHeight = availableHeight self.myengine = p = paragraphEngine() p.baseindent = self.baseindent # for shifting bullets as needed parsedText = self.parsedText formattedProgram = self.formattedProgram state = self.state if state: leading = state["leading"] else: leading = self.style1.leading program = self.program self.cansplit = 1 # until proven otherwise if state: p.resetState(state) p.x = 0 p.y = 0 needatleast = state["leading"] else: needatleast = self.style1.leading if availableHeight<=needatleast: self.cansplit = 0 #if debug: # print "CANNOT COMPILE, NEED AT LEAST", needatleast, 'AVAILABLE', availableHeight return (availableHeight+1, availableWidth) # cannot split if parsedText is None and program is None: raise ValueError, "need parsedText for formatting" if not program: self.program = program = self.compileProgram(parsedText) if not self.formattedProgram: (formattedProgram, remainder, \ laststate, heightused) = p.format(availableWidth, availableHeight, program, leading) self.formattedProgram = formattedProgram self.height = heightused self.laststate = laststate self.remainderProgram = remainder else: heightused = self.height remainder = None # too big if there is a remainder if remainder: # lie about the height: it must be split anyway #if debug: # print "I need to split", self.formattedProgram # print "heightused", heightused, "available", availableHeight, "remainder", len(remainder) height = availableHeight + 1 #print "laststate is", laststate #print "saving remainder", remainder self.remainder = Para(self.style1, parsedText=None, bulletText=None, \ state=laststate, context=self.context) self.remainder.program = remainder self.remainder.spaceAfter = self.spaceAfter self.spaceAfter = 0 else: self.remainder = None # no extra height = heightused if height>availableHeight: height = availableHeight-0.1 #if debug: # print "giving height", height, "of", availableHeight, self.parsedText result = (availableWidth, height) if debug: (w, h) = result if abs(availableHeight-h)<0.2: print "exact match???" + repr(availableHeight, h) print "wrap is", (availableWidth, availableHeight), result return result | ec9b2189ae9d1af98188bc17873ef511a6d18e72 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/ec9b2189ae9d1af98188bc17873ef511a6d18e72/para.py |
print 'usage: aml.py source.txt' | print 'usage: yaml.py source.txt' | def getClassDoc(self, modulename, classname, pathname=None): """Documents the class and its public methods""" docco = codegrab.getObjectsDefinedIn(modulename, pathname) found = 0 for cls in docco.classes: if cls.name == classname: found = 1 self._results.append(('Preformatted','FunctionHeader', 'Class %s:' % cls.name)) self._results.append(('Preformatted','DocString', cls.doc)) for mth in cls.methods: if mth.status == 'official': self._results.append(('Preformatted','FunctionHeader', mth.proto)) self._results.append(('Preformatted','DocStringIndent', mth.doc)) break assert found, 'No Classes Defined in ' + modulename | 2d7f46beb2c77c8e7d5a6796693cc6c30d66d7d9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2d7f46beb2c77c8e7d5a6796693cc6c30d66d7d9/yaml.py |
self._code.append('[%s %s] 0 d' % (array, phase)) | self._code.append('[%s] %s d' % (array, phase)) | def setDash(self, array=[], phase=0): """Two notations. pass two numbers, or an array and phase""" if type(array) == IntType or type(array) == FloatType: self._code.append('[%s %s] 0 d' % (array, phase)) elif type(array) == ListType or type(array) == TupleType: assert phase >= 0, "phase is a length in user space" textarray = join(map(str, array)) self._code.append('[%s] %s d' % (textarray, phase)) | bfe140d51f52d5c75b947ac5687323c53ba5b979 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bfe140d51f52d5c75b947ac5687323c53ba5b979/canvas.py |
textarray = join(map(str, array)) | textarray = ' '.join(map(str, array)) | def setDash(self, array=[], phase=0): """Two notations. pass two numbers, or an array and phase""" if type(array) == IntType or type(array) == FloatType: self._code.append('[%s %s] 0 d' % (array, phase)) elif type(array) == ListType or type(array) == TupleType: assert phase >= 0, "phase is a length in user space" textarray = join(map(str, array)) self._code.append('[%s] %s d' % (textarray, phase)) | bfe140d51f52d5c75b947ac5687323c53ba5b979 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bfe140d51f52d5c75b947ac5687323c53ba5b979/canvas.py |
f=lambda T,x=x,special=special: special(T,x,func) | f=lambda T,x=x,special=special,func=func: special(T,x,func) | def _findMinMaxValue(V, x, default, func, special=None): if type(V[0][0]) in (TupleType,ListType): if special: f=lambda T,x=x,special=special: special(T,x,func) else: f=lambda T,x=x: T[x] V=map(lambda e,f=f: map(f,e),V) V = filter(len,map(lambda x: filter(lambda x: x is not None,x),V)) if len(V)==0: return default return func(map(func,V)) | d053cfc9d3a717e667b371a16bffaf9b2f390b8f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/d053cfc9d3a717e667b371a16bffaf9b2f390b8f/axes.py |
from widgets import (BarcodeI2of5, BarcodeCode128, BarcodeStandard93, BarcodeExtended93, BarcodeStandard39, BarcodeExtended39, BarcodeMSI, BarcodeCodabar, BarcodeCode11, BarcodeFIM, BarcodePOSTNET, BarcodeUSPS_4State) | from widgets import BarcodeI2of5, BarcodeCode128, BarcodeStandard93,\ BarcodeExtended93, BarcodeStandard39, BarcodeExtended39,\ BarcodeMSI, BarcodeCodabar, BarcodeCode11, BarcodeFIM,\ BarcodePOSTNET, BarcodeUSPS_4State | def getCodes(): """Returns a dict mapping code names to widgets""" from widgets import (BarcodeI2of5, BarcodeCode128, BarcodeStandard93, BarcodeExtended93, BarcodeStandard39, BarcodeExtended39, BarcodeMSI, BarcodeCodabar, BarcodeCode11, BarcodeFIM, BarcodePOSTNET, BarcodeUSPS_4State) #newer codes will typically get their own module from eanbc import Ean13BarcodeWidget, Ean8BarcodeWidget #the module exports a dictionary of names to widgets, to make it easy for #apps and doc tools to display information about them. codes = {} for widget in ( BarcodeI2of5, BarcodeCode128, BarcodeStandard93, BarcodeExtended93, BarcodeStandard39, BarcodeExtended39, BarcodeMSI, BarcodeCodabar, BarcodeCode11, BarcodeFIM, BarcodePOSTNET, BarcodeUSPS_4State, Ean13BarcodeWidget, Ean8BarcodeWidget, ): codeName = widget.codeName codes[codeName] = widget return codes | 25cb6ce086058125fdfe2d0ade5f11526a431c16 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/25cb6ce086058125fdfe2d0ade5f11526a431c16/__init__.py |
if self._code[-1][-3:]==' cm': | if len(self._code) and self._code[-1][-3:]==' cm': | def transform(self, a,b,c,d,e,f): """adjoin a mathematical transform to the current graphics state matrix. Not recommended for beginners.""" #"""How can Python track this?""" #a0,b0,c0,d0,e0,f0 = self._currentMatrix #self._currentMatrix = (a0*a+c0*b, b0*a+d0*b, # a0*c+c0*d, b0*c+d0*d, # a0*e+c0*f+e0, b0*e+d0*f+f0) if self._code[-1][-3:]==' cm': L = string.split(self._code[-1]) a0, b0, c0, d0, e0, f0 = map(float,L[-7:-1]) s = len(L)>7 and string.join(L)+ ' %s cm' or '%s cm' self._code[-1] = s % fp_str(a0*a+c0*b,b0*a+d0*b,a0*c+c0*d,b0*c+d0*d,a0*e+c0*f+e0,b0*e+d0*f+f0) else: self._code.append('%s cm' % fp_str(a,b,c,d,e,f)) | 0de2e0a940c2934ce8b7bb2081b1a3823d8a6ac6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/0de2e0a940c2934ce8b7bb2081b1a3823d8a6ac6/canvas.py |
self.code.append('%'+msg) | if self.comments: self.code.append('%'+msg) | def comment(self,msg): self.code.append('%'+msg) | 2088c87e27c84740473f48627356552800eb35e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2088c87e27c84740473f48627356552800eb35e0/renderPS.py |
lc.lines.symbol = makeFilledDiamond | lc.lines.symbol = makeMarker('FilledDiamond') | def sample1(): drawing = Drawing(400, 200) data = [ (13, 5, 20, 22, 37, 45, 19, 4), (5, 20, 46, 38, 23, 21, 6, 14) ] lc = HorizontalLineChart() lc.x = 50 lc.y = 50 lc.height = 125 lc.width = 300 lc.data = data lc.joinedLines = 1 lc.lines.symbol = makeFilledDiamond lc.lineLabelFormat = '%2.0f' catNames = string.split('Jan Feb Mar Apr May Jun Jul Aug', ' ') lc.categoryAxis.categoryNames = catNames lc.categoryAxis.labels.boxAnchor = 'n' lc.valueAxis.valueMin = 0 lc.valueAxis.valueMax = 60 lc.valueAxis.valueStep = 15 drawing.add(lc) return drawing | 48a67cdad0adf89639711f5b791c6455eef2f187 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/48a67cdad0adf89639711f5b791c6455eef2f187/linecharts.py |
lc.lines.symbol = makeFilledDiamond | lc.lines.symbol = makeMarker('FilledDiamond') | def sample1a(): drawing = Drawing(400, 200) data = [ (13, 5, 20, 22, 37, 45, 19, 4), (5, 20, 46, 38, 23, 21, 6, 14) ] lc = SampleHorizontalLineChart() lc.x = 50 lc.y = 50 lc.height = 125 lc.width = 300 lc.data = data lc.joinedLines = 1 lc.strokeColor = colors.white lc.fillColor = colors.HexColor(0xCCCCCC) lc.lines.symbol = makeFilledDiamond lc.lineLabelFormat = '%2.0f' catNames = string.split('Jan Feb Mar Apr May Jun Jul Aug', ' ') lc.categoryAxis.categoryNames = catNames lc.categoryAxis.labels.boxAnchor = 'n' lc.valueAxis.valueMin = 0 lc.valueAxis.valueMax = 60 lc.valueAxis.valueStep = 15 drawing.add(lc) return drawing | 48a67cdad0adf89639711f5b791c6455eef2f187 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/48a67cdad0adf89639711f5b791c6455eef2f187/linecharts.py |
lc.lines.symbol = makeSmiley lc.lines.symbol = Marker() lc.lines.symbol.kind = 'Smiley' | lc.lines.symbol = makeMarker('Smiley') | def sample2(): drawing = Drawing(400, 200) data = [ (13, 5, 20, 22, 37, 45, 19, 4), (5, 20, 46, 38, 23, 21, 6, 14) ] lc = HorizontalLineChart() lc.x = 50 lc.y = 50 lc.height = 125 lc.width = 300 lc.data = data lc.joinedLines = 1 lc.lines.symbol = makeSmiley lc.lines.symbol = Marker() lc.lines.symbol.kind = 'Smiley' lc.lineLabelFormat = '%2.0f' lc.strokeColor = colors.black lc.fillColor = colors.lightblue catNames = string.split('Jan Feb Mar Apr May Jun Jul Aug', ' ') lc.categoryAxis.categoryNames = catNames lc.categoryAxis.labels.boxAnchor = 'n' lc.valueAxis.valueMin = 0 lc.valueAxis.valueMax = 60 lc.valueAxis.valueStep = 15 drawing.add(lc) return drawing | 48a67cdad0adf89639711f5b791c6455eef2f187 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/48a67cdad0adf89639711f5b791c6455eef2f187/linecharts.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.