[tor-commits] [bridgedb/develop] Separate BridgeHolder class from Distributor.
isis at torproject.org
isis at torproject.org
Thu Jun 25 07:10:54 UTC 2015
commit de555a5908d18cbb04c34afa88a7138ab204753f
Author: Isis Lovecruft <isis at torproject.org>
Date: Thu Apr 9 06:35:27 2015 +0000
Separate BridgeHolder class from Distributor.
* FIXES part of #12506: https://bugs.torproject.org/12506
---
lib/bridgedb/Bridges.py | 1 -
lib/bridgedb/Dist.py | 3 ++-
lib/bridgedb/test/test_Main.py | 7 +++++--
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/bridgedb/Bridges.py b/lib/bridgedb/Bridges.py
index d9b28e2..c727c9a 100644
--- a/lib/bridgedb/Bridges.py
+++ b/lib/bridgedb/Bridges.py
@@ -449,7 +449,6 @@ class BridgeSplitter(BridgeHolder):
p -- the relative proportion of bridges to assign to this
bridgeholder.
"""
- assert isinstance(ring, BridgeHolder)
self.ringsByName[ringname] = ring
self.pValues.append(self.totalP)
self.rings.append(ringname)
diff --git a/lib/bridgedb/Dist.py b/lib/bridgedb/Dist.py
index 69d9eb6..954b570 100644
--- a/lib/bridgedb/Dist.py
+++ b/lib/bridgedb/Dist.py
@@ -92,7 +92,8 @@ def getNumBridgesPerAnswer(ring, max_bridges_per_answer=3):
return n_bridges_per_answer
-class Distributor(bridgedb.Bridges.BridgeHolder):
+
+class Distributor(object):
"""Distributes bridges to clients."""
def __init__(self):
diff --git a/lib/bridgedb/test/test_Main.py b/lib/bridgedb/test/test_Main.py
index 5ae4025..9c8b68c 100644
--- a/lib/bridgedb/test/test_Main.py
+++ b/lib/bridgedb/test/test_Main.py
@@ -27,7 +27,6 @@ from twisted.internet.threads import deferToThread
from twisted.trial import unittest
from bridgedb import Main
-from bridgedb.Bridges import BridgeHolder
from bridgedb.parse.options import parseOptions
@@ -59,13 +58,17 @@ def mockUpdateBridgeHistory(bridges, timestamps):
(fingerprint, timestamp))
-class MockBridgeHolder(BridgeHolder):
+class MockBridgeHolder(object):
def __init__(self):
self._bridges = {}
def __len__(self):
return len(self._bridges.keys())
def insert(self, bridge):
self._bridges[bridge.fingerprint] = bridge
+ def clear(self):
+ pass
+ def dumpAssignments(self):
+ pass
class MainTests(unittest.TestCase):
More information about the tor-commits
mailing list