Skip to content

Commit 63cbcde

Browse files
authored
Merge pull request #1 from Nehemiazrads/dev
Fix typos and docstring mismatches in UpgradedGiftAttributeId
2 parents b332a81 + 9805d2e commit 63cbcde

6 files changed

Lines changed: 112 additions & 66 deletions

File tree

pyrogram/errors/exceptions/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from .flood_420 import *
20-
from .unauthorized_401 import *
2119
from .forbidden_403 import *
2220
from .bad_request_400 import *
21+
from .internal_server_error_500 import *
22+
from .unauthorized_401 import *
23+
from .flood_420 import *
24+
from .unknown_504 import *
25+
from .see_other_303 import *
2326
from .not_found_404 import *
2427
from .service_unavailable_503 import *
2528
from .not_acceptable_406 import *
26-
from .see_other_303 import *
27-
from .internal_server_error_500 import *
28-
from .unknown_504 import *

pyrogram/errors/exceptions/all.py

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,6 @@
1919
count = 723
2020

2121
exceptions = {
22-
420: {
23-
"_": "Flood",
24-
"2FA_CONFIRM_WAIT_X": "TwoFaConfirmWaitX",
25-
"ADDRESS_INVALID": "AddressInvalid",
26-
"FLOOD_PREMIUM_WAIT_X": "FloodPremiumWaitX",
27-
"FLOOD_WAIT_X": "FloodWaitX",
28-
"FROZEN_METHOD_INVALID": "FrozenMethodInvalid",
29-
"PREMIUM_SUB_ACTIVE_UNTIL_X": "PremiumSubActiveUntilX",
30-
"SLOWMODE_WAIT_X": "SlowmodeWaitX",
31-
"TAKEOUT_INIT_DELAY_X": "TakeoutInitDelayX",
32-
},
33-
401: {
34-
"_": "Unauthorized",
35-
"AUTH_KEY_INVALID": "AuthKeyInvalid",
36-
"AUTH_KEY_PERM_EMPTY": "AuthKeyPermEmpty",
37-
"AUTH_KEY_UNREGISTERED": "AuthKeyUnregistered",
38-
"SESSION_EXPIRED": "SessionExpired",
39-
"SESSION_PASSWORD_NEEDED": "SessionPasswordNeeded",
40-
"SESSION_REVOKED": "SessionRevoked",
41-
"USER_DEACTIVATED": "UserDeactivated",
42-
"USER_DEACTIVATED_BAN": "UserDeactivatedBan",
43-
},
4422
403: {
4523
"_": "Forbidden",
4624
"ALLOW_PAYMENT_REQUIRED_X": "AllowPaymentRequiredX",
@@ -697,6 +675,58 @@
697675
"WEBPUSH_TOKEN_INVALID": "WebpushTokenInvalid",
698676
"YOU_BLOCKED_USER": "YouBlockedUser",
699677
},
678+
500: {
679+
"_": "InternalServerError",
680+
"AUTH_KEY_UNSYNCHRONIZED": "AuthKeyUnsynchronized",
681+
"AUTH_RESTART": "AuthRestart",
682+
"AUTH_RESTART_X": "AuthRestartX",
683+
"CALL_OCCUPY_FAILED": "CallOccupyFailed",
684+
"CDN_UPLOAD_TIMEOUT": "CdnUploadTimeout",
685+
"CHAT_ID_GENERATE_FAILED": "ChatIdGenerateFailed",
686+
"CHAT_INVALID": "ChatInvalid",
687+
"FIRSTNAME_INVALID": "FirstnameInvalid",
688+
"MSG_WAIT_FAILED": "MsgWaitFailed",
689+
"PARTICIPANT_CALL_FAILED": "ParticipantCallFailed",
690+
"PERSISTENT_TIMESTAMP_OUTDATED": "PersistentTimestampOutdated",
691+
"RANDOM_ID_DUPLICATE": "RandomIdDuplicate",
692+
"SEND_MEDIA_INVALID": "SendMediaInvalid",
693+
"SIGN_IN_FAILED": "SignInFailed",
694+
"TRANSLATE_REQ_FAILED": "TranslateReqFailed",
695+
"TRANSLATION_TIMEOUT": "TranslationTimeout",
696+
},
697+
401: {
698+
"_": "Unauthorized",
699+
"AUTH_KEY_INVALID": "AuthKeyInvalid",
700+
"AUTH_KEY_PERM_EMPTY": "AuthKeyPermEmpty",
701+
"AUTH_KEY_UNREGISTERED": "AuthKeyUnregistered",
702+
"SESSION_EXPIRED": "SessionExpired",
703+
"SESSION_PASSWORD_NEEDED": "SessionPasswordNeeded",
704+
"SESSION_REVOKED": "SessionRevoked",
705+
"USER_DEACTIVATED": "UserDeactivated",
706+
"USER_DEACTIVATED_BAN": "UserDeactivatedBan",
707+
},
708+
420: {
709+
"_": "Flood",
710+
"2FA_CONFIRM_WAIT_X": "TwoFaConfirmWaitX",
711+
"ADDRESS_INVALID": "AddressInvalid",
712+
"FLOOD_PREMIUM_WAIT_X": "FloodPremiumWaitX",
713+
"FLOOD_WAIT_X": "FloodWaitX",
714+
"FROZEN_METHOD_INVALID": "FrozenMethodInvalid",
715+
"PREMIUM_SUB_ACTIVE_UNTIL_X": "PremiumSubActiveUntilX",
716+
"SLOWMODE_WAIT_X": "SlowmodeWaitX",
717+
"TAKEOUT_INIT_DELAY_X": "TakeoutInitDelayX",
718+
},
719+
504: {
720+
"_": "Unknown",
721+
"UNHANDLED_EXCEPTION": "UnhandledException",
722+
},
723+
303: {
724+
"_": "SeeOther",
725+
"NETWORK_MIGRATE_X": "NetworkMigrateX",
726+
"PHONE_MIGRATE_X": "PhoneMigrateX",
727+
"STATS_MIGRATE_X": "StatsMigrateX",
728+
"USER_MIGRATE_X": "UserMigrateX",
729+
},
700730
404: {
701731
"_": "NotFound",
702732
"METHOD_INVALID": "MethodInvalid",
@@ -742,34 +772,4 @@
742772
"USERPIC_UPLOAD_REQUIRED": "UserpicUploadRequired",
743773
"USER_RESTRICTED": "UserRestricted",
744774
},
745-
303: {
746-
"_": "SeeOther",
747-
"NETWORK_MIGRATE_X": "NetworkMigrateX",
748-
"PHONE_MIGRATE_X": "PhoneMigrateX",
749-
"STATS_MIGRATE_X": "StatsMigrateX",
750-
"USER_MIGRATE_X": "UserMigrateX",
751-
},
752-
500: {
753-
"_": "InternalServerError",
754-
"AUTH_KEY_UNSYNCHRONIZED": "AuthKeyUnsynchronized",
755-
"AUTH_RESTART": "AuthRestart",
756-
"AUTH_RESTART_X": "AuthRestartX",
757-
"CALL_OCCUPY_FAILED": "CallOccupyFailed",
758-
"CDN_UPLOAD_TIMEOUT": "CdnUploadTimeout",
759-
"CHAT_ID_GENERATE_FAILED": "ChatIdGenerateFailed",
760-
"CHAT_INVALID": "ChatInvalid",
761-
"FIRSTNAME_INVALID": "FirstnameInvalid",
762-
"MSG_WAIT_FAILED": "MsgWaitFailed",
763-
"PARTICIPANT_CALL_FAILED": "ParticipantCallFailed",
764-
"PERSISTENT_TIMESTAMP_OUTDATED": "PersistentTimestampOutdated",
765-
"RANDOM_ID_DUPLICATE": "RandomIdDuplicate",
766-
"SEND_MEDIA_INVALID": "SendMediaInvalid",
767-
"SIGN_IN_FAILED": "SignInFailed",
768-
"TRANSLATE_REQ_FAILED": "TranslateReqFailed",
769-
"TRANSLATION_TIMEOUT": "TranslationTimeout",
770-
},
771-
504: {
772-
"_": "Unknown",
773-
"UNHANDLED_EXCEPTION": "UnhandledException",
774-
},
775775
}

