[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 39ea49d5ebaa27e907c3c87e94ab70471e191eaf
Author: Philipp Winter <phw@xxxxxxxxx>
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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits