summaryrefslogtreecommitdiff
path: root/poezio/core
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2021-11-18 15:23:46 +0100
committermathieui <mathieui@mathieui.net>2021-12-11 19:16:33 +0100
commit79bbbdb3e633152cc95e77a550f2eb2cde4e6784 (patch)
tree090c32aa64837d48b5851fb56a84fa7ee76399c6 /poezio/core
parent2c59fa067af90bc116953f2ae162f5da4c1b6002 (diff)
downloadpoezio-79bbbdb3e633152cc95e77a550f2eb2cde4e6784.tar.gz
poezio-79bbbdb3e633152cc95e77a550f2eb2cde4e6784.tar.bz2
poezio-79bbbdb3e633152cc95e77a550f2eb2cde4e6784.tar.xz
poezio-79bbbdb3e633152cc95e77a550f2eb2cde4e6784.zip
Replace asyncio.ensure_future() with asyncio.create_task()
The latter function got introduced in Python 3.7, which is conveniently our MSPV, so let’s use that.
Diffstat (limited to 'poezio/core')
-rw-r--r--poezio/core/commands.py16
-rw-r--r--poezio/core/core.py2
-rw-r--r--poezio/core/handlers.py4
3 files changed, 11 insertions, 11 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index 915f9d90..717f77ce 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -298,7 +298,7 @@ class CommandCore:
jid = self.core.tabs.current_tab.jid
if jid is None or not jid.domain:
return None
- asyncio.ensure_future(
+ asyncio.create_task(
self._list_async(jid)
)
@@ -453,7 +453,7 @@ class CommandCore:
room, nick = self._parse_join_jid(args[0] if args else '')
password = args[1] if len(args) > 1 else None
- asyncio.ensure_future(
+ asyncio.create_task(
self._add_bookmark(
room=room,
nick=nick,
@@ -478,7 +478,7 @@ class CommandCore:
autojoin = (method == 'local' or
(len(args) > 1 and args[1].lower() == 'true'))
- asyncio.ensure_future(
+ asyncio.create_task(
self._add_bookmark(room, nick, autojoin, password, method)
)
@@ -596,7 +596,7 @@ class CommandCore:
else:
jid = args[0]
- asyncio.ensure_future(
+ asyncio.create_task(
self._remove_bookmark_routine(jid)
)
@@ -983,7 +983,7 @@ class CommandCore:
return self.core.information('Invalid JID for /impromptu: %s' % args[0], 'Error')
jids.add(bare)
- asyncio.ensure_future(self.core.impromptu(jids))
+ asyncio.create_task(self.core.impromptu(jids))
self.core.information('Invited %s to a random room' % (', '.join(jids)), 'Info')
@command_args_parser.quoted(1, 1, [''])
@@ -1043,7 +1043,7 @@ class CommandCore:
if jid is None:
self.core.information('No specified JID to block', 'Error')
else:
- asyncio.ensure_future(self._block_async(jid))
+ asyncio.create_task(self._block_async(jid))
async def _block_async(self, jid: JID):
"""Block a JID, asynchronously"""
@@ -1096,7 +1096,7 @@ class CommandCore:
jid = JID(current_tab.jid.bare)
if jid is not None:
- asyncio.ensure_future(
+ asyncio.create_task(
self._unblock_async(jid)
)
else:
@@ -1185,7 +1185,7 @@ class CommandCore:
self.core.information('Invalid alternative room JID: "%s"' % args[2], 'Error')
return
- asyncio.ensure_future(do_destroy(room, reason, altroom))
+ asyncio.create_task(do_destroy(room, reason, altroom))
@command_args_parser.quoted(1, 1, [''])
def bind(self, args):
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 81ac6e8a..ec64f0a0 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -444,7 +444,7 @@ class Core:
if value not in ('pep', 'privatexml'):
return
self.bookmarks.preferred = value
- asyncio.ensure_future(
+ asyncio.create_task(
self.bookmarks.save(self.xmpp, core=self)
)
diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py
index d4625b4b..bdb91475 100644
--- a/poezio/core/handlers.py
+++ b/poezio/core/handlers.py
@@ -108,7 +108,7 @@ class HandlerCore:
await self.core.check_bookmark_storage(features)
def find_identities(self, _):
- asyncio.ensure_future(
+ asyncio.create_task(
self.core.xmpp['xep_0030'].get_info_from_domain(),
)
@@ -1097,7 +1097,7 @@ class HandlerCore:
if config.getbool('enable_user_nick'):
self.core.xmpp.plugin['xep_0172'].publish_nick(
nick=self.core.own_nick, callback=dumb_callback)
- asyncio.ensure_future(self.core.xmpp.plugin['xep_0115'].update_caps())
+ asyncio.create_task(self.core.xmpp.plugin['xep_0115'].update_caps())
# Start the ping's plugin regular event
self.core.xmpp.set_keepalive_values()