Replace iteritems/itervalues/iterkeys with native versions. (#7692)

This commit is contained in:
Patrick Cloke 2020-06-15 07:03:36 -04:00 committed by GitHub
parent 2d11ea385c
commit bd6dc17221
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 184 additions and 263 deletions

View file

@ -16,8 +16,6 @@
import logging
from collections import OrderedDict
from six import iteritems, itervalues
from synapse.config import cache as cache_config
from synapse.metrics.background_process_metrics import run_as_background_process
from synapse.util.caches import register_cache
@ -150,7 +148,7 @@ class ExpiringCache(object):
keys_to_delete = set()
for key, cache_entry in iteritems(self._cache):
for key, cache_entry in self._cache.items():
if now - cache_entry.time > self._expiry_ms:
keys_to_delete.add(key)
@ -170,7 +168,7 @@ class ExpiringCache(object):
def __len__(self):
if self.iterable:
return sum(len(entry.value) for entry in itervalues(self._cache))
return sum(len(entry.value) for entry in self._cache.values())
else:
return len(self._cache)