fix: remove loop parameter when deprecated (3.10)

This commit is contained in:
mathieui 2021-12-13 21:31:30 +01:00
parent be6dde17f1
commit 799a6a07a9
4 changed files with 6 additions and 7 deletions

View file

@ -326,7 +326,6 @@ class XEP_0030(BasePlugin):
info_futures, _ = await asyncio.wait( info_futures, _ = await asyncio.wait(
infos, infos,
timeout=timeout, timeout=timeout,
loop=self.xmpp.loop
) )
self.domain_infos[domain] = [ self.domain_infos[domain] = [

View file

@ -115,7 +115,7 @@ class IBBytestream(object):
self.xmpp.add_event_handler('ibb_stream_end', on_close) self.xmpp.add_event_handler('ibb_stream_end', on_close)
self.xmpp.add_event_handler('ibb_stream_data', on_data) self.xmpp.add_event_handler('ibb_stream_data', on_data)
try: try:
await asyncio.wait_for(end_future, timeout, loop=self.xmpp.loop) await asyncio.wait_for(end_future, timeout)
except asyncio.TimeoutError: except asyncio.TimeoutError:
raise IqTimeout(result) raise IqTimeout(result)
finally: finally:

View file

@ -80,7 +80,7 @@ class Waiter(BaseHandler):
try: try:
await wait_for( await wait_for(
self._event.wait(), timeout, loop=stream.loop self._event.wait(), timeout,
) )
except TimeoutError: except TimeoutError:
log.warning("Timed out waiting for %s", self.name) log.warning("Timed out waiting for %s", self.name)

View file

@ -449,7 +449,7 @@ class XMLStream(asyncio.BaseProtocol):
if self._connect_loop_wait > 0: if self._connect_loop_wait > 0:
self.event('reconnect_delay', self._connect_loop_wait) self.event('reconnect_delay', self._connect_loop_wait)
await asyncio.sleep(self._connect_loop_wait, loop=self.loop) await asyncio.sleep(self._connect_loop_wait)
record = await self._pick_dns_answer(self.default_domain) record = await self._pick_dns_answer(self.default_domain)
if record is not None: if record is not None:
@ -504,10 +504,10 @@ class XMLStream(asyncio.BaseProtocol):
else: else:
self.loop.run_until_complete(self.disconnected) self.loop.run_until_complete(self.disconnected)
else: else:
tasks: List[Future] = [asyncio.sleep(timeout, loop=self.loop)] tasks: List[Future] = [asyncio.sleep(timeout)]
if not forever: if not forever:
tasks.append(self.disconnected) tasks.append(self.disconnected)
self.loop.run_until_complete(asyncio.wait(tasks, loop=self.loop)) self.loop.run_until_complete(asyncio.wait(tasks))
def init_parser(self) -> None: def init_parser(self) -> None:
"""init the XML parser. The parser must always be reset for each new """init the XML parser. The parser must always be reset for each new
@ -715,7 +715,7 @@ class XMLStream(asyncio.BaseProtocol):
log.debug("reconnecting...") log.debug("reconnecting...")
async def handler(event: Any) -> None: async def handler(event: Any) -> None:
# We yield here to allow synchronous handlers to work first # We yield here to allow synchronous handlers to work first
await asyncio.sleep(0, loop=self.loop) await asyncio.sleep(0)
self.connect() self.connect()
self.add_event_handler('disconnected', handler, disposable=True) self.add_event_handler('disconnected', handler, disposable=True)
self.disconnect(wait, reason) self.disconnect(wait, reason)