pyrogram/methods/business/get_business_connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async def get_business_connection(
3030
.. include:: /_includes/usable-by/bots.rst
3131
3232
Parameters:
33-
connection_id (``str``):
33+
business_connection_id (``str``):
3434
Unique identifier of the business connection.
3535
3636
Returns:
@@ -40,7 +40,7 @@ async def get_business_connection(
4040
.. code-block:: python
4141
4242
# Get a business connection information
43-
await app.get_business_connection(connection_id)
43+
await app.get_business_connection(business_connection_id)
4444
"""
4545
r = await self.invoke(
4646
raw.functions.account.GetBotBusinessConnection(

pyrogram/methods/messages/send_paid_media.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async def send_paid_media(
7676
caption (``str``, *optional*):
7777
Media caption, 0-1024 characters after entities parsing.
7878
79-
invoice_payload (``str``):
79+
payload (``str``):
8080
Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
8181
8282
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):

pyrogram/types/messages_and_media/upgraded_gift_attribute_id.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class UpgradedGiftAttributeId(Object):
2727
2828
It can be one of:
2929
30-
- :obj:`~pyrogram.types.UpgradedfGiftAttributeIdModel`
31-
- :obj:`~pyrogram.types.UpgradedfGiftAttributeIdSymbol`
32-
- :obj:`~pyrogram.types.UpgradedfGiftAttributeIdBackdrop`
30+
- :obj:`~pyrogram.types.UpgradedGiftAttributeIdModel`
31+
- :obj:`~pyrogram.types.UpgradedGiftAttributeIdSymbol`
32+
- :obj:`~pyrogram.types.UpgradedGiftAttributeIdBackdrop`
3333
"""
3434

3535
def __init__(
@@ -45,14 +45,14 @@ def _parse(
4545
return None
4646

4747
if isinstance(attribute_id, raw.types.StarGiftAttributeIdModel):
48-
return types.UpgradedfGiftAttributeIdModel(
48+
return types.UpgradedGiftAttributeIdModel(
4949
sticker_id=attribute_id.document_id
5050
)
5151
elif isinstance(attribute_id, raw.types.StarGiftAttributeIdPattern):
52-
return types.UpgradedfGiftAttributeIdSymbol(
52+
return types.UpgradedGiftAttributeIdSymbol(
5353
sticker_id=attribute_id.document_id
5454
)
5555
elif isinstance(attribute_id, raw.types.StarGiftAttributeIdBackdrop):
56-
return types.UpgradedfGiftAttributeIdBackdrop(
56+
return types.UpgradedGiftAttributeIdBackdrop(
5757
backdrop_id=attribute_id.backdrop_id
5858
)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Pyrogram - Telegram MTProto API Client Library for Python
2+
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
3+
#
4+
# This file is part of Pyrogram.
5+
#
6+
# Pyrogram is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU Lesser General Public License as published
8+
# by the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# Pyrogram is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU Lesser General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Lesser General Public License
17+
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
18+
19+
from pyrogram import raw, types
20+
from pyrogram.types.messages_and_media.upgraded_gift_attribute_id import UpgradedGiftAttributeId
21+
22+
23+
def test_parse_none():
24+
result = UpgradedGiftAttributeId._parse(None)
25+
assert result is None
26+
27+
28+
def test_parse_model():
29+
attr = raw.types.StarGiftAttributeIdModel(document_id=12345)
30+
result = UpgradedGiftAttributeId._parse(attr)
31+
assert isinstance(result, types.UpgradedGiftAttributeIdModel)
32+
assert result.sticker_id == 12345
33+
34+
35+
def test_parse_pattern():
36+
attr = raw.types.StarGiftAttributeIdPattern(document_id=67890)
37+
result = UpgradedGiftAttributeId._parse(attr)
38+
assert isinstance(result, types.UpgradedGiftAttributeIdSymbol)
39+
assert result.sticker_id == 67890
40+
41+
42+
def test_parse_backdrop():
43+
attr = raw.types.StarGiftAttributeIdBackdrop(backdrop_id=11111)
44+
result = UpgradedGiftAttributeId._parse(attr)
45+
assert isinstance(result, types.UpgradedGiftAttributeIdBackdrop)
46+
assert result.backdrop_id == 11111

0 commit comments

Comments
 (0)