bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def pfxJoin(pfx,*N): R=[] for n in N: R.append(pJoin(pfx,n)) return R | def pfxJoin(pfx,*N): R=[] for n in N: R.append(pJoin(pfx,n)) return R | 4,700 |
def pfxJoin(pfx,*N): R=[] for n in N: R.append(pJoin(pfx,n)) return R | def pfxJoin(pfx,*N): R=[] for n in N: R.append(pJoin(pfx,n)) return R | 4,701 |
def pfxJoin(pfx,*N): R=[] for n in N: R.append(pJoin(pfx,n)) return R | def pfxJoin(pfx,*N): R=[] for n in N: R.append(pJoin(pfx,n)) return R | 4,702 |
def makeSectors(self): # normalize slice data if type(self.data) in (ListType, TupleType) and type(self.data[0]) in (ListType, TupleType): #it's a nested list, more than one sequence normData = [] n = [] for l in self.data: t = self.normalizeData(l) normData.append(t) n.append(len(t)) else: normData = self.normalizeDat... | def makeSectors(self): # normalize slice data if type(self.data) in (ListType, TupleType) and type(self.data[0]) in (ListType, TupleType): #it's a nested list, more than one sequence normData = [] n = [] for l in self.data: t = self.normalizeData(l) normData.append(t) n.append(len(t)) else: normData = self.normalizeDat... | 4,703 |
def makeSectors(self): # normalize slice data if type(self.data) in (ListType, TupleType) and type(self.data[0]) in (ListType, TupleType): #it's a nested list, more than one sequence normData = [] n = [] for l in self.data: t = self.normalizeData(l) normData.append(t) n.append(len(t)) else: normData = self.normalizeDat... | def makeSectors(self): # normalize slice data if type(self.data) in (ListType, TupleType) and type(self.data[0]) in (ListType, TupleType): #it's a nested list, more than one sequence normData = [] n = [] for l in self.data: t = self.normalizeData(l) normData.append(t) n.append(len(t)) else: normData = self.normalizeDat... | 4,704 |
def makeSectors(self): # normalize slice data if type(self.data) in (ListType, TupleType) and type(self.data[0]) in (ListType, TupleType): #it's a nested list, more than one sequence normData = [] n = [] for l in self.data: t = self.normalizeData(l) normData.append(t) n.append(len(t)) else: normData = self.normalizeDat... | def makeSectors(self): # normalize slice data if type(self.data) in (ListType, TupleType) and type(self.data[0]) in (ListType, TupleType): #it's a nested list, more than one sequence normData = [] n = [] for l in self.data: t = self.normalizeData(l) normData.append(t) n.append(len(t)) else: normData = self.normalizeDat... | 4,705 |
def getSubsetInternalName(self, subset, doc): '''Returns the name of a PDF Font object corresponding to a given subset of this dynamic font. Use this function instead of PDFDocument.getInternalFontName.''' | def getSubsetInternalName(self, subset, doc): '''Returns the name of a PDF Font object corresponding to a given subset of this dynamic font. Use this function instead of PDFDocument.getInternalFontName.''' | 4,706 |
def extractInfo(self, charInfo=1): """Extract typographic information from the loaded font file. | def extractInfo(self, charInfo=1): """Extract typographic information from the loaded font file. | 4,707 |
def makeSubset(self, subset): """Create a subset of a TrueType font""" output = TTFontMaker() | def makeSubset(self, subset): """Create a subset of a TrueType font""" output = TTFontMaker() | 4,708 |
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li... | def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li... | 4,709 |
def _Flag_Palestine(self): s = _size g = Group() box = Rect(0, s/3, s*2, s/3, fillColor = colors.mintcream, strokeColor = colors.black, strokeWidth=0) g.add(box) | def _Flag_Palestine(self): s = _size g = Group() box = Rect(0, s/3, s*2, s/3, fillColor = colors.mintcream, strokeColor = None, strokeWidth=0) g.add(box) | 4,710 |
def run(format, VERBOSE=0): formats = string.split(format, ',') for i in range(0, len(formats)): formats[i] == string.lower(string.strip(formats[i])) allfiles = glob.glob('*.py') allfiles.sort() for fn in allfiles: f = string.split(fn, '.')[0] c = getclass(f) if c != None: print c.__name__ try: for f in formats: if f: ... | def run(format, VERBOSE=0): formats = string.split(format, ',') for i in range(0, len(formats)): formats[i] == string.lower(string.strip(formats[i])) allfiles = glob.glob('*.py') allfiles.sort() for fn in allfiles: f = string.split(fn, '.')[0] c = getclass(f) if c != None: print c.__name__ try: for fmt in formats: if f... | 4,711 |
def run(format, VERBOSE=0): formats = string.split(format, ',') for i in range(0, len(formats)): formats[i] == string.lower(string.strip(formats[i])) allfiles = glob.glob('*.py') allfiles.sort() for fn in allfiles: f = string.split(fn, '.')[0] c = getclass(f) if c != None: print c.__name__ try: for f in formats: if f: ... | def run(format, VERBOSE=0): formats = string.split(format, ',') for i in range(0, len(formats)): formats[i] == string.lower(string.strip(formats[i])) allfiles = glob.glob('*.py') allfiles.sort() for fn in allfiles: f = string.split(fn, '.')[0] c = getclass(f) if c != None: print c.__name__ try: for f in formats: if f: ... | 4,712 |
def rgb2cmyk(r,g,b): c = 1 - r m = 1 - g y = 1 - b k = min(c,m,y) c = min(1,max(0,c-k) m = min(1,max(0,m-k) y = min(1,max(0,y-k) k = min(1,max(0,k)) return (c,m,y,k) | def rgb2cmyk(r,g,b): c = 1 - r m = 1 - g y = 1 - b k = min(c,m,y) c = min(1,max(0,c-k)) m = min(1,max(0,m-k)) y = min(1,max(0,y-k)) k = min(1,max(0,k)) return (c,m,y,k) | 4,713 |
def __repr__(self): bT = self.bulletText H = "Preformatted(" if bT is not None: H = "Preformatted(bulletText=%s," % repr(bT) import string text = join(self.lines, "\n") return "%s'''\\ \n%s''')" % (H, text) | def __repr__(self): bT = self.bulletText H = "Preformatted(" if bT is not None: H = "Preformatted(bulletText=%s," % repr(bT) import string text = join(self.lines, "\n") return "%s'''\\ \n%s''')" % (H, text) | 4,714 |
def _listCellGeom(self, V,w,s,W=None,H=None,aH=72000): aW = w-s.leftPadding-s.rightPadding aH = aH - s.topPadding - s.bottomPadding t = 0 w = 0 canv = getattr(self,'canv',None) for v in V: vw, vh = v.wrapOn(canv,aW, aH) if W is not None: W.append(vw) if H is not None: H.append(vh) w = max(w,vw) t = t + vh + v.getSpaceB... | def _listCellGeom(self, V,w,s,W=None,H=None,aH=72000): aW = w-s.leftPadding-s.rightPadding aH = aH - s.topPadding - s.bottomPadding t = 0 w = 0 canv = getattr(self,'canv',None) for v in V: vw, vh = v.wrapOn(canv,aW, aH) if W is not None: W.append(vw) if H is not None: H.append(vh) w = max(w,vw) t = t + vh + v.getSpaceB... | 4,715 |
def failTest(x,t,tb=1,**kw): goodTest(x,t,tb,**kw) | def failTest(x,t,tb=1,**kw): goodTest(x,t,tb,**kw) | 4,716 |
def demo(self): d = Drawing(200, 100) | defdemo(self):d=Drawing(200,100) | 4,717 |
def normalizeData(self): sum = 0.0 for number in self.data: sum = sum + number | def normalizeData(self): sum = 0.0 for number in self.data: sum = sum + number | 4,718 |
def bitmap_rgb(self): return tuple(map(lambda x: int((x*255)&255), self.rgb())) | def bitmap_rgb(self): return tuple(map(lambda x: int((x*255)&255), self.rgb())) | 4,719 |
def _reduceDocStringLength(docStr): "Return first line of a multiline string." return split(docStr, '\n')[0] | def reduceDocStringLength(docStr): "Return first line of a multiline string." return split(docStr, '\n')[0] | 4,720 |
def beginModule(self, name, doc, imported): append = self.outLines.append lev, label = self.indentLevel, self.indentLabel self.outLines.append('%sModule: %s' % (lev*label, name)) | def beginModule(self, name, doc, imported): append = self.outLines.append lev, label = self.indentLevel, self.indentLabel self.outLines.append('%sModule: %s' % (lev*label, name)) | 4,721 |
def beginClass(self, name, doc, bases): append = self.outLines.append lev, label = self.indentLevel, self.indentLabel | def beginClass(self, name, doc, bases): append = self.outLines.append lev, label = self.indentLevel, self.indentLabel | 4,722 |
def beginMethod(self, name, doc, sig): append = self.outLines.append lev, label = self.indentLevel, self.indentLabel append('%s%s%s' % (lev*label, name, sig)) | def beginMethod(self, name, doc, sig): append = self.outLines.append lev, label = self.indentLevel, self.indentLabel append('%s%s%s' % (lev*label, name, sig)) | 4,723 |
def beginFunction(self, name, doc, sig): append = self.outLines.append lev, label = self.indentLevel, self.indentLabel self.outLines.append('%s%s%s' % (lev*label, name, sig)) | def beginFunction(self, name, doc, sig): append = self.outLines.append lev, label = self.indentLevel, self.indentLabel self.outLines.append('%s%s%s' % (lev*label, name, sig)) | 4,724 |
def printUsage(): """docpy0.py - Automated documentation for Python source code. | def printUsage(): """docpy0.py - Automated documentation for Python source code. | 4,725 |
def printUsage(): """docpy0.py - Automated documentation for Python source code. | def printUsage(): """docpy0.py - Automated documentation for Python source code. | 4,726 |
def documentModule0(path, builder=DocBuilder0()): """Generate documentation for one Python file in some format. This handles Python standard modules like string, custom modules on the Python search path like e.g. docpy as well as modules specified with their full path like C:/tmp/junk.py. The doc file will always be ... | def documentModule0(path, builder=PdfDocBuilder0()): """Generate documentation for one Python file in some format. This handles Python standard modules like string, custom modules on the Python search path like e.g. docpy as well as modules specified with their full path like C:/tmp/junk.py. The doc file will always ... | 4,727 |
def _packageWalkCallback(builder, dirPath, files): """A callback function used when waking over a package tree.""" files = filter(lambda f:f != '__init__.py', files) files = filter(lambda f:f[-3:] == '.py', files) if files: for f in files: path = os.path.join(dirPath, f) print path builder.indentLevel = builder.indent... | def _packageWalkCallback(builder, dirPath, files): "A callback function used when waking over a package tree." files = filter(lambda f:f != '__init__.py', files) files = filter(lambda f:f[-3:] == '.py', files) if files: for f in files: path = os.path.join(dirPath, f) print path builder.indentLevel = builder.indentLeve... | 4,728 |
def documentPackage0(path, builder=DocBuilder0()): """Generate documentation for one Python package in some format. Rigiht now, 'path' must be a filesystem path, later it will also be a package name whose path will be resolved by importing the top-level module. The doc file will always be saved in the current directo... | def documentPackage0(pathOrName, builder=PdfDocBuilder0()): """Generate documentation for one Python package in some format. Rigiht now, 'path' must be a filesystem path, later it will also be a package name whose path will be resolved by importing the top-level module. The doc file will always be saved in the curren... | 4,729 |
def documentPackage0(path, builder=DocBuilder0()): """Generate documentation for one Python package in some format. Rigiht now, 'path' must be a filesystem path, later it will also be a package name whose path will be resolved by importing the top-level module. The doc file will always be saved in the current directo... | def documentPackage0(path, builder=DocBuilder0()): """Generate documentation for one Python package in some format. Rigiht now, 'path' must be a filesystem path, later it will also be a package name whose path will be resolved by importing the top-level module. The doc file will always be saved in the current directo... | 4,730 |
def documentPackage0(path, builder=DocBuilder0()): """Generate documentation for one Python package in some format. Rigiht now, 'path' must be a filesystem path, later it will also be a package name whose path will be resolved by importing the top-level module. The doc file will always be saved in the current directo... | def documentPackage0(path, builder=DocBuilder0()): """Generate documentation for one Python package in some format. Rigiht now, 'path' must be a filesystem path, later it will also be a package name whose path will be resolved by importing the top-level module. The doc file will always be saved in the current directo... | 4,731 |
def documentPackage0(path, builder=DocBuilder0()): """Generate documentation for one Python package in some format. Rigiht now, 'path' must be a filesystem path, later it will also be a package name whose path will be resolved by importing the top-level module. The doc file will always be saved in the current directo... | def documentPackage0(path, builder=DocBuilder0()): """Generate documentation for one Python package in some format. Rigiht now, 'path' must be a filesystem path, later it will also be a package name whose path will be resolved by importing the top-level module. The doc file will always be saved in the current directo... | 4,732 |
def main(): """Handle command-line options and trigger corresponding action. """ opts, args = getopt.getopt(sys.argv[1:], 'hf:m:p:') # On -h print usage and exit immediately. for o, a in opts: if o == '-h': print printUsage.__doc__ #printUsage() sys.exit(0) # On -f set the DocBuilder to use or a default one. builder... | def main(): "Handle command-line options and trigger corresponding action." opts, args = getopt.getopt(sys.argv[1:], 'hf:m:p:') # On -h print usage and exit immediately. for o, a in opts: if o == '-h': print printUsage.__doc__ #printUsage() sys.exit(0) # On -f set the DocBuilder to use or a default one. builder = Do... | 4,733 |
def main(): """Handle command-line options and trigger corresponding action. """ opts, args = getopt.getopt(sys.argv[1:], 'hf:m:p:') # On -h print usage and exit immediately. for o, a in opts: if o == '-h': print printUsage.__doc__ #printUsage() sys.exit(0) # On -f set the DocBuilder to use or a default one. builder... | defmain():"""Handlecommand-lineoptionsandtriggercorrespondingaction."""opts,args=getopt.getopt(sys.argv[1:],'hf:m:p:')#On-hprintusageandexitimmediately.foro,ainopts:ifo=='-h':printprintUsage.__doc__#printUsage()sys.exit(0)#On-fsettheDocBuildertouseoradefaultone.builder=DocBuilder0()foro,ainopts:ifo=='-f':builder=eval("... | 4,734 |
def main(): """Handle command-line options and trigger corresponding action. """ opts, args = getopt.getopt(sys.argv[1:], 'hf:m:p:') # On -h print usage and exit immediately. for o, a in opts: if o == '-h': print printUsage.__doc__ #printUsage() sys.exit(0) # On -f set the DocBuilder to use or a default one. builder... | def main(): """Handle command-line options and trigger corresponding action. """ opts, args = getopt.getopt(sys.argv[1:], 'hf:m:p:') # On -h print usage and exit immediately. for o, a in opts: if o == '-h': print printUsage.__doc__ #printUsage() sys.exit(0) # On -f set the DocBuilder to use or a default one. builder... | 4,735 |
def cache_imagedata(self): image = self.image if not pdfutils.cachedImageExists(image): if not zlib: print 'zlib not available' return try: import Image except ImportError: print 'Python Imaging Library not available' return pdfutils.cacheImageFile(image) | def cache_imagedata(self): image = self.image if not pdfutils.cachedImageExists(image): if not zlib: warnOnce('zlib not available') return try: import Image except ImportError: print 'Python Imaging Library not available' return pdfutils.cacheImageFile(image) | 4,736 |
def cache_imagedata(self): image = self.image if not pdfutils.cachedImageExists(image): if not zlib: print 'zlib not available' return try: import Image except ImportError: print 'Python Imaging Library not available' return pdfutils.cacheImageFile(image) | def cache_imagedata(self): image = self.image if not pdfutils.cachedImageExists(image): if not zlib: print 'zlib not available' return try: import Image except ImportError: warnOnce('Python Imaging Library not available') return pdfutils.cacheImageFile(image) | 4,737 |
def PIL_imagedata(self): image = self.image if not zlib: print 'zlib not available' return myimage = image.convert('RGB') imgwidth, imgheight = myimage.size | def PIL_imagedata(self): image = self.image myimage = image.convert('RGB') imgwidth, imgheight = myimage.size | 4,738 |
def PIL_imagedata(self): image = self.image if not zlib: print 'zlib not available' return myimage = image.convert('RGB') imgwidth, imgheight = myimage.size | def PIL_imagedata(self): image = self.image if not zlib: print 'zlib not available' return myimage = image.convert('RGB') imgwidth, imgheight = myimage.size | 4,739 |
def sample3(drawing=None): "Add sample swatches to a diagram." d = drawing swatches = Legend0() swatches.alignment = 'right' swatches.x = 80 swatches.y = 160 swatches.deltax = 60 swatches.dxTextSpace = 10 swatches.columnMaximum = 4 items = [(colors.red, 'before'), (colors.green, 'after')] swatches.colorNamePairs = it... | def sample3(drawing=None): "Add sample swatches to a diagram." d = drawing or Drawing(400, 200) swatches = Legend0() swatches.alignment = 'right' swatches.x = 80 swatches.y = 160 swatches.deltax = 60 swatches.dxTextSpace = 10 swatches.columnMaximum = 4 items = [(colors.red, 'before'), (colors.green, 'after')] swatche... | 4,740 |
def get_rl_tempfile(fn=None): if not fn: import tempfile return tempfile.mktemp('','',get_rl_tempdir()) else: return os.path.join(get_rl_tempdir(),fn) | def get_rl_tempfile(fn=None): if not fn: import tempfile fn = tempfile.mktemp() return os.path.join(get_rl_tempdir(),fn) | 4,741 |
def split(self,availWidth, availHeight): if len(self.frags)<=0: return [] | def split(self,availWidth, availHeight): if len(self.frags)<=0: return [] | 4,742 |
def flagged(i,TESTS=TESTS): return 'all' in TESTS or '*' in TESTS or str(i) in TESTS | def flagged(i,TESTS=TESTS): return 'all' in TESTS or '*' in TESTS or str(i) in TESTS | 4,743 |
def multiBuild(self, story, filename=None, canvasmaker=canvas.Canvas, maxPasses = 10): """Makes multiple passes until all indexing flowables are happy.""" self._indexingFlowables = [] #scan the story and keep a copy for thing in story: if thing.isIndexing(): self._indexingFlowables.append(thing) #print 'scanned story, ... | defif isFile and not hasSeek: filename = filename._filename multiBuild(self,if isFile and not hasSeek: filename = filename._filename story,if isFile and not hasSeek: filename = filename._filename filename=None,if isFile and not hasSeek: filename = filename._filename canvasmaker=canvas.Canvas,if isFile and not hasSeek: ... | 4,744 |
def multiBuild(self, story, filename=None, canvasmaker=canvas.Canvas, maxPasses = 10): """Makes multiple passes until all indexing flowables are happy.""" self._indexingFlowables = [] #scan the story and keep a copy for thing in story: if thing.isIndexing(): self._indexingFlowables.append(thing) #print 'scanned story, ... | def multiBuild(self, story, filename=None, canvasmaker=canvas.Canvas, maxPasses = 10): """Makes multiple passes until all indexing flowables are happy.""" self._indexingFlowables = [] #scan the story and keep a copy for thing in story: if thing.isIndexing(): self._indexingFlowables.append(thing) #print 'scanned story, ... | 4,745 |
def getProperties(self,recur=1): # return any children which are defined and whatever # differs from the parent props = {} | def getProperties(self,recur=1): # return any children which are defined and whatever # differs from the parent props = {} | 4,746 |
def getProperties(self,recur=1): # return any children which are defined and whatever # differs from the parent props = {} | defgetProperties(self,recur=1):#returnanychildrenwhicharedefinedandwhatever#differsfromtheparentprops={} | 4,747 |
def _setRange(self, dataSeries): """Set minimum and maximum axis values. | def _setRange(self, dataSeries): """Set minimum and maximum axis values. | 4,748 |
def _setRange(self, dataSeries): """Set minimum and maximum axis values. | def _setRange(self, dataSeries): """Set minimum and maximum axis values. | 4,749 |
def drawImage(self, image, x, y, width=None, height=None, mask=None): """Draws the image (PIL Image object or filename) as specified. | def drawImage(self, image, x, y, width=None, height=None, mask=None): """Draws the image (PIL Image object or filename) as specified. | 4,750 |
def drawImage(self, image, x, y, width=None, height=None, mask=None): """Draws the image (PIL Image object or filename) as specified. | def drawImage(self, image, x, y, width=None, height=None, mask=None): """Draws the image (PIL Image object or filename) as specified. | 4,751 |
def moveCursor(self, dx, dy): """Moves to a point dx, dy away from the start of the current line - NOT from the current point! So if you call it in mid-sentence, watch out.""" if self._code[-1][-3:]==' Td': L = string.split(self._code[-1]) if len(L)==3: del self._code[-1] else: self._code[-1] = string.join(L[:-4]) if d... | def moveCursor(self, dx, dy): """Moves to a point dx, dy away from the start of the current line - NOT from the current point! So if you call it in mid-sentence, watch out.""" if len(self._code) and self._code[-1][-3:]==' Td': L = string.split(self._code[-1]) if len(L)==3: del self._code[-1] else: self._code[-1] = stri... | 4,752 |
def Paragraph(text, style, bulletText=None, frags=None) | def Paragraph(text, style, bulletText=None, frags=None) | 4,753 |
def readColor(text): """Read color names or tuples, RGB or CMYK, and return a Color object.""" if not text: return None from reportlab.lib import colors if text[0] in LETTERS: return colors.__dict__[text] tup = lengthSequence(text) msg = "Color tuple must have 3 (or 4) elements for RGB (or CMYC)." assert 3 <= len(tup)... | def readColor(text): """Read color names or tuples, RGB or CMYK, and return a Color object.""" if not text: return None from reportlab.lib import colors from string import letters if text[0] in letters: return colors.__dict__[text] tup = lengthSequence(text) msg = "Color tuple must have 3 (or 4) elements for RGB (or C... | 4,754 |
def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace 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 text: result... | 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... | 4,755 |
def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace 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 text: result... | def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace 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 text: result... | 4,756 |
def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace 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 text: result... | def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace 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 text: result... | 4,757 |
def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace 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 text: result... | def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace 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 text: result... | 4,758 |
def cleanBlockQuotedText(text,joiner=' '): """This is an internal utility which takes triple- quoted text form within the document and returns (hopefully) the paragraph the user intended originally.""" stripped = string.strip(text) lines = string.split(stripped, '\n') trimmed_lines = map(string.lstrip, lines) return st... | def cleanBlockQuotedText(text,joiner=' '): """This is an internal utility which takes triple- quoted text form within the document and returns (hopefully) the paragraph the user intended originally.""" L = map(_lineClean, split(text, '\n')) return join(L, joiner) def setXPos(tx,dx): if dx>1e-6 or dx<-1e-6: tx.setXPos(... | 4,759 |
def _leftDrawParaLine( tx, offset, extraspace, words, last=0): tx.setXPos(offset) tx._textOut(string.join(words),1) | def _leftDrawParaLine( tx, offset, extraspace, words, last=0): setXPos(tx,offset) tx._textOut(join(words),1) setXPos(tx,-offset) | 4,760 |
def _centerDrawParaLine( tx, offset, extraspace, words, last=0): m = offset + 0.5 * extraspace tx.setXPos(m) tx._textOut(string.join(words),1) | def _centerDrawParaLine( tx, offset, extraspace, words, last=0): m = offset + 0.5 * extraspace setXPos(tx,m) tx._textOut(join(words),1) setXPos(tx,-m) | 4,761 |
def _rightDrawParaLine( tx, offset, extraspace, words, last=0): m = offset + extraspace tx.setXPos(m) tx._textOut(string.join(words),1) | def _rightDrawParaLine( tx, offset, extraspace, words, last=0): m = offset + extraspace setXPos(tx,m) tx._textOut(join(words),1) setXPos(tx,-m) | 4,762 |
def _justifyDrawParaLine( tx, offset, extraspace, words, last=0): tx.setXPos(offset) text = string.join(words) if last: #last one, left align tx._textOut(text,1) else: nSpaces = len(words)-1 if nSpaces: tx.setWordSpace(extraspace / float(nSpaces)) tx._textOut(text,1) tx.setWordSpace(0) else: tx._textOut(text,1) | def _justifyDrawParaLine( tx, offset, extraspace, words, last=0): setXPos(tx,offset) text = join(words) if last: #last one, left align tx._textOut(text,1) else: nSpaces = len(words)-1 if nSpaces: tx.setWordSpace(extraspace / float(nSpaces)) tx._textOut(text,1) tx.setWordSpace(0) else: tx._textOut(text,1) | 4,763 |
def _leftDrawParaLineX( tx, offset, line, last=0): tx.setXPos(offset) _putFragLine(tx, line.words) | def _leftDrawParaLineX( tx, offset, line, last=0): setXPos(tx,offset) _putFragLine(tx, line.words) | 4,764 |
def _centerDrawParaLineX( tx, offset, line, last=0): m = offset+0.5*line.extraSpace tx.setXPos(m) _putFragLine(tx, line.words) | def _centerDrawParaLineX( tx, offset, line, last=0): m = offset+0.5*line.extraSpace setXPos(tx,m) _putFragLine(tx, line.words) | 4,765 |
def _rightDrawParaLineX( tx, offset, line, last=0): m = offset+line.extraSpace tx.setXPos(m) _putFragLine(tx, line.words) | def _rightDrawParaLineX( tx, offset, line, last=0): m = offset+line.extraSpace setXPos(tx,m) _putFragLine(tx, line.words) | 4,766 |
def _justifyDrawParaLineX( tx, offset, line, last=0): if last: #last one, left align tx.setXPos(offset) _putFragLine(tx, line.words) else: tx.setXPos(offset) nSpaces = line.wordCount - 1 if nSpaces: tx.setWordSpace(line.extraSpace / float(nSpaces)) _putFragLine(tx, line.words) tx.setWordSpace(0) else: _putFragLine(tx, ... | def _justifyDrawParaLineX( tx, offset, line, last=0): if last: #last one, left align _putFragLine(tx, line.words) else: nSpaces = line.wordCount - 1 if nSpaces: tx.setWordSpace(line.extraSpace / float(nSpaces)) _putFragLine(tx, line.words) tx.setWordSpace(0) else: _putFragLine(tx, line.words) | 4,767 |
def _justifyDrawParaLineX( tx, offset, line, last=0): if last: #last one, left align tx.setXPos(offset) _putFragLine(tx, line.words) else: tx.setXPos(offset) nSpaces = line.wordCount - 1 if nSpaces: tx.setWordSpace(line.extraSpace / float(nSpaces)) _putFragLine(tx, line.words) tx.setWordSpace(0) else: _putFragLine(tx, ... | def _justifyDrawParaLineX( tx, offset, line, last=0): if last: #last one, left align _putFragLine(tx, line.words) else: nSpaces = line.wordCount - 1 if nSpaces: tx.setWordSpace(line.extraSpace / float(nSpaces)) _putFragLine(tx, line.words) tx.setWordSpace(0) else: _putFragLine(tx, line.words) | 4,768 |
def _getFragWords(frags): ''' given a Parafrag list return a list of fragwords [[size, (f00,w00), ..., (f0n,w0n)],....,[size, (fm0,wm0), ..., (f0n,wmn)]] each pair f,w represents a style and some string each sublist represents a word ''' R = [] W = [] n = 0 for f in frags: text = f.text #del f.text # we can't do this u... | def _getFragWords(frags): ''' given a Parafrag list return a list of fragwords [[size, (f00,w00), ..., (f0n,w0n)],....,[size, (fm0,wm0), ..., (f0n,wmn)]] each pair f,w represents a style and some string each sublist represents a word ''' R = [] W = [] n = 0 for f in frags: text = f.text #del f.text # we can't do this u... | 4,769 |
def _handleBulletWidth(bulletText,style,maxWidths): '''work out bullet width and adjust maxWidths[0] if neccessary ''' if bulletText <> None: if type(bulletText) is StringType: bulletWidth = stringWidth( bulletText, style.bulletFontName, style.bulletFontSize) else: #it's a list of fragments bulletWidth = 0 for f in bul... | def _handleBulletWidth(bulletText,style,maxWidths): '''work out bullet width and adjust maxWidths[0] if neccessary ''' if bulletText <> None: if type(bulletText) is StringType: bulletWidth = stringWidth( bulletText, style.bulletFontName, style.bulletFontSize) else: #it's a list of fragments bulletWidth = 0 for f in bul... | 4,770 |
def _handleBulletWidth(bulletText,style,maxWidths): '''work out bullet width and adjust maxWidths[0] if neccessary ''' if bulletText <> None: if type(bulletText) is StringType: bulletWidth = stringWidth( bulletText, style.bulletFontName, style.bulletFontSize) else: #it's a list of fragments bulletWidth = 0 for f in bul... | def _handleBulletWidth(bulletText,style,maxWidths): '''work out bullet width and adjust maxWidths[0] if neccessary ''' if bulletText <> None: if type(bulletText) is StringType: bulletWidth = stringWidth( bulletText, style.bulletFontName, style.bulletFontSize) else: #it's a list of fragments bulletWidth = 0 for f in bul... | 4,771 |
def _handleBulletWidth(bulletText,style,maxWidths): '''work out bullet width and adjust maxWidths[0] if neccessary ''' if bulletText <> None: if type(bulletText) is StringType: bulletWidth = stringWidth( bulletText, style.bulletFontName, style.bulletFontSize) else: #it's a list of fragments bulletWidth = 0 for f in bul... | def _handleBulletWidth(bulletText,style,maxWidths): '''work out bullet width and adjust maxWidths[0] if neccessary ''' if bulletText <> None: if type(bulletText) is StringType: bulletWidth = stringWidth( bulletText, style.bulletFontName, style.bulletFontSize) else: #it's a list of fragments bulletWidth = 0 for f in bul... | 4,772 |
def wrap(self, availWidth, availHeight): # work out widths array for breaking self.width = availWidth first_line_width = availWidth - self.style.firstLineIndent - self.style.rightIndent later_widths = availWidth - self.style.leftIndent - self.style.rightIndent self.blPara = self.breakLines([first_line_width, later_widt... | def wrap(self, availWidth, availHeight): # work out widths array for breaking self.width = availWidth leftIndent = self.style.leftIndent first_line_width = availWidth - (leftIndent+self.style.firstLineIndent) - self.style.rightIndent later_widths = availWidth - leftIndent - self.style.rightIndent self.blPara = self.bre... | 4,773 |
def wrap(self, availWidth, availHeight): # work out widths array for breaking self.width = availWidth first_line_width = availWidth - self.style.firstLineIndent - self.style.rightIndent later_widths = availWidth - self.style.leftIndent - self.style.rightIndent self.blPara = self.breakLines([first_line_width, later_widt... | def wrap(self, availWidth, availHeight): # work out widths array for breaking self.width = availWidth first_line_width = availWidth - self.style.firstLineIndent - self.style.rightIndent later_widths = availWidth - self.style.leftIndent - self.style.rightIndent self.blPara = self.breakLines([first_line_width, later_widt... | 4,774 |
def split(self,availWidth, availHeight): if len(self.frags)<=0: return [] | def split(self,availWidth, availHeight): if len(self.frags)<=0: return [] | 4,775 |
def split(self,availWidth, availHeight): if len(self.frags)<=0: return [] | def split(self,availWidth, availHeight): if len(self.frags)<=0: return [] | 4,776 |
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li... | def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li... | 4,777 |
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li... | def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li... | 4,778 |
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.""" | 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.""" | 4,779 |
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.""" | 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.""" | 4,780 |
def getPlainText(self): """Convenience function for templates which want access to the raw text, without XML tags. """ plains = [] for frag in self.frags: plains.append(frag.text) return string.join(plains, '') | def getPlainText(self): """Convenience function for templates which want access to the raw text, without XML tags. """ plains = [] for frag in self.frags: plains.append(frag.text) return string.join(plains, '') | 4,781 |
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 | 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 | 4,782 |
def check_text(text,p=_parser): print '##########' text = cleanBlockQuotedText(text) l,rv,bv = p.parse(text,style) if rv is None: for l in _parser.errors: print l else: print 'ParaStyle', l.fontName,l.fontSize,l.textColor for l in rv: print l.fontName,l.fontSize,l.textColor,l.bold, l.rise, '|%s|'%l.text[:25], if hasatt... | def check_text(text,p=_parser): print '##########' text = cleanBlockQuotedText(text) l,rv,bv = p.parse(text,style) if rv is None: for l in _parser.errors: print l else: print 'ParaStyle', l.fontName,l.fontSize,l.textColor for l in rv: print l.fontName,l.fontSize,l.textColor,l.bold, l.rise, '|%s|'%l.text[:25], if hasatt... | 4,783 |
def calcBarPositions(self): """Works out where they go. default vertical. | def calcBarPositions(self): """Works out where they go. default vertical. | 4,784 |
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | def run(): LIBS = [] setup( name="Reportlab", version="1.17", licence="BSD license, Copyright (c) 2000-2003, ReportLab Inc.", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include an... | 4,785 |
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'reportlab': '.'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs',... | 4,786 |
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | 4,787 |
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | 4,788 |
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | 4,789 |
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | 4,790 |
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | 4,791 |
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report... | 4,792 |
def makeSuite(): suite = unittest.TestSuite() suite.addTest(PlatypusTestCase('test1')) return suite | def makeSuite(): suite = unittest.TestSuite() suite.addTest(PlatypusTestCase('test1')) return suite | 4,793 |
def draw(self, drawing, canvas, x=0, y=0, showBoundary=rl_config.showBoundary): """This is the top level function, which draws the drawing at the given location. The recursive part is handled by drawNode.""" #stash references for ease of communication self._canvas = canvas canvas.__dict__['_drawing'] = self._drawing =... | def draw(self, drawing, canvas, x=0, y=0, showBoundary=rl_config.showBoundary): """This is the top level function, which draws the drawing at the given location. The recursive part is handled by drawNode.""" #stash references for ease of communication self._canvas = canvas canvas.__dict__['_drawing'] = self._drawing =... | 4,794 |
def drawToPMCanvas(d, dpi=72, bg=0xffffff, configPIL=None, showBoundary=rl_config.showBoundary): w = int(d.width+0.5) h = int(d.height+0.5) c = PMCanvas(w, h, dpi=dpi, bg=bg, configPIL=configPIL) draw(d, c, 0, 0) return c | def drawToPMCanvas(d, dpi=72, bg=0xffffff, configPIL=None, showBoundary=rl_config.showBoundary): w = int(d.width*dpi/72.0+0.5) h = int(d.height*dpi/72.0+0.5) c = PMCanvas(w, h, dpi=dpi, bg=bg, configPIL=configPIL) draw(d, c, 0, 0) return c | 4,795 |
def breakLines(self, width): """ Returns a broken line structure. There are two cases | def breakLines(self, width): """ Returns a broken line structure. There are two cases | 4,796 |
def breakLines(self, width): """ Returns a broken line structure. There are two cases | def breakLines(self, width): """ Returns a broken line structure. There are two cases | 4,797 |
def breakLines(self, width): """ Returns a broken line structure. There are two cases | def breakLines(self, width): """ Returns a broken line structure. There are two cases | 4,798 |
def breakLines(self, width): """ Returns a broken line structure. There are two cases | def breakLines(self, width): """ Returns a broken line structure. There are two cases | 4,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.