Change some things

This commit is contained in:
Tulir Asokan
2021-08-02 12:52:05 +03:00
parent c02f67e0d1
commit 742a925040
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -410,7 +410,7 @@ class PortalTelegram(BasePortal, ABC):
@staticmethod
def _int_to_bytes(i: int) -> bytes:
hex_value = "{0:010x}".format(i).encode("utf-8")
hex_value = f"{i:010x}".encode("utf-8")
return codecs.decode(hex_value, "hex_codec")
def _encode_msgid(self, source: 'AbstractUser', evt: Message) -> str:
@@ -134,7 +134,7 @@ class ParallelTransferrer:
self.upload_ticker = 0
async def _cleanup(self) -> None:
await asyncio.gather(*[sender.disconnect() for sender in self.senders])
await asyncio.gather(*(sender.disconnect() for sender in self.senders))
self.senders = None
@staticmethod
@@ -161,9 +161,9 @@ class ParallelTransferrer:
await self._create_download_sender(file, 0, part_size, connections * part_size,
get_part_count()),
*await asyncio.gather(
*[self._create_download_sender(file, i, part_size, connections * part_size,
*(self._create_download_sender(file, i, part_size, connections * part_size,
get_part_count())
for i in range(1, connections)])
for i in range(1, connections)))
]
async def _create_download_sender(self, file: TypeLocation, index: int, part_size: int,
@@ -177,8 +177,8 @@ class ParallelTransferrer:
self.senders = [
await self._create_upload_sender(file_id, part_count, big, 0, connections),
*await asyncio.gather(
*[self._create_upload_sender(file_id, part_count, big, i, connections)
for i in range(1, connections)])
*(self._create_upload_sender(file_id, part_count, big, i, connections)
for i in range(1, connections)))
]
async def _create_upload_sender(self, file_id: int, part_count: int, big: bool, index: int,