[bridgedb/develop] Rename ipCategories → proxySets.

isis at torproject.org isis at torproject.org
Thu Jun 25 07:10:54 UTC 2015


commit 423f75d309abe304297cad2449e9a210347877da
Author: Isis Lovecruft <isis at torproject.org>
Date:   Fri Apr 10 07:37:24 2015 +0000

    Rename ipCategories → proxySets.
---
 lib/bridgedb/Dist.py                 |   16 ++++++++--------
 lib/bridgedb/test/test_HTTPServer.py |    4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/bridgedb/Dist.py b/lib/bridgedb/Dist.py
index f9f61de..2f63574 100644
--- a/lib/bridgedb/Dist.py
+++ b/lib/bridgedb/Dist.py
@@ -134,7 +134,7 @@ class IPBasedDistributor(Distributor):
         hashrings, one for each area in the ``areaMapper``. Every inserted
         bridge will go into one of these rings, and every area is associated
         with one.
-    :ivar categories: DOCDOC See :param:`ipCategories`.
+    :ivar categories: DOCDOC See :param:`proxySets`.
     :type splitter: :class:`bridgedb.Bridges.FixedBridgeSplitter`
     :ivar splitter: A hashring that assigns bridges to subrings with fixed
         proportions. Used to assign bridges into the subrings of this
@@ -142,7 +142,7 @@ class IPBasedDistributor(Distributor):
     """
 
     def __init__(self, areaMapper, numberOfClusters, key,
-                 ipCategories=None, answerParameters=None):
+                 proxySets=None, answerParameters=None):
         """Create a Distributor that decides which bridges to distribute based
         upon the client's IP address and the current time.
 
@@ -160,8 +160,8 @@ class IPBasedDistributor(Distributor):
         :param bytes key: The master HMAC key for this distributor. All added
             bridges are HMACed with this key in order to place them into the
             hashrings.
-        :type ipCategories: iterable or None
-        :param ipCategories: DOCDOC
+        :type proxySets: iterable or None
+        :param proxySets: DOCDOC
         :type answerParameters: :class:`bridgedb.Bridges.BridgeRingParameters`
         :param answerParameters: A mechanism for ensuring that the set of
             bridges that this distributor answers a client with fit certain
@@ -172,14 +172,14 @@ class IPBasedDistributor(Distributor):
         self.numberOfClusters = numberOfClusters
         self.answerParameters = answerParameters
 
-        if not ipCategories:
-            ipCategories = []
+        if not proxySets:
+            proxySets = []
         if not answerParameters:
             answerParameters = []
         self.rings = []
 
         self.categories = []
-        for c in ipCategories:
+        for c in proxySets:
             self.categories.append(c)
 
         key2 = getHMAC(key, "Assign-Bridges-To-Rings")
@@ -193,7 +193,7 @@ class IPBasedDistributor(Distributor):
         #
         # XXX Why is the "extra room" hardcoded to be 5? Shouldn't it be some
         #     fraction of the number of clusters/categories? --isis
-        ring_cache_size  = self.numberOfClusters + len(ipCategories) + 5
+        ring_cache_size  = self.numberOfClusters + len(proxySets) + 5
         self.splitter = bridgedb.Bridges.FilteredBridgeSplitter(
             key2, max_cached_rings=ring_cache_size)
         logging.debug("Added splitter %s to IPBasedDistributor."
diff --git a/lib/bridgedb/test/test_HTTPServer.py b/lib/bridgedb/test/test_HTTPServer.py
index c3cf79a..103976e 100644
--- a/lib/bridgedb/test/test_HTTPServer.py
+++ b/lib/bridgedb/test/test_HTTPServer.py
@@ -488,7 +488,7 @@ class DummyIPBasedDistributor(object):
     def _dumbAreaMapper(ip): return ip
 
     def __init__(self, areaMapper=None, numberOfClusters=None, key=None,
-                 ipCategories=None, answerParameters=None):
+                 proxySets=None, answerParameters=None):
         """None of the parameters are really used, they are just there to retain
         an identical method signature.
         """
@@ -496,7 +496,7 @@ class DummyIPBasedDistributor(object):
         self.numberOfClusters = 3
         self.nBridgesToGive = 3
         self.key = self.__class__.__name__
-        self.ipCategories = ipCategories
+        self.proxySets = proxySets
         self.answerParameters = answerParameters
 
     def getBridges(self, bridgeRequest=None, epoch=None, N=1):





More information about the tor-commits mailing list