# HG changeset patch # User Povilas Kanapickas # Date 1733872629 -7200 # Node ID e9971a4b062740b54521f4cf488419e78e4ae7fb # Parent ea72364131d57a7617621e89d0c5002773f8821a remove uses of twisted.internet.defer.returnValue This function has been deprecated in Twisted 24.7.0. diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/memory/disco.py --- a/libervia/backend/memory/disco.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/memory/disco.py Wed Dec 11 01:17:09 2024 +0200 @@ -305,7 +305,7 @@ ) items = disco.DiscoItems() - defer.returnValue(items) + return items def _infos_eb(self, failure_, entity_jid): failure_.trap(StanzaError) @@ -480,15 +480,13 @@ 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 @@ 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)) diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/memory/encryption.py --- a/libervia/backend/memory/encryption.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/memory/encryption.py Wed Dec 11 01:17:09 2024 +0200 @@ -487,7 +487,7 @@ 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 ## diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/plugins/plugin_blog_import.py --- a/libervia/backend/plugins/plugin_blog_import.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/plugins/plugin_blog_import.py Wed Dec 11 01:17:09 2024 +0200 @@ -141,13 +141,13 @@ "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( diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/plugins/plugin_comp_file_sharing_management.py --- a/libervia/backend/plugins/plugin_comp_file_sharing_management.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/plugins/plugin_comp_file_sharing_management.py Wed Dec 11 01:17:09 2024 +0200 @@ -130,7 +130,7 @@ 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 @@ 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( diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/plugins/plugin_exp_jingle_stream.py --- a/libervia/backend/plugins/plugin_exp_jingle_stream.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/plugins/plugin_exp_jingle_stream.py Wed Dec 11 01:17:09 2024 +0200 @@ -267,7 +267,7 @@ ) 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 @@ 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] diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/plugins/plugin_import.py --- a/libervia/backend/plugins/plugin_import.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/plugins/plugin_import.py Wed Dec 11 01:17:09 2024 +0200 @@ -259,7 +259,7 @@ pubsub_service, pubsub_node, ) - defer.returnValue(progress_id) + return progress_id @defer.inlineCallbacks def recursive_import( diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/plugins/plugin_misc_account.py --- a/libervia/backend/plugins/plugin_misc_account.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/plugins/plugin_misc_account.py Wed Dec 11 01:17:09 2024 +0200 @@ -425,7 +425,7 @@ @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 @@ 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 @@ 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 @@ 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. diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/plugins/plugin_misc_merge_requests.py --- a/libervia/backend/plugins/plugin_misc_merge_requests.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/plugins/plugin_misc_merge_requests.py Wed Dec 11 01:17:09 2024 +0200 @@ -251,7 +251,7 @@ 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, diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/plugins/plugin_tickets_import.py --- a/libervia/backend/plugins/plugin_tickets_import.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/plugins/plugin_tickets_import.py Wed Dec 11 01:17:09 2024 +0200 @@ -124,7 +124,7 @@ 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): diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/plugins/plugin_xep_0048.py --- a/libervia/backend/plugins/plugin_xep_0048.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/plugins/plugin_xep_0048.py Wed Dec 11 01:17:09 2024 +0200 @@ -156,7 +156,7 @@ 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): diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/plugins/plugin_xep_0060.py --- a/libervia/backend/plugins/plugin_xep_0060.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/plugins/plugin_xep_0060.py Wed Dec 11 01:17:09 2024 +0200 @@ -964,7 +964,7 @@ # 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 @@ # 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 # diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/plugins/plugin_xep_0166/__init__.py --- a/libervia/backend/plugins/plugin_xep_0166/__init__.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/plugins/plugin_xep_0166/__init__.py Wed Dec 11 01:17:09 2024 +0200 @@ -1399,7 +1399,7 @@ 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 @@ 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 diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/plugins/plugin_xep_0277.py --- a/libervia/backend/plugins/plugin_xep_0277.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/plugins/plugin_xep_0277.py Wed Dec 11 01:17:09 2024 +0200 @@ -605,7 +605,7 @@ # 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 diff -r ea72364131d5 -r e9971a4b0627 libervia/backend/tools/sat_defer.py --- a/libervia/backend/tools/sat_defer.py Tue Dec 03 00:53:18 2024 +0100 +++ b/libervia/backend/tools/sat_defer.py Wed Dec 11 01:17:09 2024 +0200 @@ -263,7 +263,7 @@ # 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)