summaryrefslogtreecommitdiff
path: root/plugins
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 /plugins
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 'plugins')
-rw-r--r--plugins/exec.py2
-rw-r--r--plugins/irc.py2
-rw-r--r--plugins/ping.py6
-rw-r--r--plugins/upload.py2
-rw-r--r--plugins/user_extras.py9
-rw-r--r--plugins/vcard.py8
6 files changed, 13 insertions, 16 deletions
diff --git a/plugins/exec.py b/plugins/exec.py
index 0786c86f..68f24486 100644
--- a/plugins/exec.py
+++ b/plugins/exec.py
@@ -95,4 +95,4 @@ class Plugin(BasePlugin):
else:
self.api.run_command('/help exec')
return
- asyncio.ensure_future(self.async_exec(command, arg))
+ asyncio.create_task(self.async_exec(command, arg))
diff --git a/plugins/irc.py b/plugins/irc.py
index a7650ec4..d732c127 100644
--- a/plugins/irc.py
+++ b/plugins/irc.py
@@ -141,7 +141,7 @@ from poezio import tabs
class Plugin(BasePlugin):
def init(self):
if self.config.get('initial_connect', True):
- asyncio.ensure_future(
+ asyncio.create_task(
self.initial_connect()
)
diff --git a/plugins/ping.py b/plugins/ping.py
index 46ce4efc..cc987bf0 100644
--- a/plugins/ping.py
+++ b/plugins/ping.py
@@ -123,7 +123,7 @@ class Plugin(BasePlugin):
jid = arg
if not arg:
jid = self.api.current_tab().jid
- asyncio.ensure_future(
+ asyncio.create_task(
self.command_ping(jid)
)
@@ -140,7 +140,7 @@ class Plugin(BasePlugin):
jid = JID(arg)
except InvalidJID:
return self.api.information('Invalid JID: %s' % arg, 'Error')
- asyncio.ensure_future(
+ asyncio.create_task(
self.command_ping(jid.full)
)
@@ -156,7 +156,7 @@ class Plugin(BasePlugin):
res = current.get_highest_priority_resource()
if res is not None:
jid =res.jid
- asyncio.ensure_future(
+ asyncio.create_task(
self.command_ping(jid)
)
diff --git a/plugins/upload.py b/plugins/upload.py
index c702dc49..9a70a965 100644
--- a/plugins/upload.py
+++ b/plugins/upload.py
@@ -78,7 +78,7 @@ class Plugin(BasePlugin):
return
filename, = args
filename = expanduser(filename)
- asyncio.ensure_future(self.send_upload(filename))
+ asyncio.create_task(self.send_upload(filename))
@staticmethod
def completion_filename(the_input):
diff --git a/plugins/user_extras.py b/plugins/user_extras.py
index ad49a142..96559111 100644
--- a/plugins/user_extras.py
+++ b/plugins/user_extras.py
@@ -91,10 +91,7 @@ Configuration
"""
-from asyncio import (
- ensure_future,
- gather,
-)
+import asyncio
from functools import reduce
from typing import Dict
@@ -174,10 +171,10 @@ class Plugin(BasePlugin):
]
for name, handler in handlers:
self.core.xmpp.del_event_handler(name, handler)
- ensure_future(self._stop())
+ asyncio.create_task(self._stop())
async def _stop(self):
- await gather(
+ await asyncio.gather(
self.core.xmpp.plugin['xep_0108'].stop(),
self.core.xmpp.plugin['xep_0107'].stop(),
self.core.xmpp.plugin['xep_0196'].stop(),
diff --git a/plugins/vcard.py b/plugins/vcard.py
index ef70dc79..b0c8e396 100644
--- a/plugins/vcard.py
+++ b/plugins/vcard.py
@@ -266,7 +266,7 @@ class Plugin(BasePlugin):
self.api.information('Invalid JID: %s' % arg, 'Error')
return
- asyncio.ensure_future(
+ asyncio.create_task(
self._get_vcard(jid)
)
@@ -290,7 +290,7 @@ class Plugin(BasePlugin):
jid = JID(arg)
except InvalidJID:
return self.api.information('Invalid JID: %s' % arg, 'Error')
- asyncio.ensure_future(
+ asyncio.create_task(
self._get_vcard(jid)
)
@@ -301,11 +301,11 @@ class Plugin(BasePlugin):
return
current = self.api.current_tab().selected_row
if isinstance(current, Resource):
- asyncio.ensure_future(
+ asyncio.create_task(
self._get_vcard(JID(current.jid).bare)
)
elif isinstance(current, Contact):
- asyncio.ensure_future(
+ asyncio.create_task(
self._get_vcard(current.bare_jid)
)