[tor-commits] [stem/master] Conforming to E128 (continuation line under-indented for visual indent)
atagar at torproject.org
atagar at torproject.org
Mon Jan 7 09:08:00 UTC 2013
commit 9e45887a491b6b1938303bc3077d00673fca119a
Author: Damian Johnson <atagar at torproject.org>
Date: Sun Jan 6 20:40:51 2013 -0800
Conforming to E128 (continuation line under-indented for visual indent)
Meh.
---
stem/connection.py | 10 +++--
stem/util/connection.py | 5 +-
stem/util/proc.py | 6 ++-
test/check_whitespace.py | 2 +-
test/integ/descriptor/networkstatus.py | 10 +++--
test/unit/connection/authentication.py | 10 +++--
test/unit/control/controller.py | 27 +++++++++----
test/unit/descriptor/networkstatus/document_v3.py | 6 ++-
test/unit/util/conf.py | 42 +++++++++++++-------
9 files changed, 76 insertions(+), 42 deletions(-)
diff --git a/stem/connection.py b/stem/connection.py
index e4760ef..ee8f852 100644
--- a/stem/connection.py
+++ b/stem/connection.py
@@ -678,15 +678,17 @@ def authenticate_safecookie(controller, cookie_path, suppress_ctl_errors = True)
if not suppress_ctl_errors: raise exc
else: raise AuthChallengeFailed("Unable to parse AUTHCHALLENGE response: %s" % exc, cookie_path)
- expected_server_hash = stem.util.connection.hmac_sha256(SERVER_HASH_CONSTANT,
- cookie_data + client_nonce + authchallenge_response.server_nonce)
+ expected_server_hash = stem.util.connection.hmac_sha256(
+ SERVER_HASH_CONSTANT,
+ cookie_data + client_nonce + authchallenge_response.server_nonce)
if not stem.util.connection.cryptovariables_equal(authchallenge_response.server_hash, expected_server_hash):
raise AuthSecurityFailure("Tor provided the wrong server nonce", cookie_path)
try:
- client_hash = stem.util.connection.hmac_sha256(CLIENT_HASH_CONSTANT,
- cookie_data + client_nonce + authchallenge_response.server_nonce)
+ client_hash = stem.util.connection.hmac_sha256(
+ CLIENT_HASH_CONSTANT,
+ cookie_data + client_nonce + authchallenge_response.server_nonce)
auth_response = _msg(controller, "AUTHENTICATE %s" % (binascii.b2a_hex(client_hash)))
except stem.ControllerError, exc:
try: controller.connect()
diff --git a/stem/util/connection.py b/stem/util/connection.py
index c325bd9..91614b7 100644
--- a/stem/util/connection.py
+++ b/stem/util/connection.py
@@ -278,6 +278,7 @@ def cryptovariables_equal(x, y):
:returns: **True** if both strings are equal, **False** otherwise.
"""
- return (hmac_sha256(CRYPTOVARIABLE_EQUALITY_COMPARISON_NONCE, x) ==
- hmac_sha256(CRYPTOVARIABLE_EQUALITY_COMPARISON_NONCE, y))
+ return (
+ hmac_sha256(CRYPTOVARIABLE_EQUALITY_COMPARISON_NONCE, x) ==
+ hmac_sha256(CRYPTOVARIABLE_EQUALITY_COMPARISON_NONCE, y))
diff --git a/stem/util/proc.py b/stem/util/proc.py
index fd019cb..56b2928 100644
--- a/stem/util/proc.py
+++ b/stem/util/proc.py
@@ -55,8 +55,10 @@ CLOCK_TICKS = None
try: CLOCK_TICKS = os.sysconf(os.sysconf_names["SC_CLK_TCK"])
except AttributeError: pass
-Stat = stem.util.enum.Enum(("COMMAND", "command"), ("CPU_UTIME", "utime"),
- ("CPU_STIME", "stime"), ("START_TIME", "start time"))
+Stat = stem.util.enum.Enum(
+ ("COMMAND", "command"), ("CPU_UTIME", "utime"),
+ ("CPU_STIME", "stime"), ("START_TIME", "start time")
+)
def is_available():
"""
diff --git a/test/check_whitespace.py b/test/check_whitespace.py
index 0671d65..8419762 100644
--- a/test/check_whitespace.py
+++ b/test/check_whitespace.py
@@ -47,7 +47,7 @@ def pep8_issues(base_path = DEFAULT_TARGET):
# We're gonna trim these down by cateogry but include the pep8 checks to
# prevent regression.
- ignored_issues = "E111,E121,W293,E501,E302,E701,E251,E261,W391,E127,E241,E128"
+ ignored_issues = "E111,E121,W293,E501,E302,E701,E251,E261,W391,E127,E241"
issues = {}
pep8_output = system.call("pep8 --ignore %s %s" % (ignored_issues, base_path))
diff --git a/test/integ/descriptor/networkstatus.py b/test/integ/descriptor/networkstatus.py
index aa20169..2e179ec 100644
--- a/test/integ/descriptor/networkstatus.py
+++ b/test/integ/descriptor/networkstatus.py
@@ -132,8 +132,9 @@ class TestNetworkStatus(unittest.TestCase):
"0.2.3.19-rc",
)]
- expected_flags = set(["Authority", "BadExit", "Exit", "Fast", "Guard", "HSDir",
- "Named", "Running", "Stable", "Unnamed", "V2Dir", "Valid"])
+ expected_flags = set(
+ ["Authority", "BadExit", "Exit", "Fast", "Guard", "HSDir",
+ "Named", "Running", "Stable", "Unnamed", "V2Dir", "Valid"])
expected_bandwidth_weights = {
"Wbd": 3335, "Wbe": 0, "Wbg": 3536, "Wbm": 10000, "Wdb": 10000,
@@ -305,8 +306,9 @@ TpQQk3nNQF8z6UIvdlvP+DnJV4izWVkQEZgUZgIVM0E=
Checks that vote documents are properly parsed.
"""
- expected_flags = set(["Authority", "BadExit", "Exit", "Fast", "Guard", "HSDir",
- "Running", "Stable", "V2Dir", "Valid"])
+ expected_flags = set(
+ ["Authority", "BadExit", "Exit", "Fast", "Guard", "HSDir",
+ "Running", "Stable", "V2Dir", "Valid"])
expected_identity_key = """-----BEGIN RSA PUBLIC KEY-----
MIIBigKCAYEA6uSmsoxj2MiJ3qyZq0qYXlRoG8o82SNqg+22m+t1c7MlQOZWPJYn
diff --git a/test/unit/connection/authentication.py b/test/unit/connection/authentication.py
index fa4aba4..abc4af8 100644
--- a/test/unit/connection/authentication.py
+++ b/test/unit/connection/authentication.py
@@ -62,14 +62,16 @@ class TestAuthenticate(unittest.TestCase):
stem_logger.setLevel(log.logging_level(None))
# exceptions that the authentication functions are documented to raise
- all_auth_none_exc = (None,
- stem.connection.OpenAuthRejected(None))
- all_auth_password_exc = (None,
+ all_auth_none_exc = (None, stem.connection.OpenAuthRejected(None))
+
+ all_auth_password_exc = (
+ None,
stem.connection.PasswordAuthRejected(None),
stem.connection.IncorrectPassword(None))
- all_auth_cookie_exc = (None,
+ all_auth_cookie_exc = (
+ None,
stem.connection.IncorrectCookieSize(None, False, None),
stem.connection.UnreadableCookieFile(None, False, None),
stem.connection.CookieAuthRejected(None, False, None),
diff --git a/test/unit/control/controller.py b/test/unit/control/controller.py
index 624de39..c669870 100644
--- a/test/unit/control/controller.py
+++ b/test/unit/control/controller.py
@@ -53,8 +53,10 @@ class TestControl(unittest.TestCase):
mocking.mock_method(Controller, "get_info", mocking.raise_exception(InvalidArguments))
# Get a default value when the call fails.
- self.assertEqual("default returned",
- self.controller.get_version(default = "default returned"))
+ self.assertEqual(
+ "default returned",
+ self.controller.get_version(default = "default returned")
+ )
# No default value, accept the error.
self.assertRaises(InvalidArguments, self.controller.get_version)
@@ -138,8 +140,11 @@ class TestControl(unittest.TestCase):
mocking.mock_method(Controller, "get_info", mocking.return_value(
'"127.0.0.1:1112" "127.0.0.1:1114"'
))
- self.assertEqual([('127.0.0.1', 1112), ('127.0.0.1', 1114)],
- self.controller.get_socks_listeners())
+
+ self.assertEqual(
+ [('127.0.0.1', 1112), ('127.0.0.1', 1114)],
+ self.controller.get_socks_listeners()
+ )
# no SOCKS listeners
mocking.mock_method(Controller, "get_info", mocking.return_value(""))
@@ -175,8 +180,11 @@ class TestControl(unittest.TestCase):
mocking.mock(stem.connection.get_protocolinfo, mocking.raise_exception(ProtocolError))
# Get a default value when the call fails.
- self.assertEqual("default returned",
- self.controller.get_protocolinfo(default = "default returned"))
+
+ self.assertEqual(
+ "default returned",
+ self.controller.get_protocolinfo(default = "default returned")
+ )
# No default value, accept the error.
self.assertRaises(ProtocolError, self.controller.get_protocolinfo)
@@ -210,8 +218,11 @@ class TestControl(unittest.TestCase):
mocking.mock_method(Controller, "get_info", mocking.raise_exception(InvalidArguments))
# Get a default value when the call fails.
- self.assertEqual("default returned",
- self.controller.get_network_status(nickname, default = "default returned"))
+
+ self.assertEqual(
+ "default returned",
+ self.controller.get_network_status(nickname, default = "default returned")
+ )
# No default value, accept the error.
self.assertRaises(InvalidArguments, self.controller.get_network_status, nickname)
diff --git a/test/unit/descriptor/networkstatus/document_v3.py b/test/unit/descriptor/networkstatus/document_v3.py
index 009d365..6a825ea 100644
--- a/test/unit/descriptor/networkstatus/document_v3.py
+++ b/test/unit/descriptor/networkstatus/document_v3.py
@@ -41,7 +41,8 @@ class TestNetworkStatusDocument(unittest.TestCase):
document = get_network_status_document_v3()
- expected_known_flags = [Flag.AUTHORITY, Flag.BADEXIT, Flag.EXIT,
+ expected_known_flags = [
+ Flag.AUTHORITY, Flag.BADEXIT, Flag.EXIT,
Flag.FAST, Flag.GUARD, Flag.HSDIR, Flag.NAMED, Flag.RUNNING,
Flag.STABLE, Flag.UNNAMED, Flag.V2DIR, Flag.VALID]
@@ -75,7 +76,8 @@ class TestNetworkStatusDocument(unittest.TestCase):
document = get_network_status_document_v3({"vote-status": "vote"})
- expected_known_flags = [Flag.AUTHORITY, Flag.BADEXIT, Flag.EXIT,
+ expected_known_flags = [
+ Flag.AUTHORITY, Flag.BADEXIT, Flag.EXIT,
Flag.FAST, Flag.GUARD, Flag.HSDIR, Flag.NAMED, Flag.RUNNING,
Flag.STABLE, Flag.UNNAMED, Flag.V2DIR, Flag.VALID]
diff --git a/test/unit/util/conf.py b/test/unit/util/conf.py
index 8b85216..9006b54 100644
--- a/test/unit/util/conf.py
+++ b/test/unit/util/conf.py
@@ -82,25 +82,37 @@ class TestConf(unittest.TestCase):
self.assertEqual([], parse_enum_csv("my_option", "", Insects))
self.assertEqual([Insects.LADYBUG], parse_enum_csv("my_option", "ladybug", Insects))
- self.assertEqual([Insects.LADYBUG, Insects.BUTTERFLY],
- parse_enum_csv("my_option", "ladybug, butterfly", Insects))
+ self.assertEqual(
+ [Insects.LADYBUG, Insects.BUTTERFLY],
+ parse_enum_csv("my_option", "ladybug, butterfly", Insects)
+ )
- self.assertEqual([Insects.LADYBUG, Insects.BUTTERFLY, Insects.CRICKET],
- parse_enum_csv("my_option", "ladybug, butterfly, cricket", Insects))
+ self.assertEqual(
+ [Insects.LADYBUG, Insects.BUTTERFLY, Insects.CRICKET],
+ parse_enum_csv("my_option", "ladybug, butterfly, cricket", Insects)
+ )
# edge cases for count argument where things are ok
- self.assertEqual([Insects.LADYBUG, Insects.BUTTERFLY],
- parse_enum_csv("my_option", "ladybug, butterfly", Insects, 2))
-
- self.assertEqual([Insects.LADYBUG, Insects.BUTTERFLY],
- parse_enum_csv("my_option", "ladybug, butterfly", Insects, (1, 2)))
-
- self.assertEqual([Insects.LADYBUG, Insects.BUTTERFLY],
- parse_enum_csv("my_option", "ladybug, butterfly", Insects, (2, 3)))
-
- self.assertEqual([Insects.LADYBUG, Insects.BUTTERFLY],
- parse_enum_csv("my_option", "ladybug, butterfly", Insects, (2, 2)))
+ self.assertEqual(
+ [Insects.LADYBUG, Insects.BUTTERFLY],
+ parse_enum_csv("my_option", "ladybug, butterfly", Insects, 2)
+ )
+
+ self.assertEqual(
+ [Insects.LADYBUG, Insects.BUTTERFLY],
+ parse_enum_csv("my_option", "ladybug, butterfly", Insects, (1, 2))
+ )
+
+ self.assertEqual(
+ [Insects.LADYBUG, Insects.BUTTERFLY],
+ parse_enum_csv("my_option", "ladybug, butterfly", Insects, (2, 3))
+ )
+
+ self.assertEqual(
+ [Insects.LADYBUG, Insects.BUTTERFLY],
+ parse_enum_csv("my_option", "ladybug, butterfly", Insects, (2, 2))
+ )
# failure cases
More information about the tor-commits
mailing list