attempt to remove python 3 only print stuff py33
authorrobin
Tue, 03 Dec 2013 13:57:37 +0000
branchpy33
changeset 3884 3bc59a4c3c21
parent 3883 ef5b12e5f4e2
child 3885 64dd51d570e5
attempt to remove python 3 only print stuff
src/reportlab/graphics/shapes.py
src/reportlab/lib/fontfinder.py
src/reportlab/lib/sequencer.py
src/reportlab/lib/xmllib.py
src/reportlab/platypus/doctemplate.py
src/reportlab/platypus/xpreformatted.py
--- a/src/reportlab/graphics/shapes.py	Tue Dec 03 13:57:08 2013 +0000
+++ b/src/reportlab/graphics/shapes.py	Tue Dec 03 13:57:37 2013 +0000
@@ -1427,17 +1427,17 @@
     r = Rect(10,10,200,50)
     import pprint
     pp = pprint.pprint
-    print('a Rectangle:')
+    w = sys.stdout.write
+    w('a Rectangle: ')
     pp(r.getProperties())
-    print()
-    print('verifying...', end=' ')
+    w('\nverifying...')
     r.verify()
-    print('OK')
+    w(' OK\n')
     #print 'setting rect.z = "spam"'
     #r.z = 'spam'
-    print('deleting rect.width')
+    w('deleting rect.width ')
     del r.width
-    print('verifying...', end=' ')
+    w('verifying...')
     r.verify()
 
 
--- a/src/reportlab/lib/fontfinder.py	Tue Dec 03 13:57:08 2013 +0000
+++ b/src/reportlab/lib/fontfinder.py	Tue Dec 03 13:57:37 2013 +0000
@@ -318,15 +318,15 @@
         print('\t%s' % familyName)
 
     print()
-    print('fonts called Vera:', end=' ')
+    outw = sys.stdout.write
+    outw('fonts called Vera:')
     for font in ff.getFontsInFamily('Bitstream Vera Sans'):
-        print('\t%s' % font.name)
-
+        outw(' %s' % font.name)
     print()
-    print('Bold fonts\n\t')
+    outw('Bold fonts\n\t')
     for font in ff.getFontsWithAttributes(isBold=True, isItalic=False):
-        print(font.fullName, end=' ')
-
+        outw(font.fullName+' ')
+    print()
     print('family report')
     print(ff.getFamilyXmlReport())
 
--- a/src/reportlab/lib/sequencer.py	Tue Dec 03 13:57:08 2013 +0000
+++ b/src/reportlab/lib/sequencer.py	Tue Dec 03 13:57:37 2013 +0000
@@ -289,9 +289,7 @@
     print('Defining a custom format with french words:')
     s.registerFormat('french', format_french)
     s.setFormat('FrenchList', 'french')
-    print('   ', end=' ')
-    for i in range(1,6):
-        print(s.nextf('FrenchList'), end=' ')
+    print('   ' +(' '.join(str(s.nextf('FrenchList')) for i in range(1,6))))
     print()
     print('Chaining H1 and H2 - H2 goes back to one when H1 increases')
     s.chain('H1','H2')
--- a/src/reportlab/lib/xmllib.py	Tue Dec 03 13:57:08 2013 +0000
+++ b/src/reportlab/lib/xmllib.py	Tue Dec 03 13:57:37 2013 +0000
@@ -7,7 +7,7 @@
 
 Probably ought to be removed'''
 
-import re
+import sys, re
 
 try:
     import sgmlop   # this works for both builtin on the path or relative
@@ -711,9 +711,10 @@
         if not attrs:
             print('start tag: <' + tag + '>')
         else:
-            print('start tag: <' + tag, end=' ')
+            w = sys.stdout.write
+            w('start tag: <' + tag)
             for name, value in attrs.items():
-                print(name + '=' + '"' + value + '"', end=' ')
+                w(name + '=' + '"' + value + '"')
             print('>')
 
     def unknown_endtag(self, tag):
--- a/src/reportlab/platypus/doctemplate.py	Tue Dec 03 13:57:08 2013 +0000
+++ b/src/reportlab/platypus/doctemplate.py	Tue Dec 03 13:57:37 2013 +0000
@@ -961,7 +961,7 @@
             passes += 1
             if self._onProgress:
                 self._onProgress('PASS', passes)
-            if verbose: print('building pass '+str(passes) + '...', end=' ')
+            if verbose: sys.stdout.write('building pass '+str(passes) + '...')
 
             for fl in self._indexingFlowables:
                 fl.beforeBuild()
--- a/src/reportlab/platypus/xpreformatted.py	Tue Dec 03 13:57:08 2013 +0000
+++ b/src/reportlab/platypus/xpreformatted.py	Tue Dec 03 13:57:37 2013 +0000
@@ -251,13 +251,14 @@
         print('\n############dumpXPreforemattedLines(%s)' % str(P))
         lines = P.blPara.lines
         n =len(lines)
+        outw=sys.stdout.write
         for l in range(n):
             line = lines[l]
             words = line.words
             nwords = len(words)
-            print('line%d: %d(%d)\n  ' % (l,nwords,line.wordCount), end=' ')
+            outw('line%d: %d(%d)\n  ' % (l,nwords,line.wordCount))
             for w in range(nwords):
-                print("%d:'%s'"%(w,words[w].text), end=' ')
+                outw(" %d:'%s'"%(w,words[w].text))
             print()
 
     def dumpXPreformattedFrags(P):
@@ -267,14 +268,15 @@
         for l in range(n):
             print("frag%d: '%s'" % (l, frags[l].text))
 
+        outw=sys.stdout.write
         l = 0
         for L in _getFragLines(frags):
             n=0
             for W in _getFragWords(L,360):
-                print("frag%d.%d: size=%d" % (l, n, W[0]), end=' ')
+                outw("frag%d.%d: size=%d" % (l, n, W[0]))
                 n = n + 1
                 for w in W[1:]:
-                    print("'%s'" % w[1], end=' ')
+                    outw(" '%s'" % w[1])
                 print()
             l = l + 1