[tasks] Fix typing for tasks.SleepHandle.future set calls

This commit is contained in:
Thanos 2023-12-10 11:38:55 -05:00 committed by GitHub
parent 4d03fa1c29
commit 9b9c93ad49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,12 +111,12 @@ class SleepHandle:
self.loop: asyncio.AbstractEventLoop = loop
self.future: asyncio.Future[None] = loop.create_future()
relative_delta = discord.utils.compute_timedelta(dt)
self.handle = loop.call_later(relative_delta, self.future.set_result, True)
self.handle = loop.call_later(relative_delta, self.future.set_result, None)
def recalculate(self, dt: datetime.datetime) -> None:
self.handle.cancel()
relative_delta = discord.utils.compute_timedelta(dt)
self.handle: asyncio.TimerHandle = self.loop.call_later(relative_delta, self.future.set_result, True)
self.handle: asyncio.TimerHandle = self.loop.call_later(relative_delta, self.future.set_result, None)
def wait(self) -> asyncio.Future[Any]:
return self.future