commit 3def4de56f19aefcb584f59af7a84d1f648b10e2 Author: Isis Lovecruft isis@torproject.org Date: Tue Nov 5 08:29:01 2013 +0000
Separate pseudo-distributor dumping into function in bridgedb.runner.
* MOVE code for dumping bridges in 'unassigned' pseudo-distributor rings to new function, bridgedb.runner.doDumpBridges(). --- lib/bridgedb/Main.py | 5 +---- lib/bridgedb/runner.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/lib/bridgedb/Main.py b/lib/bridgedb/Main.py index 924b10c..3c5aa0c 100644 --- a/lib/bridgedb/Main.py +++ b/lib/bridgedb/Main.py @@ -25,7 +25,6 @@ import bridgedb.Bridges as Bridges import bridgedb.Dist as Dist import bridgedb.Time as Time import bridgedb.Storage -import bridgedb.Bucket as Bucket import bridgedb.Util as Util
@@ -473,9 +472,7 @@ def runSubcommand(options, config): from bridgedb import runner
if options('dump-bridges'): - bucketManager = Bucket.BucketManager(config) - bucketManager.assignBridgesToBuckets() - bucketManager.dumpBridges() + runner.doDumpBridges(config)
if options.subCommand is not None: logging.debug("Running BridgeDB command: '%s'" % options.subCommand) diff --git a/lib/bridgedb/runner.py b/lib/bridgedb/runner.py index 3ba61ec..425c0e8 100644 --- a/lib/bridgedb/runner.py +++ b/lib/bridgedb/runner.py @@ -95,3 +95,17 @@ def runTests(options): """ testModule = __import__('bridgedb.Tests', globals(), '', []) testModule.Tests.main() + +def doDumpBridges(config): + """Dump bridges by assignment to a file. + + This function handles the commandline '--dump-bridges' option. + + :type config: :class:`bridgedb.Main.Conf` + :param config: The current configuration. + """ + import bridgedb.Bucket as bucket + + bucketManager = bucket.BucketManager(config) + bucketManager.assignBridgesToBuckets() + bucketManager.dumpBridges()
tor-commits@lists.torproject.org