summaryrefslogtreecommitdiff
path: root/engine/SCons/Memoize.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-09-28 10:21:20 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-09-28 10:21:20 +0200
commit7c651e273c4db37f4babd91aaecf26800c50dd79 (patch)
tree21acf2b4172448f034a5cceb86ec34dd932fa4c0 /engine/SCons/Memoize.py
parent1d9b9f9adaf7a3b7582c243643c6405d4f5cd135 (diff)
New upstream version 3.0.0upstream/3.0.0
Diffstat (limited to 'engine/SCons/Memoize.py')
-rw-r--r--engine/SCons/Memoize.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/engine/SCons/Memoize.py b/engine/SCons/Memoize.py
index 10d3064..5fe481d 100644
--- a/engine/SCons/Memoize.py
+++ b/engine/SCons/Memoize.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2016 The SCons Foundation
+# Copyright (c) 2001 - 2017 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,8 +20,9 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
+from __future__ import print_function
-__revision__ = "src/engine/SCons/Memoize.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
+__revision__ = "src/engine/SCons/Memoize.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
__doc__ = """Memoizer
@@ -33,7 +34,7 @@ values in a consistent way. In particular, it requires that the class uses a
dictionary named "_memo" to store the cached values.
Here is an example of wrapping a method that returns a computed value,
-with no input parameters:
+with no input parameters::
@SCons.Memoize.CountMethodCall
def foo(self):
@@ -50,7 +51,7 @@ with no input parameters:
return result
Here is an example of wrapping a method that will return different values
-based on one or more input arguments:
+based on one or more input arguments::
def _bar_key(self, argument): # Memoization
return argument # Memoization
@@ -123,13 +124,12 @@ class Counter(object):
def key(self):
return self.cls_name+'.'+self.method_name
def display(self):
- fmt = " %7d hits %7d misses %s()"
- print fmt % (self.hit, self.miss, self.key())
- def __cmp__(self, other):
+ print(" {:7d} hits {:7d} misses {}()".format(self.hit, self.miss, self.key()))
+ def __eq__(self, other):
try:
- return cmp(self.key(), other.key())
+ return self.key() == other.key()
except AttributeError:
- return 0
+ return True
class CountValue(Counter):
"""
@@ -185,7 +185,7 @@ def Dump(title=None):
collected so far.
"""
if title:
- print title
+ print(title)
for counter in sorted(CounterList):
CounterList[counter].display()