Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit 0e3c2e4

Browse files
committed
Rename RPCError.x to RPCError.value
1 parent 68f151b commit 0e3c2e4

File tree

13 files changed

+23
-23
lines changed

13 files changed

+23
-23
lines changed

pyrogram/errors/rpc_error.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ class RPCError(Exception):
3030
ID = None
3131
CODE = None
3232
NAME = None
33-
MESSAGE = "{x}"
33+
MESSAGE = "{value}"
3434

3535
def __init__(
3636
self,
37-
x: Union[int, str, raw.types.RpcError] = None,
37+
value: Union[int, str, raw.types.RpcError] = None,
3838
rpc_name: str = None,
3939
is_unknown: bool = False,
4040
is_signed: bool = False
@@ -43,18 +43,18 @@ def __init__(
4343
"-" if is_signed else "",
4444
self.CODE,
4545
self.ID or self.NAME,
46-
self.MESSAGE.format(x=x),
46+
self.MESSAGE.format(value=value),
4747
f'(caused by "{rpc_name}")' if rpc_name else ""
4848
))
4949

5050
try:
51-
self.x = int(x)
51+
self.value = int(value)
5252
except (ValueError, TypeError):
53-
self.x = x
53+
self.value = value
5454

5555
if is_unknown:
5656
with open("unknown_errors.txt", "a", encoding="utf-8") as f:
57-
f.write(f"{datetime.now()}\t{x}\t{rpc_name}\n")
57+
f.write(f"{datetime.now()}\t{value}\t{rpc_name}\n")
5858

5959
@staticmethod
6060
def raise_it(rpc_error: "raw.types.RpcError", rpc_type: Type[TLObject]):
@@ -68,7 +68,7 @@ def raise_it(rpc_error: "raw.types.RpcError", rpc_type: Type[TLObject]):
6868

6969
if error_code not in exceptions:
7070
raise UnknownError(
71-
x=f"[{error_code} {error_message}]",
71+
value=f"[{error_code} {error_message}]",
7272
rpc_name=rpc_name,
7373
is_unknown=True,
7474
is_signed=is_signed
@@ -80,18 +80,18 @@ def raise_it(rpc_error: "raw.types.RpcError", rpc_type: Type[TLObject]):
8080
raise getattr(
8181
import_module("pyrogram.errors"),
8282
exceptions[error_code]["_"]
83-
)(x=f"[{error_code} {error_message}]",
83+
)(value=f"[{error_code} {error_message}]",
8484
rpc_name=rpc_name,
8585
is_unknown=True,
8686
is_signed=is_signed)
8787

88-
x = re.search(r"_(\d+)", error_message)
89-
x = x.group(1) if x is not None else x
88+
value = re.search(r"_(\d+)", error_message)
89+
value = value.group(1) if value is not None else value
9090

9191
raise getattr(
9292
import_module("pyrogram.errors"),
9393
exceptions[error_code][error_id]
94-
)(x=x,
94+
)(value=value,
9595
rpc_name=rpc_name,
9696
is_unknown=False,
9797
is_signed=is_signed)

pyrogram/methods/auth/send_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async def send_code(
6060
except (PhoneMigrate, NetworkMigrate) as e:
6161
await self.session.stop()
6262

63-
await self.storage.dc_id(e.x)
63+
await self.storage.dc_id(e.value)
6464
await self.storage.auth_key(
6565
await Auth(
6666
self, await self.storage.dc_id(),

pyrogram/methods/auth/sign_in_bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async def sign_in_bot(
5757
except UserMigrate as e:
5858
await self.session.stop()
5959

60-
await self.storage.dc_id(e.x)
60+
await self.storage.dc_id(e.value)
6161
await self.storage.auth_key(
6262
await Auth(
6363
self, await self.storage.dc_id(),

pyrogram/methods/bots/get_inline_bot_results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async def get_inline_bot_results(
8484
)
8585
except UnknownError as e:
8686
# TODO: Add this -503 Timeout error into the Error DB
87-
if e.x.error_code == -503 and e.x.error_message == "Timeout":
87+
if e.value.error_code == -503 and e.value.error_message == "Timeout":
8888
raise TimeoutError("The inline bot didn't answer in time") from None
8989
else:
9090
raise e

pyrogram/methods/messages/send_animation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def progress(current, total):
230230
)
231231
)
232232
except FilePartMissing as e:
233-
await self.save_file(animation, file_id=file.id, file_part=e.x)
233+
await self.save_file(animation, file_id=file.id, file_part=e.value)
234234
else:
235235
for i in r.updates:
236236
if isinstance(i, (raw.types.UpdateNewMessage,

pyrogram/methods/messages/send_audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def progress(current, total):
224224
)
225225
)
226226
except FilePartMissing as e:
227-
await self.save_file(audio, file_id=file.id, file_part=e.x)
227+
await self.save_file(audio, file_id=file.id, file_part=e.value)
228228
else:
229229
for i in r.updates:
230230
if isinstance(i, (raw.types.UpdateNewMessage,

pyrogram/methods/messages/send_document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def progress(current, total):
202202
)
203203
)
204204
except FilePartMissing as e:
205-
await self.save_file(document, file_id=file.id, file_part=e.x)
205+
await self.save_file(document, file_id=file.id, file_part=e.value)
206206
else:
207207
for i in r.updates:
208208
if isinstance(i, (raw.types.UpdateNewMessage,

pyrogram/methods/messages/send_photo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ async def send_photo(
179179
)
180180
)
181181
except FilePartMissing as e:
182-
await self.save_file(photo, file_id=file.id, file_part=e.x)
182+
await self.save_file(photo, file_id=file.id, file_part=e.value)
183183
else:
184184
for i in r.updates:
185185
if isinstance(i, (raw.types.UpdateNewMessage,

pyrogram/methods/messages/send_sticker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async def send_sticker(
161161
)
162162
)
163163
except FilePartMissing as e:
164-
await self.save_file(sticker, file_id=file.id, file_part=e.x)
164+
await self.save_file(sticker, file_id=file.id, file_part=e.value)
165165
else:
166166
for i in r.updates:
167167
if isinstance(i, (raw.types.UpdateNewMessage,

pyrogram/methods/messages/send_video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def progress(current, total):
236236
)
237237
)
238238
except FilePartMissing as e:
239-
await self.save_file(video, file_id=file.id, file_part=e.x)
239+
await self.save_file(video, file_id=file.id, file_part=e.value)
240240
else:
241241
for i in r.updates:
242242
if isinstance(i, (raw.types.UpdateNewMessage,

0 commit comments

Comments
 (0)