Skip to content

Commit dc600f6

Browse files
authored
Merge pull request #114 from cjwatson/remove-defer-returnValue
Stop using twisted.internet.defer.returnValue
2 parents f7f3bcf + 9e9bdaa commit dc600f6

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/foolscap/connections/tor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os, re
22
import six
33
from twisted.internet.interfaces import IStreamClientEndpoint
4-
from twisted.internet.defer import inlineCallbacks, returnValue, succeed
4+
from twisted.internet.defer import inlineCallbacks, succeed
55
from twisted.internet.endpoints import clientFromString
66
import ipaddress
77
from .. import observer
@@ -71,7 +71,7 @@ def hint_to_endpoint(self, hint, reactor, update_status):
7171
socks_endpoint = yield self._maybe_connect(reactor, update_status)
7272
ep = txtorcon.TorClientEndpoint(host, portnum,
7373
socks_endpoint=socks_endpoint)
74-
returnValue( (ep, host) )
74+
return ep, host
7575

7676
def describe(self):
7777
return "tor"
@@ -133,7 +133,7 @@ def _connect(self, reactor, update_status):
133133
#print "launched"
134134
# gives a TorProcessProtocol with .tor_protocol
135135
self._tor_protocol = tpp.tor_protocol
136-
returnValue(socks_endpoint)
136+
return socks_endpoint
137137

138138
def launch(data_directory=None, tor_binary=None):
139139
"""Return a handler which launches a new Tor process (once).
@@ -189,7 +189,7 @@ def _connect(self, reactor, update_status):
189189
try:
190190
(socks_endpoint, socks_desc) = next(find_port(reactor, ports))
191191
self._socks_desc = socks_desc # stash for tests
192-
returnValue(socks_endpoint)
192+
return socks_endpoint
193193
except StopIteration:
194194
raise ValueError("could not use config.SocksPort: %r" % (ports,))
195195

src/foolscap/logging/web.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import six
33
from six.moves.urllib.parse import quote
44
from twisted.internet import reactor, endpoints
5-
from twisted.internet.defer import inlineCallbacks, returnValue
5+
from twisted.internet.defer import inlineCallbacks
66
from twisted.python import usage
77
from foolscap import base32
88
from foolscap.eventual import fireEventually
@@ -395,7 +395,7 @@ def start(self, options):
395395
import webbrowser
396396
webbrowser.open(url)
397397

398-
returnValue(url) # for tests
398+
return url # for tests
399399

400400
def stop(self):
401401
return self.lp.stopListening()

src/foolscap/test/test_logging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from twisted.trial import unittest
88
from twisted.application import service
99
from twisted.internet import defer, reactor
10-
from twisted.internet.defer import inlineCallbacks, returnValue
10+
from twisted.internet.defer import inlineCallbacks
1111
try:
1212
from twisted import logger as twisted_logger
1313
except ImportError:
@@ -2332,7 +2332,7 @@ def getPage(url):
23322332
if response.code != 200:
23332333
raise ValueError("request failed (%d), page contents were: %s" % (
23342334
response.code, six.ensure_str(page)))
2335-
returnValue(page)
2335+
return page
23362336

23372337
class Web(unittest.TestCase):
23382338
def setUp(self):

src/foolscap/test/test_negotiate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from twisted.trial import unittest
33

44
from twisted.internet import protocol, defer, reactor
5-
from twisted.internet.defer import inlineCallbacks, returnValue
5+
from twisted.internet.defer import inlineCallbacks
66
from twisted.application import internet
77
from twisted.web.client import Agent
88
from foolscap import negotiate, tokens
@@ -386,7 +386,7 @@ def connect2(self):
386386
# connection to be dropped, which will happen shortly after the
387387
# forward direction is established (but after some network traffic).
388388
yield self.poll(lambda: self.tub2phases)
389-
returnValue(rref1)
389+
return rref1
390390

391391
def checkConnectedViaReverse(self, rref, targetPhases):
392392
# assert that connection[0] (from tub1 to tub2) is actually in use.

0 commit comments

Comments
 (0)