mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-10 16:30:07 -04:00
Replace iteritems/itervalues/iterkeys with native versions. (#7692)
This commit is contained in:
parent
2d11ea385c
commit
bd6dc17221
47 changed files with 184 additions and 263 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue