commit 5eebd00ece41ce0b09ef72cf9d15183bfb991e2e Author: Damian Johnson atagar@torproject.org Date: Wed Jan 1 13:15:28 2014 -0800
Correcting issues caught by pep8
Not entirely thrilled about some of the overindent changes, but meh. --- arm/arguments.py | 36 ++++++++++++++++++++++++++++-------- arm/starter.py | 3 ++- arm/util/tracker.py | 9 ++++++--- test/util/authenticate.py | 2 +- test/util/init_controller.py | 2 +- 5 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/arm/arguments.py b/arm/arguments.py index dd19453..3d4a656 100644 --- a/arm/arguments.py +++ b/arm/arguments.py @@ -38,12 +38,30 @@ OPT_EXPANDED = [ ]
TOR_EVENT_TYPES = { - 'd': 'DEBUG', 'a': 'ADDRMAP', 'k': 'DESCCHANGED', 's': 'STREAM', - 'i': 'INFO', 'f': 'AUTHDIR_NEWDESCS', 'g': 'GUARD', 'r': 'STREAM_BW', - 'n': 'NOTICE', 'h': 'BUILDTIMEOUT_SET', 'l': 'NEWCONSENSUS', 't': 'STATUS_CLIENT', - 'w': 'WARN', 'b': 'BW', 'm': 'NEWDESC', 'u': 'STATUS_GENERAL', - 'e': 'ERR', 'c': 'CIRC', 'p': 'NS', 'v': 'STATUS_SERVER', - 'j': 'CLIENTS_SEEN', 'q': 'ORCONN'} + 'd': 'DEBUG', + 'i': 'INFO', + 'n': 'NOTICE', + 'w': 'WARN', + 'e': 'ERR', + + 'a': 'ADDRMAP', + 'f': 'AUTHDIR_NEWDESCS', + 'h': 'BUILDTIMEOUT_SET', + 'b': 'BW', + 'c': 'CIRC', + 'j': 'CLIENTS_SEEN', + 'k': 'DESCCHANGED', + 'g': 'GUARD', + 'l': 'NEWCONSENSUS', + 'm': 'NEWDESC', + 'p': 'NS', + 'q': 'ORCONN', + 's': 'STREAM', + 'r': 'STREAM_BW', + 't': 'STATUS_CLIENT', + 'u': 'STATUS_GENERAL', + 'v': 'STATUS_SERVER', +}
def parse(argv): @@ -114,7 +132,8 @@ def get_help(): :returns: **str** with our usage information """
- return msg('usage.help_output', + return msg( + 'usage.help_output', address = DEFAULT_ARGS['control_address'], port = DEFAULT_ARGS['control_port'], socket = DEFAULT_ARGS['control_socket'], @@ -131,7 +150,8 @@ def get_version(): :returns: **str** with our versioning information """
- return msg('usage.version_output', + return msg( + 'usage.version_output', version = arm.__version__, date = arm.__release_date__, ) diff --git a/arm/starter.py b/arm/starter.py index 2cd45ce..48611f3 100644 --- a/arm/starter.py +++ b/arm/starter.py @@ -131,7 +131,8 @@ def _setup_debug_logging(args): except IOError as exc: armrc_content = "[unable to read file: %s]" % exc.strerror
- trace('debug.header', + trace( + 'debug.header', arm_version = arm.__version__, stem_version = stem.__version__, python_version = '.'.join(map(str, sys.version_info[:3])), diff --git a/arm/util/tracker.py b/arm/util/tracker.py index 6148361..476b11e 100644 --- a/arm/util/tracker.py +++ b/arm/util/tracker.py @@ -379,7 +379,8 @@ class ConnectionTracker(Daemon): self._failure_count = 0
if self._resolvers: - notice('tracker.unable_to_use_resolver', + notice( + 'tracker.unable_to_use_resolver', old_resolver = resolver, new_resolver = self._resolvers[0], ) @@ -476,7 +477,8 @@ class ResourceTracker(Daemon): self._use_proc = False self._failure_count = 0
- info('tracker.abort_getting_resources', + info( + 'tracker.abort_getting_resources', resolver = 'proc', response = 'falling back to ps', exc = exc, @@ -487,7 +489,8 @@ class ResourceTracker(Daemon): if self._failure_count >= 3: # Give up on further attempts.
- info('tracker.abort_getting_resources', + info( + 'tracker.abort_getting_resources', resolver = 'ps', response = 'giving up on getting resource usage information', exc = exc, diff --git a/test/util/authenticate.py b/test/util/authenticate.py index 11bd92b..9dae10b 100644 --- a/test/util/authenticate.py +++ b/test/util/authenticate.py @@ -68,6 +68,6 @@ class TestAuthenticate(unittest.TestCase): try: init_controller(authenticate(controller, None)) self.fail() - except ValueError, exc: + except ValueError as exc: if not msg in str(exc): self.fail("Expected...\n\n%s\n\n... which couldn't be found in...\n\n%s" % (msg, exc)) diff --git a/test/util/init_controller.py b/test/util/init_controller.py index a106a06..cbbeffa 100644 --- a/test/util/init_controller.py +++ b/test/util/init_controller.py @@ -63,5 +63,5 @@ class TestGetController(unittest.TestCase): try: init_controller(parse(args)) self.fail() - except ValueError, exc: + except ValueError as exc: self.assertEqual(msg, str(exc))