summary refs log tree commit diff
path: root/contrib/cmdclient/http.py
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2024-12-20 10:57:59 +0000
committerGitHub <noreply@github.com>2024-12-20 10:57:59 +0000
commitd69c00b5a19ba45645665afa532421b25c74407a (patch)
treebda017e2da19ec213aaccd5d4fd8a95b297efaab /contrib/cmdclient/http.py
parentRemove support for PostgreSQL 11 and 12 (#18034) (diff)
downloadsynapse-d69c00b5a19ba45645665afa532421b25c74407a.tar.xz
Stop using twisted.internet.defer.returnValue (#18020)
`defer.returnValue` was only needed in Python 2; in Python 3, a simple
`return` is fine.

`twisted.internet.defer.returnValue` is deprecated as of Twisted 24.7.0.

Most uses of `returnValue` in synapse were removed a while back; this
cleans up some remaining bits.
Diffstat (limited to 'contrib/cmdclient/http.py')
-rw-r--r--contrib/cmdclient/http.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/cmdclient/http.py b/contrib/cmdclient/http.py

index e6a10b5f32..54363e4259 100644 --- a/contrib/cmdclient/http.py +++ b/contrib/cmdclient/http.py
@@ -78,7 +78,7 @@ class TwistedHttpClient(HttpClient): url, data, headers_dict={"Content-Type": ["application/json"]} ) body = yield readBody(response) - defer.returnValue((response.code, body)) + return response.code, body @defer.inlineCallbacks def get_json(self, url, args=None): @@ -88,7 +88,7 @@ class TwistedHttpClient(HttpClient): url = "%s?%s" % (url, qs) response = yield self._create_get_request(url) body = yield readBody(response) - defer.returnValue(json.loads(body)) + return json.loads(body) def _create_put_request(self, url, json_data, headers_dict: Optional[dict] = None): """Wrapper of _create_request to issue a PUT request""" @@ -134,7 +134,7 @@ class TwistedHttpClient(HttpClient): response = yield self._create_request(method, url) body = yield readBody(response) - defer.returnValue(json.loads(body)) + return json.loads(body) @defer.inlineCallbacks def _create_request( @@ -173,7 +173,7 @@ class TwistedHttpClient(HttpClient): if self.verbose: print("Status %s %s" % (response.code, response.phrase)) print(pformat(list(response.headers.getAllRawHeaders()))) - defer.returnValue(response) + return response def sleep(self, seconds): d = defer.Deferred()