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

[tor-commits] [bridgedb/master] 5482 - Fix familiar function



commit 6639350579fa408849318fa1529fe940fa9003ec
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Mon Nov 5 13:34:21 2012 -0800

    5482 - Fix familiar function
    
    Sort function is already operating on list of weightedTimes.
---
 lib/bridgedb/Stability.py |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/bridgedb/Stability.py b/lib/bridgedb/Stability.py
index da66141..bdc4a4a 100644
--- a/lib/bridgedb/Stability.py
+++ b/lib/bridgedb/Stability.py
@@ -80,7 +80,6 @@ class BridgeHistory(object):
     def numDiscountRounds(self, discountUntilMillis):
         """ return the number of rounds of discounting needed to bring this
         history element current """
-              
         result = discountUntilMillis - self.lastDiscountedHistoryValues
         result = int(result/discountIntervalMillis)
         return max(result,0)
@@ -113,8 +112,8 @@ class BridgeHistory(object):
         allWeightedTimes = [ bh.weightedTime for bh in db.getAllBridgeHistory()]
         numBridges = len(allWeightedTimes)
         logging.debug("Got %d weightedTimes", numBridges)
-        allWeightedTimes.sort(lambda x,y: cmp(x.weightedTime, y.weightedTime))
-        if self.weightedTime > allWeightedTimes[numBridges/8].weightedTime:
+        allWeightedTimes.sort()
+        if self.weightedTime >= allWeightedTimes[numBridges/8]:
             return True
         return False
 



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