diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-10-03 06:25:00 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-10-03 06:25:00 +0200 |
commit | d4ed069896a9d49eb33966a0f871e39b5c24da8a (patch) | |
tree | 1c923e288e1641b8a08a71891e3ee5ea1e4dfde5 /engine/SCons/Memoize.py | |
parent | 3765e33b76c51c81dd7bbbfacab0c4e76a1713cb (diff) | |
parent | 13e92f02338ad8d28d58fcd7c9f46d0d5e970e54 (diff) |
Merge branch 'release/3.0.0-1'3.0.0-1
Diffstat (limited to 'engine/SCons/Memoize.py')
-rw-r--r-- | engine/SCons/Memoize.py | 20 |
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() |