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

[or-cvs] r12954: report totals more accurately. (in bridgedb/trunk: . lib/bridgedb)



Author: nickm
Date: 2007-12-24 11:07:39 -0500 (Mon, 24 Dec 2007)
New Revision: 12954

Modified:
   bridgedb/trunk/
   bridgedb/trunk/lib/bridgedb/Bridges.py
   bridgedb/trunk/lib/bridgedb/Dist.py
Log:
 r15661@tombo:  nickm | 2007-12-24 11:07:22 -0500
 report totals more accurately.



Property changes on: bridgedb/trunk
___________________________________________________________________
 svk:merge ticket from /bridgedb/trunk [r15661] on d9e39d38-0f13-419c-a857-e10a0ce2aa0c

Modified: bridgedb/trunk/lib/bridgedb/Bridges.py
===================================================================
--- bridgedb/trunk/lib/bridgedb/Bridges.py	2007-12-24 11:37:16 UTC (rev 12953)
+++ bridgedb/trunk/lib/bridgedb/Bridges.py	2007-12-24 16:07:39 UTC (rev 12954)
@@ -362,6 +362,9 @@
     def assignmentsArePersistent(self):
         return False
 
+    def __len__(self):
+        return 0
+
 class BridgeTracker:
     """A stats tracker that records when we first saw and most recently
        saw each bridge.
@@ -395,7 +398,7 @@
 
     def __len__(self):
         n = 0
-        for r in self.rings:
+        for r in self.ringsByName.values():
             n += len(r)
         return n
 

Modified: bridgedb/trunk/lib/bridgedb/Dist.py
===================================================================
--- bridgedb/trunk/lib/bridgedb/Dist.py	2007-12-24 11:37:16 UTC (rev 12953)
+++ bridgedb/trunk/lib/bridgedb/Dist.py	2007-12-24 16:07:39 UTC (rev 12954)
@@ -80,6 +80,8 @@
         pos = self.areaOrderHmac("<%s>%s" % (epoch, area))
         return ring.getBridges(pos, N)
 
+    def __len__(self):
+        return sum(len(r) for r in self.rings)
 
 # These characters are the ones that RFC2822 allows.
 #ASPECIAL = '!#$%&*+-/=?^_`{|}~'
@@ -165,7 +167,7 @@
         localpart = localpart[:idx]
     # j.doe@ is the same as jdoe@.
     localpart = localpart.replace(".", "")
-    
+
     return "%s@%s"%(localpart, domain)
 
 class EmailBasedDistributor(bridgedb.Bridges.BridgeHolder):
@@ -221,3 +223,6 @@
         memo = "".join(b.getID() for b in result)
         self.store[emailaddress] = memo
         return result
+
+    def __len__(self):
+        return len(self.ring)