Commit dcbd28d1 authored by Nick Mathewson's avatar Nick Mathewson 🎨
Browse files

r15661@tombo: nickm | 2007-12-24 11:07:22 -0500

 report totals more accurately.


svn:r12954
parent 5e9e9148
......@@ -362,6 +362,9 @@ class UnallocatedHolder(BridgeHolder):
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 @@ class BridgeSplitter(BridgeHolder):
def __len__(self):
n = 0
for r in self.rings:
for r in self.ringsByName.values():
n += len(r)
return n
......
......@@ -80,6 +80,8 @@ class IPBasedDistributor(bridgedb.Bridges.BridgeHolder):
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 @@ def normalizeEmail(addr, domainmap):
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 @@ class EmailBasedDistributor(bridgedb.Bridges.BridgeHolder):
memo = "".join(b.getID() for b in result)
self.store[emailaddress] = memo
return result
def __len__(self):
return len(self.ring)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment