[tor-commits] [bridgedb/master] Convert filter() output to list() before len().

phw at torproject.org phw at torproject.org
Wed Feb 19 18:26:38 UTC 2020


commit 39ea49d5ebaa27e907c3c87e94ab70471e191eaf
Author: Philipp Winter <phw at nymity.ch>
Date:   Mon Jan 27 16:29:14 2020 -0800

    Convert filter() output to list() before len().
    
    ...otherwise Python 3 will complain:
    
      TypeError: object of type 'filter' has no len()
---
 bridgedb/main.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bridgedb/main.py b/bridgedb/main.py
index 7776750..bc309c5 100644
--- a/bridgedb/main.py
+++ b/bridgedb/main.py
@@ -198,7 +198,7 @@ def load(state, hashring, clear=False):
         inserted = 0
         logging.info("Trying to insert %d bridges into hashring, %d of which "
                      "have the 'Running' flag..." % (len(bridges),
-                     len(filter(lambda b: b.flags.running, bridges.values()))))
+                     len(list(filter(lambda b: b.flags.running, bridges.values())))))
 
         for fingerprint, bridge in bridges.items():
             # Skip insertion of bridges which are geolocated to be in one of the





More information about the tor-commits mailing list