summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorR. Tyler Ballance <tyler@monkeypox.org>2009-11-08 15:22:10 -0800
committerR. Tyler Ballance <tyler@monkeypox.org>2009-11-16 00:04:04 -0800
commit0b8c21f8f3cc5f95f2184bf717b62f2888ed4935 (patch)
treef8450c987a3b178936b5d62a8820d1a803788c49
parenta23cfe7fc38af7f38a5d032592456152f635f995 (diff)
downloadpython-cheetah-0b8c21f8f3cc5f95f2184bf717b62f2888ed4935.tar.gz
Refactor raw print statements in accordance with 2to3
Removed prints in a couple places entirely, some of this code should likely use the `logging` module instead
-rw-r--r--SetupConfig.py2
-rw-r--r--SetupTools.py12
-rw-r--r--cheetah/CheetahWrapper.py8
-rw-r--r--cheetah/Filters.py24
-rwxr-xr-xcheetah/ImportManager.py4
-rw-r--r--cheetah/NameMapper.py14
-rw-r--r--cheetah/Parser.py40
-rw-r--r--cheetah/Template.py2
-rw-r--r--cheetah/TemplateCmdLineIface.py8
-rw-r--r--cheetah/Templates/_SkeletonPage.py2
-rw-r--r--cheetah/Tests/CheetahWrapper.py4
-rw-r--r--cheetah/Tests/Filters.py2
-rw-r--r--cheetah/Tests/Performance.py8
-rw-r--r--cheetah/Tests/Regressions.py2
-rw-r--r--cheetah/Tests/SyntaxAndOutput.py2
-rw-r--r--cheetah/Tests/Template.py4
-rwxr-xr-xcheetah/Tests/unittest_local_copy.py4
-rw-r--r--cheetah/Tests/xmlrunner.py4
-rw-r--r--cheetah/Tools/SiteHierarchy.py10
-rw-r--r--cheetah/Utils/memcache.py39
-rw-r--r--cheetah/Utils/statprof.py16
-rw-r--r--cheetah/Version.py10
22 files changed, 101 insertions, 120 deletions
diff --git a/SetupConfig.py b/SetupConfig.py
index c95001d..85539e9 100644
--- a/SetupConfig.py
+++ b/SetupConfig.py
@@ -71,7 +71,7 @@ if not os.getenv('CHEETAH_INSTALL_WITHOUT_SETUPTOOLS'):
]
}
except ImportError:
- print 'Not using setuptools, so we cannot install the Markdown dependency'
+ print('Not using setuptools, so we cannot install the Markdown dependency')
description = "Cheetah is a template engine and code generation tool."
diff --git a/SetupTools.py b/SetupTools.py
index d08eef2..096ee40 100644
--- a/SetupTools.py
+++ b/SetupTools.py
@@ -158,14 +158,14 @@ def run_setup(configurations):
try:
apply(setup, (), kws)
except BuildFailed, x:
- print "One or more C extensions failed to build."
- print "Details: %s" % x
- print "Retrying without C extensions enabled."
+ print("One or more C extensions failed to build.")
+ print("Details: %s" % x)
+ print("Retrying without C extensions enabled.")
del kws['ext_modules']
apply(setup, (), kws)
- print "One or more C extensions failed to build."
- print "Performance enhancements will not be available."
- print "Pure Python installation succeeded."
+ print("One or more C extensions failed to build.")
+ print("Performance enhancements will not be available.")
+ print("Pure Python installation succeeded.")
diff --git a/cheetah/CheetahWrapper.py b/cheetah/CheetahWrapper.py
index 3b1f991..d01f46a 100644
--- a/cheetah/CheetahWrapper.py
+++ b/cheetah/CheetahWrapper.py
@@ -195,14 +195,14 @@ Files are %s""", args, pprint.pformat(vars(opts)), files)
if opts.print_settings:
- print
- print '>> Available Cheetah compiler settings:'
+ print()
+ print('>> Available Cheetah compiler settings:')
from Cheetah.Compiler import _DEFAULT_COMPILER_SETTINGS
listing = _DEFAULT_COMPILER_SETTINGS
listing.sort(key=lambda l: l[0][0].lower())
for l in listing:
- print '\t%s (default: "%s")\t%s' % l
+ print('\t%s (default: "%s")\t%s' % l)
sys.exit(0)
#cleanup trailing path separators
@@ -266,7 +266,7 @@ you do have write permission to and re-run the tests.""")
runner.run(unittest.TestSuite(Test.suites))
def version(self):
- print Version
+ print(Version)
# If you add a command, also add it to the 'meths' variable in main().
diff --git a/cheetah/Filters.py b/cheetah/Filters.py
index d452439..39ac9ec 100644
--- a/cheetah/Filters.py
+++ b/cheetah/Filters.py
@@ -65,9 +65,9 @@ class Markdown(EncodeUnicode):
try:
import markdown
except ImportError:
- print '>>> Exception raised importing the "markdown" module'
- print '>>> Are you sure you have the ElementTree module installed?'
- print ' http://effbot.org/downloads/#elementtree'
+ print('>>> Exception raised importing the "markdown" module')
+ print('>>> Are you sure you have the ElementTree module installed?')
+ print(' http://effbot.org/downloads/#elementtree')
raise
encoded = super(Markdown, self).filter(value, **kwargs)
@@ -97,8 +97,8 @@ class CodeHighlighter(EncodeUnicode):
from pygments import lexers
from pygments import formatters
except ImportError, ex:
- print '<%s> - Failed to import pygments! (%s)' % (self.__class__.__name__, ex)
- print '-- You may need to install it from: http://pygments.org'
+ print('<%s> - Failed to import pygments! (%s)' % (self.__class__.__name__, ex))
+ print('-- You may need to install it from: http://pygments.org')
return encoded
lexer = None
@@ -196,15 +196,15 @@ class StripSqueeze(Filter):
def test():
s1 = "abc <=> &"
s2 = " asdf \n\t 1 2 3\n"
- print "WebSafe INPUT:", `s1`
- print " WebSafe:", `WebSafe().filter(s1)`
+ print("WebSafe INPUT:", `s1`)
+ print(" WebSafe:", `WebSafe().filter(s1)`)
- print
- print " Strip INPUT:", `s2`
- print " Strip:", `Strip().filter(s2)`
- print "StripSqueeze:", `StripSqueeze().filter(s2)`
+ print()
+ print(" Strip INPUT:", `s2`)
+ print(" Strip:", `Strip().filter(s2)`)
+ print("StripSqueeze:", `StripSqueeze().filter(s2)`)
- print "Unicode:", `EncodeUnicode().filter(u'aoeu12345\u1234')`
+ print("Unicode:", `EncodeUnicode().filter(u'aoeu12345\u1234')`)
if __name__ == "__main__":
test()
diff --git a/cheetah/ImportManager.py b/cheetah/ImportManager.py
index 743360e..667898f 100755
--- a/cheetah/ImportManager.py
+++ b/cheetah/ImportManager.py
@@ -223,8 +223,8 @@ class DirOwner(Owner):
co = compile(open(py[0], 'r').read()+'\n', py[0], 'exec')
break
except SyntaxError, e:
- print "Invalid syntax in %s" % py[0]
- print e.args
+ print("Invalid syntax in %s" % py[0])
+ print(e.args)
raise
elif pyc:
stuff = open(pyc[0], 'rb').read()
diff --git a/cheetah/NameMapper.py b/cheetah/NameMapper.py
index 3a6322e..c70db38 100644
--- a/cheetah/NameMapper.py
+++ b/cheetah/NameMapper.py
@@ -364,13 +364,13 @@ def example():
}
b = 'this is local b'
- print valueForKey(a.dic,'subDict')
- print valueForName(a, 'dic.item')
- print valueForName(vars(), 'b')
- print valueForName(__builtins__, 'dir')()
- print valueForName(vars(), 'a.classVar')
- print valueForName(vars(), 'a.dic.func', executeCallables=True)
- print valueForName(vars(), 'a.method2.item1', executeCallables=True)
+ print(valueForKey(a.dic,'subDict'))
+ print(valueForName(a, 'dic.item'))
+ print(valueForName(vars(), 'b'))
+ print(valueForName(__builtins__, 'dir')())
+ print(valueForName(vars(), 'a.classVar'))
+ print(valueForName(vars(), 'a.dic.func', executeCallables=True))
+ print(valueForName(vars(), 'a.method2.item1', executeCallables=True))
if __name__ == '__main__':
example()
diff --git a/cheetah/Parser.py b/cheetah/Parser.py
index 7436e9c..3eccc50 100644
--- a/cheetah/Parser.py
+++ b/cheetah/Parser.py
@@ -1,21 +1,12 @@
-# $Id: Parser.py,v 1.137 2008/03/10 05:25:13 tavis_rudd Exp $
-"""Parser classes for Cheetah's Compiler
+"""
+Parser classes for Cheetah's Compiler
Classes:
ParseError( Exception )
_LowLevelParser( Cheetah.SourceReader.SourceReader ), basically a lexer
_HighLevelParser( _LowLevelParser )
Parser === _HighLevelParser (an alias)
-
-Meta-Data
-================================================================================
-Author: Tavis Rudd <tavis@damnsimple.com>
-Version: $Revision: 1.137 $
-Start Date: 2001/08/01
-Last Revision Date: $Date: 2008/03/10 05:25:13 $
"""
-__author__ = "Tavis Rudd <tavis@damnsimple.com>"
-__revision__ = "$Revision: 1.137 $"[11:-2]
import os
import sys
@@ -1224,7 +1215,6 @@ class _LowLevelParser(SourceReader):
startPosIdx = 3
else:
startPosIdx = 1
- #print 'CHEETAH STRING', nextToken, theStr, startPosIdx
self.setPos(beforeTokenPos+startPosIdx+1)
outputExprs = []
strConst = ''
@@ -1240,8 +1230,6 @@ class _LowLevelParser(SourceReader):
self.setPos(endPos)
if strConst:
outputExprs.append(repr(strConst))
- #if not self.atEnd() and self.matches('.join('):
- # print 'DEBUG***'
token = "''.join(["+','.join(outputExprs)+"])"
return token
@@ -1854,13 +1842,11 @@ class _HighLevelParser(_LowLevelParser):
try:
self._compiler.setCompilerSetting(settingName, valueExpr)
except:
- out = sys.stderr
- print >> out, 'An error occurred while processing the following #compiler directive.'
- print >> out, '-'*80
- print >> out, self[startPos:endPos]
- print >> out, '-'*80
- print >> out, 'Please check the syntax of these settings.'
- print >> out, 'A full Python exception traceback follows.'
+ sys.stderr.write('An error occurred while processing the following #compiler directive.\n')
+ sys.stderr.write('----------------------------------------------------------------------\n')
+ sys.stderr.write('%s\n' % self[startPos:endPos])
+ sys.stderr.write('----------------------------------------------------------------------\n')
+ sys.stderr.write('Please check the syntax of these settings.\n\n')
raise
@@ -1890,13 +1876,11 @@ class _HighLevelParser(_LowLevelParser):
try:
self._compiler.setCompilerSettings(keywords=keywords, settingsStr=settingsStr)
except:
- out = sys.stderr
- print >> out, 'An error occurred while processing the following compiler settings.'
- print >> out, '-'*80
- print >> out, settingsStr.strip()
- print >> out, '-'*80
- print >> out, 'Please check the syntax of these settings.'
- print >> out, 'A full Python exception traceback follows.'
+ sys.stderr.write('An error occurred while processing the following compiler settings.\n')
+ sys.stderr.write('----------------------------------------------------------------------\n')
+ sys.stderr.write('%s\n' % settingsStr.strip())
+ sys.stderr.write('----------------------------------------------------------------------\n')
+ sys.stderr.write('Please check the syntax of these settings.\n\n')
raise
def eatAttr(self):
diff --git a/cheetah/Template.py b/cheetah/Template.py
index ec92208..ab63074 100644
--- a/cheetah/Template.py
+++ b/cheetah/Template.py
@@ -1837,7 +1837,7 @@ class Template(Servlet):
# 'dic = super(ThisClass, self).webInput(names, namesMulti, ...)'
# and then the code below.
if debug:
- print "<PRE>\n" + pprint.pformat(dic) + "\n</PRE>\n\n"
+ print("<PRE>\n" + pprint.pformat(dic) + "\n</PRE>\n\n")
self.searchList().insert(0, dic)
return dic
diff --git a/cheetah/TemplateCmdLineIface.py b/cheetah/TemplateCmdLineIface.py
index 16a90cf..6690b6d 100644
--- a/cheetah/TemplateCmdLineIface.py
+++ b/cheetah/TemplateCmdLineIface.py
@@ -41,7 +41,7 @@ class CmdLineIface:
"""The main program controller."""
self._processCmdLineArgs()
- print self._template
+ print(self._template)
def _processCmdLineArgs(self):
try:
@@ -53,13 +53,13 @@ class CmdLineIface:
except getopt.GetoptError, v:
# print help information and exit:
- print v
- print self.usage()
+ print(v)
+ print(self.usage())
sys.exit(2)
for o, a in self._opts:
if o in ('-h','--help'):
- print self.usage()
+ print(self.usage())
sys.exit()
if o == '--env':
self._template.searchList().insert(0, os.environ)
diff --git a/cheetah/Templates/_SkeletonPage.py b/cheetah/Templates/_SkeletonPage.py
index fe01ebf..95a59a7 100644
--- a/cheetah/Templates/_SkeletonPage.py
+++ b/cheetah/Templates/_SkeletonPage.py
@@ -88,7 +88,7 @@ class _SkeletonPage(Template):
if not self._stylesheets.has_key(identifier):
warning = '# the identifier ' + identifier + \
'was in stylesheetsOrder, but not in stylesheets'
- print warning
+ print(warning)
stylesheetTagsTxt += warning
continue
diff --git a/cheetah/Tests/CheetahWrapper.py b/cheetah/Tests/CheetahWrapper.py
index e152e68..809be40 100644
--- a/cheetah/Tests/CheetahWrapper.py
+++ b/cheetah/Tests/CheetahWrapper.py
@@ -52,7 +52,7 @@ class CFBase(unittest.TestCase):
def inform(self, message):
if self.verbose:
- print message
+ print(message)
def setUp(self):
"""Create the top-level directories, subdirectories and .tmpl
@@ -520,7 +520,7 @@ def listTests(cheetahWrapperFile):
break
m = rx.search(lin)
if m:
- print m.group(1)
+ print(m.group(1))
f.close()
def main():
diff --git a/cheetah/Tests/Filters.py b/cheetah/Tests/Filters.py
index bf35440..9b3c7c2 100644
--- a/cheetah/Tests/Filters.py
+++ b/cheetah/Tests/Filters.py
@@ -31,7 +31,7 @@ Header
assert template == expected
except Exception, ex:
if ex.__class__.__name__ == 'MarkdownException' and majorVer == 2 and minorVer < 5:
- print '>>> NOTE: Support for the Markdown filter will be broken for you. Markdown says: %s' % ex
+ print('>>> NOTE: Support for the Markdown filter will be broken for you. Markdown says: %s' % ex)
return
raise
diff --git a/cheetah/Tests/Performance.py b/cheetah/Tests/Performance.py
index 8101e85..fc74367 100644
--- a/cheetah/Tests/Performance.py
+++ b/cheetah/Tests/Performance.py
@@ -57,8 +57,8 @@ def perftest(max_num_pystones, current_pystone=None):
pystone_total_time = total_time / pystone_rate
global DEBUG
if DEBUG:
- print 'The test "%s" took: %s pystones' % (function.func_name,
- pystone_total_time)
+ print('The test "%s" took: %s pystones' % (function.func_name,
+ pystone_total_time))
else:
if pystone_total_time > (max_num_pystones + TOLERANCE):
raise DurationError((('Test too long (%.2f Ps, '
@@ -98,8 +98,8 @@ class PerformanceTest(unittest.TestCase):
self.prof.stop()
self.prof.close()
if self.display:
- print '>>> %s (%d iterations) ' % (self.__class__.__name__,
- self.iterations)
+ print('>>> %s (%d iterations) ' % (self.__class__.__name__,
+ self.iterations))
stats = hotshot.stats.load('%s.prof' % self.__class__.__name__)
#stats.strip_dirs()
stats.sort_stats('time', 'calls')
diff --git a/cheetah/Tests/Regressions.py b/cheetah/Tests/Regressions.py
index 4d50348..67a736a 100644
--- a/cheetah/Tests/Regressions.py
+++ b/cheetah/Tests/Regressions.py
@@ -29,7 +29,7 @@ class GetAttrTest(unittest.TestCase):
def test_ValidException(self):
o = CustomGetAttrClass()
try:
- print o.attr
+ print(o.attr)
except GetAttrException, e:
# expected
return
diff --git a/cheetah/Tests/SyntaxAndOutput.py b/cheetah/Tests/SyntaxAndOutput.py
index 72721bc..6bd6963 100644
--- a/cheetah/Tests/SyntaxAndOutput.py
+++ b/cheetah/Tests/SyntaxAndOutput.py
@@ -171,7 +171,7 @@ Template output mismatch:
)
moduleCode = templateObj._CHEETAH_generatedModuleCode
if self.DEBUGLEV >= 1:
- print moduleCode
+ print(moduleCode)
try:
output = templateObj.respond() # rather than __str__, because of unicode
assert output==expectedOutput, self._outputMismatchReport(output, expectedOutput)
diff --git a/cheetah/Tests/Template.py b/cheetah/Tests/Template.py
index 144ae6f..7edbdb9 100644
--- a/cheetah/Tests/Template.py
+++ b/cheetah/Tests/Template.py
@@ -293,7 +293,7 @@ class TryExceptImportTest(TemplateTest):
class ClassMethodSupport(TemplateTest):
def test_BasicDecorator(self):
if sys.version_info[0] == 2 and sys.version_info[1] == 3:
- print 'This version of Python doesn\'t support decorators, skipping tests'
+ print('This version of Python doesn\'t support decorators, skipping tests')
return
template = '''
#@classmethod
@@ -311,7 +311,7 @@ class ClassMethodSupport(TemplateTest):
class StaticMethodSupport(TemplateTest):
def test_BasicDecorator(self):
if sys.version_info[0] == 2 and sys.version_info[1] == 3:
- print 'This version of Python doesn\'t support decorators, skipping tests'
+ print('This version of Python doesn\'t support decorators, skipping tests')
return
template = '''
#@staticmethod
diff --git a/cheetah/Tests/unittest_local_copy.py b/cheetah/Tests/unittest_local_copy.py
index a5f5499..11d2d2c 100755
--- a/cheetah/Tests/unittest_local_copy.py
+++ b/cheetah/Tests/unittest_local_copy.py
@@ -917,8 +917,8 @@ Examples:
self.runTests()
def usageExit(self, msg=None):
- if msg: print msg
- print self.USAGE % self.__dict__
+ if msg: print(msg)
+ print(self.USAGE % self.__dict__)
sys.exit(2)
def parseArgs(self, argv):
diff --git a/cheetah/Tests/xmlrunner.py b/cheetah/Tests/xmlrunner.py
index dc49c56..36b5d8d 100644
--- a/cheetah/Tests/xmlrunner.py
+++ b/cheetah/Tests/xmlrunner.py
@@ -313,7 +313,7 @@ class XMLTestRunnerTest(unittest.TestCase):
"""
class TestTest(unittest.TestCase):
def test_foo(self):
- print "Test"
+ print("Test")
self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="1" time="0.000">
<testcase classname="__main__.TestTest" name="test_foo" time="0.000"></testcase>
<system-out><![CDATA[Test
@@ -329,7 +329,7 @@ class XMLTestRunnerTest(unittest.TestCase):
"""
class TestTest(unittest.TestCase):
def test_foo(self):
- print >>sys.stderr, "Test"
+ sys.stderr.write('Test\n')
self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="1" time="0.000">
<testcase classname="__main__.TestTest" name="test_foo" time="0.000"></testcase>
<system-out><![CDATA[]]></system-out>
diff --git a/cheetah/Tools/SiteHierarchy.py b/cheetah/Tools/SiteHierarchy.py
index 06da56f..6cae0bc 100644
--- a/cheetah/Tools/SiteHierarchy.py
+++ b/cheetah/Tools/SiteHierarchy.py
@@ -173,10 +173,10 @@ if __name__ == '__main__':
]
for url in ['/', '/services', '/services/products/widget', '/contact']:
- print '<p>', '='*50
- print '<br> %s: <br>\n' % url
+ print('<p>', '='*50)
+ print('<br> %s: <br>\n' % url)
n = Hierarchy(hierarchy, url, menuCSSClass='menu', crumbCSSClass='crumb',
prefix='/here')
- print n.menuList()
- print '<p>', '-'*50
- print n.crumbs()
+ print(n.menuList())
+ print('<p>', '-'*50)
+ print(n.crumbs())
diff --git a/cheetah/Utils/memcache.py b/cheetah/Utils/memcache.py
index ee9678d..029f621 100644
--- a/cheetah/Utils/memcache.py
+++ b/cheetah/Utils/memcache.py
@@ -177,7 +177,6 @@ class Client:
for i in range(Client._SERVER_RETRIES):
server = self.buckets[serverhash % len(self.buckets)]
if server.connect():
- #print "(using server %s)" % server,
return server, key
serverhash = hash(str(serverhash) + str(i))
return None, None
@@ -555,10 +554,9 @@ def _doctest():
return doctest.testmod(memcache, globs=globs)
if __name__ == "__main__":
- print "Testing docstrings..."
+ print("Testing docstrings...")
_doctest()
- print "Running tests:"
- print
+ print("Running tests:")
#servers = ["127.0.0.1:11211", "127.0.0.1:11212"]
servers = ["127.0.0.1:11211"]
mc = Client(servers, debug=1)
@@ -568,14 +566,14 @@ if __name__ == "__main__":
return "%s (%s)" % (val, type(val))
return "%s" % val
def test_setget(key, val):
- print "Testing set/get {'%s': %s} ..." % (to_s(key), to_s(val)),
+ print("Testing set/get {'%s': %s} ..." % (to_s(key), to_s(val)))
mc.set(key, val)
newval = mc.get(key)
if newval == val:
- print "OK"
+ print("OK")
return 1
else:
- print "FAIL"
+ print("FAIL")
return 0
class FooStruct:
@@ -591,34 +589,33 @@ if __name__ == "__main__":
test_setget("a_string", "some random string")
test_setget("an_integer", 42)
if test_setget("long", long(1<<30)):
- print "Testing delete ...",
+ print("Testing delete ...")
if mc.delete("long"):
- print "OK"
+ print("OK")
else:
- print "FAIL"
- print "Testing get_multi ...",
- print mc.get_multi(["a_string", "an_integer"])
+ print("FAIL")
+ print("Testing get_multi ...")
+ print(mc.get_multi(["a_string", "an_integer"]))
- print "Testing get(unknown value) ...",
- print to_s(mc.get("unknown_value"))
+ print("Testing get(unknown value) ...")
+ print(to_s(mc.get("unknown_value")))
f = FooStruct()
test_setget("foostruct", f)
- print "Testing incr ...",
+ print("Testing incr ...")
x = mc.incr("an_integer", 1)
if x == 43:
- print "OK"
+ print("OK")
else:
- print "FAIL"
+ print("FAIL")
- print "Testing decr ...",
+ print("Testing decr ...")
x = mc.decr("an_integer", 1)
if x == 42:
- print "OK"
+ print("OK")
else:
- print "FAIL"
-
+ print("FAIL")
# vim: ts=4 sw=4 et :
diff --git a/cheetah/Utils/statprof.py b/cheetah/Utils/statprof.py
index 55638eb..d6d64d6 100644
--- a/cheetah/Utils/statprof.py
+++ b/cheetah/Utils/statprof.py
@@ -277,15 +277,15 @@ class CallStats(object):
self.cum_secs_per_call = None
def display(self):
- print '%6.2f %9.2f %9.2f %s' % (self.pcnt_time_in_proc,
+ print('%6.2f %9.2f %9.2f %s' % (self.pcnt_time_in_proc,
self.cum_secs_in_proc,
self.self_secs_in_proc,
- self.name)
+ self.name))
def display():
if state.sample_count == 0:
- print 'No samples recorded.'
+ print('No samples recorded.')
return
l = [CallStats(x) for x in call_data.itervalues()]
@@ -293,12 +293,12 @@ def display():
l.sort(reverse=True)
l = [x[2] for x in l]
- print '%5.5s %10.10s %7.7s %-8.8s' % ('% ', 'cumulative', 'self', '')
- print '%5.5s %9.9s %8.8s %-8.8s' % ("time", "seconds", "seconds", "name")
+ print('%5.5s %10.10s %7.7s %-8.8s' % ('% ', 'cumulative', 'self', ''))
+ print('%5.5s %9.9s %8.8s %-8.8s' % ("time", "seconds", "seconds", "name"))
for x in l:
x.display()
- print '---'
- print 'Sample count: %d' % state.sample_count
- print 'Total time: %f seconds' % state.accumulated_time
+ print('---')
+ print('Sample count: %d' % state.sample_count)
+ print('Total time: %f seconds' % state.accumulated_time)
diff --git a/cheetah/Version.py b/cheetah/Version.py
index 7fdf82f..9cc2e91 100644
--- a/cheetah/Version.py
+++ b/cheetah/Version.py
@@ -32,11 +32,11 @@ def convertVersionStringToTuple(s):
if __name__ == '__main__':
c = convertVersionStringToTuple
- print c('2.0a1')
- print c('2.0b1')
- print c('2.0rc1')
- print c('2.0')
- print c('2.0.2')
+ print(c('2.0a1'))
+ print(c('2.0b1'))
+ print(c('2.0rc1'))
+ print(c('2.0'))
+ print(c('2.0.2'))
assert c('0.9.19b1') < c('0.9.19')