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

[tor-commits] [bridgedb/master] PEP8 fixes for several lines in Dist.getNumBridgesPerAnswer().



commit 7c9c93b0e8324104141b2c0bc4a4972e47c76ed4
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Sat Jan 11 16:03:35 2014 +0000

    PEP8 fixes for several lines in Dist.getNumBridgesPerAnswer().
    
    Several `if` clauses are split to the next line, and an unneeded
    line-continued backslash is removed from the parameters for a call to
    the logger.
---
 lib/bridgedb/Dist.py |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/bridgedb/Dist.py b/lib/bridgedb/Dist.py
index 840881d..130a1b2 100644
--- a/lib/bridgedb/Dist.py
+++ b/lib/bridgedb/Dist.py
@@ -36,12 +36,16 @@ def uniformMap(ip):
         return ".".join(ip.split(".")[:3])
 
 def getNumBridgesPerAnswer(ring, max_bridges_per_answer=3):
-    if len(ring) < 20: n_bridges_per_answer = 1
-    if 20 <= len(ring) < 100: n_bridges_per_answer = min(2, max_bridges_per_answer)
-    if len(ring) >= 100: n_bridges_per_answer = max_bridges_per_answer
+    if len(ring) < 20:
+        n_bridges_per_answer = 1
+    if 20 <= len(ring) < 100:
+        n_bridges_per_answer = min(2, max_bridges_per_answer)
+    if len(ring) >= 100:
+        n_bridges_per_answer = max_bridges_per_answer
+
+    logging.debug("Returning %d bridges from ring of len: %d" %
+                  (n_bridges_per_answer, len(ring)))
 
-    logging.debug("Returning %d bridges from ring of len: %d" % \
-            (n_bridges_per_answer, len(ring)))
     return n_bridges_per_answer
 
 class IPBasedDistributor(bridgedb.Bridges.BridgeHolder):



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