[Pkg-privacy-commits] [txtorcon] 43/96: pep8

Jérémy Bobbio lunar at moszumanska.debian.org
Sun Sep 6 18:33:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository txtorcon.

commit 504f2b1c64ee1e89464fba29f21c64b192e4d695
Author: meejah <meejah at meejah.ca>
Date:   Mon Feb 2 22:34:10 2015 -0700

    pep8
---
 test/test_endpoints.py         |  4 +++-
 test/test_torconfig.py         | 23 +++++++++++++----------
 test/test_torinfo.py           |  3 +--
 txtorcon/endpoints.py          |  1 +
 txtorcon/torconfig.py          |  2 ++
 txtorcon/torcontrolprotocol.py |  1 +
 6 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/test/test_endpoints.py b/test/test_endpoints.py
index 41f82d8..fd419a5 100644
--- a/test/test_endpoints.py
+++ b/test/test_endpoints.py
@@ -47,7 +47,7 @@ class EndpointTests(unittest.TestCase):
         self.protocol = FakeControlProtocol([])
         self.protocol.event_happened(
             'INFO',
-            'connection_dir_client_reached_eof(): Uploaded rendezvous '\
+            'connection_dir_client_reached_eof(): Uploaded rendezvous '
             'descriptor (status 200 ("Service descriptor (v2) stored"))'
         )
         self.config = TorConfig(self.protocol)
@@ -185,6 +185,7 @@ class EndpointTests(unittest.TestCase):
 
     def test_hiddenservice_key_unfound(self):
         ep = TCPHiddenServiceEndpoint.private_tor(self.reactor, 1234, hidden_service_dir='/dev/null')
+
         # FIXME Mock() should work somehow for this, but I couldn't make it "go"
         class Blam(object):
             @property
@@ -230,6 +231,7 @@ class EndpointTests(unittest.TestCase):
         # make sure listen() correctly configures our hidden-serivce
         # with the explicit directory we passed in above
         d = ep.listen(NoOpProtocolFactory())
+
         def foo(fail):
             print "ERROR", fail
         d.addErrback(foo)
diff --git a/test/test_torconfig.py b/test/test_torconfig.py
index 4d7bae3..a2e57ac 100644
--- a/test/test_torconfig.py
+++ b/test/test_torconfig.py
@@ -46,8 +46,8 @@ class FakeControlProtocol:
         self.post_bootstrap = defer.succeed(self)
         self.on_disconnect = defer.Deferred()
         self.sets = []
-        self.events = {} # event type -> callback
-        self.pending_events = {} # event type -> list
+        self.events = {}  #: event type -> callback
+        self.pending_events = {}  #: event type -> list
 
     def event_happened(self, event_type, *args):
         '''
@@ -397,6 +397,7 @@ class ConfigTests(unittest.TestCase):
         self.assertNotIn('_slutty_', conf.__dict__)
         self.assertNotIn('foo', conf)
 
+
 class LogTests(unittest.TestCase):
 
     def setUp(self):
@@ -684,7 +685,7 @@ HiddenServicePort=90 127.0.0.1:2345''')
 
         conf = TorConfig(self.protocol)
         self.assertTrue(self.protocol.post_bootstrap.called)
-        self.assertTrue(conf.post_bootstrap == None or conf.post_bootstrap.called)
+        self.assertTrue(conf.post_bootstrap is None or conf.post_bootstrap.called)
         self.assertEqual(len(conf.hiddenservices), 1)
         self.assertTrue(conf.hiddenservices[0].conf)
         conf.hiddenservices[0].version = 3
