Mercurial > libervia-backend
comparison libervia/backend/memory/disco.py @ 4341:e9971a4b0627
remove uses of twisted.internet.defer.returnValue
This function has been deprecated in Twisted 24.7.0.
author | Povilas Kanapickas <povilas@radix.lt> |
---|---|
date | Wed, 11 Dec 2024 01:17:09 +0200 |
parents | 554a87ae17a6 |
children | 17fa953c8cd7 |
comparison
equal
deleted
inserted
replaced
4340:ea72364131d5 | 4341:e9971a4b0627 |
---|---|
303 jid=jid_.full(), reason=e.condition | 303 jid=jid_.full(), reason=e.condition |
304 ) | 304 ) |
305 ) | 305 ) |
306 items = disco.DiscoItems() | 306 items = disco.DiscoItems() |
307 | 307 |
308 defer.returnValue(items) | 308 return items |
309 | 309 |
310 def _infos_eb(self, failure_, entity_jid): | 310 def _infos_eb(self, failure_, entity_jid): |
311 failure_.trap(StanzaError) | 311 failure_.trap(StanzaError) |
312 log.warning( | 312 log.warning( |
313 _("Error while requesting [%(jid)s]: %(error)s") | 313 _("Error while requesting [%(jid)s]: %(error)s") |
478 values = [C.bool_const(v) for v in values] | 478 values = [C.bool_const(v) for v in values] |
479 fields.append((data, values)) | 479 fields.append((data, values)) |
480 | 480 |
481 extensions[form_type or ""] = fields | 481 extensions[form_type or ""] = fields |
482 | 482 |
483 defer.returnValue( | 483 return ( |
484 ( | 484 [str(f) for f in disco_infos.features], |
485 [str(f) for f in disco_infos.features], | 485 [ |
486 [ | 486 (cat, type_, name or "") |
487 (cat, type_, name or "") | 487 for (cat, type_), name in list(disco_infos.identities.items()) |
488 for (cat, type_), name in list(disco_infos.identities.items()) | 488 ], |
489 ], | 489 extensions, |
490 extensions, | |
491 ) | |
492 ) | 490 ) |
493 | 491 |
494 def items2tuples(self, disco_items): | 492 def items2tuples(self, disco_items): |
495 """convert disco items to tuple of strings | 493 """convert disco items to tuple of strings |
496 | 494 |
514 @param use_cache(bool): if True, use cached data if available | 512 @param use_cache(bool): if True, use cached data if available |
515 @return: list of tuples""" | 513 @return: list of tuples""" |
516 client = self.host.get_client(profile_key) | 514 client = self.host.get_client(profile_key) |
517 entity = jid.JID(entity_jid_s) | 515 entity = jid.JID(entity_jid_s) |
518 disco_items = yield self.get_items(client, entity, node, use_cache) | 516 disco_items = yield self.get_items(client, entity, node, use_cache) |
519 ret = list(self.items2tuples(disco_items)) | 517 return list(self.items2tuples(disco_items)) |
520 defer.returnValue(ret) |