diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py
index 6dc76b323..f86307ed5 100644
--- a/pyrogram/__init__.py
+++ b/pyrogram/__init__.py
@@ -19,7 +19,7 @@
# along with pyroblack. If not, see .
__fork_name__ = "pyroblack"
-__version__ = "2.3.45"
+__version__ = "2.3.46"
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
__copyright__ = "# Copyright (C) 2024-present eyMarv "
diff --git a/pyrogram/methods/advanced/save_file.py b/pyrogram/methods/advanced/save_file.py
index e6147d5c1..efb3b5c1b 100644
--- a/pyrogram/methods/advanced/save_file.py
+++ b/pyrogram/methods/advanced/save_file.py
@@ -117,7 +117,9 @@ async def worker(session):
elif isinstance(path, io.IOBase):
fp = path
else:
- raise ValueError("Invalid file. Expected a file path as string or a binary (not text) file pointer")
+ raise ValueError(
+ "Invalid file. Expected a file path as string or a binary (not text) file pointer"
+ )
file_name = getattr(fp, "name", "file.jpg")
@@ -131,7 +133,9 @@ async def worker(session):
file_size_limit_mib = 4000 if self.me.is_premium else 2000
if file_size > file_size_limit_mib * 1024 * 1024:
- raise ValueError(f"Can't upload files bigger than {file_size_limit_mib} MiB")
+ raise ValueError(
+ f"Can't upload files bigger than {file_size_limit_mib} MiB"
+ )
file_total_parts = int(math.ceil(file_size / part_size))
is_big = file_size > 10 * 1024 * 1024
@@ -140,10 +144,15 @@ async def worker(session):
file_id = file_id or self.rnd_id()
md5_sum = md5() if not is_big and not is_missing_part else None
session = Session(
- self, await self.storage.dc_id(), await self.storage.auth_key(),
- await self.storage.test_mode(), is_media=True
+ self,
+ await self.storage.dc_id(),
+ await self.storage.auth_key(),
+ await self.storage.test_mode(),
+ is_media=True,
)
- workers = [self.loop.create_task(worker(session)) for _ in range(workers_count)]
+ workers = [
+ self.loop.create_task(worker(session)) for _ in range(workers_count)
+ ]
queue = asyncio.Queue(1)
try:
@@ -156,7 +165,9 @@ async def worker(session):
if not chunk:
if not is_big and not is_missing_part:
- md5_sum = "".join([hex(i)[2:].zfill(2) for i in md5_sum.digest()])
+ md5_sum = "".join(
+ [hex(i)[2:].zfill(2) for i in md5_sum.digest()]
+ )
break
if is_big:
@@ -164,13 +175,11 @@ async def worker(session):
file_id=file_id,
file_part=file_part,
file_total_parts=file_total_parts,
- bytes=chunk
+ bytes=chunk,
)
else:
rpc = raw.functions.upload.SaveFilePart(
- file_id=file_id,
- file_part=file_part,
- bytes=chunk
+ file_id=file_id, file_part=file_part, bytes=chunk
)
await queue.put(rpc)
@@ -188,7 +197,7 @@ async def worker(session):
progress,
min(file_part * part_size, file_size),
file_size,
- *progress_args
+ *progress_args,
)
if inspect.iscoroutinefunction(progress):
@@ -205,7 +214,6 @@ async def worker(session):
id=file_id,
parts=file_total_parts,
name=file_name,
-
)
else:
return raw.types.InputFile(
diff --git a/pyrogram/methods/chats/get_send_as_chats.py b/pyrogram/methods/chats/get_send_as_chats.py
index 160ffaf23..8c5f3673d 100644
--- a/pyrogram/methods/chats/get_send_as_chats.py
+++ b/pyrogram/methods/chats/get_send_as_chats.py
@@ -56,8 +56,12 @@ async def get_send_as_chats(
for p in r.peers:
if isinstance(p.peer, raw.types.PeerUser):
- send_as_chats.append(types.Chat._parse_chat(self, users[p.peer.user_id]))
+ send_as_chats.append(
+ types.Chat._parse_chat(self, users[p.peer.user_id])
+ )
else:
- send_as_chats.append(types.Chat._parse_chat(self, chats[p.peer.channel_id]))
+ send_as_chats.append(
+ types.Chat._parse_chat(self, chats[p.peer.channel_id])
+ )
return send_as_chats