/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-02-03 23:21:15 UTC
  • mfrom: (7290.42.6 paramiko-compat)
  • Revision ID: breezy.the.bot@gmail.com-20200203232115-g7k11bhsfeiqcprv
Fix compatibility with newer versions of paramiko, which break on noise before keys in pem files.

Merged from https://code.launchpad.net/~jelmer/brz/paramiko-compat/+merge/378480

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
    )
24
28
 
25
29
 
26
30
_null_key = object()
132
136
        :return: An unordered list of keys that are currently cached.
133
137
        """
134
138
        # GZ 2016-06-04: Maybe just make this return the view?
135
 
        return list(self._cache.keys())
 
139
        return list(viewkeys(self._cache))
136
140
 
137
141
    def as_dict(self):
138
142
        """Get a new dict with the same key:value pairs as the cache"""
139
 
        return dict((k, n.value) for k, n in self._cache.items())
 
143
        return dict((k, n.value) for k, n in viewitems(self._cache))
140
144
 
141
145
    def cleanup(self):
142
146
        """Clear the cache until it shrinks to the requested size.