summaryrefslogtreecommitdiff
path: root/odoo/tools/lru.py
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2017-08-18 18:43:46 +0200
committerOlivier Dony <odo@openerp.com>2017-08-20 23:25:54 +0200
commit695716efb0f79f9a0e716952b1dcd433d866371a (patch)
tree1b582a3469d12fc716d6252b4f239f0cd40da9e4 /odoo/tools/lru.py
parent589c0d7e2c3a44adc5d26aac8af08c0d06b97d5a (diff)
[FIX] P3: remove pycompat.{keys,items,values} helpers
Now that we're closer to switching to P3 for good, these helpers have outlived their usefulness, and mostly add noise. All remaining dict.iter*() or dict.view*() must be converted to the normal keys(), values() or items() calls. Whenever the result is likely to be used for more than the scope of a loop, or when the dict needs to be modified during iteration, the calls must be wrapped in a ``list()``, to protect the new P3 semantics. Those cases are very exceptional. Also removed some dead code or improved the API to remove unnecessary conversions.
Diffstat (limited to 'odoo/tools/lru.py')
-rw-r--r--odoo/tools/lru.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/odoo/tools/lru.py b/odoo/tools/lru.py
index 21ecaf6383a..119fce0e1ee 100644
--- a/odoo/tools/lru.py
+++ b/odoo/tools/lru.py
@@ -2,7 +2,6 @@
# taken from http://code.activestate.com/recipes/252524-length-limited-o1-lru-cache-implementation/
import threading
-from odoo.tools import pycompat
from .func import synchronized
__all__ = ['LRU']
@@ -110,12 +109,11 @@ class LRU(object):
@synchronized()
def itervalues(self):
- for i,j in pycompat.items(self):
- yield j
+ return iter(self.d.values())
@synchronized()
def keys(self):
- return list(pycompat.keys(self.d))
+ return list(self.d)
@synchronized()
def pop(self,key):