/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/lru_cache.py

  • Committer: Martin
  • Date: 2017-06-05 20:48:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6658.
  • Revision ID: gzlist@googlemail.com-20170605204831-20accykspjcrx0a8
Apply 2to3 dict fixer and clean up resulting mess using view helpers

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from . import (
22
22
    trace,
23
23
    )
 
24
from .sixish import (
 
25
    viewitems,
 
26
    viewkeys,
 
27
    )
 
28
 
24
29
 
25
30
_null_key = object()
26
31
 
129
134
 
130
135
        :return: An unordered list of keys that are currently cached.
131
136
        """
132
 
        return self._cache.keys()
 
137
        # GZ 2016-06-04: Maybe just make this return the view?
 
138
        return list(viewkeys(self._cache))
133
139
 
134
140
    def as_dict(self):
135
141
        """Get a new dict with the same key:value pairs as the cache"""
136
 
        return dict((k, n.value) for k, n in self._cache.iteritems())
 
142
        return dict((k, n.value) for k, n in viewitems(self._cache))
137
143
 
138
144
    def cleanup(self):
139
145
        """Clear the cache until it shrinks to the requested size.