summaryrefslogtreecommitdiff
path: root/engine/SCons/Memoize.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-01 13:23:10 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-01 13:23:10 +0200
commit0414abd565dbdf12ea741930bef5268bc7fe6da3 (patch)
treeaa7e983f81ffe2090fa31869b6670bf18bcc28a0 /engine/SCons/Memoize.py
parent3765e33b76c51c81dd7bbbfacab0c4e76a1713cb (diff)
parent3bab2962eecc24c19366692e52ebca5eb835d117 (diff)
Merge branch 'feature/upstream' into develop
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()