summaryrefslogtreecommitdiffstats
path: root/bench
diff options
context:
space:
mode:
authorStefan Zimmermann <zimmermann.code@gmail.com>2014-03-31 15:13:02 (GMT)
committerStefan Zimmermann <zimmermann.code@gmail.com>2014-03-31 15:13:02 (GMT)
commit1a1a11122ad28df19d305af879ba79a2b08ce7d4 (patch)
tree4464eb544fe0cc698ea4d1c5789e19770b83cd6f /bench
parent9f36c5b899b8d2d54cae8d3da76b01308c144ed6 (diff)
downloadSCons-1a1a11122ad28df19d305af879ba79a2b08ce7d4.zip
SCons-1a1a11122ad28df19d305af879ba79a2b08ce7d4.tar.gz
SCons-1a1a11122ad28df19d305af879ba79a2b08ce7d4.tar.bz2
Made former 2to3 changes Python 2.7 compatible (or removed unneeded changes).
Diffstat (limited to 'bench')
-rw-r--r--bench/bench.py4
-rw-r--r--bench/env.__setitem__.py4
-rw-r--r--bench/is_types.py12
-rw-r--r--bench/timeit.py4
4 files changed, 12 insertions, 12 deletions
diff --git a/bench/bench.py b/bench/bench.py
index 1a98d8c..f1d18c6 100644
--- a/bench/bench.py
+++ b/bench/bench.py
@@ -23,7 +23,7 @@
#
# This will allow (as much as possible) us to time just the code itself,
# not Python function call overhead.
-
+from __future__ import division, print_function
import getopt
import sys
@@ -94,7 +94,7 @@ exec(open(args[0], 'rU').read())
try:
FunctionList
except NameError:
- function_names = sorted([x for x in list(locals().keys()) if x[:4] == FunctionPrefix])
+ function_names = sorted([x for x in locals().keys() if x[:4] == FunctionPrefix])
l = [locals()[f] for f in function_names]
FunctionList = [f for f in l if isinstance(f, types.FunctionType)]
diff --git a/bench/env.__setitem__.py b/bench/env.__setitem__.py
index 284653e..9c27b6d 100644
--- a/bench/env.__setitem__.py
+++ b/bench/env.__setitem__.py
@@ -33,7 +33,7 @@ class Timing(object):
def times(num=1000000, init='', title='Results:', **statements):
# time each statement
timings = []
- for n, s in list(statements.items()):
+ for n, s in statements.items():
t = Timing(n, num, init, s)
t.timeit()
timings.append(t)
@@ -287,7 +287,7 @@ else:
# that the timer will use to get at these classes.
class_names = []
-for n in list(locals().keys()):
+for n in locals().keys():
#if n.startswith('env_'):
if n[:4] == 'env_':
class_names.append(n)
diff --git a/bench/is_types.py b/bench/is_types.py
index b6da0d2..69c029f 100644
--- a/bench/is_types.py
+++ b/bench/is_types.py
@@ -17,11 +17,11 @@ InstanceType = types.InstanceType
DictType = dict
ListType = list
StringType = str
-try: str
+try: unicode
except NameError:
UnicodeType = None
else:
- UnicodeType = str
+ UnicodeType = unicode
# The original implementations, pretty straightforward checks for the
@@ -36,7 +36,7 @@ def original_is_List(e):
if UnicodeType is not None:
def original_is_String(e):
- return isinstance(e, (str,UserString))
+ return isinstance(e, (str,unicode,UserString))
else:
def original_is_String(e):
return isinstance(e, (str,UserString))
@@ -58,7 +58,7 @@ def checkInstanceType_is_List(e):
if UnicodeType is not None:
def checkInstanceType_is_String(e):
return isinstance(e, str) \
- or isinstance(e, str) \
+ or isinstance(e, unicode) \
or (isinstance(e, types.InstanceType) and isinstance(e, UserString))
else:
def checkInstanceType_is_String(e):
@@ -84,7 +84,7 @@ if UnicodeType is not None:
def cache_type_e_is_String(e):
t = type(e)
return t is str \
- or t is str \
+ or t is unicode \
or (t is types.InstanceType and isinstance(e, UserString))
else:
def cache_type_e_is_String(e):
@@ -136,7 +136,7 @@ if UnicodeType is not None:
t = type(obj)
if t is types.InstanceType:
t = instanceTypeMap.get(obj.__class__, t)
- elif t is str:
+ elif t is unicode:
t = str
return t
else:
diff --git a/bench/timeit.py b/bench/timeit.py
index 2840010..7db0dd4 100644
--- a/bench/timeit.py
+++ b/bench/timeit.py
@@ -46,7 +46,7 @@ be aware of it. The baseline overhead can be measured by invoking the
program without arguments. The baseline overhead differs between
Python versions!
"""
-
+from __future__ import division, print_function
try:
import gc
@@ -245,7 +245,7 @@ def main(args=None):
precision = precision + 1
verbose = precision + 1
if o in ("-h", "--help"):
- print(__doc__, end=' ')
+ print(__doc__)
return 0
setup = "\n".join(setup) or "pass"
# Include the current directory, so that local imports work (sys.path