mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-17 18:46:40 +00:00
Use loop.create_future instead asyncio.Future
This commit is contained in:
parent
d3a6822fc9
commit
fbc46bd388
@ -187,6 +187,6 @@ class InlineQuery(EventBuilder):
|
|||||||
if inspect.isawaitable(obj):
|
if inspect.isawaitable(obj):
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
f = asyncio.Future(loop=loop)
|
f = loop.create_future()
|
||||||
f.set_result(obj)
|
f.set_result(obj)
|
||||||
return f
|
return f
|
||||||
|
@ -282,7 +282,7 @@ class MTProtoSender:
|
|||||||
|
|
||||||
# First connection or manual reconnection after a failure
|
# First connection or manual reconnection after a failure
|
||||||
if self._disconnected is None or self._disconnected.done():
|
if self._disconnected is None or self._disconnected.done():
|
||||||
self._disconnected = asyncio.Future(loop=self._loop)
|
self._disconnected = self._loop.create_future()
|
||||||
__log__.info('Connection to {} complete!'.format(self._ip))
|
__log__.info('Connection to {} complete!'.format(self._ip))
|
||||||
|
|
||||||
async def _reconnect(self):
|
async def _reconnect(self):
|
||||||
|
@ -30,7 +30,7 @@ class TLMessage(TLObject):
|
|||||||
|
|
||||||
# If no loop is given then it is an incoming message.
|
# If no loop is given then it is an incoming message.
|
||||||
# Only outgoing messages need the future to await them.
|
# Only outgoing messages need the future to await them.
|
||||||
self.future = asyncio.Future(loop=loop) if loop else None
|
self.future = loop.create_future() if loop else None
|
||||||
|
|
||||||
# After which message ID this one should run. We do this so
|
# After which message ID this one should run. We do this so
|
||||||
# InvokeAfterMsgRequest is transparent to the user and we can
|
# InvokeAfterMsgRequest is transparent to the user and we can
|
||||||
|
@ -181,7 +181,7 @@ class Conversation(ChatGetter):
|
|||||||
return incoming
|
return incoming
|
||||||
|
|
||||||
# Otherwise the next incoming response will be the one to use
|
# Otherwise the next incoming response will be the one to use
|
||||||
future = asyncio.Future(loop=self._client.loop)
|
future = self._client.loop.create_future()
|
||||||
pending[target_id] = future
|
pending[target_id] = future
|
||||||
return self._get_result(future, start_time, timeout)
|
return self._get_result(future, start_time, timeout)
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ class Conversation(ChatGetter):
|
|||||||
will also trigger even without a response.
|
will also trigger even without a response.
|
||||||
"""
|
"""
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
future = asyncio.Future(loop=self._client.loop)
|
future = self._client.loop.create_future()
|
||||||
target_id = self._get_message_id(message)
|
target_id = self._get_message_id(message)
|
||||||
|
|
||||||
if self._last_read is None:
|
if self._last_read is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user