[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Manual provided options in the wrong order



commit 3c513aaddbec6e189de1e96d59c1d320fcaa7e29
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun May 28 15:58:32 2017 -0700

    Manual provided options in the wrong order
    
    We made an effort to provide tor's configuration options by their order in the
    man page, but we still used basic dicts a couple places. Ran into this due to a
    unit testing failure for python 3.6 where dicts seem to be ordered by default.
---
 stem/manual.py      | 20 ++++++++++----------
 test/unit/manual.py | 14 +++++++-------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/stem/manual.py b/stem/manual.py
index 86585a4..9287033 100644
--- a/stem/manual.py
+++ b/stem/manual.py
@@ -82,15 +82,15 @@ Category = stem.util.enum.Enum('GENERAL', 'CLIENT', 'RELAY', 'DIRECTORY', 'AUTHO
 GITWEB_MANUAL_URL = 'https://gitweb.torproject.org/tor.git/plain/doc/tor.1.txt'
 CACHE_PATH = os.path.join(os.path.dirname(__file__), 'cached_tor_manual.cfg')
 
-CATEGORY_SECTIONS = {
-  'GENERAL OPTIONS': Category.GENERAL,
-  'CLIENT OPTIONS': Category.CLIENT,
-  'SERVER OPTIONS': Category.RELAY,
-  'DIRECTORY SERVER OPTIONS': Category.DIRECTORY,
-  'DIRECTORY AUTHORITY SERVER OPTIONS': Category.AUTHORITY,
-  'HIDDEN SERVICE OPTIONS': Category.HIDDEN_SERVICE,
-  'TESTING NETWORK OPTIONS': Category.TESTING,
-}
+CATEGORY_SECTIONS = OrderedDict((
+  ('GENERAL OPTIONS', Category.GENERAL),
+  ('CLIENT OPTIONS', Category.CLIENT),
+  ('SERVER OPTIONS', Category.RELAY),
+  ('DIRECTORY SERVER OPTIONS', Category.DIRECTORY),
+  ('DIRECTORY AUTHORITY SERVER OPTIONS', Category.AUTHORITY),
+  ('HIDDEN SERVICE OPTIONS', Category.HIDDEN_SERVICE),
+  ('TESTING NETWORK OPTIONS', Category.TESTING),
+))
 
 
 class ConfigOption(object):
@@ -492,7 +492,7 @@ def _get_categories(content):
   if content and content[-1].startswith('Tor'):
     content = content[:-1]
 
-  categories = {}
+  categories = OrderedDict()
   category, lines = None, []
 
   for line in content:
diff --git a/test/unit/manual.py b/test/unit/manual.py
index 28a8a8b..0e6a50d 100644
--- a/test/unit/manual.py
+++ b/test/unit/manual.py
@@ -61,13 +61,6 @@ EXPECTED_FILES = {
 
 EXPECTED_CONFIG_OPTIONS = OrderedDict()
 
-EXPECTED_CONFIG_OPTIONS['Bridge'] = stem.manual.ConfigOption(
-  name = 'Bridge',
-  category = 'Client',
-  usage = '[transport] IP:ORPort [fingerprint]',
-  summary = 'Available bridges',
-  description = 'When set along with UseBridges, instructs Tor to use the relay at "IP:ORPort" as a "bridge" relaying into the Tor network. If "fingerprint" is provided (using the same format as for DirAuthority), we will verify that the relay running at that location has the right fingerprint. We also use fingerprint to look up the bridge descriptor at the bridge authority, if it\'s provided and if UpdateBridgesFromAuthority is set too.\n\nIf "transport" is provided, and matches to a ClientTransportPlugin line, we use that pluggable transports proxy to transfer data to the bridge.')
-
 EXPECTED_CONFIG_OPTIONS['BandwidthRate'] = stem.manual.ConfigOption(
   name = 'BandwidthRate',
   category = 'General',
@@ -89,6 +82,13 @@ EXPECTED_CONFIG_OPTIONS['MaxAdvertisedBandwidth'] = stem.manual.ConfigOption(
   summary = 'Limit for the bandwidth we advertise as being available for relaying',
   description = 'If set, we will not advertise more than this amount of bandwidth for our BandwidthRate. Server operators who want to reduce the number of clients who ask to build circuits through them (since this is proportional to advertised bandwidth rate) can thus reduce the CPU demands on their server without impacting network performance.')
 
+EXPECTED_CONFIG_OPTIONS['Bridge'] = stem.manual.ConfigOption(
+  name = 'Bridge',
+  category = 'Client',
+  usage = '[transport] IP:ORPort [fingerprint]',
+  summary = 'Available bridges',
+  description = 'When set along with UseBridges, instructs Tor to use the relay at "IP:ORPort" as a "bridge" relaying into the Tor network. If "fingerprint" is provided (using the same format as for DirAuthority), we will verify that the relay running at that location has the right fingerprint. We also use fingerprint to look up the bridge descriptor at the bridge authority, if it\'s provided and if UpdateBridgesFromAuthority is set too.\n\nIf "transport" is provided, and matches to a ClientTransportPlugin line, we use that pluggable transports proxy to transfer data to the bridge.')
+
 CACHED_MANUAL = None
 
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits