Skip to content

Commit 9bd9d77

Browse files
committed
Replace "with await" with "async with"
1 parent b3d6b41 commit 9bd9d77

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

pyrogram/client/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ async def get_file(self, media_type: int,
15551555
is_big: bool,
15561556
progress: callable,
15571557
progress_args: tuple = ()) -> str:
1558-
with await self.media_sessions_lock:
1558+
async with self.media_sessions_lock:
15591559
session = self.media_sessions.get(dc_id, None)
15601560

15611561
if session is None:
@@ -1670,7 +1670,7 @@ async def get_file(self, media_type: int,
16701670
)
16711671

16721672
elif isinstance(r, types.upload.FileCdnRedirect):
1673-
with await self.media_sessions_lock:
1673+
async with self.media_sessions_lock:
16741674
cdn_session = self.media_sessions.get(r.dc_id, None)
16751675

16761676
if cdn_session is None:

pyrogram/client/ext/syncer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async def add(cls, client):
4444
if cls.lock is None:
4545
cls.lock = asyncio.Lock()
4646

47-
with await cls.lock:
47+
async with cls.lock:
4848
cls.sync(client)
4949

5050
cls.clients[id(client)] = client
@@ -54,7 +54,7 @@ async def add(cls, client):
5454

5555
@classmethod
5656
async def remove(cls, client):
57-
with await cls.lock:
57+
async with cls.lock:
5858
cls.sync(client)
5959

6060
del cls.clients[id(client)]
@@ -77,7 +77,7 @@ async def worker(cls):
7777
try:
7878
await asyncio.wait_for(cls.event.wait(), cls.INTERVAL)
7979
except asyncio.TimeoutError:
80-
with await cls.lock:
80+
async with cls.lock:
8181
for client in cls.clients.values():
8282
cls.sync(client)
8383
else:

pyrogram/connection/transport/tcp/tcp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def close(self):
9292
self.socket.close()
9393

9494
async def send(self, data: bytes):
95-
with await self.lock:
95+
async with self.lock:
9696
self.writer.write(data)
9797
await self.writer.drain()
9898

0 commit comments

Comments
 (0)