@@ -719,6 +720,7 @@ HiddenServicePort=90 127.0.0.1:2345''')
         conf.hiddenservices[0].ports.append('90 127.0.0.1:2345')
         self.assertTrue(conf.needs_save())
 
+
 class FakeReactor(task.Clock):
     implements(IReactorCore)
 
@@ -890,8 +892,10 @@ class LaunchTorTests(unittest.TestCase):
 
     def test_launch_with_timeout_no_ireactortime(self):
         config = TorConfig()
-        return self.assertRaises(RuntimeError,
-            launch_tor, config, None, timeout=5, tor_binary='/bin/echo')
+        return self.assertRaises(
+            RuntimeError,
+            launch_tor, config, None, timeout=5, tor_binary='/bin/echo'
+        )
 
     @patch('txtorcon.torconfig.sys')
     @patch('txtorcon.torconfig.pwd')
@@ -912,8 +916,8 @@ class LaunchTorTests(unittest.TestCase):
         self.protocol.answers.append('''config/names=
 DataDirectory String
 ControlPort Port''')
-        self.protocol.answers.append({'DataDirectory':'foo'})
-        self.protocol.answers.append({'ControlPort':0})
+        self.protocol.answers.append({'DataDirectory': 'foo'})
+        self.protocol.answers.append({'ControlPort': 0})
         config = TorConfig(self.protocol)
         yield config.post_bootstrap
         config.DataDirectory = '/dev/null'
@@ -937,8 +941,8 @@ ControlPort Port''')
         self.protocol.answers.append('''config/names=
 DataDirectory String
 ControlPort Port''')
-        self.protocol.answers.append({'DataDirectory':'foo'})
-        self.protocol.answers.append({'ControlPort':0})
+        self.protocol.answers.append({'DataDirectory': 'foo'})
+        self.protocol.answers.append({'ControlPort': 0})
         config = TorConfig(self.protocol)
         yield config.post_bootstrap
         config.DataDirectory = '/dev/null'
@@ -1271,7 +1275,6 @@ ControlPort Port''')
         return pp
 
 
-from mock import patch
 class ErrorTests(unittest.TestCase):
     @patch('txtorcon.torconfig.find_tor_binary')
     def test_no_tor_binary(self, ftb):
diff --git a/test/test_torinfo.py b/test/test_torinfo.py
index 7a7d2d1..19539e1 100644
--- a/test/test_torinfo.py
+++ b/test/test_torinfo.py
@@ -203,10 +203,9 @@ something/two a second documentation string
             all.append(x)
         self.assertTrue(len(all) == 2)
 
-
     def test_accessors_not_setup(self):
         info = TorInfo(self.protocol)
-        self.assertTrue(info.__dict__['_setup'] == False)
+        self.assertTrue(info.__dict__['_setup'] is False)
         self.assertRaises(TypeError, len, info)
         dir(info)
         try:
diff --git a/txtorcon/endpoints.py b/txtorcon/endpoints.py
index ef3c93c..e2e5619 100644
--- a/txtorcon/endpoints.py
+++ b/txtorcon/endpoints.py
@@ -389,6 +389,7 @@ class TCPHiddenServiceEndpoint(object):
 
         # listen for the descriptor upload event
         info_callback = defer.Deferred()
+
         def info_event(msg):
             # XXX giant hack here; Right Thing would be to implement a
             # "real" event in Tor and listen for that.
diff --git a/txtorcon/torconfig.py b/txtorcon/torconfig.py
index b715383..ffdd0d3 100644
--- a/txtorcon/torconfig.py
+++ b/txtorcon/torconfig.py
@@ -557,6 +557,7 @@ class CommaList(TorConfigType):
 class TimeIntervalCommaList(CommaList):
     pass
 
+
 ## FIXME: is this really a comma-list?
 class RouterList(CommaList):
     pass
@@ -591,6 +592,7 @@ config_types = [Boolean, Boolean_Auto, LineList, Integer, SignedInteger, Port,
 def is_list_config_type(klass):
     return 'List' in klass.__name__ or klass.__name__ in ['HiddenServices']
 
+
 def _wrapture(orig):
     """
     Returns a new method that wraps orig (the original method) with
diff --git a/txtorcon/torcontrolprotocol.py b/txtorcon/torcontrolprotocol.py
index ab5d8be..3c33423 100644
--- a/txtorcon/torcontrolprotocol.py
+++ b/txtorcon/torcontrolprotocol.py
@@ -305,6 +305,7 @@ class TorControlProtocol(LineOnlyReceiver):
     def stop_debug(self):
         def noop(*args, **kw):
             pass
+
         class NullLog(object):
             write = noop
             flush = noop

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/txtorcon.git



More information about the Pkg-privacy-commits mailing list