##// END OF EJS Templates
lru-cache: fixed iterators on python3
super-admin -
r5007:79d8fb28 default
parent child Browse files
Show More
@@ -54,7 +54,7 b' class LRUDict(LRUCache):'
54 54 del self.data[key]
55 55
56 56 def keys(self):
57 return self.data.keys()
57 return list(self.data.keys())
58 58
59 59
60 60 class LRUDictDebug(LRUDict):
@@ -62,12 +62,13 b' class LRUDictDebug(LRUDict):'
62 62 Wrapper to provide some debug options
63 63 """
64 64 def _report_keys(self):
65 elems_cnt = '%s/%s' % (len(self.keys()), self.size)
65
66 66 # trick for pformat print it more nicely
67 67 fmt = '\n'
68 68 for cnt, elem in enumerate(self.keys()):
69 fmt += '%s - %s\n' % (cnt+1, safe_str(elem))
70 log.debug('current LRU keys (%s):%s', elems_cnt, fmt)
69 fmt += f'{cnt+1} - {safe_str(elem)}\n'
70
71 log.debug('current LRU keys (%s/%s):%s', len(self.keys()), self.size, fmt)
71 72
72 73 def __getitem__(self, key):
73 74 self._report_keys()
General Comments 0
You need to be logged in to leave comments. Login now