commit 5c646aa195364ad9d410979057d6a6879aa7d17e Author: Isis Lovecruft isis@torproject.org Date: Sun Jan 12 01:23:24 2014 +0000
Update/add docstrings for bridgedb.Bridges.FilteredBridgeSplitter. --- lib/bridgedb/Bridges.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/lib/bridgedb/Bridges.py b/lib/bridgedb/Bridges.py index 39148a5..dd0a7a9 100644 --- a/lib/bridgedb/Bridges.py +++ b/lib/bridgedb/Bridges.py @@ -1055,13 +1055,32 @@ class BridgeSplitter(BridgeHolder): ring.dumpAssignments(f, "%s %s" % (description, name))
class FilteredBridgeSplitter(BridgeHolder): - """ A configurable BridgeHolder that filters bridges - into subrings. - The set of subrings and conditions used to assign Bridges - are passed to the constructor as a list of (filterFn, ringName) + """A configurable BridgeHolder that filters bridges into subrings. + + The set of subrings and conditions used to assign :class:`Bridge`s should + be passed to :meth:`~FilteredBridgeSplitter.addRing`. """
def __init__(self, key, max_cached_rings=3): + """Create a hashring which filters bridges into sub hashrings. + + :type key: DOCDOC + :param key: An HMAC key. + :param int max_cached_rings: XXX max_cached_rings appears to not be + used anywhere. + + :ivar filterRings: A dictionary of subrings which has the form + ``{ringname: (filterFn, subring)}``, where: + - ``ringname`` is a unique string identifying the subring. + - ``filterFn`` is a callable which filters Bridges in some + manner, i.e. by whether they are IPv4 or IPv6, etc. + - ``subring`` is a :class:`BridgeHolder`. + :ivar hmac: DOCDOC + :ivar bridges: DOCDOC + :type distributorName: str + :ivar distributorName: The name of this splitter's distributor. See + :meth:`bridgedb.Dist.IPBasedDistributor.setDistributorName`. + """ self.key = key self.filterRings = {} self.hmac = get_hmac_fn(key, hex=True)