bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def SaveToFile(self, filename, canvas): from types import StringType # prepare outline outline = self.outline outline.prepare(self, canvas) if type(filename) is StringType: myfile = 1 f = open(filename, "wb") else: myfile = 0 f = filename # IT BETTER BE A FILE-LIKE OBJECT! txt = self.format() f.write(txt) if myfile: f....
def SaveToFile(self, filename, canvas): from types import StringType # prepare outlineif type(filename) is StringType: myfile = 1 f = open(filename, "wb") else: myfile = 0 f = filename # IT BETTER BE A FILE-LIKE OBJECT! txt = self.format() f.write(txt) if myfile: f.close() markfilename(filename) # do platform specific ...
5,700
def frange(start, end=None, inc=None): "A range function, that does accept float increments..." if end == None: end = start + 0.0 start = 0.0 if inc == None: inc = 1.0 L = [] while 1: next = start + len(L) * inc if next >= end: break L.append(next) return L
def frange(start, end=None, inc=None): "A range function, that does accept float increments..." if end == None: end = start + 0.0 start = 0.0 if inc == None: inc = 1.0 L = [] while 1: next = start + len(L) * inc if inc > 0 and next >= end: break elif inc < 0 and next <= end: break L.append(next) return L
5,701
def main(): cwd = os.getcwd() os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) MACROS=[('ROBIN_DEBUG',None)] MACROS=[] from glob import glob from distutils.core import setup, Extension pJoin=os.path.join LIBART_VERSION = libart_version() SOURCES=['_renderPM.c'] DEVEL_DIR=os.curdir LIBART_DIR=pJoin(DEVEL_DIR,'li...
def main(): cwd = os.getcwd() os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) MACROS=[('ROBIN_DEBUG',None)] MACROS=[] from glob import glob from distutils.core import setup, Extension pJoin=os.path.join LIBART_VERSION = libart_version() SOURCES=['_renderPM.c'] DEVEL_DIR=os.curdir LIBART_DIR=pJoin(DEVEL_DIR,'li...
5,702
def recursiveImport(modulename, baseDir=None, noCWD=0): """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 noCWD and '.'...
def recursiveImport(modulename, baseDir=None, noCWD=0): """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 noCWD and '.'...
5,703
def drawRightString(self, x, y, text): """Draws a string right-aligned with the y coordinate""" width = self.stringWidth(text, self._fontname, self._fontsize) t = self.beginText(x - width, y) t.textLine(text) self.drawText(t)
def drawRightString(self, x, y, text): """Draws a string right-aligned with the x coordinate""" width = self.stringWidth(text, self._fontname, self._fontsize) t = self.beginText(x - width, y) t.textLine(text) self.drawText(t)
5,704
def drawCentredString(self, x, y, text): """Draws a string right-aligned with the y coordinate. I am British so the spelling is correct, OK?""" width = self.stringWidth(text, self._fontname, self._fontsize) t = self.beginText(x - 0.5*width, y) t.textLine(text) self.drawText(t)
def drawCentredString(self, x, y, text): """Draws a string right-aligned with the x coordinate. I am British so the spelling is correct, OK?""" width = self.stringWidth(text, self._fontname, self._fontsize) t = self.beginText(x - 0.5*width, y) t.textLine(text) self.drawText(t)
5,705
def __init__(self): self.debug = 0
def __init__(self): self.debug = 0
5,706
def _findMinMaxValues(self): "Find the minimum and maximum value of the data we have." data = map(lambda x: map(lambda x: x is not None and x or 0,x), self.data) return min(min(data)), max(max(data))
def _findMinMaxValues(self): "Find the minimum and maximum value of the data we have." data = map(lambda x: map(lambda x: x is not None and x or 0,x), self.data) return min(min(data)), max(max(data))
5,707
def makeBackground(self): g = Group() #print 'BarChart.makeBackground(%s, %s, %s, %s)' % (self.x, self.y, self.width, self.height) g.add(Rect(self.x, self.y, self.width, self.height, strokeColor = self.strokeColor, fillColor= self.fillColor))
def makeBackground(self): g = Group() #print 'BarChart.makeBackground(%s, %s, %s, %s)' % (self.x, self.y, self.width, self.height) g.add(Rect(self.x, self.y, self.width, self.height, strokeColor = self.strokeColor, fillColor= self.fillColor))
5,708
def demo(self): """Shows basic use of a bar chart"""
defdemo(self):"""Showsbasicuseofabarchart"""
5,709
def demo(self): """Shows basic use of a bar chart"""
def demo(self): """Shows basic use of a bar chart"""
5,710
def demo(self): """Shows basic use of a bar chart"""
def demo(self): """Shows basic use of a bar chart"""
5,711
def demo(self): """Shows basic use of a bar chart"""
defdemo(self):"""Showsbasicuseofabarchart"""
5,712
def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): from reportlab import rl_config "Saves copies of self in desired location and formats" ext = '' if not fnRoot: fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) chartId = getattr(self,'chartId',0) if callable(fnRoot): fnRoot =...
def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): from reportlab import rl_config "Saves copies of self in desired location and formats" ext = '' if not fnRoot: fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) chartId = getattr(self,'chartId',0) if callable(fnRoot): fnRoot =...
5,713
def makeSuite(folder, exclude=[],nonImportable=[]): "Build a test suite of all available test files." allTests = unittest.TestSuite() sys.path.insert(0, folder) for filename in GlobDirectoryWalker(folder, 'test_*.py'): modname = os.path.splitext(os.path.basename(filename))[0] if modname not in exclude: try: module = ...
def makeSuite(folder, exclude=[],nonImportable=[]): "Build a test suite of all available test files." allTests = unittest.TestSuite() sys.path.insert(0, folder) for filename in GlobDirectoryWalker(folder, 'test_*.py'): modname = os.path.splitext(os.path.basename(filename))[0] if modname not in exclude: try: module = ...
5,714
def _listCellGeom(V,w,s,W=None): aW = w-s.leftPadding-s.rightPadding t = 0 w = 0 for v in V: vw, vh = v.wrap(aW, 72000) if W is not None: W.append(vw) w = max(w,vw) t = t + vh + v.getSpaceBefore()+v.getSpaceAfter() return w, t - V[0].getSpaceBefore()-V[-1].getSpaceAfter()
def _listCellGeom(V,w,s,W=None,H=None): aW = w-s.leftPadding-s.rightPadding t = 0 w = 0 for v in V: vw, vh = v.wrap(aW, 72000) if W is not None: W.append(vw) w = max(w,vw) t = t + vh + v.getSpaceBefore()+v.getSpaceAfter() return w, t - V[0].getSpaceBefore()-V[-1].getSpaceAfter()
5,715
def _calc(self): if hasattr(self,'_width'): return
def _calc(self): if hasattr(self,'_width'): return
5,716
def _calc(self): if hasattr(self,'_width'): return
def _calc(self): if hasattr(self,'_width'): return
5,717
def _calc(self): if hasattr(self,'_width'): return
def _calc(self): if hasattr(self,'_width'): return
5,718
def _calc(self): if hasattr(self,'_width'): return
def _calc(self): if hasattr(self,'_width'): return
5,719
def _calc(self): if hasattr(self,'_width'): return
def _calc(self): if hasattr(self,'_width'): return
5,720
def _splitRows(self,availHeight): h = 0 n = 0 lim = len(self._rowHeights) while n<lim: hn = h + self._rowHeights[n] if hn>availHeight: break h = hn n = n + 1
def _splitRows(self,availHeight): h = 0 n = 0 lim = len(self._rowHeights) while n<lim: hn = h + self._rowHeights[n] if hn>availHeight: break h = hn n = n + 1
5,721
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.fontn...
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.fontn...
5,722
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.fontn...
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.fontn...
5,723
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.fontn...
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.fontn...
5,724
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.fontn...
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.fontn...
5,725
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.fontn...
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.fontn...
5,726
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.fontn...
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.fontn...
5,727
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,...
deftest():fromreportlab.lib.unitsimportinchrowheights=(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),('...
5,728
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,...
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,...
5,729
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,...
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,...
5,730
def mainPageFrame(canvas, doc): "The page frame used for all PDF documents." canvas.saveState() pageNumber = canvas.getPageNumber() canvas.line(2*cm, A4[1]-2*cm, A4[0]-2*cm, A4[1]-2*cm) canvas.line(2*cm, 2*cm, A4[0]-2*cm, 2*cm) if pageNumber > 1: canvas.setFont('Times-Roman', 12) canvas.drawString(4 * inch, cm, "%d" ...
def mainPageFrame(canvas, doc): "The page frame used for all PDF documents." canvas.saveState() pageNumber = canvas.getPageNumber() canvas.line(2*cm, A4[1]-2*cm, A4[0]-2*cm, A4[1]-2*cm) canvas.line(2*cm, 2*cm, A4[0]-2*cm, 2*cm) if pageNumber > 1: canvas.setFont('Times-Roman', 12) canvas.drawString(4 * inch, cm, "%d" ...
5,731
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
5,732
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
5,733
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
5,734
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
5,735
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
5,736
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
5,737
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
5,738
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
5,739
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
5,740
def makeHtmlSection(text, bgcolor='#FFA0FF'): """Create HTML code for a section. This is usually a header for all classes or functions. """ text = htmlescape(expandtabs(text)) result = [] result.append("""<TABLE WIDTH="100\%" BORDER="0">""") result.append("""<TR><TD BGCOLOR="%s" VALIGN="CENTER">""" % bgcolor) result.a...
def makeHtmlSection(text, bgcolor='#FFA0FF'): """Create HTML code for a section. This is usually a header for all classes or functions. u """ text = htmlescape(expandtabs(text)) result = [] result.append("""<TABLE WIDTH="100\%" BORDER="0">""") result.append("""<TR><TD BGCOLOR="%s" VALIGN="CENTER">u """ % bgcolor...
5,741
def begin(self): styleSheet = getSampleStyleSheet() self.h1 = styleSheet['Heading1'] self.h2 = styleSheet['Heading2'] self.h3 = styleSheet['Heading3'] self.code = styleSheet['Code'] self.bt = styleSheet['BodyText'] self.story = [] self.classCompartment = '' self.methodCompartment = []
def begin(self, name='', typ=''): styleSheet = getSampleStyleSheet() self.h1 = styleSheet['Heading1'] self.h2 = styleSheet['Heading2'] self.h3 = styleSheet['Heading3'] self.code = styleSheet['Code'] self.bt = styleSheet['BodyText'] self.story = [] self.classCompartment = '' self.methodCompartment = []
5,742
def beginModule(self, name, doc, imported): story = self.story h1, h2, h3, bt = self.h1, self.h2, self.h3, self.bt styleSheet = getSampleStyleSheet() bt1 = styleSheet['BodyText']
def beginModule(self, name, doc, imported): story = self.story h1, h2, h3, bt = self.h1, self.h2, self.h3, self.bt styleSheet = getSampleStyleSheet() bt1 = styleSheet['BodyText']
5,743
def beginModule(self, name, doc, imported): story = self.story h1, h2, h3, bt = self.h1, self.h2, self.h3, self.bt styleSheet = getSampleStyleSheet() bt1 = styleSheet['BodyText']
def beginModule(self, name, doc, imported): story = self.story h1, h2, h3, bt = self.h1, self.h2, self.h3, self.bt styleSheet = getSampleStyleSheet() bt1 = styleSheet['BodyText']
5,744
def makeBars(self): g = Group()
def makeBars(self): g = Group()
5,745
def makeBars(self): g = Group()
def makeBars(self): g = Group()
5,746
def sample1c(): "Make sample legend." d = Drawing(200, 100) legend = Legend() legend.alignment = 'right' legend.x = 0 legend.y = 100 legend.dxTextSpace = 5 items = string.split('red green blue yellow pink black white', ' ') items = map(lambda i:(getattr(colors, i), i), items) legend.colorNamePairs = items d.add(lege...
def sample1c(): "Make sample legend." d = Drawing(200, 100) legend = Legend() legend.alignment = 'right' legend.x = 0 legend.y = 100 legend.dxTextSpace = 5 items = string.split('red green blue yellow pink black white', ' ') items = map(lambda i:(getattr(colors, i), i), items) legend.colorNamePairs = items d.add(lege...
5,747
def makeTickLabels(self): g = Group()
def makeTickLabels(self): g = Group()
5,748
def _calcTickmarkPositions(self): """Calculate a list of tick positions on the axis.
def _calcTickmarkPositions(self): """Calculate a list of tick positions on the axis.
5,749
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
5,750
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
5,751
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
def afterFlowable(self, flowable): "Takes care of header line, TOC and outline entries." if flowable.__class__.__name__ == 'Paragraph': f = flowable
5,752
def beginClass(self, name, doc, bases): "Append a graphic demo of a widget at the end of a class." aClass = eval('self.skeleton.moduleSpace.' + name) if issubclass(aClass, Widget): if self.shouldDisplayModule: modName, modDoc, imported = self.shouldDisplayModule self.story.append(Paragraph(modName, self.makeHeadingSty...
def beginClass(self, name, doc, bases): "Append a graphic demo of a widget at the end of a class." aClass = eval('self.skeleton.moduleSpace.' + name) if issubclass(aClass, Widget): if self.shouldDisplayModule: modName, modDoc, imported = self.shouldDisplayModule self.story.append(Paragraph(modName, self.makeHeadingSty...
5,753
def _showWidgetDemo(self, widget): """Show a graphical demo of the widget."""
def _showWidgetDemo(self, widget): """Show a graphical demo of the widget."""
5,754
def _showWidgetDemo(self, widget): """Show a graphical demo of the widget."""
def _showWidgetDemo(self, widget): """Show a graphical demo of the widget."""
5,755
def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): "Saves copies of self in desired location and formats" ext = '' outDir = outDir or getattr(self,'outDir','.') if not os.path.isabs(outDir): outDir = os.path.join(os.path.dirname(sys.argv[0]),outDir) if not os.path.isdir(outDir): os.makedirs(outDir) f...
def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): "Saves copies of self in desired location and formats" ext = '' outDir = outDir or getattr(self,'outDir','.') if not os.path.isabs(outDir): outDir = os.path.join(os.path.dirname(sys.argv[0]),outDir) if not os.path.isdir(outDir): os.makedirs(outDir) f...
5,756
def _do_under_lines(i, t_off, tx): y = tx.XtraState.cur_y - i*tx.XtraState.style.leading - tx.XtraState.f.fontSize/8.0 # 8.0 factor copied from para.py text = join(lines[i][1]) textlen = tx._canvas.stringWidth(text, tx._fontname, tx._fontsize) tx._canvas.line(t_off, y, t_off+textlen, y)
def _do_under_lines(i, t_off, tx): y = tx.XtraState.cur_y - i*tx.XtraState.style.leading - tx.XtraState.f.fontSize/8.0 # 8.0 factor copied from para.py text = join(tx.lines[i][1]) textlen = tx._canvas.stringWidth(text, tx._fontname, tx._fontsize) tx._canvas.line(t_off, y, t_off+textlen, y)
5,757
def polarToRect(self, r, theta): "Convert to rectangular based on current size" return (self._centerx + r * sin(theta),self._centery + r * cos(theta))
def polarToRect(self, r, theta): "Convert to rectangular based on current size" return (self._centerx + r * sin(theta),self._centery + r * cos(theta))
5,758
def draw(self): # normalize slice data g = self.makeBackground() or Group()
def draw(self): # normalize slice data g = self.makeBackground() or Group()
5,759
def draw(self): # normalize slice data g = self.makeBackground() or Group()
def draw(self): # normalize slice data g = self.makeBackground() or Group()
5,760
def draw(self): # normalize slice data g = self.makeBackground() or Group()
def draw(self): # normalize slice data g = self.makeBackground() or Group()
5,761
def draw(self): # normalize slice data g = self.makeBackground() or Group()
def draw(self): # normalize slice data g = self.makeBackground() or Group()
5,762
def draw(self): # normalize slice data g = self.makeBackground() or Group()
def draw(self): # normalize slice data g = self.makeBackground() or Group()
5,763
def draw(self): # normalize slice data g = self.makeBackground() or Group()
def draw(self): # normalize slice data g = self.makeBackground() or Group()
5,764
def draw(self): # normalize slice data g = self.makeBackground() or Group()
def draw(self): # normalize slice data g = self.makeBackground() or Group()
5,765
def draw(self): # normalize slice data g = self.makeBackground() or Group()
def draw(self): # normalize slice data g = self.makeBackground() or Group()
5,766
def draw(self): # normalize slice data g = self.makeBackground() or Group()
def draw(self): # normalize slice data g = self.makeBackground() or Group()
5,767
def draw(self): g = Group() colorNamePairs = self.colorNamePairs thisx = upperleftx = self.x thisy = upperlefty = self.y - self.dx dx, dy = self.dx, self.dy
def draw(self): g = Group() colorNamePairs = self.colorNamePairs thisx = upperleftx = self.x thisy = upperlefty = self.y - self.dy dx, dy = self.dx, self.dy
5,768
def F(x,i, slope=slope, y0=y0): return float((x-x0)*slope[i]+y0[i])
def F(x,i, slope=slope, y0=y0): return float((x-x0)*slope[i]+y0[i])
5,769
def F(x,i, slope=slope, y0=y0): return float((x-x0)*slope[i]+y0[i])
def F(x,i, slope=slope, y0=y0): return float((x-x0)*slope[i]+y0[i])
5,770
def _cmp_rl_accel_dirs(a,b): return cmp(_rl_accel_dir_info(b),__rl_accel_dir_info(a))
def _cmp_rl_accel_dirs(a,b): return cmp(_rl_accel_dir_info(b),_rl_accel_dir_info(a))
5,771
def runOpCodes(self, program, canvas, textobject): "render the line(s)"
def runOpCodes(self, program, canvas, textobject): "render the line(s)"
5,772
def draw(self): style = self.style lines = self.lines rightIndent = style.rightIndent leftIndent = style.leftIndent leading = style.leading font = style.fontName size = style.fontSize alignment = style.alignment firstindent = style.firstLineIndent c = self.canv escape = c._escape #if debug: # print "FAST", id(self),...
def draw(self): style = self.style lines = self.lines rightIndent = style.rightIndent leftIndent = style.leftIndent leading = style.leading font = style.fontName size = style.fontSize alignment = style.alignment firstindent = style.firstLineIndent c = self.canv escape = c._escape #if debug: # print "FAST", id(self),...
5,773
def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace, atoi, atoi_error standard={'lt':'<', 'gt':'>', 'amp':'&'} # add space prefix if space here if text[0:1] in whitespace: program.append(" ") #print "handling", repr(text) # shortcut if 0 and "&" n...
def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks from string import whitespace, atoi, atoi_error standard={'lt':'<', 'gt':'>', 'amp':'&'} # add space prefix if space here if text[0:1] in whitespace: program.append(" ") #print "handling", repr(text) # shortcut if 0 and "&" not in te...
5,774
def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace, atoi, atoi_error standard={'lt':'<', 'gt':'>', 'amp':'&'} # add space prefix if space here if text[0:1] in whitespace: program.append(" ") #print "handling", repr(text) # shortcut if 0 and "&" n...
def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace, atoi, atoi_error standard={'lt':'<', 'gt':'>', 'amp':'&'} # add space prefix if space here if text[0:1] in whitespace: program.append(" ") #print "handling", repr(text) # shortcut if 0 and "&" n...
5,775
def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace, atoi, atoi_error standard={'lt':'<', 'gt':'>', 'amp':'&'} # add space prefix if space here if text[0:1] in whitespace: program.append(" ") #print "handling", repr(text) # shortcut if 0 and "&" n...
def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace, atoi, atoi_error standard={'lt':'<', 'gt':'>', 'amp':'&'} # add space prefix if space here if text[0:1] in whitespace: program.append(" ") #print "handling", repr(text) # shortcut if 0 and "&" n...
5,776
def splitspace(text): # split on spacing but include spaces at element ends stext = text.split() result = [] for e in stext: result.append(e+" ") return result
def splitspace(text): # split on spacing but include spaces at element ends stext = text.split() result = [] for e in stext: result.append(e+" ") return result
5,777
def __init__(self,filename, pagesize=(595.27,841.89), bottomup = 1, pageCompression=None, encoding=rl_config.defaultEncoding, invariant=rl_config.invariant, verbosity=0): """Create a canvas of a given size. etc. Most of the attributes are private - we will use set/get methods as the preferred interface. Default page s...
def __init__(self,filename, pagesize=None, bottomup = 1, pageCompression=None, encoding=rl_config.defaultEncoding, invariant=rl_config.invariant, verbosity=0): """Create a canvas of a given size. etc. Most of the attributes are private - we will use set/get methods as the preferred interface. Default page size is A4."...
5,778
def __init__(self,filename, pagesize=(595.27,841.89), bottomup = 1, pageCompression=None, encoding=rl_config.defaultEncoding, invariant=rl_config.invariant, verbosity=0): """Create a canvas of a given size. etc. Most of the attributes are private - we will use set/get methods as the preferred interface. Default page s...
def __init__(self,filename, pagesize=(595.27,841.89), bottomup = 1, pageCompression=None, encoding = None, invariant = None, verbosity=0): """Create a canvas of a given size. etc. Most of the attributes are private - we will use set/get methods as the preferred interface. Default page size is A4.""" self._filename = f...
5,779
def cvs_checkout(d): os.chdir(d) recursive_rmdir(cvsdir) cvs = find_exe('cvs') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s reportlab' % tagname), 'the export phase') else: if py2pdf: do_exec(cvs+' co rep...
def cvs_checkout(d): os.chdir(d) recursive_rmdir(cvsdir) cvs = find_exe('cvs') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s %s' % (tagname,projdir)), 'the export phase') else: if py2pdf: do_exec(cvs+' co ...
5,780
def cvs_checkout(d): os.chdir(d) recursive_rmdir(cvsdir) cvs = find_exe('cvs') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s reportlab' % tagname), 'the export phase') else: if py2pdf: do_exec(cvs+' co rep...
def cvs_checkout(d): os.chdir(d) recursive_rmdir(cvsdir) cvs = find_exe('cvs') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s reportlab' % tagname), 'the export phase') else: if py2pdf: # now we need to mov...
5,781
def cvs_checkout(d): os.chdir(d) recursive_rmdir(cvsdir) cvs = find_exe('cvs') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s reportlab' % tagname), 'the export phase') else: if py2pdf: do_exec(cvs+' co rep...
def cvs_checkout(d): os.chdir(d) recursive_rmdir(cvsdir) cvs = find_exe('cvs') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s reportlab' % tagname), 'the export phase') else: if py2pdf: do_exec(cvs+' co rep...
5,782
def cvs_checkout(d): os.chdir(d) recursive_rmdir(cvsdir) cvs = find_exe('cvs') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s reportlab' % tagname), 'the export phase') else: if py2pdf: do_exec(cvs+' co rep...
def cvs_checkout(d): os.chdir(d) recursive_rmdir(cvsdir) cvs = find_exe('cvs') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s reportlab' % tagname), 'the export phase') else: if py2pdf: do_exec(cvs+' co rep...
5,783
def getCommentary(): """Returns the story for the commentary - all the paragraphs.""" styleSheet = getSampleStyleSheet() story = [] story.append(Paragraph(""" PLATYPUS User Guide and Test Script """, styleSheet['Heading1'])) spam = """ Welcome to PLATYPUS! Platypus stands for "Page Layout and Typography Using Scri...
def getCommentary(): """Returns the story for the commentary - all the paragraphs.""" styleSheet = getSampleStyleSheet() story = [] story.append(Paragraph(""" PLATYPUS User Guide and Test Script """, styleSheet['Heading1'])) spam = """ Welcome to PLATYPUS! Platypus stands for "Page Layout and Typography Using Scri...
5,784
def makeSuite(): return makeSuiteForClasses(PlatypusTestCase)
def makeSuite(): return makeSuiteForClasses(PlatypusTestCase)
5,785
def addFromList(self, drawlist, canv): """Consumes objects from the front of the list until the frame is full. If it cannot fit one object, raises an exception."""
def addFromList(self, drawlist, canv): """Consumes objects from the front of the list until the frame is full. If it cannot fit one object, raises an exception."""
5,786
def drawOn(self, canv): if self.effectName: canv.setPageTransition( effectname=self.effectName, direction = self.effectDirection, dimension = self.effectDimension, motion = self.effectMotion, duration = self.effectDuration ) if self.outlineEntry: #gets an outline automatically self.showOutline = 1 #put an outline entry...
def drawOn(self, canv): if self.effectName: canv.setPageTransition( effectname=self.effectName, direction = self.effectDirection, dimension = self.effectDimension, motion = self.effectMotion, duration = self.effectDuration ) if self.outlineEntry: #gets an outline automatically self.showOutline = 1 #put an outline entry...
5,787
def parseData(self): """Try to make sense of the table data!""" rawdata = string.strip(string.join(self.rawBlocks, '')) lines = string.split(rawdata, self.rowDelim) #clean up... lines = map(string.strip, lines) self.data = [] for line in lines: cells = string.split(line, self.fieldDelim) self.data.append(cells)
defparseData(self):"""Trytomakesenseofthetabledata!"""rawdata=string.strip(string.join(self.rawBlocks,''))lines=string.split(rawdata,self.rowDelim)#cleanup...lines=map(string.strip,lines)self.data=[]forlineinlines:cells=string.split(line,self.fieldDelim)self.data.append(cells)
5,788
def drawOn(self, canv): if self.filename: canv.drawInlineImage( self.filename, self.x, self.y, self.width, self.height )
def drawOn(self, canv): if self.filename: canv.drawInlineImage( self.filename, self.x, self.y, self.width, self.height )
5,789
def __init__(self, x1, y1, x2, y2): self.x1 = x1 self.y1 = y1 self.x2 = x2 self.y2 = y2 self.fillColor = None self.strokeColor = (1,1,1) self.lineWidth=0
def__init__(self,x1,y1,x2,y2):self.x1=x1self.y1=y1self.x2=x2self.y2=y2self.fillColor=Noneself.strokeColor=(1,1,1)self.lineWidth=0
5,790
def __init__(self, x1, y1, x2, y2): self.x1 = x1 self.y1 = y1 self.x2 = x2 self.y2 = y2 self.fillColor = None self.strokeColor = (1,1,1) self.lineWidth=0
def__init__(self,x1,y1,x2,y2):self.x1=x1self.y1=y1self.x2=x2self.y2=y2self.fillColor=Noneself.strokeColor=(1,1,1)self.lineWidth=0
5,791
def __init__(self, pointlist): self.points = pointlist self.fillColor = None self.strokeColor = (1,1,1) self.lineWidth=0
def__init__(self,pointlist):self.points=pointlistself.fillColor=Noneself.strokeColor=(1,1,1)self.lineWidth=0
5,792
def process(datafilename, speakerNotes=0): parser = stdparser.PPMLParser() rawdata = open(datafilename).read() parser.feed(rawdata) pres = parser.getPresentation() pres.speakerNotes = speakerNotes pres.save() print 'saved presentation %s.pdf' % os.path.splitext(datafilename)[0] parser.close()
def process(datafilename, speakerNotes=0): parser = stdparser.PPMLParser() rawdata = open(datafilename).read() parser.feed(rawdata) pres = parser.getPresentation() pres.speakerNotes = speakerNotes pres.save() print 'saved presentation %s.pdf' % os.path.splitext(datafilename)[0] parser.close()
5,793
def isSeqType(v): return type(t) in SeqTypes
def isSeqType(v): return type(t) in SeqTypes
5,794
def find_intersections(data,small=0): ''' data is a sequence of series each series is a list of (x,y) coordinates where x & y are ints or floats find_intersections returns a sequence of 4-tuples i, j, x, y where i is a data index j is an insertion position for data[i] and x, y are coordinates of an intersection of se...
def find_intersections(data,small=0): ''' data is a sequence of series each series is a list of (x,y) coordinates where x & y are ints or floats find_intersections returns a sequence of 4-tuples i, j, x, y where i is a data index j is an insertion position for data[i] and x, y are coordinates of an intersection of se...
5,795
def makeTickLabels(self): g = Group()
def makeTickLabels(self): g = Group()
5,796
def __init__(self,filename,pagesize=(595.27,841.89), bottomup = 1, pageCompression=0 ): """Most of the attributes are private - we will use set/get methods as the preferred interface. Default page size is A4.""" self._filename = filename self._doc = pdfdoc.PDFDocument() self._pagesize = pagesize self._currentPageHasIm...
def __init__(self,filename,pagesize=(595.27,841.89), bottomup = 1, pageCompression=0 ): """Most of the attributes are private - we will use set/get methods as the preferred interface. Default page size is A4.""" self._filename = filename self._doc = pdfdoc.PDFDocument() self._pagesize = pagesize self._currentPageHasIm...
5,797
def checkFileForTabs(self, filename): txt = open(filename, 'r').read() chunks = string.split(txt, '\t') tabCount = len(chunks) - 1 if tabCount: #raise Exception, "File %s contains %d tab characters!" % (filename, tabCount) self.output.write("file %s contains %d tab characters!\n" % (filename, tabCount))
def checkFileForTabs(self, filename): txt = open_and_read(filename, 'r') chunks = string.split(txt, '\t') tabCount = len(chunks) - 1 if tabCount: #raise Exception, "File %s contains %d tab characters!" % (filename, tabCount) self.output.write("file %s contains %d tab characters!\n" % (filename, tabCount))
5,798
def checkFileForTrailingSpaces(self, filename): txt = open(filename, 'r').read() initSize = len(txt) badLines = 0 badChars = 0 for line in string.split(txt, '\n'): stripped = string.rstrip(line) spaces = len(line) - len(stripped) # OK, so they might be trailing tabs, who cares? if spaces: badLines = badLines + 1 badCh...
def checkFileForTrailingSpaces(self, filename): txt = open_and_read(filename, 'r') initSize = len(txt) badLines = 0 badChars = 0 for line in string.split(txt, '\n'): stripped = string.rstrip(line) spaces = len(line) - len(stripped) # OK, so they might be trailing tabs, who cares? if spaces: badLines = badLines + 1 bad...
5,799