remove uses of twisted.internet.defer.returnValue
This function has been deprecated in Twisted 24.7.0.
This commit is contained in:
parent
67208fb87e
commit
4326d01956
14 changed files with 36 additions and 41 deletions
|
|
@ -305,7 +305,7 @@ class Discovery(object):
|
|||
)
|
||||
items = disco.DiscoItems()
|
||||
|
||||
defer.returnValue(items)
|
||||
return items
|
||||
|
||||
def _infos_eb(self, failure_, entity_jid):
|
||||
failure_.trap(StanzaError)
|
||||
|
|
@ -480,15 +480,13 @@ class Discovery(object):
|
|||
|
||||
extensions[form_type or ""] = fields
|
||||
|
||||
defer.returnValue(
|
||||
(
|
||||
[str(f) for f in disco_infos.features],
|
||||
[
|
||||
(cat, type_, name or "")
|
||||
for (cat, type_), name in list(disco_infos.identities.items())
|
||||
],
|
||||
extensions,
|
||||
)
|
||||
return (
|
||||
[str(f) for f in disco_infos.features],
|
||||
[
|
||||
(cat, type_, name or "")
|
||||
for (cat, type_), name in list(disco_infos.identities.items())
|
||||
],
|
||||
extensions,
|
||||
)
|
||||
|
||||
def items2tuples(self, disco_items):
|
||||
|
|
@ -516,5 +514,4 @@ class Discovery(object):
|
|||
client = self.host.get_client(profile_key)
|
||||
entity = jid.JID(entity_jid_s)
|
||||
disco_items = yield self.get_items(client, entity, node, use_cache)
|
||||
ret = list(self.items2tuples(disco_items))
|
||||
defer.returnValue(ret)
|
||||
return list(self.items2tuples(disco_items))
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ class EncryptionHandler:
|
|||
client = host.get_client(profile)
|
||||
peer_jid = jid.JID(data["jid"]).userhostJID()
|
||||
ui = yield client.encryption.get_trust_ui(peer_jid, plg.namespace)
|
||||
defer.returnValue({"xmlui": ui.toXml()})
|
||||
return {"xmlui": ui.toXml()}
|
||||
|
||||
## Triggers ##
|
||||
|
||||
|
|
|
|||
|
|
@ -141,13 +141,13 @@ class BlogImportPlugin(object):
|
|||
"service": comments_service,
|
||||
"node": comments_node,
|
||||
}
|
||||
defer.returnValue(recurse_kwargs)
|
||||
return recurse_kwargs
|
||||
else:
|
||||
if item_import_data["comments"][0]:
|
||||
raise exceptions.DataError(
|
||||
"allow_comments set to False, but comments are there"
|
||||
)
|
||||
defer.returnValue(None)
|
||||
return None
|
||||
|
||||
def publish_item(self, client, mb_data, service, node, session):
|
||||
log.debug(
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ class FileSharingManagement(object):
|
|||
|
||||
workflow will be interrupted with an error note
|
||||
@param reason(unicode): reason of the error
|
||||
@return (tuple): arguments to use in defer.returnValue
|
||||
@return (tuple): value to return
|
||||
"""
|
||||
status = self._c.STATUS.COMPLETED
|
||||
payload = None
|
||||
|
|
@ -140,7 +140,7 @@ class FileSharingManagement(object):
|
|||
def _get_root_args(self):
|
||||
"""Create the form to select the file to use
|
||||
|
||||
@return (tuple): arguments to use in defer.returnValue
|
||||
@return (tuple): value to return
|
||||
"""
|
||||
status = self._c.STATUS.EXECUTING
|
||||
form = data_form.Form(
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ class JingleStream(object):
|
|||
)
|
||||
|
||||
if not C.bool(confirm_data["answer"]):
|
||||
defer.returnValue(False)
|
||||
return False
|
||||
try:
|
||||
port = int(confirm_data["port"])
|
||||
except (ValueError, KeyError):
|
||||
|
|
@ -279,7 +279,7 @@ class JingleStream(object):
|
|||
finished_d = content_data["finished_d"] = defer.Deferred()
|
||||
args = [client, session, content_name, content_data]
|
||||
finished_d.addCallbacks(self._finished_cb, self._finished_eb, args, None, args)
|
||||
defer.returnValue(True)
|
||||
return True
|
||||
|
||||
def jingle_handler(self, client, action, session, content_name, desc_elt):
|
||||
content_data = session["contents"][content_name]
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ class ImportPlugin(object):
|
|||
pubsub_service,
|
||||
pubsub_node,
|
||||
)
|
||||
defer.returnValue(progress_id)
|
||||
return progress_id
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def recursive_import(
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ class MiscAccount(object):
|
|||
@defer.inlineCallbacks
|
||||
def verify(attempt):
|
||||
auth = yield PasswordHasher.verify(attempt, sat_cipher)
|
||||
defer.returnValue(auth)
|
||||
return auth
|
||||
|
||||
def error_ui(message=None):
|
||||
if not message:
|
||||
|
|
@ -443,8 +443,8 @@ class MiscAccount(object):
|
|||
verified = yield verify(delete_passwd)
|
||||
assert isinstance(verified, bool)
|
||||
if verified:
|
||||
defer.returnValue(self.__delete_account(profile))
|
||||
defer.returnValue(error_ui())
|
||||
return self.__delete_account(profile)
|
||||
return error_ui()
|
||||
|
||||
# check for blog posts deletion
|
||||
if 'GROUPBLOG' in self.host.plugins:
|
||||
|
|
@ -457,8 +457,8 @@ class MiscAccount(object):
|
|||
verified = yield verify(delete_posts_passwd)
|
||||
assert isinstance(verified, bool)
|
||||
if verified:
|
||||
defer.returnValue(self.__delete_blog_posts(posts, comments, profile))
|
||||
defer.returnValue(error_ui())
|
||||
return self.__delete_blog_posts(posts, comments, profile)
|
||||
return error_ui()
|
||||
"""
|
||||
|
||||
# check for password modification
|
||||
|
|
@ -471,16 +471,14 @@ class MiscAccount(object):
|
|||
if verified:
|
||||
if new_passwd1 == new_passwd2:
|
||||
data = yield self.__change_password(new_passwd1, profile=profile)
|
||||
defer.returnValue(data)
|
||||
return data
|
||||
else:
|
||||
defer.returnValue(
|
||||
error_ui(
|
||||
D_("The values entered for the new password are not equal.")
|
||||
)
|
||||
return error_ui(
|
||||
D_("The values entered for the new password are not equal.")
|
||||
)
|
||||
defer.returnValue(error_ui())
|
||||
return error_ui()
|
||||
|
||||
defer.returnValue({})
|
||||
return {}
|
||||
|
||||
def __change_password(self, password, profile):
|
||||
"""Ask for a confirmation before changing the XMPP account and SàT profile passwords.
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ class MergeRequests(object):
|
|||
request_data = ticket.named_widgets[FIELD_DATA].value
|
||||
parsed_data = yield self.parse_data(request_type, request_data)
|
||||
parsed_patches.append(parsed_data)
|
||||
defer.returnValue((tickets_xmlui, metadata, parsed_patches))
|
||||
return (tickets_xmlui, metadata, parsed_patches)
|
||||
|
||||
def _set(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class TicketsImportPlugin(object):
|
|||
session["schema"] = yield self._s.get_schema_form(
|
||||
client, service, node or session["root_node"]
|
||||
)
|
||||
defer.returnValue(item_import_data)
|
||||
return item_import_data
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def import_sub_items(self, client, item_import_data, ticket_data, session, options):
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class XEP_0048(object):
|
|||
raise NotImplementedError
|
||||
else:
|
||||
raise ValueError("storage_type must be 'private' or 'pubsub'")
|
||||
defer.returnValue(data)
|
||||
return data
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def _set_server_bookmarks(self, storage_type, bookmarks_elt, profile):
|
||||
|
|
|
|||
|
|
@ -964,7 +964,7 @@ class XEP_0060(object):
|
|||
# log.debug(u"Skip the items retrieval for [{node}]: node doesn't exist".format(node=node))
|
||||
# continue # avoid pubsub "item-not-found" error
|
||||
# d_dict[publisher] = self.get_items(service, node, max_items, None, sub_id, rsm, client.profile)
|
||||
# defer.returnValue(d_dict)
|
||||
# return d_dict
|
||||
|
||||
def getOptions(
|
||||
self,
|
||||
|
|
@ -1667,7 +1667,7 @@ class XEP_0060(object):
|
|||
# log.debug(u"Skip the subscription to [{node}]: node doesn't exist".format(node=nodeIdentifier))
|
||||
# continue # avoid sat-pubsub "SubscriptionExists" error
|
||||
# d_list.append(client.pubsub_client.subscribe(service, nodeIdentifier, sub_jid or client.pubsub_client.parent.jid.userhostJID(), options=options))
|
||||
# defer.returnValue(d_list)
|
||||
# return d_list
|
||||
|
||||
# get #
|
||||
|
||||
|
|
|
|||
|
|
@ -1399,7 +1399,7 @@ class XEP_0166:
|
|||
jingle_elt, session, request, client, with_application=False
|
||||
)
|
||||
except exceptions.CancelError:
|
||||
defer.returnValue(None)
|
||||
return None
|
||||
|
||||
client.send(xmlstream.toResponse(request, "result"))
|
||||
|
||||
|
|
@ -1433,7 +1433,7 @@ class XEP_0166:
|
|||
reject_jingle_elt.addChild(child)
|
||||
|
||||
iq_elt.send()
|
||||
defer.returnValue(None)
|
||||
return None
|
||||
|
||||
# at this point, everything is alright and we can replace the transport(s)
|
||||
# this is similar to an session-accept action, but for transports only
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ class XEP_0277(object):
|
|||
# if other plugins have things to add or change
|
||||
yield self.host.trigger.point("XEP-0277_item2data", item_elt, entry_elt, mb_data)
|
||||
|
||||
defer.returnValue(mb_data)
|
||||
return mb_data
|
||||
|
||||
async def mb_data_2_entry_elt(self, client, mb_data, item_id, service, node):
|
||||
"""Convert a data dict to en entry usable to create an item
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ class RTDeferredSessions(memory.Sessions):
|
|||
# we can cleanly finish the session
|
||||
self._purge_session(session_id, got_result=True)
|
||||
|
||||
defer.returnValue((len(filtered_data), results))
|
||||
return (len(filtered_data), results)
|
||||
|
||||
# we wait for a result
|
||||
return session_data[KEY_NEXT].addCallback(next_cb)
|
||||
|
|
|
|||
Loading…
Reference in a new issue