summary refs log tree commit diff
path: root/synapse/util/caches/treecache.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-01-17 11:44:57 +0000
committerErik Johnston <erik@matrix.org>2017-01-17 11:47:03 +0000
commitd6c75cb7c237a31252f0838d2aa6114cd58b2ad4 (patch)
tree7f851b05f0b5c44ce43e4935c84d3d9fe39cfe75 /synapse/util/caches/treecache.py
parentRemove needless call to evict() (diff)
downloadsynapse-d6c75cb7c237a31252f0838d2aa6114cd58b2ad4.tar.xz
Rename and comment tree_to_leaves_iterator
Diffstat (limited to '')
-rw-r--r--synapse/util/caches/treecache.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/util/caches/treecache.py b/synapse/util/caches/treecache.py
index 460e98a92d..fcc341a6b7 100644
--- a/synapse/util/caches/treecache.py
+++ b/synapse/util/caches/treecache.py
@@ -65,16 +65,19 @@ class TreeCache(object):
         return popped
 
     def values(self):
-        return list(popped_to_iterator(self.root))
+        return list(iterate_tree_cache_entry(self.root))
 
     def __len__(self):
         return self.size
 
 
-def popped_to_iterator(d):
+def iterate_tree_cache_entry(d):
+    """Helper function to iterate over the leaves of a tree, i.e. a dict of that
+    can contain dicts.
+    """
     if isinstance(d, dict):
         for value_d in d.itervalues():
-            for value in popped_to_iterator(value_d):
+            for value in iterate_tree_cache_entry(value_d):
                 yield value
     else:
         if isinstance(d, _Entry):