Initial Python3 compatibility fixes
authordamian
Mon, 08 Feb 2010 18:17:33 +0000
changeset 3326 ce725978d11c
parent 3325 64eb1b787d02
child 3327 512eb20b0c3d
Initial Python3 compatibility fixes
demos/odyssey/dodyssey.py
demos/odyssey/fodyssey.py
docs/source/conf.py
docs/userguide/ch5_paragraphs.py
docs/userguide/ch6_tables.py
ez_setup.py
src/reportlab/graphics/barcode/code128.py
src/reportlab/graphics/barcode/code39.py
src/reportlab/graphics/barcode/code93.py
src/reportlab/graphics/barcode/lto.py
src/reportlab/graphics/barcode/usps.py
src/reportlab/graphics/charts/axes.py
src/reportlab/graphics/charts/barcharts.py
src/reportlab/graphics/charts/legends.py
src/reportlab/graphics/charts/linecharts.py
src/reportlab/graphics/charts/lineplots.py
src/reportlab/graphics/charts/piecharts.py
src/reportlab/graphics/charts/spider.py
src/reportlab/graphics/charts/utils.py
src/reportlab/graphics/renderPS.py
src/reportlab/graphics/renderSVG.py
src/reportlab/graphics/renderbase.py
src/reportlab/graphics/samples/bubble.py
src/reportlab/graphics/samples/clustered_bar.py
src/reportlab/graphics/samples/clustered_column.py
src/reportlab/graphics/samples/exploded_pie.py
src/reportlab/graphics/samples/filled_radar.py
src/reportlab/graphics/samples/line_chart.py
src/reportlab/graphics/samples/linechart_with_markers.py
src/reportlab/graphics/samples/radar.py
src/reportlab/graphics/samples/scatter.py
src/reportlab/graphics/samples/scatter_lines.py
src/reportlab/graphics/samples/scatter_lines_markers.py
src/reportlab/graphics/samples/simple_pie.py
src/reportlab/graphics/samples/stacked_bar.py
src/reportlab/graphics/samples/stacked_column.py
src/reportlab/graphics/shapes.py
src/reportlab/graphics/widgetbase.py
src/reportlab/graphics/widgets/eventcal.py
src/reportlab/graphics/widgets/grids.py
src/reportlab/graphics/widgets/markers.py
src/reportlab/lib/PyFontify.py
src/reportlab/lib/__init__.py
src/reportlab/lib/attrmap.py
src/reportlab/lib/colors.py
src/reportlab/lib/fontfinder.py
src/reportlab/lib/fonts.py
src/reportlab/lib/logger.py
src/reportlab/lib/normalDate.py
src/reportlab/lib/pdfencrypt.py
src/reportlab/lib/rparsexml.py
src/reportlab/lib/styles.py
src/reportlab/lib/testutils.py
src/reportlab/lib/utils.py
src/reportlab/lib/validators.py
src/reportlab/lib/xmllib.py
src/reportlab/lib/yaml.py
src/reportlab/pdfbase/_can_cmap_data.py
src/reportlab/pdfbase/cidfonts.py
src/reportlab/pdfbase/pdfdoc.py
src/reportlab/pdfbase/pdfmetrics.py
src/reportlab/pdfbase/pdfutils.py
src/reportlab/pdfbase/rl_codecs.py
src/reportlab/pdfbase/ttfonts.py
src/reportlab/pdfgen/canvas.py
src/reportlab/pdfgen/pycanvas.py
src/reportlab/platypus/doctemplate.py
src/reportlab/platypus/flowables.py
src/reportlab/platypus/para.py
src/reportlab/platypus/paragraph.py
src/reportlab/platypus/paraparser.py
src/reportlab/platypus/tables.py
src/reportlab/platypus/xpreformatted.py
src/reportlab/rl_config.py
src/rl_addons/renderPM/pfm.py
tests/test_charts_textlabels.py
tests/test_docstrings.py
tests/test_graphics_charts.py
tests/test_graphics_layout.py
tests/test_hello.py
tests/test_lib_utils.py
tests/test_pdfbase_ttfonts.py
tests/test_pdfgen_general.py
tests/test_pdfgen_pycanvas.py
tests/test_platypus_breaking.py
tests/test_platypus_general.py
tests/test_platypus_indents.py
tests/test_platypus_index.py
tests/test_platypus_leftright.py
tests/test_platypus_paragraphs.py
tests/test_platypus_toc.py
tests/test_platypus_xref.py
tests/test_pyfiles.py
tests/test_source_chars.py
tools/docco/codegrab.py
tools/docco/docpy.py
tools/docco/graphdocpy.py
tools/docco/t_parse.py
tools/docco/yaml.py
tools/pythonpoint/demos/slidebox.py
tools/pythonpoint/pythonpoint.py
tools/pythonpoint/stdparser.py
--- a/demos/odyssey/dodyssey.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/demos/odyssey/dodyssey.py	Mon Feb 08 18:17:33 2010 +0000
@@ -39,7 +39,7 @@
 def go():
     def myCanvasMaker(fn,**kw):
         from reportlab.pdfgen.canvas import Canvas
-        canv = apply(Canvas,(fn,),kw)
+        canv = Canvas(fn,**kw)
         # attach our callback to the canvas
         canv.myOnDrawCB = myOnDrawCB
         return canv
@@ -208,7 +208,7 @@
     t4 = time()
     print "Deleting list of lines took %.4f seconds" %(t4-t3)
     for i in xrange(len(E)):
-        apply(E[i][0],E[i][1:])
+        E[i][0](*E[i][1:])
     t5 = time()
     print "Moving into platypus took %.4f seconds" %(t5-t4)
     del E
--- a/demos/odyssey/fodyssey.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/demos/odyssey/fodyssey.py	Mon Feb 08 18:17:33 2010 +0000
@@ -142,7 +142,7 @@
     t4 = time()
     print "Deleting list of lines took %.4f seconds" %(t4-t3)
     for i in xrange(len(E)):
-        apply(E[i][0],E[i][1:])
+        E[i][0](*E[i][1:])
     t5 = time()
     print "Moving into platypus took %.4f seconds" %(t5-t4)
     del E
--- a/docs/source/conf.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/docs/source/conf.py	Mon Feb 08 18:17:33 2010 +0000
@@ -66,7 +66,7 @@
 # for source files.
 exclude_trees = []
 
-# The reST default role (used for this markup: `text`) to use for all documents.
+# The reST default role (used for this markup: 'text') to use for all documents.
 #default_role = None
 
 # If true, '()' will be appended to :func: etc. cross-reference text.
--- a/docs/userguide/ch5_paragraphs.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/docs/userguide/ch5_paragraphs.py	Mon Feb 08 18:17:33 2010 +0000
@@ -190,7 +190,7 @@
     S={}
     for k, v in A.items():
         a = v[0]
-        if not S.has_key(a):
+        if a not in S:
             S[a] = k
         else:
             S[a] = "%s, %s" %(S[a],k)
@@ -204,7 +204,7 @@
     rows=len(D)*[None]
     return D,cols,rows
 
-t=apply(Table,getAttrs(_paraAttrMap))
+t=Table(*getAttrs(_paraAttrMap))
 t.setStyle(TableStyle([
             ('FONT',(0,0),(-1,1),'Times-Bold',10,12),
             ('FONT',(0,1),(-1,-1),'Courier',8,8),
@@ -356,7 +356,7 @@
 characters but we suggest first trying the Unicode bullet ($•$), which may
 be written as $•$,  $•$ or (in utf8) $\\xe2\\x80\\xa2$):""")
 
-t=apply(Table,getAttrs(_bulletAttrMap))
+t=Table(*getAttrs(_bulletAttrMap))
 t.setStyle([
             ('FONT',(0,0),(-1,1),'Times-Bold',10,12),
             ('FONT',(0,1),(-1,-1),'Courier',8,8),
--- a/docs/userguide/ch6_tables.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/docs/userguide/ch6_tables.py	Mon Feb 08 18:17:33 2010 +0000
@@ -563,7 +563,7 @@
 
     def __init__(self, filename, **kw):
         self.allowSplitting = 0
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         template = PageTemplate('normal', [Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')])
         self.addPageTemplates(template)
 
@@ -654,4 +654,4 @@
 
 disc("""
 This indexes the terms "comma (,)", "," and "...".
-""")
\ No newline at end of file
+""")
--- a/ez_setup.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/ez_setup.py	Mon Feb 08 18:17:33 2010 +0000
@@ -9,7 +9,7 @@
 
 If you want to require a specific version of setuptools, set a download
 mirror, or use an alternate download directory, you can do so by supplying
-the appropriate options to ``use_setuptools()``.
+the appropriate options to "use_setuptools()".
 
 This file can also be run as a script to install or upgrade setuptools.
 """
@@ -71,13 +71,13 @@
 ):
     """Automatically find/download setuptools and make it available on sys.path
 
-    `version` should be a valid setuptools version number that is available
-    as an egg for download under the `download_base` URL (which should end with
-    a '/').  `to_dir` is the directory where setuptools will be downloaded, if
-    it is not already available.  If `download_delay` is specified, it should
+    "version" should be a valid setuptools version number that is available
+    as an egg for download under the "download_base" URL (which should end with
+    a '/').  "to_dir" is the directory where setuptools will be downloaded, if
+    it is not already available.  If "download_delay" is specified, it should
     be the number of seconds that will be paused before initiating a download,
     should one be required.  If an older version of setuptools is installed,
-    this routine will print a message to ``sys.stderr`` and raise SystemExit in
+    this routine will print a message to "sys.stderr" and raise SystemExit in
     an attempt to abort the calling script.
     """
     was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
@@ -112,10 +112,10 @@
 ):
     """Download setuptools from a specified location and return its filename
 
-    `version` should be a valid setuptools version number that is available
-    as an egg for download under the `download_base` URL (which should end
-    with a '/'). `to_dir` is the directory where the egg will be downloaded.
-    `delay` is the number of seconds to pause before an actual download attempt.
+    "version" should be a valid setuptools version number that is available
+    as an egg for download under the "download_base" URL (which should end
+    with a '/'). "to_dir" is the directory where the egg will be downloaded.
+    "delay" is the number of seconds to pause before an actual download attempt.
     """
     import urllib2, shutil
     egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
--- a/src/reportlab/graphics/barcode/code128.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/barcode/code128.py	Mon Feb 08 18:17:33 2010 +0000
@@ -276,7 +276,7 @@
         s = self.validated
         l = ['START_B']
         for c in s:
-            if not setb.has_key(c):
+            if c not in setb:
                 l = l + ['TO_A', c, 'TO_B']
             else:
                 l.append(c)
@@ -288,7 +288,7 @@
         if l[1] in tos:
             l[:2] = ['START_' + l[1][-1]]
 
-#        print `l`
+#        print repr(l)
 
         # encode into numbers
         start, set, shset = setmap[l[0]]
--- a/src/reportlab/graphics/barcode/code39.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/barcode/code39.py	Mon Feb 08 18:17:33 2010 +0000
@@ -232,7 +232,7 @@
     def encode(self):
         self.encoded = ""
         for c in self.validated:
-            if _extended.has_key(c):
+            if c in _extended:
                 self.encoded = self.encoded + _extended[c]
             elif c in _stdchrs:
                 self.encoded = self.encoded + c
--- a/src/reportlab/graphics/barcode/code93.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/barcode/code93.py	Mon Feb 08 18:17:33 2010 +0000
@@ -187,7 +187,7 @@
         for c in self.value:
             if c in string.lowercase:
                 c = string.upper(c)
-            if not _patterns.has_key(c):
+            if c not in _patterns:
                 self.valid = 0
                 continue
             vval = vval + c
@@ -213,7 +213,7 @@
         self.valid = 1
         a = vval.append
         for c in self.value:
-            if not _patterns.has_key(c) and not _extended.has_key(c):
+            if c not in _patterns and c not in _extended:
                 self.valid = 0
                 continue
             a(c)
@@ -223,9 +223,9 @@
     def encode(self):
         self.encoded = ""
         for c in self.validated:
-            if _patterns.has_key(c):
+            if c in _patterns:
                 self.encoded = self.encoded + c
-            elif _extended.has_key(c):
+            elif c in _extended:
                 self.encoded = self.encoded + _extended[c]
             else:
                 raise ValueError
--- a/src/reportlab/graphics/barcode/lto.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/barcode/lto.py	Mon Feb 08 18:17:33 2010 +0000
@@ -108,7 +108,7 @@
 
         colored : boolean to determine if blocks have to be colorized.
         """
-        if kwargs.has_key("colored") :
+        if "colored" in kwargs:
             self.colored = kwargs["colored"]
             del kwargs["colored"]
         else :
--- a/src/reportlab/graphics/barcode/usps.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/barcode/usps.py	Mon Feb 08 18:17:33 2010 +0000
@@ -199,7 +199,7 @@
             else:
                 raise ValueError, "Invalid character in input"
         check = (10 - check) % 10
-        self.encoded = self.encoded + `check` + 'S'
+        self.encoded = self.encoded + repr(check) + 'S'
         return self.encoded
 
     def decompose(self):
--- a/src/reportlab/graphics/charts/axes.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/charts/axes.py	Mon Feb 08 18:17:33 2010 +0000
@@ -101,7 +101,7 @@
         e = kwds.pop('end',None)
         if s is None or e is None:
             dim = getattr(getattr(axis,'joinAxis',None),'getGridDims',None)
-            if dim and callable(dim):
+            if dim and hasattr(dim,'__call__'):
                 dim = dim()
             if dim:
                 if s is None: s = dim[0]
@@ -202,7 +202,7 @@
             s = self.gridStart
             e = self.gridEnd
             if s is None or e is None:
-                if dim and callable(dim):
+                if dim and hasattr(dim,'__call__'):
                     dim = dim()
                 if dim:
                     if s is None: s = dim[0]
@@ -225,7 +225,7 @@
         s = self.subGridStart
         e = self.subGridEnd
         if s is None or e is None:
-            if dim and callable(dim):
+            if dim and hasattr(dim,'__call__'):
                 dim = dim()
             if dim:
                 if s is None: s = dim[0]
@@ -1187,7 +1187,7 @@
                             txt = f[i]
                         else:
                             txt = ''
-                    elif callable(f):
+                    elif hasattr(f,'__call__'):
                         if isinstance(f,TickLabeller):
                             txt = f(self,t)
                         else:
@@ -1480,10 +1480,10 @@
                 yyyy += 1
 
             #first and last may still be forced in.
-            if self.forceFirstDate and xVals[0] <> ticks[0]:
+            if self.forceFirstDate and xVals[0] != ticks[0]:
                 ticks.insert(0, firstDate)
                 labels.insert(0,formatter(firstDate))
-            if self.forceEndDate and xVals[-1] <> ticks[-1]:
+            if self.forceEndDate and xVals[-1] != ticks[-1]:
                 ticks.append(lastDate)
                 labels.append(formatter(lastDate))
 
--- a/src/reportlab/graphics/charts/barcharts.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/charts/barcharts.py	Mon Feb 08 18:17:33 2010 +0000
@@ -315,7 +315,7 @@
             labelText = self.barLabelArray[rowNo][colNo]
         elif type(labelFmt) is str:
             labelText = labelFmt % self.data[rowNo][colNo]
-        elif callable(labelFmt):
+        elif hasattr(labelFmt):
             labelText = labelFmt(self.data[rowNo][colNo])
         else:
             msg = "Unknown formatter type %s, expected string or function" % labelFmt
@@ -433,7 +433,7 @@
             rowStyle = bars[styleIdx]
             for colNo in range(len(row)):
                 barPos = row[colNo]
-                style = bars.has_key((styleIdx,colNo)) and bars[(styleIdx,colNo)] or rowStyle
+                style = (styleIdx,colNo) in bars and bars[(styleIdx,colNo)] or rowStyle
                 (x, y, width, height) = barPos
                 if None in (width,height):
                     self._addNABarLabel(lg,rowNo,colNo,x,y,width,height)
@@ -1953,7 +1953,7 @@
     "Simple bar chart with absolute spacing."
 
     def __init__(self,width=400,height=200,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         bc = HorizontalBarChart()
         bc.x = 50
         bc.y = 50
--- a/src/reportlab/graphics/charts/legends.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/charts/legends.py	Mon Feb 08 18:17:33 2010 +0000
@@ -102,12 +102,12 @@
         L = find_locals(lambda L: L.get('self',None) is legend and L or None)
         return tuple([getattr(self,a,L[a]) for a in args])
 
-    def __call__(self,legend,g,thisx,y,(col,name)):
-        pass
+    def __call__(self,legend,g,thisx,y,colName):
+        col, name = colName
 
 class LegendSwatchCallout(LegendCallout):
-    def __call__(self,legend,g,thisx,y,i,(col,name),swatch):
-        pass
+    def __call__(self,legend,g,thisx,y,i,colName,swatch):
+        col, name = colName
 
 class LegendColEndCallout(LegendCallout):
     def __call__(self,legend, g, x, xt, y, width, lWidth):
@@ -321,7 +321,7 @@
             deltay = max(dy,leading)+self.autoYPadding
         ba = self.boxAnchor
         maxWidth = self._calculateMaxBoundaries(colorNamePairs)
-        nCols = int((n+columnMaximum-1)/columnMaximum)
+        nCols = int((n+columnMaximum-1)/(columnMaximum*1.0))
         xW = dx+dxTextSpace+self.autoXPadding
         variColumn = self.variColumn
         if variColumn:
@@ -378,7 +378,7 @@
             T = _getLines(name)
             S = []
             aS = S.append
-            j = int(i/columnMaximum)
+            j = int(i/(columnMaximum*1.0))
             jOffs = maxWidth[j]
 
             # thisy+dy/2 = y+leading/2
--- a/src/reportlab/graphics/charts/linecharts.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/charts/linecharts.py	Mon Feb 08 18:17:33 2010 +0000
@@ -247,7 +247,7 @@
                     labelText = None
             else:
                 labelText = labelFmt % labelValue
-        elif callable(labelFmt):
+        elif hasattr(labelFmt,'__call__'):
             labelText = labelFmt(labelValue)
         else:
             raise ValueError("Unknown formatter type %s, expected string or function"%labelFmt)
--- a/src/reportlab/graphics/charts/lineplots.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/charts/lineplots.py	Mon Feb 08 18:17:33 2010 +0000
@@ -212,7 +212,7 @@
                 labelText = self.lineLabelArray[rowNo][colNo]
             else:
                 labelText = labelFmt % labelValue
-        elif callable(labelFmt):
+        elif hasattr(labelFmt,'__call__'):
             labelText = labelFmt(labelValue)
         else:
             raise ValueError("Unknown formatter type %s, expected string or function"%labelFmt)
--- a/src/reportlab/graphics/charts/piecharts.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/charts/piecharts.py	Mon Feb 08 18:17:33 2010 +0000
@@ -838,7 +838,7 @@
                     pass
                 elif type(lNF) is StringType:
                     ldf = lNF % ldf
-                elif callable(lNF):
+                elif hasattr(lNF,'__call__'):
                     ldf = lNF(ldf)
                 else:
                     p = self.legend_names[f]
@@ -849,7 +849,7 @@
                         pass
                     elif type(lNF) is StringType:
                         ldf = lNF % ldf
-                    elif callable(lNF):
+                    elif hasattr(lNF,'__call__'):
                         ldf = lNF(ldf)
                     else:
                         msg = "Unknown formatter type %s, expected string or function" % self.legendNumberFormat
--- a/src/reportlab/graphics/charts/spider.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/charts/spider.py	Mon Feb 08 18:17:33 2010 +0000
@@ -207,7 +207,7 @@
                 text = sty._text
             else:
                 text = fmt % value
-        elif callable(fmt):
+        elif hasattr(fmt,'__call__'):
             text = fmt(value)
         else:
             raise ValueError("Unknown formatter type %s, expected string or function" % fmt)
--- a/src/reportlab/graphics/charts/utils.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/charts/utils.py	Mon Feb 08 18:17:33 2010 +0000
@@ -166,14 +166,14 @@
     w = int(w)!=w
 
     if power > 3 or power < -3:
-        format = '%+'+`w+7`+'.0e'
+        format = '%+'+repr(w+7)+'.0e'
     else:
         if power >= 0:
             digits = int(power)+w
-            format = '%' + `digits`+'.0f'
+            format = '%' + repr(digits)+'.0f'
         else:
             digits = w-int(power)
-            format = '%'+`digits+2`+'.'+`digits`+'f'
+            format = '%'+repr(digits+2)+'.'+repr(digits)+'f'
 
     if percent: format=format+'%%'
     T = []
--- a/src/reportlab/graphics/renderPS.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/renderPS.py	Mon Feb 08 18:17:33 2010 +0000
@@ -592,7 +592,7 @@
         outstream = getStringIO(hex_encoded)
 
         dataline = outstream.read(78)
-        while dataline <> "":
+        while dataline != "":
             self.code_append(dataline)
             dataline= outstream.read(78)
         self.code_append('% end of image data') # for clarity
@@ -662,7 +662,7 @@
         outstream = getStringIO(hex_encoded)
 
         dataline = outstream.read(78)
-        while dataline <> "":
+        while dataline != "":
             self.code_append(dataline)
             dataline= outstream.read(78)
         self.code_append('> % end of image data') # > is EOD for hex encoded filterfor clarity
@@ -706,7 +706,7 @@
     def drawNode(self, node):
         """This is the recursive method called for each node
         in the tree"""
-        self._canvas.comment('begin node %s'%`node`)
+        self._canvas.comment('begin node %r'%node)
         color = self._canvas._color
         if not (isinstance(node, Path) and node.isClipPath):
             self._canvas.saveState()
@@ -722,12 +722,12 @@
         rDeltas = self._tracker.pop()
         if not (isinstance(node, Path) and node.isClipPath):
             self._canvas.restoreState()
-        self._canvas.comment('end node %s'%`node`)
+        self._canvas.comment('end node %r'%node)
         self._canvas._color = color
 
         #restore things we might have lost (without actually doing anything).
         for k, v in rDeltas.items():
-            if self._restores.has_key(k):
+            if k in self._restores:
                 setattr(self._canvas,self._restores[k],v)
 
 ##  _restores = {'stroke':'_stroke','stroke_width': '_lineWidth','stroke_linecap':'_lineCap',
--- a/src/reportlab/graphics/renderSVG.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/renderSVG.py	Mon Feb 08 18:17:33 2010 +0000
@@ -582,7 +582,7 @@
 
         if self.verbose: print "### begin _SVGRenderer.drawNode(%r)" % node
 
-        self._canvas.comment('begin node %s'%`node`)
+        self._canvas.comment('begin node %r'%node)
         color = self._canvas._color
         style = self._canvas.style.copy()
         if not (isinstance(node, Path) and node.isClipPath):
@@ -599,12 +599,12 @@
         rDeltas = self._tracker.pop()
         if not (isinstance(node, Path) and node.isClipPath):
             pass #self._canvas.restoreState()
-        self._canvas.comment('end node %s'%`node`)
+        self._canvas.comment('end node %r'%node)
         self._canvas._color = color
 
         #restore things we might have lost (without actually doing anything).
         for k, v in rDeltas.items():
-            if self._restores.has_key(k):
+            if k in self._restores:
                 setattr(self._canvas,self._restores[k],v)
         self._canvas.style = style
 
--- a/src/reportlab/graphics/renderbase.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/renderbase.py	Mon Feb 08 18:17:33 2010 +0000
@@ -38,7 +38,7 @@
     the given shape would have on the graphics state"""
     delta = {}
     for (prop, value) in shape.getProperties().items():
-        if STATE_DEFAULTS.has_key(prop):
+        if prop in STATE_DEFAULTS:
             delta[prop] = value
     return delta
 
@@ -62,7 +62,7 @@
         if defaults is None:
             defaults = STATE_DEFAULTS.copy()
         #ensure  that if we have a transform, we have a CTM
-        if defaults.has_key('transform'):
+        if 'transform' in defaults:
             defaults['ctm'] = defaults['transform']
         self._combined.append(defaults)
 
@@ -100,7 +100,7 @@
         for key, curValue in lastDelta.items():
             #print '   key=%s, value=%s' % (key, curValue)
             prevValue = newState[key]
-            if prevValue <> curValue:
+            if prevValue != curValue:
                 #print '    state popping "%s"="%s"' % (key, curValue)
                 if key == 'transform':
                     reverseDelta[key] = inverse(lastDelta['transform'])
--- a/src/reportlab/graphics/samples/bubble.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/bubble.py	Mon Feb 08 18:17:33 2010 +0000
@@ -7,7 +7,7 @@
 
 class Bubble(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,ScatterPlot(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 115
         self.chart.height     = 80
--- a/src/reportlab/graphics/samples/clustered_bar.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/clustered_bar.py	Mon Feb 08 18:17:33 2010 +0000
@@ -7,7 +7,7 @@
 
 class ClusteredBar(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,HorizontalBarChart(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 115
         self.chart.height     = 80
@@ -81,4 +81,4 @@
         self._add(self,0,name='preview',validate=None,desc=None)
 
 if __name__=="__main__": #NORUNTESTS
-    ClusteredBar().save(formats=['pdf'],outDir=None,fnRoot='clustered_bar')
\ No newline at end of file
+    ClusteredBar().save(formats=['pdf'],outDir=None,fnRoot='clustered_bar')
--- a/src/reportlab/graphics/samples/clustered_column.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/clustered_column.py	Mon Feb 08 18:17:33 2010 +0000
@@ -7,7 +7,7 @@
 
 class ClusteredColumn(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,VerticalBarChart(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 115
         self.chart.height     = 80
--- a/src/reportlab/graphics/samples/exploded_pie.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/exploded_pie.py	Mon Feb 08 18:17:33 2010 +0000
@@ -8,7 +8,7 @@
 
 class ExplodedPie(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,Pie(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 100
         self.chart.height     = 100
@@ -62,4 +62,4 @@
         self._add(self,0,name='preview',validate=None,desc=None)
 
 if __name__=="__main__": #NORUNTESTS
-    ExplodedPie().save(formats=['pdf'],outDir=None,fnRoot='exploded_pie')
\ No newline at end of file
+    ExplodedPie().save(formats=['pdf'],outDir=None,fnRoot='exploded_pie')
--- a/src/reportlab/graphics/samples/filled_radar.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/filled_radar.py	Mon Feb 08 18:17:33 2010 +0000
@@ -7,7 +7,7 @@
 
 class FilledRadarChart(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,SpiderChart(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 90
         self.chart.height     = 90
--- a/src/reportlab/graphics/samples/line_chart.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/line_chart.py	Mon Feb 08 18:17:33 2010 +0000
@@ -7,7 +7,7 @@
 
 class LineChart(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,LinePlot(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 115
         self.chart.height     = 80
--- a/src/reportlab/graphics/samples/linechart_with_markers.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/linechart_with_markers.py	Mon Feb 08 18:17:33 2010 +0000
@@ -8,7 +8,7 @@
 
 class LineChartWithMarkers(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,LinePlot(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 115
         self.chart.height     = 80
--- a/src/reportlab/graphics/samples/radar.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/radar.py	Mon Feb 08 18:17:33 2010 +0000
@@ -7,7 +7,7 @@
 
 class RadarChart(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,SpiderChart(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 90
         self.chart.height     = 90
--- a/src/reportlab/graphics/samples/scatter.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/scatter.py	Mon Feb 08 18:17:33 2010 +0000
@@ -7,7 +7,7 @@
 
 class Scatter(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,ScatterPlot(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 115
         self.chart.height     = 80
--- a/src/reportlab/graphics/samples/scatter_lines.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/scatter_lines.py	Mon Feb 08 18:17:33 2010 +0000
@@ -7,7 +7,7 @@
 
 class ScatterLines(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,ScatterPlot(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 115
         self.chart.height     = 80
--- a/src/reportlab/graphics/samples/scatter_lines_markers.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/scatter_lines_markers.py	Mon Feb 08 18:17:33 2010 +0000
@@ -7,7 +7,7 @@
 
 class ScatterLinesMarkers(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,ScatterPlot(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 115
         self.chart.height     = 80
--- a/src/reportlab/graphics/samples/simple_pie.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/simple_pie.py	Mon Feb 08 18:17:33 2010 +0000
@@ -8,7 +8,7 @@
 
 class SimplePie(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,Pie(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 100
         self.chart.height     = 100
@@ -58,4 +58,4 @@
         self._add(self,0,name='preview',validate=None,desc=None)
 
 if __name__=="__main__": #NORUNTESTS
-    SimplePie().save(formats=['pdf'],outDir=None,fnRoot=None)
\ No newline at end of file
+    SimplePie().save(formats=['pdf'],outDir=None,fnRoot=None)
--- a/src/reportlab/graphics/samples/stacked_bar.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/stacked_bar.py	Mon Feb 08 18:17:33 2010 +0000
@@ -7,7 +7,7 @@
 
 class StackedBar(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,HorizontalBarChart(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 115
         self.chart.height     = 80
@@ -82,4 +82,4 @@
         self._add(self,0,name='preview',validate=None,desc=None)
 
 if __name__=="__main__": #NORUNTESTS
-    StackedBar().save(formats=['pdf'],outDir=None,fnRoot='stacked_bar')
\ No newline at end of file
+    StackedBar().save(formats=['pdf'],outDir=None,fnRoot='stacked_bar')
--- a/src/reportlab/graphics/samples/stacked_column.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/samples/stacked_column.py	Mon Feb 08 18:17:33 2010 +0000
@@ -7,7 +7,7 @@
 
 class StackedColumn(_DrawingEditorMixin,Drawing):
     def __init__(self,width=200,height=150,*args,**kw):
-        apply(Drawing.__init__,(self,width,height)+args,kw)
+        Drawing.__init__(self,width,height,*args,**kw)
         self._add(self,VerticalBarChart(),name='chart',validate=None,desc="The main chart")
         self.chart.width      = 115
         self.chart.height     = 80
--- a/src/reportlab/graphics/shapes.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/shapes.py	Mon Feb 08 18:17:33 2010 +0000
@@ -251,7 +251,7 @@
         #may need to override this.
         props = {}
         for key, value in self.__dict__.items():
-            if key[0:1] <> '_':
+            if key[0:1] != '_':
                 props[key] = value
         return props
 
@@ -284,8 +284,8 @@
 
         if self._attrMap is not None:
             for key in self.__dict__.keys():
-                if key[0] <> '_':
-                    assert self._attrMap.has_key(key), "Unexpected attribute %s found in %s" % (key, self)
+                if key[0] != '_':
+                    assert key in self._attrMap, "Unexpected attribute %s found in %s" % (key, self)
             for (attr, metavalue) in self._attrMap.items():
                 assert hasattr(self, attr), "Missing attribute %s from %s" % (attr, self)
                 value = getattr(self, attr)
@@ -498,7 +498,7 @@
     c = obj.__class__
     m = getmodule(c).__name__
     n = n or c.__name__
-    if not I.has_key(m):
+    if m not in I:
         I[m] = [n]
     elif n not in I[m]:
         I[m].append(n)
@@ -606,7 +606,7 @@
             s = s + 'from %s import %s\n' % (m,string.replace(str(o)[1:-1],"'",""))
         s = s + '\nclass %s(_DrawingEditorMixin,Drawing):\n' % n
         s = s + '\tdef __init__(self,width=%s,height=%s,*args,**kw):\n' % (self.width,self.height)
-        s = s + '\t\tapply(Drawing.__init__,(self,width,height)+args,kw)\n'
+        s = s + '\t\tDrawing.__init__(self,width,height)+args,**kw)\n'
         s = s + G
         s = s + '\n\nif __name__=="__main__": #NORUNTESTS\n\t%s().save(formats=[\'pdf\'],outDir=\'.\',fnRoot=None)\n' % n
         return s
@@ -639,7 +639,7 @@
         return self._copy(self.__class__(self.width, self.height))
 
     def asGroup(self,*args,**kw):
-        return self._copy(apply(Group,args,kw))
+        return self._copy(Group(*args,**kw))
 
     def save(self, formats=None, verbose=None, fnRoot=None, outDir=None, title='', **kw):
         """Saves copies of self in desired location and formats.
@@ -653,7 +653,7 @@
         if not fnRoot:
             fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d'))
             chartId = getattr(self,'chartId',0)
-            if callable(fnRoot):
+            if hasattr(fnRoot,'__call__'):
                 fnRoot = fnRoot(chartId)
             else:
                 try:
@@ -798,7 +798,7 @@
         '''
         ivc = isValidChild(value)
         if name and hasattr(obj,'_attrMap'):
-            if not obj.__dict__.has_key('_attrMap'):
+            if '_attrMap' not in obj.__dict__:
                 obj._attrMap = obj._attrMap.clone()
             if ivc and validate is None: validate = isValidChild
             obj._attrMap[name] = AttrMapValue(validate,desc)
@@ -889,7 +889,7 @@
         nArgs = _PATH_OP_ARG_COUNT[op]
         func = drawFuncs[op]
         j = i + nArgs
-        apply(func, points[i:j])
+        func(*points[i:j])
         i = j
         if op == _CLOSEPATH:
             hadClosePath = hadClosePath + 1
@@ -999,7 +999,7 @@
     for d,o in (dx,0), (dy,1):
         for i in xrange(o,len(P),2):
             P[i] = P[i]+d
-    return apply(Path,(P,O,isClipPath),kw)
+    return Path(P,O,isClipPath,**kw)
 
 class Rect(SolidShape):
     """Rectangle, possibly with rounded corners."""
--- a/src/reportlab/graphics/widgetbase.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/widgetbase.py	Mon Feb 08 18:17:33 2010 +0000
@@ -28,9 +28,9 @@
 
         if self._attrMap is not None:
             for key in self.__dict__.keys():
-                if key[0] <> '_':
+                if key[0] != '_':
                     msg = "Unexpected attribute %s found in %s" % (key, self)
-                    assert self._attrMap.has_key(key), msg
+                    assert key in self._attrMap, msg
             for (attr, metavalue) in self._attrMap.items():
                 msg = "Missing attribute %s from %s" % (attr, self)
                 assert hasattr(self, attr), msg
@@ -65,7 +65,7 @@
 
         props = {}
         for name in self.__dict__.keys():
-            if name[0:1] <> '_':
+            if name[0:1] != '_':
                 component = getattr(self, name)
 
                 if recur and isValidChild(component):
@@ -137,7 +137,7 @@
 
     def _setKeywords(self,**kw):
         for k,v in kw.items():
-            if not self.__dict__.has_key(k):
+            if k not in self.__dict__:
                 setattr(self,k,v)
 
     def draw(self):
@@ -214,11 +214,11 @@
                     i = self._index
                     if i:
                         c = self._parent._children
-                        if c.has_key(i) and c[i].__dict__.has_key(name):
+                        if i in c and name in c[i].__dict__:
                             return getattr(c[i],name)
                         elif len(i)==1:
                             i = i[0]
-                            if c.has_key(i) and c[i].__dict__.has_key(name):
+                            if i in c and name in c[i].__dict__:
                                 return getattr(c[i],name)
                     return getattr(self._parent,name)
         return WKlass
@@ -228,7 +228,7 @@
             return self._children[index]
         except KeyError:
             Klass = self._value.__class__
-            if _ItemWrapper.has_key(Klass):
+            if Klass in _ItemWrapper:
                 WKlass = _ItemWrapper[Klass]
             else:
                 _ItemWrapper[Klass] = WKlass = self.wKlassFactory(Klass)
@@ -249,9 +249,9 @@
             self._children[index] = child
             return child
 
-    def has_key(self,key):
+    def __contains__(self,key):
         if type(key) in (type(()),type([])): key = tuple(key)
-        return self._children.has_key(key)
+        return key in self._children
 
     def __setitem__(self, key, value):
         msg = "This collection can only hold objects of type %s" % self._value.__class__.__name__
@@ -271,7 +271,7 @@
         for idx in self._children.keys():
             childProps = self._children[idx].getProperties(recur=recur)
             for (key, value) in childProps.items():
-                if not hasattr(self,key) or getattr(self, key)<>value:
+                if not hasattr(self,key) or getattr(self, key)!=value:
                     newKey = '[%s].%s' % (idx, key)
                     props[newKey] = value
         return props
--- a/src/reportlab/graphics/widgets/eventcal.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/widgets/eventcal.py	Mon Feb 08 18:17:33 2010 +0000
@@ -104,7 +104,7 @@
         used = []
         for talk in talkList:
             (title, speaker, trackId, day, hours, duration) = talk
-            assert trackId <> 0, "trackId must be None or 1,2,3... zero not allowed!"
+            assert trackId != 0, "trackId must be None or 1,2,3... zero not allowed!"
             if day == self.day:
                 if (((self.startTime is None) or ((hours + duration) >= self.startTime))
                 and ((self.endTime is None) or (hours <= self.endTime))):
--- a/src/reportlab/graphics/widgets/grids.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/widgets/grids.py	Mon Feb 08 18:17:33 2010 +0000
@@ -440,9 +440,11 @@
     x0, y0 = centroid(P)
     theta = (angle/180.)*pi
     s,c=sin(theta),cos(theta)
-    def parallelAxisDist((x,y),s=s,c=c,x0=x0,y0=y0):
+    def parallelAxisDist(xy,s=s,c=c,x0=x0,y0=y0):
+        x,y = xy
         return (s*(y-y0)+c*(x-x0))
-    def orthogonalAxisDist((x,y),s=s,c=c,x0=x0,y0=y0):
+    def orthogonalAxisDist(xy,s=s,c=c,x0=x0,y0=y0):
+        x,y = xy
         return (c*(y-y0)+s*(x-x0))
     L = map(parallelAxisDist,P)
     L.sort()
--- a/src/reportlab/graphics/widgets/markers.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/widgets/markers.py	Mon Feb 08 18:17:33 2010 +0000
@@ -223,17 +223,17 @@
 
 class _isSymbol(Validator):
     def test(self,x):
-        return callable(x) or isinstance(x,Marker) or isinstance(x,Flag) \
+        return hasattr(x,'__call__') or isinstance(x,Marker) or isinstance(x,Flag) \
                 or (type(x)==ClassType and issubclass(x,Widget))
 
 isSymbol = _isSymbol()
 
 def makeMarker(name,**kw):
     if Marker._attrMap['kind'].validate(name):
-        m = apply(Marker,(),kw)
+        m = Marker(**kw)
         m.kind = name
     elif name[-5:]=='_Flag' and Flag._attrMap['kind'].validate(name[:-5]):
-        m = apply(Flag,(),kw)
+        m = Flag(**kw)
         m.kind = name[:-5]
         m.size = 10
     else:
--- a/src/reportlab/lib/PyFontify.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/PyFontify.py	Mon Feb 08 18:17:33 2010 +0000
@@ -124,7 +124,7 @@
         c = match[0]
         if c not in "#'\"":
             # Must have matched a keyword.
-            if start <> searchfrom:
+            if start != searchfrom:
                 # there's still a redundant char before and after it, strip!
                 match = match[1:-1]
                 start = start + 1
@@ -157,4 +157,4 @@
     f.close()
     tags = fontify(text)
     for tag, start, end, sublist in tags:
-        print tag, `text[start:end]`
+        print tag, repr(text[start:end])
--- a/src/reportlab/lib/__init__.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/__init__.py	Mon Feb 08 18:17:33 2010 +0000
@@ -4,4 +4,4 @@
 #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/__init__.py
 __version__=''' $Id$ '''
 import os
-RL_DEBUG = os.environ.has_key('RL_DEBUG')
\ No newline at end of file
+RL_DEBUG = 'RL_DEBUG' in os.environ
--- a/src/reportlab/lib/attrmap.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/attrmap.py	Mon Feb 08 18:17:33 2010 +0000
@@ -41,7 +41,7 @@
         self.kw = kw
 
     def __call__(self):
-        return apply(self.func,self.args,self.kw)
+        return self.func(*self.args,**self.kw)
 
 class AttrMapValue:
     '''Simple multi-value holder for attribute maps'''
--- a/src/reportlab/lib/colors.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/colors.py	Mon Feb 08 18:17:33 2010 +0000
@@ -208,8 +208,9 @@
         PCMYKColor.__init__(self,cyan,magenta,yellow,black,density,spotName,knockout=None,alpha=alpha)
     _cKwds='cyan magenta yellow black density spotName alpha'.split()
 
-def cmyk2rgb((c,m,y,k),density=1):
+def cmyk2rgb(cmyk,density=1):
     "Convert from a CMYK color tuple to an RGB color tuple"
+    c,m,y,k = cmyk
     # From the Adobe Postscript Ref. Manual 2nd ed.
     r = 1.0 - min(1.0, c + k)
     g = 1.0 - min(1.0, m + k)
@@ -729,7 +730,7 @@
         if C: return C
         C = getAllNamedColors()
         s = arg.lower()
-        if C.has_key(s): return C[s]
+        if s in C: return C[s]
         try:
             return toColor(eval(arg))
         except:
--- a/src/reportlab/lib/fontfinder.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/fontfinder.py	Mon Feb 08 18:17:33 2010 +0000
@@ -144,7 +144,7 @@
             fonts = self._fonts
             for font in fonts:
                 fam = font.familyName
-                if self._fontsByFamily.has_key(fam):
+                if fam in self._fontsByFamily:
                     self._fontsByFamily[fam].append(font)
                 else:
                     self._fontsByFamily[fam] = [font]
@@ -179,7 +179,7 @@
         for font in self._fonts:
             OK = True
             for (k, v) in kwds.items():
-                if getattr(font, k, None) <> v:
+                if getattr(font, k, None) != v:
                     OK = False
             if OK:
                 selected.append(font)
--- a/src/reportlab/lib/fonts.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/fonts.py	Mon Feb 08 18:17:33 2010 +0000
@@ -67,25 +67,25 @@
 
 _ps2tt_map={}
 for k,v in _tt2ps_map.items():
-    if not _ps2tt_map.has_key(k):
+    if k not in _ps2tt_map:
         _ps2tt_map[v.lower()] = k
 
 def ps2tt(psfn):
     'ps fontname to family name, bold, italic'
     psfn = psfn.lower()
-    if _ps2tt_map.has_key(psfn):
+    if psfn in _ps2tt_map:
         return _ps2tt_map[psfn]
     raise ValueError, "Can't map determine family/bold/italic for %s" % psfn
 
 def tt2ps(fn,b,i):
     'family name + bold & italic to ps font name'
     K = (fn.lower(),b,i)
-    if _tt2ps_map.has_key(K):
+    if K in _tt2ps_map:
         return _tt2ps_map[K]
     else:
         fn, b1, i1 = ps2tt(K[0])
         K = fn, b1|b, i1|i
-        if _tt2ps_map.has_key(K):
+        if K in _tt2ps_map:
             return _tt2ps_map[K]
     raise ValueError, "Can't find concrete font for family=%s, bold=%d, italic=%d" % (fn, b, i)
 
--- a/src/reportlab/lib/logger.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/logger.py	Mon Feb 08 18:17:33 2010 +0000
@@ -50,7 +50,7 @@
         self.enabled = 1
 
     def once(self,warning):
-        if not self.uttered.has_key(warning):
+        if warning not in self.uttered:
             if self.enabled: logger.write(self.pfx + warning)
             self.uttered[warning] = 1
 
@@ -58,4 +58,4 @@
         self.once(warning)
 
 warnOnce=WarnOnce()
-infoOnce=WarnOnce('Info')
\ No newline at end of file
+infoOnce=WarnOnce('Info')
--- a/src/reportlab/lib/normalDate.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/normalDate.py	Mon Feb 08 18:17:33 2010 +0000
@@ -166,7 +166,7 @@
 
     def dayOfWeek(self):
         """return integer representing day of week, Mon=0, Tue=1, etc."""
-        return apply(dayOfWeek, self.toTuple())
+        return dayOfWeek(*self.toTuple())
 
     def dayOfWeekAbbrev(self):
         """return day of week abbreviation for current date: Mon, Tue, etc."""
@@ -415,7 +415,7 @@
     def __repr__(self):
         """print format: [-]yyyymmdd"""
         # Note: When disassembling a NormalDate string, be sure to
-        # count from the right, i.e. epochMonth = int(`Epoch`[-4:-2]),
+        # count from the right, i.e. epochMonth = int(repr(Epoch)[-4:-2]),
         # or the slice won't work for dates B.C.
         if self.normalDate < 0:
             return "%09d" % self.normalDate
@@ -467,7 +467,7 @@
                 if m:
                     self.setNormalDate(m.group(1)+m.group(2)+m.group(3))
                 else:
-                    raise NormalDateException("unable to setNormalDate(%s)" % `normalDate`)
+                    raise NormalDateException("unable to setNormalDate(%r)" % normalDate)
         elif isinstance(normalDate,_DateSeqTypes):
             self.normalDate = int("%04d%02d%02d" % normalDate[:3])
         elif isinstance(normalDate,NormalDate):
@@ -475,7 +475,7 @@
         elif isinstance(normalDate,(datetime.datetime,datetime.date)):
             self.normalDate = (normalDate.year*100+normalDate.month)*100+normalDate.day
         if not self._isValidNormalDate(self.normalDate):
-            raise NormalDateException("unable to setNormalDate(%s)" % `normalDate`)
+            raise NormalDateException("unable to setNormalDate(%r)" % normalDate)
 
     def setYear(self, year):
         if year == 0:
@@ -581,7 +581,7 @@
         return self.asNormalDate.daysBetweenDates(normalDate)
 
     def _checkDOW(self):
-        if self.dayOfWeek()>4: raise NormalDateException("%s isn't a business day" % `self.normalDate`)
+        if self.dayOfWeek()>4: raise NormalDateException("%r isn't a business day" % self.normalDate)
 
     def normalize(self, i):
         i = int(i)
--- a/src/reportlab/lib/pdfencrypt.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/pdfencrypt.py	Mon Feb 08 18:17:33 2010 +0000
@@ -190,7 +190,7 @@
     assert hexText[-1] == '>', 'bad hex text'
     hexText = hexText[1:-1]
     out = ''
-    for i in range(len(hexText)/2):
+    for i in range(int(len(hexText)/2.0)):
         slice = hexText[i*2: i*2+2]
         char = chr(eval('0x'+slice))
         out = out + char
--- a/src/reportlab/lib/rparsexml.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/rparsexml.py	Mon Feb 08 18:17:33 2010 +0000
@@ -133,7 +133,7 @@
                 found = 1
                 cursor = find(text, ">", past)
                 if cursor<0:
-                    raise ValueError, "can't close prologue %s" % `e`
+                    raise ValueError, "can't close prologue %r" % e
                 cursor = cursor+1
         if found is None:
             done=1
@@ -150,7 +150,7 @@
        return (dictionary, endcharacter)
        special case: comment returns (None, endcharacter)"""
     #from string import strip, split, find
-    #print "parsexml0", `xmltext[startingat: startingat+10]`
+    #print "parsexml0", repr(xmltext[startingat: startingat+10])
     # DEFAULTS
     NameString = NONAME
     ContentList = AttDict = ExtraStuff = None
@@ -163,7 +163,7 @@
     #look for interesting starting points
     firstbracket = find(xmltext, "<", cursor)
     afterbracket2char = xmltext[firstbracket+1:firstbracket+3]
-    #print "a", `afterbracket2char`
+    #print "a", repr(afterbracket2char)
     #firstampersand = find(xmltext, "&", cursor)
     #if firstampersand>0 and firstampersand<firstbracket:
     #    raise ValueError, "I don't handle ampersands yet!!!"
@@ -177,7 +177,7 @@
                 if entityReplacer: ContentList = entityReplacer(ContentList)
                 return (NameString, AttDict, ContentList, ExtraStuff), len(xmltext)
             else:
-                raise ValueError, "no tags at non-toplevel %s" % `xmltext[cursor:cursor+20]`
+                raise ValueError, "no tags at non-toplevel %s" % repr(xmltext[cursor:cursor+20])
     #D = {}
     L = []
     # look for start tag
@@ -343,7 +343,7 @@
                     linenum = len(split(prefix, "\n"))
                     raise ValueError, \
                        "at lines %s...%s close tag name doesn't match %s...%s %s" %(
-                       linenum, endlinenum, `name`, `closename`, repr(xmltext[cursor: cursor+100]))
+                       linenum, endlinenum, repr(name), repr(closename), repr(xmltext[cursor: cursor+100]))
                 remainder = xmltext[cursor:nextopenbracket]
                 if remainder:
                     #if verbose: print "remainder", repr(remainder)
@@ -385,7 +385,7 @@
     attlist = []
     for k in attdict.keys():
         v = attdict[k]
-        attlist.append("%s=%s" % (k, `v`))
+        attlist.append("%s=%s" % (k, repr(v)))
     attributes = join(attlist, " ")
     if not name and attributes:
         raise ValueError, "name missing with attributes???"
--- a/src/reportlab/lib/styles.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/styles.py	Mon Feb 08 18:17:33 2010 +0000
@@ -32,8 +32,8 @@
         if any.  All the work is done in init - styles
         should cost little to use at runtime."""
         # step one - validate the hell out of it
-        assert not self.defaults.has_key('name'), "Class Defaults may not contain a 'name' attribute"
-        assert not self.defaults.has_key('parent'), "Class Defaults may not contain a 'parent' attribute"
+        assert 'name' not in self.defaults, "Class Defaults may not contain a 'name' attribute"
+        assert 'parent' not in self.defaults, "Class Defaults may not contain a 'parent' attribute"
         if parent:
             assert parent.__class__ == self.__class__, "Parent style must have same class as new style"
 
@@ -148,25 +148,20 @@
             except KeyError:
                 raise KeyError, "Style '%s' not found in stylesheet" % key
 
-    def has_key(self, key):
-        if self.byAlias.has_key(key):
-            return 1
-        elif self.byName.has_key(key):
-            return 1
-        else:
-            return 0
+    def __contains__(self, key):
+        return key in self.byAlias or key in self.byName
 
     def add(self, style, alias=None):
         key = style.name
-        if self.byName.has_key(key):
+        if key in self.byName:
             raise KeyError, "Style '%s' already defined in stylesheet" % key
-        if self.byAlias.has_key(key):
+        if key in self.byAlias:
             raise KeyError, "Style name '%s' is already an alias in stylesheet" % key
 
         if alias:
-            if self.byName.has_key(alias):
+            if alias in self.byName:
                 raise KeyError, "Style '%s' already defined in stylesheet" % alias
-            if self.byAlias.has_key(alias):
+            if alias in self.byAlias:
                 raise KeyError, "Alias name '%s' is already an alias in stylesheet" % alias
         #passed all tests?  OK, add it
         self.byName[key] = style
--- a/src/reportlab/lib/testutils.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/testutils.py	Mon Feb 08 18:17:33 2010 +0000
@@ -135,7 +135,7 @@
     def getstringlist(self, section, option):
         "Coerce option to a list of strings or return unchanged if that fails."
 
-        value = apply(ConfigParser.get, (self, section, option))
+        value = ConfigParser.get(self, section, option)
 
         # This seems to allow for newlines inside values
         # of the config file, but be careful!!
@@ -200,7 +200,7 @@
     "An restricted directory tree iterator."
 
     def __init__(self, directory, pattern='*', ignore=None):
-        apply(GlobDirectoryWalker.__init__, (self, directory, pattern))
+        GlobDirectoryWalker.__init__(self, directory, pattern)
 
         if ignore == None:
             ignore = []
--- a/src/reportlab/lib/utils.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/utils.py	Mon Feb 08 18:17:33 2010 +0000
@@ -80,7 +80,7 @@
         except KeyError:
             return dv
 
-    def has_key(self,k):
+    def __contains__(self,k):
         try:
             self[k]
             return True
@@ -293,7 +293,7 @@
         sys.path = opath
         msg = "recursiveimport(%s,baseDir=%s) failed" % (modulename,baseDir)
         if baseDir:
-            msg = msg + " under paths '%s'" % `path`
+            msg = msg + " under paths '%s'" % repr(path)
         raise ImportError, msg
 
 def recursiveGetAttr(obj, name):
@@ -492,7 +492,7 @@
     return time_mktime((y,m,d,h,m,s,0,0,0))
 
 def rl_get_module(name,dir):
-    if sys.modules.has_key(name):
+    if name in sys.modules:
         om = sys.modules[name]
         del sys.modules[name]
     else:
@@ -659,7 +659,7 @@
         if sys.platform[0:4] == 'java':
             return None
         else:
-            if self._image.info.has_key("transparency"):
+            if "transparency" in self._image.info:
                 transparency = self._image.info["transparency"] * 3
                 palette = self._image.palette
                 try:
--- a/src/reportlab/lib/validators.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/validators.py	Mon Feb 08 18:17:33 2010 +0000
@@ -182,7 +182,7 @@
 
 class _isCallable(Validator):
     def test(self, x):
-        return callable(x)
+        return hasattr(x,'__call__')
 
 class OneOf(Validator):
     """Make validator functions for list of choices.
@@ -272,7 +272,7 @@
             text = x
         else:
             text = str(x)
-        return (self._pattern.match(text) <> None)
+        return (self._pattern.match(text) != None)
 
 class DerivedValue:
     """This is used for magic values which work themselves out.
--- a/src/reportlab/lib/xmllib.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/xmllib.py	Mon Feb 08 18:17:33 2010 +0000
@@ -267,21 +267,21 @@
     # Internal -- parse comment, return length or -1 if not terminated
     def parse_comment(self, i):
         rawdata = self.rawdata
-        if rawdata[i:i+4] <> '<!--':
+        if rawdata[i:i+4] != '<!--':
             raise RuntimeError, 'unexpected call to handle_comment'
         res = commentclose.search(rawdata, i+4)
         if not res:
             return -1
         # doubledash search will succeed because it's a subset of commentclose
         if doubledash.search(rawdata, i+4).start(0) < res.start(0):
-            self.syntax_error(self.lineno, "`--' inside comment")
+            self.syntax_error(self.lineno, "'--' inside comment")
         self.handle_comment(rawdata[i+4: res.start(0)])
         return res.end(0)
 
     # Internal -- handle CDATA tag, return lenth or -1 if not terminated
     def parse_cdata(self, i):
         rawdata = self.rawdata
-        if rawdata[i:i+9] <> '<![CDATA[':
+        if rawdata[i:i+9] != '<![CDATA[':
             raise RuntimeError, 'unexpected call to handle_cdata'
         res = cdataclose.search(rawdata, i+9)
         if not res:
@@ -336,7 +336,7 @@
                 self.syntax_error(self.lineno,
                                   'unknown attribute %s of element %s' %
                                   (attrname, tag))
-            if attrdict.has_key(attrname):
+            if attrname in attrdict:
                 self.syntax_error(self.lineno, 'attribute specified twice')
             attrdict[attrname] = self.translate_references(attrvalue)
             k = res.end(0)
@@ -441,7 +441,7 @@
     # Example -- handle entity reference, no need to override
     def handle_entityref(self, name):
         table = self.entitydefs
-        if table.has_key(name):
+        if name in table:
             self.handle_data(table[name])
         else:
             self.unknown_entityref(name)
@@ -620,7 +620,7 @@
     # Example -- handle entity reference, no need to override
     def handle_entityref(self, name):
         table = self.entitydefs
-        if table.has_key(name):
+        if name in table:
             self.handle_data(table[name])
         else:
             self.unknown_entityref(name)
@@ -676,30 +676,30 @@
 
     def handle_data(self, data):
         self.testdata = self.testdata + data
-        if len(`self.testdata`) >= 70:
+        if len(repr(self.testdata)) >= 70:
             self.flush()
 
     def flush(self):
         data = self.testdata
         if data:
             self.testdata = ""
-            print 'data:', `data`
+            print 'data:', repr(data)
 
     def handle_cdata(self, data):
         self.flush()
-        print 'cdata:', `data`
+        print 'cdata:', repr(data)
 
     def handle_proc(self, name, data):
         self.flush()
-        print 'processing:',name,`data`
+        print 'processing:',name,repr(data)
 
     def handle_special(self, data):
         self.flush()
-        print 'special:',`data`
+        print 'special:',repr(data)
 
     def handle_comment(self, data):
         self.flush()
-        r = `data`
+        r = repr(data)
         if len(r) > 68:
             r = r[:32] + '...' + r[-32:]
         print 'comment:', r
--- a/src/reportlab/lib/yaml.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/lib/yaml.py	Mon Feb 08 18:17:33 2010 +0000
@@ -101,13 +101,12 @@
 
             #is it a parser method?
             if hasattr(self.__class__, cmd):
-                method = eval('self.'+cmd)
                 #this was very bad; any type error in the method was hidden
                 #we have to hack the traceback
                 try:
-                    apply(method, tuple(args))
+                    getattr(self,cmd)(*args)
                 except TypeError, err:
-                    sys.stderr.write("Parser method: apply(%s,%s) %s at line %d\n" % (cmd, tuple(args), err, self._lineNo))
+                    sys.stderr.write("Parser method: %s(*%s) %s at line %d\n" % (cmd, args, err, self._lineNo))
                     raise
             else:
                 # assume it is a paragraph style -
@@ -180,9 +179,9 @@
 
 
 if __name__=='__main__': #NORUNTESTS
-    if len(sys.argv) <> 2:
+    if len(sys.argv) != 2:
         results = parseText(__doc__)
     else:
         results = parseFile(sys.argv[1])
     import pprint
-    pprint.pprint(results)
\ No newline at end of file
+    pprint.pprint(results)
--- a/src/reportlab/pdfbase/_can_cmap_data.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/pdfbase/_can_cmap_data.py	Mon Feb 08 18:17:33 2010 +0000
@@ -40,7 +40,7 @@
         nonStandardWidthsByUnichar = {}
         for (codePoint, cid) in cmap.items():
             width = widthsByCID.get(cid, 1000)
-            if width <> 1000:
+            if width != 1000:
                 nonStandardWidthsByUnichar[unichr(codePoint)] = width
         
 
--- a/src/reportlab/pdfbase/cidfonts.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/pdfbase/cidfonts.py	Mon Feb 08 18:17:33 2010 +0000
@@ -122,17 +122,17 @@
 
 
         words = split(rawdata)
-        while words <> []:
+        while words != []:
             if words[0] == 'begincodespacerange':
                 words = words[1:]
-                while words[0] <> 'endcodespacerange':
+                while words[0] != 'endcodespacerange':
                     strStart, strEnd, words = words[0], words[1], words[2:]
                     start = int(strStart[1:-1], 16)
                     end = int(strEnd[1:-1], 16)
                     self._codeSpaceRanges.append((start, end),)
             elif words[0] == 'beginnotdefrange':
                 words = words[1:]
-                while words[0] <> 'endnotdefrange':
+                while words[0] != 'endnotdefrange':
                     strStart, strEnd, strValue = words[0:3]
                     start = int(strStart[1:-1], 16)
                     end = int(strEnd[1:-1], 16)
@@ -141,7 +141,7 @@
                     words = words[3:]
             elif words[0] == 'begincidrange':
                 words = words[1:]
-                while words[0] <> 'endcidrange':
+                while words[0] != 'endcidrange':
                     strStart, strEnd, strValue = words[0:3]
                     start = int(strStart[1:-1], 16)
                     end = int(strEnd[1:-1], 16)
@@ -166,7 +166,7 @@
         cmap = self._cmap
         lastChar = ''
         for char in text:
-            if lastChar <> '':
+            if lastChar != '':
                 #print 'convert character pair "%s"' % (lastChar + char)
                 num = ord(lastChar) * 256 + ord(char)
             else:
--- a/src/reportlab/pdfbase/pdfdoc.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/pdfbase/pdfdoc.py	Mon Feb 08 18:17:33 2010 +0000
@@ -224,7 +224,7 @@
         return self._ID
 
     def SaveToFile(self, filename, canvas):
-        if callable(getattr(filename, "write",None)):
+        if hasattr(getattr(filename, "write",None),'__call__'):
             myfile = 0
             f = filename
             filename = utf8str(getattr(filename,'name',''))
@@ -273,7 +273,7 @@
 
     def getInternalFontName(self, psfontname):
         fm = self.fontMapping
-        if fm.has_key(psfontname):
+        if psfontname in fm:
             return fm[psfontname]
         else:
             try:
@@ -398,7 +398,7 @@
         File = PDFFile(self._pdfVersion) # output collector
         while done is None:
             counter += 1 # do next object...
-            if numbertoid.has_key(counter):
+            if counter in numbertoid:
                 id = numbertoid[counter]
                 #printidToOb
                 obj = idToOb[id]
@@ -444,14 +444,14 @@
     def hasForm(self, name):
         """test for existence of named form"""
         internalname = xObjectName(name)
-        return self.idToObject.has_key(internalname)
+        return internalname in self.idToObject
 
     def getFormBBox(self, name, boxType="MediaBox"):
         """get the declared bounding box of the form as a list.
         If you specify a different PDF box definition (e.g. the
         ArtBox) and it has one, that's what you'll get."""
         internalname = xObjectName(name)
-        if self.idToObject.has_key(internalname):
+        if internalname in self.idToObject:
             theform = self.idToObject[internalname]
             if hasattr(theform,'_extra_pageCatcher_info'):
                 return theform._extra_pageCatcher_info[boxType]
@@ -494,14 +494,14 @@
             if name is not None and name!=intname:
                 raise ValueError, "attempt to reregister object %s with new name %s" % (
                     repr(intname), repr(name))
-            if not idToObject.has_key(intname):
+            if intname not in idToObject:
                 raise ValueError, "object named but not registered"
             return PDFObjectReference(intname)
         # otherwise register the new object
         objectcounter = self.objectcounter = self.objectcounter+1
         if name is None:
             name = "R"+repr(objectcounter)
-        if idToObject.has_key(name):
+        if name in idToObject:
             other = idToObject[name]
             if other!=object:
                 raise ValueError, "redefining named object: "+repr(name)
@@ -643,8 +643,8 @@
         self.dict[name] = value
     def __getitem__(self, a):
         return self.dict[a]
-    def has_key(self,a):
-        return self.dict.has_key(a)
+    def __contains__(self,a):
+        return a in self.dict
     def Reference(self, name, document):
         self.dict[name] = document.Reference(self.dict[name])
     def format(self, document,IND=LINEEND+' '):
@@ -772,7 +772,7 @@
         if filters is None:
             filters = document.defaultStreamFilters
         # only apply filters if they haven't been applied elsewhere
-        if filters is not None and not dictionary.dict.has_key("Filter"):
+        if filters is not None and "Filter" not in dictionary.dict:
             # apply filters in reverse order listed
             rf = list(filters)
             rf.reverse()
@@ -929,7 +929,7 @@
         lastentrynumber = firstentrynumber+nentries-1
         for id in idsequence:
             (num, version) = idToNV[id]
-            if taken.has_key(num):
+            if num in taken:
                 raise ValueError, "object number collision %s %s %s" % (num, repr(id), repr(taken[id]))
             if num>lastentrynumber or num<firstentrynumber:
                 raise ValueError, "object number %s not in range %s..%s" % (num, firstentrynumber, lastentrynumber)
@@ -1034,7 +1034,7 @@
                     D[k] = v
         # force objects to be references where required
         for k in Refs:
-            if D.has_key(k):
+            if k in D:
                 #print"k is", k, "value", D[k]
                 D[k] = document.Reference(D[k])
         dict = PDFDictionary(D)
@@ -1411,7 +1411,7 @@
         self.setDestinations(desttree)
 
     def setNameList(self, canvas, nametree):
-        "Explicit list so I don't need to do apply(...) in the caller"
+        "Explicit list so I don't need to do in the caller"
         desttree = self.translateNames(canvas, nametree)
         self.setDestinations(desttree)
 
@@ -1425,12 +1425,12 @@
         if Ot is StringType:
             destination = canvas._bookmarkReference(object)
             title = object
-            if destinationnamestotitles.has_key(object):
+            if object in destinationnamestotitles:
                 title = destinationnamestotitles[object]
             else:
                 destinationnamestotitles[title] = title
             destinationstotitles[destination] = title
-            if closedict.has_key(object):
+            if object in closedict:
                 closedict[destination] = 1 # mark destination closed
             return {object: canvas._bookmarkReference(object)} # name-->ref
         if Ot is ListType or Ot is TupleType:
@@ -1516,7 +1516,7 @@
                 raise ValueError, "bad outline leaf dictionary, should have one entry "+utf8str(elt)
             eltobj.Title = destinationnamestotitles[Title]
             eltobj.Dest = Dest
-            if te is TupleType and closedict.has_key(Dest):
+            if te is TupleType and Dest in closedict:
                 # closed subsection, count should be negative
                 eltobj.Count = -eltobj.Count
         return (firstref, lastref)
@@ -1530,7 +1530,7 @@
         # leaf with subsections XXXX should clean up this structural usage
         (leafdict, subsections) = tree
         [(Title, Dest)] = leafdict.items()
-        if closedict and closedict.has_key(Dest):
+        if closedict and Dest in closedict:
             return 1 # closed tree element
     if tt is TupleType or tt is ListType:
         #return reduce(add, map(count, tree))
@@ -1605,7 +1605,7 @@
             d[name] = val
         d.update(kw)
         for name in self.required:
-            if not d.has_key(name):
+            if name not in d:
                 raise ValueError, "keyword argument %s missing" % name
         d = self.cvtdict(d,escape=escape)
         permitted = self.permitted
@@ -1677,7 +1677,7 @@
         d["Contents"] = self.Contents
         d["Subtype"] = "/Link"
         d["Dest"] = self.Destination
-        return apply(self.AnnotationDict, (), d)
+        return self.AnnotationDict(**d)
 
 # skipping names tree
 # skipping actions
@@ -1712,7 +1712,7 @@
             import time
             now = tuple(time.localtime(_getTimeStamp())[:6])
             from time import timezone
-            self.dhh = int(timezone / 3600)
+            self.dhh = int(timezone / (3600.0))
             self.dmm = (timezone % 3600) % 60
         self.date = now[:6]
         self.dateFormatter = dateFormatter
--- a/src/reportlab/pdfbase/pdfmetrics.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/pdfbase/pdfmetrics.py	Mon Feb 08 18:17:33 2010 +0000
@@ -587,7 +587,7 @@
 
 def registerEncoding(enc):
     assert isinstance(enc, Encoding), 'Not an Encoding: %s' % enc
-    if _encodings.has_key(enc.name):
+    if enc.name in _encodings:
         # already got one, complain if they are not the same
         if enc.isEqual(_encodings[enc.name]):
             enc.freeze()
--- a/src/reportlab/pdfbase/pdfutils.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/pdfbase/pdfutils.py	Mon Feb 08 18:17:33 2010 +0000
@@ -276,7 +276,7 @@
         # special rules apply if not a multiple of five bytes.
         whole_word_count, remainder_size = divmod(len(stripped), 5)
         #print '%d words, %d leftover' % (whole_word_count, remainder_size)
-        #assert remainder_size <> 1, 'invalid Ascii 85 stream!'
+        #assert remainder_size != 1, 'invalid Ascii 85 stream!'
         cut = 5 * whole_word_count
         body, lastbit = stripped[0:cut], stripped[cut:]
 
--- a/src/reportlab/pdfbase/rl_codecs.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/pdfbase/rl_codecs.py	Mon Feb 08 18:17:33 2010 +0000
@@ -983,7 +983,8 @@
     def __init__(self):
         raise NotImplementedError
 
-    def _256_exception_codec((exceptions,rexceptions)):
+    def _256_exception_codec(xt):
+        exceptions,rexceptions = xt
         import codecs
         decoding_map = codecs.make_identity_dict(xrange(32,256))
         decoding_map.update(exceptions)
--- a/src/reportlab/pdfbase/ttfonts.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/pdfbase/ttfonts.py	Mon Feb 08 18:17:33 2010 +0000
@@ -533,7 +533,7 @@
 
         # OS/2 - OS/2 and Windows metrics table
         # (needs data from head table)
-        if self.table.has_key("OS/2"):
+        if "OS/2" in self.table:
             self.seek_table("OS/2")
             version = self.read_ushort()
             self.skip(2)
@@ -646,7 +646,7 @@
         length = self.read_ushort()
         limit = unicode_cmap_offset + length
         self.skip(2)
-        segCount = self.read_ushort() / 2
+        segCount = int(self.read_ushort() / 2.0)
         self.skip(6)
         endCount = map(lambda x, self=self: self.read_ushort(), xrange(segCount))
         self.skip(2)
@@ -673,7 +673,7 @@
                         if glyph != 0:
                             glyph = (glyph + idDelta[n]) & 0xFFFF
                 charToGlyph[unichar] = glyph
-                if glyphToChar.has_key(glyph):
+                if glyph in glyphToChar:
                     glyphToChar[glyph].append(unichar)
                 else:
                     glyphToChar[glyph] = [unichar]
@@ -693,7 +693,7 @@
             aw = scale(aw)
             if glyph == 0:
                 self.defaultWidth = aw
-            if glyphToChar.has_key(glyph):
+            if glyph in glyphToChar:
                 for char in glyphToChar[glyph]:
                     self.charWidths[char] = aw
         for glyph in xrange(numberOfHMetrics, numGlyphs):
@@ -701,7 +701,7 @@
             # so we reuse aw set by the last iteration of the previous loop
             lsb = self.read_ushort()
             self.hmetrics.append((aw, lsb))
-            if glyphToChar.has_key(glyph):
+            if glyph in glyphToChar:
                 for char in glyphToChar[glyph]:
                     self.charWidths[char] = aw
 
@@ -732,11 +732,11 @@
         glyphSet = {0:0}                # old glyph index -> new glyph index
         codeToGlyph = {}                # unicode -> new glyph index
         for code in subset:
-            if self.charToGlyph.has_key(code):
+            if code in self.charToGlyph:
                 originalGlyphIdx = self.charToGlyph[code]
             else:
                 originalGlyphIdx = 0
-            if not glyphSet.has_key(originalGlyphIdx):
+            if originalGlyphIdx not in glyphSet:
                 glyphSet[originalGlyphIdx] = len(glyphMap)
                 glyphMap.append(originalGlyphIdx)
             codeToGlyph[code] = glyphSet[originalGlyphIdx]
@@ -759,7 +759,7 @@
                 while flags & GF_MORE_COMPONENTS:
                     flags = self.read_ushort()
                     glyphIdx = self.read_ushort()
-                    if not glyphSet.has_key(glyphIdx):
+                    if glyphIdx not in glyphSet:
                         glyphSet[glyphIdx] = len(glyphMap)
                         glyphMap.append(glyphIdx)
                     if flags & GF_ARG_1_AND_2_ARE_WORDS:
@@ -812,7 +812,7 @@
                 0,
                 entryCount] + \
                map(codeToGlyph.get, subset)
-        cmap = apply(pack, [">%dH" % len(cmap)] + cmap)
+        cmap = pack(*([">%dH" % len(cmap)] + cmap))
         output.add('cmap', cmap)
 
         # hmtx - Horizontal Metrics
@@ -823,7 +823,7 @@
             if n < numberOfHMetrics:
                 hmtx.append(int(aw))
             hmtx.append(int(lsb))
-        hmtx = apply(pack, [">%dH" % len(hmtx)] + hmtx)
+        hmtx = pack(*([">%dH" % len(hmtx)] + hmtx))
         output.add('hmtx', hmtx)
 
         # glyf - Glyph data
@@ -872,12 +872,12 @@
             indexToLocFormat = 1        # long format
             for offset in offsets:
                 loca.append(offset)
-            loca = apply(pack, [">%dL" % len(loca)] + loca)
+            loca = pack(*([">%dL" % len(loca)] + loca))
         else:
             indexToLocFormat = 0        # short format
             for offset in offsets:
                 loca.append(offset >> 1)
-            loca = apply(pack, [">%dH" % len(loca)] + loca)
+            loca = pack(*([">%dH" % len(loca)] + loca))
         output.add('loca', loca)
 
         # head - Font header
@@ -1046,7 +1046,7 @@
         assignments = state.assignments
         subsets = state.subsets
         for code in map(ord,text):
-            if assignments.has_key(code):
+            if code in assignments:
                 n = assignments[code]
             else:
                 if state.frozen:
@@ -1083,7 +1083,7 @@
         if subset < 0 or subset >= len(state.subsets):
             raise IndexError, 'Subset %d does not exist in font %s' % (subset, self.fontName)
         if state.internalName is None:
-            state.internalName = state.namePrefix +`(len(doc.fontMapping) + 1)`
+            state.internalName = state.namePrefix +repr(len(doc.fontMapping) + 1)
             doc.fontMapping[self.fontName] = '/' + state.internalName
             doc.delayedFonts.append(self)
         return '/%s+%d' % (state.internalName, subset)
--- a/src/reportlab/pdfgen/canvas.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/pdfgen/canvas.py	Mon Feb 08 18:17:33 2010 +0000
@@ -58,9 +58,9 @@
 
 def _annFormat(D,color,thickness,dashArray,hradius=0,vradius=0):
     from reportlab.pdfbase.pdfdoc import PDFArray, PDFDictionary
-    if color and not D.has_key('C'):
+    if color and 'C' not in D:
         D["C"] = PDFArray([color.red, color.green, color.blue])
-    if not D.has_key('Border'):
+    if 'Border' not in D:
         border = [hradius,vradius,thickness or 0]
         if dashArray:
             border.append(PDFArray(dashArray))
--- a/src/reportlab/pdfgen/pycanvas.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/pdfgen/pycanvas.py	Mon Feb 08 18:17:33 2010 +0000
@@ -170,10 +170,10 @@
         """The fake method is called, print it then call the real one."""
         if not self._parent._parent._in :
             self._precomment()
-            self._parent._parent._PyWrite("    %s.%s(%s)" % (self._parent._name, self._action, apply(buildargs, args, kwargs)))
+            self._parent._parent._PyWrite("    %s.%s(%s)" % (self._parent._name, self._action, buildargs(*args, **kwargs)))
             self._postcomment()
         self._parent._parent._in = self._parent._parent._in + 1
-        retcode = apply(getattr(self._parent._object, self._action), args, kwargs)
+        retcode = getattr(self._parent._object, self._action)(*args,**kwargs)
         self._parent._parent._in = self._parent._parent._in - 1
         return retcode
 
@@ -212,8 +212,8 @@
         """Real object initialisation is made here, because now we've got the arguments."""
         if not self._initdone :
             self.__class__._number = self.__class__._number + 1
-            methodname = apply(self._postinit, args, kwargs)
-            self._parent._PyWrite("\n    # create PDF%sObject number %i\n    %s = %s.%s(%s)" % (methodname[5:], self.__class__._number, self._name, self._parent._name, methodname, apply(buildargs, args, kwargs)))
+            methodname = self._postinit(*args,**kwargs)
+            self._parent._PyWrite("\n    # create PDF%sObject number %i\n    %s = %s.%s(%s)" % (methodname[5:], self.__class__._number, self._name, self._parent._name, methodname, buildargs(*args,**kwargs)))
             self._initdone = 1
         return self
 
@@ -222,13 +222,13 @@
     class TextObject(PDFObject) :
         _name = "t"
         def _postinit(self, *args, **kwargs) :
-            self._object = apply(textobject.PDFTextObject, (self._parent, ) + args, kwargs)
+            self._object = textobject.PDFTextObject(self._parent,*args,**kwargs)
             return "beginText"
 
     class PathObject(PDFObject) :
         _name = "p"
         def _postinit(self, *args, **kwargs) :
-            self._object = apply(pathobject.PDFPathObject, args, kwargs)
+            self._object = pathobject.PDFPathObject(*args, **kwargs)
             return "beginPath"
 
     class Action(PDFAction) :
@@ -272,14 +272,14 @@
         self._pagenumber = 1
         self._formnumber = 0
         self._footerpresent = 0
-        self._object = apply(canvas.Canvas, args, kwargs)
+        self._object = canvas.Canvas(*args,**kwargs)
         self._pyfile = cStringIO.StringIO()
         self._PyWrite(PyHeader)
         try :
             del kwargs["filename"]
         except KeyError :
             pass
-        self._PyWrite("    # create the PDF document\n    %s = Canvas(file, %s)\n\n    # Begins page 1" % (self._name, apply(buildargs, args[1:], kwargs)))
+        self._PyWrite("    # create the PDF document\n    %s = Canvas(file, %s)\n\n    # Begins page 1" % (self._name, buildargs(*args[1:], **kwargs)))
 
     def __nonzero__(self) :
         """This is needed by platypus' tables."""
--- a/src/reportlab/platypus/doctemplate.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/platypus/doctemplate.py	Mon Feb 08 18:17:33 2010 +0000
@@ -452,7 +452,7 @@
         self._lifetimes = {}
 
         for k in self._initArgs.keys():
-            if not kw.has_key(k):
+            if k not in kw:
                 v = self._initArgs[k]
             else:
                 if k in self._invalidInitArgs:
--- a/src/reportlab/platypus/flowables.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/platypus/flowables.py	Mon Feb 08 18:17:33 2010 +0000
@@ -320,7 +320,7 @@
         fp = hasattr(filename,'read')
         if fp:
             self._file = filename
-            self.filename = `filename`
+            self.filename = repr(filename)
         else:
             self._file = self.filename = filename
         if not fp and os.path.splitext(filename)[1] in ['.jpg', '.JPG', '.jpeg', '.JPEG']:
@@ -636,7 +636,7 @@
         intermediate_widths = later_widths - xpad - wI
         first_line_width = intermediate_widths - style.firstLineIndent
         P.width = 0
-        nIW = int((hI+ypad)/leading)
+        nIW = int((hI+ypad)/(leading*1.0))
         P.blPara = P.breakLines([first_line_width] + nIW*[intermediate_widths]+[later_widths])
         if self._side=='left':
             self._offsets = [wI+xpad]*(1+nIW)+[0]
@@ -864,8 +864,9 @@
     b = b21*h0+b22*h1
     return a,b
 
-def _qsolve(h,(a,b)):
+def _qsolve(h,ab):
     '''solve the model v = a/s**2 + b/s for an s which gives us v==h'''
+    a,b = ab
     if abs(a)<=_FUZZ:
         return b/h
     t = 0.5*b/a
--- a/src/reportlab/platypus/para.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/platypus/para.py	Mon Feb 08 18:17:33 2010 +0000
@@ -654,10 +654,10 @@
                         doswap = 0
                         if (nextindicator=="endLineOperation" and thisindicator!="endLineOperation"
                             and thisindicator!="lineOperation"):
-                            doswap = 1 # swap nonend<>end
+                            doswap = 1 # swap nonend!=end
                     elif tnext==FloatType:
                         if thisindicator=="lineOperation":
-                            doswap = 1 # begin <> space
+                            doswap = 1 # begin != space
                 if doswap:
                     #print "swap", line[index],line[nextindex]
                     result[index] = next
@@ -952,7 +952,7 @@
         colClass = colors.Color
     elif len(tup) == 4:
         colClass = colors.CMYKColor
-    return apply(colClass, tup)
+    return colClass(*tup)
 
 class StyleAttributeConverters:
     fontSize=[readLength]
@@ -1197,17 +1197,17 @@
     if stylesheet is not None:
         # Copy styles with the same name as aliases
         for (stylenamekey, stylenamevalue) in DEFAULT_ALIASES.items():
-            if stylesheet.has_key(stylenamekey):
+            if stylenamekey in stylesheet:
                 result[stylenamekey] = stylesheet[stylenamekey]
         # Then make aliases
         for (stylenamekey, stylenamevalue) in DEFAULT_ALIASES.items():
-            if stylesheet.has_key(stylenamevalue):
+            if stylenamevalue in stylesheet:
                 result[stylenamekey] = stylesheet[stylenamevalue]
 
     styles = getSampleStyleSheet()
     # Then, fill in defaults if they were not filled yet.
     for (stylenamekey, stylenamevalue) in DEFAULT_ALIASES.items():
-        if not result.has_key(stylenamekey) and styles.has_key(stylenamevalue):
+        if stylenamekey not in result and stylenamevalue in styles:
             result[stylenamekey] = styles[stylenamevalue]
     return result
 
@@ -1648,7 +1648,7 @@
     def compile_font(self, attdict, content, extra, program):
         #program = self.program
         program.append( ("push",) ) # store current data
-        if attdict.has_key("face"):
+        if "face" in attdict:
             face = attdict["face"]
             from reportlab.lib.fonts import tt2ps
             try:
@@ -1656,10 +1656,10 @@
             except:
                 font = face # better work!
             program.append( ("face", font ) )
-        if attdict.has_key("color"):
+        if "color" in attdict:
             colorname = attdict["color"]
             program.append( ("color", colorname) )
-        if attdict.has_key("size"):
+        if "size" in attdict:
             #size = float(attdict["size"]) # really should convert int, cm etc here!
             size = attdict["size"]
             program.append( ("size", size) )
@@ -1791,7 +1791,7 @@
         #print tagname, "bulletmaker type is", typ
         self.typ =typ = atts.get("type", typ)
         #print tagname, "bulletmaker type is", typ
-        if not atts.has_key("leftIndent"):
+        if "leftIndent" not in atts:
             # get the style so you can choose an indent length
             thestyle = context[style]
             from reportlab.pdfbase.pdfmetrics import stringWidth
@@ -1816,7 +1816,7 @@
                 elif typ=="square": bl = chr(110)
                 else:
                     raise ValueError, "unordered list type %s not implemented" % repr(typ)
-                if not atts.has_key("bulletFontName"):
+                if "bulletFontName" not in atts:
                     atts["bulletFontName"] = "ZapfDingbats"
             elif tagname=="ol":
                 if 'value' in atts:
@@ -1834,9 +1834,9 @@
                     raise ValueError, "ordered bullet type %s not implemented" % repr(typ)
             else:
                 raise ValueError, "bad tagname "+repr(tagname)
-        if not atts.has_key("bulletText"):
+        if "bulletText" not in atts:
             atts["bulletText"] = bl
-        if not atts.has_key("style"):
+        if "style" not in atts:
             atts["style"] = self.style
 
 class EvalStringObject:
@@ -1882,11 +1882,11 @@
         attr = self.attdict
         #if it has a template, use that; otherwise try for id;
         #otherwise take default sequence
-        if attr.has_key('template'):
+        if 'template' in attr:
             templ = attr['template']
             op = self.op = templ % globalsequencer
             return op
-        elif attr.has_key('id'):
+        elif 'id' in attr:
             id = attr['id']
         else:
             id = None
@@ -2035,12 +2035,12 @@
                         fragment = unichr(n).encode('utf8')+fragment[semi+1:]
                     else:
                         fragment = "&"+fragment
-                elif standard.has_key(name):
+                elif name in standard:
                     s = standard[name]
                     if isinstance(fragment,unicode):
                         s = s.decode('utf8')
                     fragment = s+fragment[semi+1:]
-                elif greeks.has_key(name):
+                elif name in greeks:
                     s = greeks[name]
                     if isinstance(fragment,unicode):
                         s = s.decode('utf8')
--- a/src/reportlab/platypus/paragraph.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/platypus/paragraph.py	Mon Feb 08 18:17:33 2010 +0000
@@ -922,7 +922,7 @@
                 l = max(leading,1.2*style.fontSize)
             elif autoLeading=='min':
                 l = 1.2*style.fontSize
-            s = int(availHeight/l)
+            s = int(availHeight/(l*1.0))
             height = s*l
 
         n = len(lines)
--- a/src/reportlab/platypus/paraparser.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/platypus/paraparser.py	Mon Feb 08 18:17:33 2010 +0000
@@ -189,9 +189,9 @@
     K = m.keys()
     for k in K:
         n = m[k][0]
-        if not m.has_key(n): m[n] = m[k]
+        if n not in m: m[n] = m[k]
         n = string.lower(n)
-        if not m.has_key(n): m[n] = m[k]
+        if n not in m: m[n] = m[k]
 
 _addAttributeNames(_paraAttrMap)
 _addAttributeNames(_fontAttrMap)
@@ -695,7 +695,7 @@
         self.handle_data(unichr(n).encode('utf8'))
 
     def handle_entityref(self,name):
-        if greeks.has_key(name):
+        if name in greeks:
             self.handle_data(greeks[name])
         else:
             xmllib.XMLParser.handle_entityref(self,name)
@@ -714,15 +714,15 @@
         self._pop(greek=1)
 
     def start_unichar(self, attr):
-        if attr.has_key('name'):
-            if attr.has_key('code'):
+        if 'name' in attr:
+            if 'code' in attr:
                 self._syntax_error('<unichar/> invalid with both name and code attributes')
             try:
                 v = unicodedata.lookup(attr['name']).encode('utf8')
             except KeyError:
                 self._syntax_error('<unichar/> invalid name attribute\n"%s"' % name)
                 v = '\0'
-        elif attr.has_key('code'):
+        elif 'code' in attr:
             try:
                 v = unichr(int(eval(attr['code']))).encode('utf8')
             except:
@@ -862,11 +862,11 @@
     def start_seq(self, attr):
         #if it has a template, use that; otherwise try for id;
         #otherwise take default sequence
-        if attr.has_key('template'):
+        if 'template' in attr:
             templ = attr['template']
             self.handle_data(templ % self._seq)
             return
-        elif attr.has_key('id'):
+        elif 'id' in attr:
             id = attr['id']
         else:
             id = None
@@ -889,10 +889,10 @@
 
     def start_onDraw(self,attr):
         defn = ABag()
-        if attr.has_key('name'): defn.name = attr['name']
+        if 'name' in attr: defn.name = attr['name']
         else: self._syntax_error('<onDraw> needs at least a name attribute')
 
-        if attr.has_key('label'): defn.label = attr['label']
+        if 'label' in attr: defn.label = attr['label']
         defn.kind='onDraw'
         self._push(cbDefn=defn)
         self.handle_data('')
@@ -902,11 +902,11 @@
     def start_index(self,attr):
         attr=self.getAttributes(attr,_indexAttrMap)
         defn = ABag()
-        if attr.has_key('item'):
+        if 'item' in attr:
             label = attr['item']
         else:
             self._syntax_error('<index> needs at least an item attribute')
-        if attr.has_key('name'):
+        if 'name' in attr:
             name = attr['name']
         else:
             name = DEFAULT_INDEX_NAME
--- a/src/reportlab/platypus/tables.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/platypus/tables.py	Mon Feb 08 18:17:33 2010 +0000
@@ -277,7 +277,7 @@
             for i in xrange(nrows):
                 cellcols = []
                 for j in xrange(ncols):
-                    cellcols.append(CellStyle(`(i,j)`))
+                    cellcols.append(CellStyle(repr((i,j))))
                 cellrows.append(cellcols)
             self._cellStyles = cellrows
         else:
@@ -1015,23 +1015,27 @@
         self.canv.restoreState()
         self._curcolor = None
 
-    def _drawUnknown(self,  (sc, sr), (ec, er), weight, color, count, space):
+    def _drawUnknown(self,  start, end, weight, color, count, space):
         #we are only called from _drawLines which is one level up
         import sys
         op = sys._getframe(1).f_locals['op']
         raise ValueError("Unknown line command '%s'" % op)
 
-    def _drawGrid(self, (sc, sr), (ec, er), weight, color, count, space):
-        self._drawBox( (sc, sr), (ec, er), weight, color, count, space)
-        self._drawInnerGrid( (sc, sr), (ec, er), weight, color, count, space)
+    def _drawGrid(self, start, end, weight, color, count, space):
+        self._drawBox( start, end, weight, color, count, space)
+        self._drawInnerGrid( start, end, weight, color, count, space)
 
-    def _drawBox(self,  (sc, sr), (ec, er), weight, color, count, space):
+    def _drawBox(self,  start, end, weight, color, count, space):
+        sc,sr = start
+        ec,er = end
         self._drawHLines((sc, sr), (ec, sr), weight, color, count, space)
         self._drawHLines((sc, er+1), (ec, er+1), weight, color, count, space)
         self._drawVLines((sc, sr), (sc, er), weight, color, count, space)
         self._drawVLines((ec+1, sr), (ec+1, er), weight, color, count, space)
 
-    def _drawInnerGrid(self, (sc, sr), (ec, er), weight, color, count, space):
+    def _drawInnerGrid(self, start, end, weight, color, count, space):
+        sc,sr = start
+        ec,er = end
         self._drawHLines((sc, sr+1), (ec, er), weight, color, count, space)
         self._drawVLines((sc+1, sr), (ec, er), weight, color, count, space)
 
@@ -1043,7 +1047,9 @@
             self.canv.setLineWidth(weight)
             self._curweight = weight
 
-    def _drawHLines(self, (sc, sr), (ec, er), weight, color, count, space):
+    def _drawHLines(self, start, end, weight, color, count, space):
+        sc,sr = start
+        ec,er = end
         ecp = self._colpositions[sc:ec+2]
         rp = self._rowpositions[sr:er+1]
         if len(ecp)<=1 or len(rp)<1: return
@@ -1060,10 +1066,14 @@
             for y in rp:
                 _hLine(lf, scp, ecp, y, hBlocks)
 
-    def _drawHLinesB(self, (sc, sr), (ec, er), weight, color, count, space):
+    def _drawHLinesB(self, start, end, weight, color, count, space):
+        sc,sr = start
+        ec,er = end
         self._drawHLines((sc, sr+1), (ec, er+1), weight, color, count, space)
 
-    def _drawVLines(self, (sc, sr), (ec, er), weight, color, count, space):
+    def _drawVLines(self, start, end, weight, color, count, space):
+        sc,sr = start
+        ec,er = end
         erp = self._rowpositions[sr:er+2]
         cp  = self._colpositions[sc:ec+1]
         if len(erp)<=1 or len(cp)<1: return
@@ -1080,7 +1090,9 @@
             for x in cp:
                 _hLine(lf, erp, srp, x, vBlocks)
 
-    def _drawVLinesA(self, (sc, sr), (ec, er), weight, color, count, space):
+    def _drawVLinesA(self, start, end, weight, color, count, space):
+        sc,sr = start
+        ec,er = end
         self._drawVLines((sc+1, sr), (ec+1, er), weight, color, count, space)
 
     def wrap(self, availWidth, availHeight):
@@ -1252,7 +1264,7 @@
         for rh in self._rowHeights:
             if h+rh>availHeight:
                 break
-            if not impossible.has_key(n):
+            if n not in impossible:
                 split_at=n
             h=h+rh
             n=n+1
@@ -1306,7 +1318,7 @@
             x1 = colpositions[min(ec+1,ncols)]
             y1 = rowpositions[min(er+1,nrows)]
             w, h = x1-x0, y1-y0
-            if callable(arg):
+            if hasattr(arg,'__call__'):
                 arg(self,canv, x0, y0, w, h)
             elif cmd == 'ROWBACKGROUNDS':
                 #Need a list of colors to cycle through.  The arguments
@@ -1346,7 +1358,9 @@
                     canv.setFillColor(color)
                     canv.rect(x0, y0, w, h, stroke=0,fill=1)
 
-    def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)):
+    def _drawCell(self, cellval, cellstyle, pos, size):
+        colpos, rowpos = pos
+        colwidth, rowheight = size
         if self._curcellstyle is not cellstyle:
             cur = self._curcellstyle
             if cur is None or cellstyle.color != cur.color:
--- a/src/reportlab/platypus/xpreformatted.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/platypus/xpreformatted.py	Mon Feb 08 18:17:33 2010 +0000
@@ -108,7 +108,7 @@
         different first line indent; a longer list could be created to facilitate custom wraps
         around irregular objects."""
 
-        if type(width) <> ListType: maxWidths = [width]
+        if type(width) != ListType: maxWidths = [width]
         else: maxWidths = width
         lines = []
         lineno = 0
@@ -213,9 +213,7 @@
     def __init__(self, text, style, bulletText = None, dedent=0, frags=None):
         if text:
             text = self.fontify(self.escapeHtml(text))
-        apply(XPreformatted.__init__,
-              (self, text, style),
-              {'bulletText':bulletText, 'dedent':dedent, 'frags':frags})
+        XPreformatted.__init__(self, text, style,bulletText=bulletText,dedent=dedent,frags=frags)
 
     def escapeHtml(self, text):
         s = string.replace(text, '&', '&amp;')
--- a/src/reportlab/rl_config.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/rl_config.py	Mon Feb 08 18:17:33 2010 +0000
@@ -126,7 +126,7 @@
     '''set a module level value from environ/default'''
     from os import environ
     ename = 'RL_'+name
-    if environ.has_key(ename):
+    if ename in environ:
         value = environ[ename]
     if conv: value = conv(value)
     globals()[name] = value
--- a/src/rl_addons/renderPM/pfm.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/rl_addons/renderPM/pfm.py	Mon Feb 08 18:17:33 2010 +0000
@@ -60,7 +60,7 @@
 				X.append(S)
 				i = 0
 				S = []
-		return map(lambda x,T=T: apply(T,x),X)
+		return map(lambda x,T=T: T(*x),X)
 
 class KernPair:
 	'''hold info about a possible kerning pair'''
--- a/tests/test_charts_textlabels.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_charts_textlabels.py	Mon Feb 08 18:17:33 2010 +0000
@@ -44,7 +44,7 @@
     def __init__(self, filename, **kw):
         frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
         self.allowSplitting = 0
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         template = PageTemplate('normal', [frame1], myMainPageFrame)
         self.addPageTemplates(template)
 
@@ -90,8 +90,8 @@
 
             # Create drawing.
             d = Drawing(w, h)
-            d.add(Line(0,h/2, w, h/2, strokeColor=colors.gray, strokeWidth=0.5))
-            d.add(Line(w/2,0, w/2, h, strokeColor=colors.gray, strokeWidth=0.5))
+            d.add(Line(0, h*0.5, w, h*0.5, strokeColor=colors.gray, strokeWidth=0.5))
+            d.add(Line(w*0.5 ,0, w*0.5, h, strokeColor=colors.gray, strokeWidth=0.5))
 
             labels = []
             for boxAnchor in boxAnchors:
@@ -136,7 +136,7 @@
 
         w, h = drawWidth, drawHeight = 400, 100
         protoLabel = self._makeProtoLabel()
-        protoLabel.setOrigin(drawWidth/2, drawHeight/2)
+        protoLabel.setOrigin(drawWidth*0.5, drawHeight*0.5)
         protoLabel.textAnchor = 'start'
         protoLabel.fontName = 'Helvetica'
         protoLabel.fontSize = 10
@@ -153,7 +153,7 @@
 
         w, h = drawWidth, drawHeight = 400, 100
         protoLabel = self._makeProtoLabel()
-        protoLabel.setOrigin(drawWidth/2, drawHeight/2)
+        protoLabel.setOrigin(drawWidth*0.5, drawHeight*0.5)
         protoLabel.textAnchor = 'start'
         protoLabel.fontName = 'Helvetica'
         protoLabel.fontSize = 18
@@ -170,7 +170,7 @@
 
         w, h = drawWidth, drawHeight = 400, 100
         protoLabel = self._makeProtoLabel()
-        protoLabel.setOrigin(drawWidth/2, drawHeight/2)
+        protoLabel.setOrigin(drawWidth*0.5, drawHeight*0.5)
         protoLabel.textAnchor = 'start'
         protoLabel.fontName = 'Helvetica'
         protoLabel.fontSize = 18
@@ -193,7 +193,7 @@
 
         w, h = drawWidth, drawHeight = 400, 100
         protoLabel = self._makeProtoLabel()
-        protoLabel.setOrigin(drawWidth/2, drawHeight/2)
+        protoLabel.setOrigin(drawWidth*0.5, drawHeight*0.5)
         protoLabel.width = 4*cm
         protoLabel.height = 1.5*cm
         protoLabel.textAnchor = 'start'
@@ -212,7 +212,7 @@
 
         w, h = drawWidth, drawHeight = 400, 100
         protoLabel = self._makeProtoLabel()
-        protoLabel.setOrigin(drawWidth/2, drawHeight/2)
+        protoLabel.setOrigin(drawWidth*0.5, drawHeight*0.5)
         protoLabel.width = 4*cm
         protoLabel.height = 1.5*cm
         protoLabel.textAnchor = 'middle'
@@ -231,7 +231,7 @@
 
         w, h = drawWidth, drawHeight = 400, 100
         protoLabel = self._makeProtoLabel()
-        protoLabel.setOrigin(drawWidth/2, drawHeight/2)
+        protoLabel.setOrigin(drawWidth*0.5, drawHeight*0.5)
         protoLabel.width = 4*cm
         protoLabel.height = 1.5*cm
         protoLabel.textAnchor = 'end'
@@ -250,7 +250,7 @@
 
         w, h = drawWidth, drawHeight = 400, 100
         protoLabel = self._makeProtoLabel()
-        protoLabel.setOrigin(drawWidth/2, drawHeight/2)
+        protoLabel.setOrigin(drawWidth*0.5, drawHeight*0.5)
         protoLabel.width = 4*cm
         protoLabel.height = 1.5*cm
         protoLabel.textAnchor = 'start'
--- a/tests/test_docstrings.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_docstrings.py	Mon Feb 08 18:17:33 2010 +0000
@@ -71,7 +71,7 @@
                 obj = eval(mName + '.' + n)
                 # Handle functions and classes.
                 if typ in (FunctionType, ClassType):
-                    if type(obj) == typ and not lookup.has_key(obj):
+                    if type(obj) == typ and obj not in lookup:
                         if typ == ClassType:
                             if find(obj.__module__, rootName) != 0:
                                 continue
@@ -82,7 +82,7 @@
                     if type(obj) == ClassType:
                         for m in dir(obj):
                             a = getattr(obj, m)
-                            if type(a) == typ and not lookup.has_key(a):
+                            if type(a) == typ and a not in lookup:
                                 if find(a.im_class.__module__, rootName) != 0:
                                     continue
                                 cName = obj.__name__
--- a/tests/test_graphics_charts.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_graphics_charts.py	Mon Feb 08 18:17:33 2010 +0000
@@ -53,7 +53,7 @@
     def __init__(self, filename, **kw):
         frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
         self.allowSplitting = 0
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         template = PageTemplate('normal', [frame1], myMainPageFrame)
         self.addPageTemplates(template)
 
--- a/tests/test_graphics_layout.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_graphics_layout.py	Mon Feb 08 18:17:33 2010 +0000
@@ -69,7 +69,7 @@
         from reportlab.graphics.widgetbase import Sizer
         siz = Sizer()
         siz.add(vbc, 'vbc')
-        assert siz.getBounds()[0:2] <> (0,0)
+        assert siz.getBounds()[0:2] != (0,0)
 
 
 def makeSuite():
--- a/tests/test_hello.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_hello.py	Mon Feb 08 18:17:33 2010 +0000
@@ -38,8 +38,8 @@
         seq._dingo = 1
         rl_config._reset()
         assert not hasattr(seq,'_dingo')
-        assert not tfd.has_key(' a ') and len(tfd)<ntfd
-        assert not fbn.has_key(' a ') and len(fbn)<nfbn
+        assert ' a ' not in tfd and len(tfd)<ntfd
+        assert ' a ' not in fbn and len(fbn)<nfbn
 
 def makeSuite():
     return makeSuiteForClasses(HelloTestCase)
--- a/tests/test_lib_utils.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_lib_utils.py	Mon Feb 08 18:17:33 2010 +0000
@@ -29,7 +29,7 @@
     def setUp(self):
         from time import time
         from reportlab.lib.utils import get_rl_tempdir
-        s = `int(time())` + `self.count`
+        s = repr(int(time())) + repr(self.count)
         self.__class__.count += 1
         self._tempdir = get_rl_tempdir('reportlab_test','tmp_%s' % s)
         _testmodulename = os.path.join(self._tempdir,'test_module_%s.py' % s)
--- a/tests/test_pdfbase_ttfonts.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_pdfbase_ttfonts.py	Mon Feb 08 18:17:33 2010 +0000
@@ -66,7 +66,7 @@
             for i in xrange(32):
                 for j in xrange(32):
                     ch = utf8(i * 32 + j+p*alter)
-                    c.drawString(80 + j * 13 + int(j / 16) * 4, 600 - i * 13 - int(i / 8) * 8, ch)
+                    c.drawString(80 + j * 13 + int(j / 16.0) * 4, 600 - i * 13 - int(i / 8.0) * 8, ch)
         c.showPage()
     c.save()
 
--- a/tests/test_pdfgen_general.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_pdfgen_general.py	Mon Feb 08 18:17:33 2010 +0000
@@ -864,7 +864,7 @@
     ### now do stuff for the outline
     #for x in outlinenametree: print x
     #stop
-    #apply(c.setOutlineNames0, tuple(outlinenametree))
+    #c.setOutlineNames0(*outlinenametree)
     return c
 
 
--- a/tests/test_pdfgen_pycanvas.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_pdfgen_pycanvas.py	Mon Feb 08 18:17:33 2010 +0000
@@ -736,7 +736,7 @@
     ### now do stuff for the outline
     #for x in outlinenametree: print x
     #stop
-    #apply(c.setOutlineNames0, tuple(outlinenametree))
+    #c.setOutlineNames0(*outlinenametree)
     return c
 
 
--- a/tests/test_platypus_breaking.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_platypus_breaking.py	Mon Feb 08 18:17:33 2010 +0000
@@ -42,7 +42,7 @@
         frame4 = Frame(11.5*cm, 2.5*cm, 6*cm, 10*cm, id='F4')
         self.allowSplitting = 0
         self.showBoundary = 1
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         template = PageTemplate('normal', [frame1, frame2, frame3, frame4], myMainPageFrame)
         self.addPageTemplates(template)
 
--- a/tests/test_platypus_general.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_platypus_general.py	Mon Feb 08 18:17:33 2010 +0000
@@ -77,13 +77,13 @@
     for line in lines:
         if len(string.strip(line)) == 0:
             #blank, add it
-            if currentPara <> []:
+            if currentPara != []:
                 paras.append(string.join(currentPara, '\n'))
                 currentPara = []
         else:
             currentPara.append(line)
     #...and the last one
-    if currentPara <> []:
+    if currentPara != []:
         paras.append(string.join(currentPara, '\n'))
 
     return paras
@@ -528,7 +528,7 @@
         frame1 = platypus.Frame(inch, 5.6*inch, 6*inch, 5.2*inch,id='F1')
         frame2 = platypus.Frame(inch, inch, 6*inch, 4.5*inch, showBoundary=1,id='F2')
         self.allowSplitting = 0
-        apply(BaseDocTemplate.__init__,(self,filename),kw)
+        BaseDocTemplate.__init__(self,filename,**kw)
         self.addPageTemplates(PageTemplate('normal',[frame1,frame2],framePage))
 
     def fillFrame(self,flowables):
--- a/tests/test_platypus_indents.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_platypus_indents.py	Mon Feb 08 18:17:33 2010 +0000
@@ -49,7 +49,7 @@
     def __init__(self, filename, **kw):
         frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
         self.allowSplitting = 0
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         template1 = PageTemplate('normal', [frame1], myMainPageFrame)
 
         frame2 = Frame(2.5*cm, 16*cm, 15*cm, 10*cm, id='F2', showBoundary=1)
--- a/tests/test_platypus_index.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_platypus_index.py	Mon Feb 08 18:17:33 2010 +0000
@@ -43,7 +43,7 @@
     def __init__(self, filename, **kw):
         frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
         self.allowSplitting = 0
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         template = PageTemplate('normal', [frame1], myMainPageFrame)
         self.addPageTemplates(template)
 
--- a/tests/test_platypus_leftright.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_platypus_leftright.py	Mon Feb 08 18:17:33 2010 +0000
@@ -73,7 +73,7 @@
     _invalidInitArgs = ('pageTemplates',)
 
     def __init__(self, filename, **kw):
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         self.addPageTemplates(
             [
              PageTemplate(id='plain',
--- a/tests/test_platypus_paragraphs.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_platypus_paragraphs.py	Mon Feb 08 18:17:33 2010 +0000
@@ -47,7 +47,7 @@
         frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
         frame2 = Frame(2.5*cm, 2.5*cm, 310, 25*cm, id='F2')
         self.allowSplitting = 0
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         template = PageTemplate('normal', [frame1], myMainPageFrame)
         template1 = PageTemplate('special', [frame2], myMainPageFrame)
         self.addPageTemplates([template,template1])
@@ -274,7 +274,7 @@
             leftPadding=0, topPadding=0, rightPadding=0, bottomPadding=0,
             showBoundary=True
         )
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         template = PageTemplate('template', [f1, f2])
         self.addPageTemplates(template)
 
--- a/tests/test_platypus_toc.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_platypus_toc.py	Mon Feb 08 18:17:33 2010 +0000
@@ -46,7 +46,7 @@
     def __init__(self, filename, **kw):
         frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
         self.allowSplitting = 0
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         template = PageTemplate('normal', [frame1], myMainPageFrame)
         self.addPageTemplates(template)
 
--- a/tests/test_platypus_xref.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_platypus_xref.py	Mon Feb 08 18:17:33 2010 +0000
@@ -36,7 +36,7 @@
         frame1 = Frame(2.5*cm, 2.5*cm, 16*cm, 25*cm, id='Frame1')
         self.allowSplitting = 0
         self.showBoundary = 1
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         template = PageTemplate('normal', [frame1], myMainPageFrame)
         self.addPageTemplates(template)
 
--- a/tests/test_pyfiles.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_pyfiles.py	Mon Feb 08 18:17:33 2010 +0000
@@ -18,9 +18,9 @@
         return seq
 
     # Make a sorted copy of the input sequence.
+    cnvt = isinstance(seq,basestring)
     seq2 = seq[:]
-    if type(seq2) == type(''):
-        seq2 = map(None, seq2)
+    if cnvt: seq2 = list(seq2)
     seq2.sort()
 
     # Remove adjacent elements if they are identical.
@@ -32,11 +32,11 @@
                 del seq2[i+1]
         except IndexError:
             pass
-        i = i + 1
+        i += 1
 
     # Try to return something of the same type as the input.
-    if type(seq) == type(''):
-        return string.join(seq2, '')
+    if cnvt:
+        return seq[0:0].join(seq2)
     else:
         return seq2
 
--- a/tests/test_source_chars.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tests/test_source_chars.py	Mon Feb 08 18:17:33 2010 +0000
@@ -44,7 +44,7 @@
                 badLines = badLines + 1
                 badChars = badChars + spaces
 
-        if badChars <> 0:
+        if badChars != 0:
             self.output.write("file %s contains %d trailing spaces, or %0.2f%% wastage\n" % (filename, badChars, 100.0*badChars/initSize))
 
     def testFiles(self):
@@ -59,7 +59,7 @@
     assert os.path.isdir(dirname), "Directory not found!"
     print "This will eliminate all trailing spaces in py files under %s." % dirname
     ok = raw_input("Shall I proceed?  type YES > ")
-    if ok <> 'YES':
+    if ok != 'YES':
         print 'aborted by user'
         return
     w = GlobDirectoryWalker(dirname, '*.py')
@@ -75,7 +75,7 @@
             if spaces:
                 badChars = badChars + spaces
 
-        if badChars <> 0:
+        if badChars != 0:
             open(filename, 'w').write(string.join(cleaned, '\n'))
             print "file %s contained %d trailing spaces, FIXED" % (filename, badChars)
     print 'done'
--- a/tools/docco/codegrab.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tools/docco/codegrab.py	Mon Feb 08 18:17:33 2010 +0000
@@ -38,7 +38,7 @@
         #now the full path should be known, if it is in the
         #package
 
-        directory = apply(os.path.join, tuple([packagepath] + words[1:-1]))
+        directory = os.path.join(*([packagepath] + words[1:-1]))
         modulename = words[-1]
         searchpath = [directory]
 
@@ -109,7 +109,7 @@
                 items = value.__dict__.items()
                 items.sort()
                 for (key2, value2) in items:
-                    if type(value2) <> types.FunctionType:
+                    if type(value2) != types.FunctionType:
                         continue # not a method
                     elif os.path.splitext(value2.func_code.co_filename)[0] == modulename:
                         continue # defined in base class
@@ -225,4 +225,4 @@
     if M==[]:
         M.append('reportlab.platypus.paragraph')
     for m in M:
-        test(m)
\ No newline at end of file
+        test(m)
--- a/tools/docco/docpy.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tools/docco/docpy.py	Mon Feb 08 18:17:33 2010 +0000
@@ -92,7 +92,7 @@
     def __init__(self, filename, **kw):
         frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
         self.allowSplitting = 0
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         self.addPageTemplates(PageTemplate('normal', [frame1], mainPageFrame))
 
 
@@ -306,10 +306,10 @@
         for c in classes:
             for base in c.__bases__:
                 key, modname = base.__name__, base.__module__
-                if modname != name and sys.modules.has_key(modname):
+                if modname != name and modname in sys.modules:
                     module = sys.modules[modname]
                     if hasattr(module, key) and getattr(module, key) is base:
-                        if not cdict.has_key(key):
+                        if key not in cdict:
                             cdict[key] = cdict[base] = modname + '.txt#' + key
 
 ##        doc = getdoc(object) or 'No doc string.'
@@ -350,7 +350,7 @@
             mdict[key] = mdict[value] = '#' + name + '-' + key
 
         if methods:
-            if not self.classes[name].has_key('methods'):
+            if 'methods' not in self.classes[name]:
                 self.classes[name]['methods'] = {}
             for item in methods:
                 self._inspectMethod(item, functions, classes, mdict, name)
@@ -390,7 +390,7 @@
                 self.functions[object.__name__] = {'signature':argspec, 'doc':doc}
             else:
                 theMethods = self.classes[clname]['methods']
-                if not theMethods.has_key(object.__name__):
+                if object.__name__ not in theMethods:
                     theMethods[object.__name__] = {}
 
                 theMethod = theMethods[object.__name__]
@@ -433,7 +433,7 @@
             f.beginClass(k, cDoc, bases)
 
             # This if should move out of this method.
-            if not s.classes[k].has_key('methods'):
+            if 'methods' not in s.classes[k]:
                 s.classes[k]['methods'] = {}
 
             # Methods
@@ -1203,7 +1203,7 @@
     optsDict = {}
     for k, v in opts:
         optsDict[k] = v
-    hasOpt = optsDict.has_key
+    hasOpt = optsDict.__contains__
 
     # On -h print usage and exit immediately.
     if hasOpt('-h'):
--- a/tools/docco/graphdocpy.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tools/docco/graphdocpy.py	Mon Feb 08 18:17:33 2010 +0000
@@ -92,7 +92,7 @@
     def __init__(self, filename, **kw):
         frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
         self.allowSplitting = 0
-        apply(BaseDocTemplate.__init__, (self, filename), kw)
+        BaseDocTemplate.__init__(self, filename, **kw)
         self.addPageTemplates(PageTemplate('normal', [frame1], mainPageFrame))
 
     def afterFlowable(self, flowable):
@@ -915,7 +915,7 @@
     optsDict = {}
     for k, v in opts:
         optsDict[k] = v
-    hasOpt = optsDict.has_key
+    hasOpt = optsDict.__contains__
 
     # On -h print usage and exit immediately.
     if hasOpt('-h'):
--- a/tools/docco/t_parse.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tools/docco/t_parse.py	Mon Feb 08 18:17:33 2010 +0000
@@ -110,7 +110,7 @@
        self.markers = markers
        for mark in markers:
            if len(mark)>1:
-              raise ValueError, "Marks must be single characters: "+`mark`
+              raise ValueError, "Marks must be single characters: "+repr(mark)
        # compile the regular expressions if needed
        self.marker_dict = marker_dict = {}
        for (mark, rgex) in marker_to_regex_dict.items():
@@ -174,7 +174,7 @@
            # is it a literal indicator?
            if indicator is None:
               if find(str, data, currentindex) != currentindex:
-                 raise ValueError, "literal not found at "+`(currentindex,data)`
+                 raise ValueError, "literal not found at "+repr((currentindex,data))
               currentindex = currentindex + len(data)
            else:
               # anything else is a directive
@@ -192,13 +192,13 @@
                        last = find(str, nextdata, currentindex)
                        if last<currentindex:
                           raise ValueError, \
-                           "couldn't terminate wild with lit "+`currentindex`
+                           "couldn't terminate wild with lit "+repr(currentindex)
                     else:
                        # data is a re, search for it
                        last = nextdata.search(str, currentindex)
                        if last<currentindex:
                           raise ValueError, \
-                           "couldn't terminate wild with re "+`currentindex`
+                           "couldn't terminate wild with re "+repr(currentindex)
               elif indicator == single_char:
                  # data is length to eat
                  last = currentindex + data
@@ -206,7 +206,7 @@
                  # other directives are always regular expressions
                  last = data.match(str, currentindex) + currentindex
                  if last<currentindex:
-                    raise ValueError, "couldn't match re at "+`currentindex`
+                    raise ValueError, "couldn't match re at "+repr(currentindex)
               #print "accepting", str[currentindex:last]
               result[current_directive_index] = str[currentindex:last]
               current_directive_index = current_directive_index+1
--- a/tools/docco/yaml.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tools/docco/yaml.py	Mon Feb 08 18:17:33 2010 +0000
@@ -87,13 +87,12 @@
 
             #is it a parser method?
             if hasattr(self.__class__, cmd):
-                method = eval('self.'+cmd)
                 #this was very bad; any type error in the method was hidden
                 #we have to hack the traceback
                 try:
-                    apply(method, tuple(args))
+                    getattr(self,cmd)(*args)
                 except TypeError, err:
-                    sys.stderr.write("Parser method: apply(%s,%s) %s at line %d\n" % (cmd, tuple(args), err, self._lineNo))
+                    sys.stderr.write("Parser method: %s(*%s) %s at line %d\n" % (cmd, tuple(args), err, self._lineNo))
                     raise
             else:
                 # assume it is a paragraph style -
@@ -153,7 +152,7 @@
         """Documents the entire module at this point by making
         paragraphs and preformatted objects"""
         docco = codegrab.getObjectsDefinedIn(modulename, pathname)
-        if docco.doc <> None:
+        if docco.doc != None:
             self._results.append(('Paragraph', 'DocString', docco.doc))
         if len(docco.functions) > 0:
             for fn in docco.functions:
@@ -192,10 +191,10 @@
         self._results.append(('NextPageTemplate',templateName))
 
 if __name__=='__main__': #NORUNTESTS
-    if len(sys.argv) <> 2:
+    if len(sys.argv) != 2:
         print 'usage: yaml.py source.txt'
     else:
         p = Parser()
         results = p.parseFile(sys.argv[1])
         import pprint
-        pprint.pprint(results)
\ No newline at end of file
+        pprint.pprint(results)
--- a/tools/pythonpoint/demos/slidebox.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tools/pythonpoint/demos/slidebox.py	Mon Feb 08 18:17:33 2010 +0000
@@ -5,7 +5,7 @@
 
 class SlideBoxDrawing(_DrawingEditorMixin,DataAwareDrawing):
     def __init__(self,width=400,height=200,*args,**kw):
-        apply(DataAwareDrawing.__init__,(self,width,height)+args,kw)
+        DataAwareDrawing.__init__(self,width,height,*args,**kw)
         self._add(self,SlideBox(),name='SlideBox',validate=None,desc='The main chart')
         self.height          = 40
         self.width           = 168
--- a/tools/pythonpoint/pythonpoint.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tools/pythonpoint/pythonpoint.py	Mon Feb 08 18:17:33 2010 +0000
@@ -70,7 +70,7 @@
 - save in combined presentation/handout mode (TODO)
 - add pyRXP support (TODO)
 """
-__version__='''$Id:$'''
+__version__='''$Id$'''
 import os, sys, imp, string, pprint, getopt, glob
 
 from reportlab import rl_config
@@ -489,7 +489,7 @@
             continue
             name = str(hash(graphic))
             #internalname = canv._doc.hasForm(name)
-            if definedForms.has_key(name):
+            if name in definedForms:
                 internalname = 1
             else:
                 internalname = None
@@ -747,8 +747,8 @@
             r,g,b = checkColor(self.strokeColor)
             canv.setStrokeColorRGB(r,g,b)
         canv.rect(self.x, self.y, self.width, self.height,
-                    stroke=(self.strokeColor<>None),
-                    fill = (self.fillColor<>None)
+                    stroke=(self.strokeColor!=None),
+                    fill = (self.fillColor!=None)
                     )
         canv.restoreState()
 
@@ -775,8 +775,8 @@
             canv.setStrokeColorRGB(r,g,b)
         canv.roundRect(self.x, self.y, self.width, self.height,
                     self.radius,
-                    stroke=(self.strokeColor<>None),
-                    fill = (self.fillColor<>None)
+                    stroke=(self.strokeColor!=None),
+                    fill = (self.fillColor!=None)
                     )
         canv.restoreState()
 
@@ -821,8 +821,8 @@
             r,g,b = checkColor(self.fillColor)
             canv.setFillColorRGB(r,g,b)
         canv.ellipse(self.x1, self.y1, self.x2, self.y2,
-                    stroke=(self.strokeColor<>None),
-                    fill = (self.fillColor<>None)
+                    stroke=(self.strokeColor!=None),
+                    fill = (self.fillColor!=None)
                      )
         canv.restoreState()
 
@@ -851,8 +851,8 @@
             path.lineTo(x,y)
         path.close()
         canv.drawPath(path,
-                      stroke=(self.strokeColor<>None),
-                      fill=(self.fillColor<>None))
+                      stroke=(self.strokeColor!=None),
+                      fill=(self.fillColor!=None))
         canv.restoreState()
 
 
--- a/tools/pythonpoint/stdparser.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/tools/pythonpoint/stdparser.py	Mon Feb 08 18:17:33 2010 +0000
@@ -214,20 +214,20 @@
 
     def _arg(self,tag,args,name):
         "What's this for???"
-        if args.has_key(name):
+        if name in args:
             v = args[name]
         else:
-            if self.attributes.has_key(tag):
+            if tag in self.attributes:
                 v = self.attributes[tag][name]
             else:
                 v = None
         return v
 
     def ceval(self,tag,args,name):
-        if args.has_key(name):
+        if name in args:
             v = args[name]
         else:
-            if self.attributes.has_key(tag):
+            if tag in self.attributes:
                 v = self.attributes[tag][name]
             else:
                 return None
@@ -256,12 +256,12 @@
             self._curString.text = self._curString.text + data
         elif self._curTable:
             self._curTable.rawBlocks.append(data)
-        elif self._curTitle <> None:  # need to allow empty strings,
+        elif self._curTitle != None:  # need to allow empty strings,
             # hence explicitly testing for None
             self._curTitle = self._curTitle + data
-        elif self._curAuthor <> None:
+        elif self._curAuthor != None:
             self._curAuthor = self._curAuthor + data
-        elif self._curSubject <> None:
+        elif self._curSubject != None:
             self._curSubject = self._curSubject + data
 
     def handle_cdata(self, data):
@@ -276,9 +276,9 @@
             self._curString.text = self._curString.text + data
         elif self._curTable:
             self._curTable.rawBlocks.append(data)
-        elif self._curAuthor <> None:
+        elif self._curAuthor != None:
             self._curAuthor = self._curAuthor + data
-        elif self._curSubject <> None:
+        elif self._curSubject != None:
             self._curSubject = self._curSubject + data
 
     def start_presentation(self, args):
@@ -359,7 +359,7 @@
         s.id = self._arg('slide',args,'id')
         s.title = self._arg('slide',args,'title')
         a = self._arg('slide',args,'effectname')
-        if a <> 'None':
+        if a != 'None':
             s.effectName = a
         s.effectDirection = self.ceval('slide',args,'effectdirection')
         s.effectDimension = self._arg('slide',args,'effectdimension')
@@ -372,7 +372,7 @@
         a = self._arg('slide',args,'outlineentry')
         if a == "Hide":
             s.outlineEntry = None
-        elif a <> 'None':
+        elif a != 'None':
             s.outlineEntry = a
         else:
             s.outlineEntry = s.title
@@ -422,7 +422,7 @@
     def pack_slide(self, element, args):
         if self.fx:
             effectName = self._arg(element,args,'effectname')
-            if effectName <> 'None':
+            if effectName != 'None':
                 curSlide = copy.deepcopy(self._curSlide)
                 if self._curFrame:
                     curFrame = copy.deepcopy(self._curFrame)
@@ -504,11 +504,11 @@
         self._curTable.heights = self.ceval('table',args,'heights')
         #these may contain escapes like tabs - handle with
         #a bit more care.
-        if args.has_key('fieldDelim'):
+        if 'fieldDelim' in args:
             self._curTable.fieldDelim = eval('"' + args['fieldDelim'] + '"')
-        if args.has_key('rowDelim'):
+        if 'rowDelim' in args:
             self._curTable.rowDelim = eval('"' + args['rowDelim'] + '"')
-        if args.has_key('style'):
+        if 'style' in args:
             self._curTable.style = args['style']
 
 
@@ -712,7 +712,7 @@
 
         func = getattr(mod, funcname)
         initargs = self.ceval('customshape',args,'initargs')
-        self._curCustomShape = apply(func, initargs)
+        self._curCustomShape = func(*initargs)
 
     def end_customshape(self):
         if self._curSlide: