Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Anti-censorship
BridgeDB
Commits
5c646aa1
Unverified
Commit
5c646aa1
authored
Jan 12, 2014
by
Isis Lovecruft
Browse files
Update/add docstrings for bridgedb.Bridges.FilteredBridgeSplitter.
parent
db5a0d28
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/bridgedb/Bridges.py
View file @
5c646aa1
...
...
@@ -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
ar
e 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
b
e 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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment