/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-12 01:45:56 UTC
  • mfrom: (7513.1.2 pypy3)
  • Revision ID: breezy.the.bot@gmail.com-20200612014556-tsc8assk3d0luziu
Avoid deprecated behaviour in ElementTree.

Merged from https://code.launchpad.net/~jelmer/brz/pypy3/+merge/385611

Show diffs side-by-side

added added

removed removed

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