L i :dZddlZddlmZmZddlmZddlm Z ddl m Z dZ Gdd e ZGd d eZGd d eZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZy)zThis module contains classes that represent Telegram errors. .. versionchanged:: 20.0 Replaced ``Unauthorized`` by :class:`Forbidden`. N)OptionalUnion) to_timedelta)get_timedelta_value) TimePeriod) BadRequest ChatMigratedConflictEndPointNotFound Forbidden InvalidToken NetworkErrorPassportDecryptionError RetryAfter TelegramErrorTimedOutc`eZdZdZdZdeffd ZdefdZdefdZde e e effdZ xZ S) ra Base class for Telegram errors. Tip: Objects of this type can be serialized via Python's :mod:`pickle` module and pickled objects from one version of PTB are usually loadable in future versions. However, we can not guarantee that this compatibility will always be provided. At least a manual one-time conversion of the data may be needed on major updates of the library. .. seealso:: :wiki:`Exceptions, Warnings and Logging ` messagerct||jd}|jd}|jd}||k7r|j}||_y)NzError: z [Error]: z Bad Request: )super__init__ removeprefix capitalizer)selfrmsg __class__s T/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/telegram/error.pyrzTelegramError.__init__>sX ""9-{+/ '>.."C returnc|jS)zgGives the string representation of exceptions message. Returns: :obj:`str` rrs r__str__zTelegramError.__str__Is ||rcN|jjd|jdS)zmGives an unambiguous string representation of the exception. Returns: :obj:`str` z('z'))r__name__rr"s r__repr__zTelegramError.__repr__Qs& ..))*"T\\N"==rc4|j|jffS)zDefines how to serialize the exception for pickle. .. seealso:: :py:meth:`object.__reduce__`, :mod:`pickle`. Returns: :obj:`tuple` rrr"s r __reduce__zTelegramError.__reduce__Ys~~ ..r) r% __module__ __qualname____doc__ __slots__strrr#r&tupletyper) __classcell__rs@rrr/sM I    >#> /E$c "23 /rrceZdZdZdZy)r zRaised when the bot has not enough rights to perform the requested action. Examples: :any:`Raw API Bot ` .. versionchanged:: 20.0 This class was previously named ``Unauthorized``. Nr%r*r+r,r-r4rrr r esIrr c8eZdZdZdZddeeddffd ZxZS)r zRaised when the token is invalid. Args: message (:obj:`str`, optional): Any additional information about the exception. .. versionadded:: 20.0 r4Nrr c6t||dy|y)Nz Invalid tokenrrrrrs rrzInvalidToken.__init__}s GOIIrN r%r*r+r,r-rr.rr1r2s@rr r rs/IJ JJJrr ceZdZdZdZy)r zRaised when the requested endpoint is not found. Only relevant for :meth:`telegram.Bot.do_api_request`. .. versionadded:: 20.8 r4Nr5r4rrr r s Irr ceZdZdZdZy)rafBase class for exceptions due to networking errors. Tip: This exception (and its subclasses) usually originates from the networking backend used by :class:`~telegram.request.HTTPXRequest`, or a custom implementation of :class:`~telegram.request.BaseRequest`. In this case, the original exception can be accessed via the ``__cause__`` `attribute `_. Examples: :any:`Raw API Bot ` .. seealso:: :wiki:`Handling network errors ` r4Nr5r4rrrrs IrrceZdZdZdZy)rz=Raised when Telegram could not process the request correctly.r4Nr5r4rrrrs GIrrc8eZdZdZdZddeeddffd ZxZS)raRaised when a request took too long to finish. .. seealso:: :wiki:`Handling network errors ` Args: message (:obj:`str`, optional): Any additional information about the exception. .. versionadded:: 20.0 r4Nrr c,t||xsdy)Nz Timed outr8r9s rrzTimedOut.__init__s /K0rr:r;r2s@rrrs+ I1 111rrcHeZdZdZdZdeffd ZdeeeeffdZ xZ S)r ao Raised when the requested group chat migrated to supergroup and has a new chat id. .. seealso:: :wiki:`Storing Bot, User and Chat Related Data ` Args: new_chat_id (:obj:`int`): The new chat id of the group. Attributes: new_chat_id (:obj:`int`): The new chat id of the group. ) new_chat_idrBc8t|d|||_y)Nz+Group migrated to supergroup. New chat id: )rrrB)rrBrs rrzChatMigrated.__init__s  F{mTU +rr c4|j|jffSr:)rrBr"s rr)zChatMigrated.__reduce__s~~ 0 0222r) r%r*r+r,r-intrr/r0r)r1r2s@rr r s5 !I,C,3E$c "233rr c|eZdZdZdZdeffd Zedee e jffdZ de ee effdZxZS)raa Raised when flood limits where exceeded. .. versionchanged:: 20.0 :attr:`retry_after` is now an integer to comply with the Bot API. Args: retry_after (:obj:`int` | :class:`datetime.timedelta`): Time in seconds, after which the bot can retry the request. .. versionchanged:: v22.2 |time-period-input| Attributes: retry_after (:obj:`int` | :class:`datetime.timedelta`): Time in seconds, after which the bot can retry the request. .. deprecated:: v22.2 |time-period-int-deprecated| ) _retry_after retry_afterct||_t|jtrt |d|jdyt |d|jy)Nz!Flood control exceeded. Retry in z seconds)rrG isinstancerHrErr)rrHrs rrzRetryAfter.__init__s[+7 +D d&& , G @AQAQ@RRZ[ \ G @AQAQ@TU Vrr c0t|jdS)NrH) attribute)rrGr"s rrHzRetryAfter.retry_afters#     rcb|jt|jjffSr:)rrErG total_secondsr"s rr)zRetryAfter.__reduce__s*~~D$5$5$C$C$E FHHHr)r%r*r+r,r-rrpropertyrrEdtm timedeltarHr/r0floatr)r1r2s@rrrsb,"IWJW U3 #56  IE$e "45Irrc0eZdZdZdZdeeeeffdZy)r z>Raised when a long poll or webhook conflicts with another one.r4r c4|j|jffSr:r(r"s rr)zConflict.__reduce__s~~ ..rN) r%r*r+r,r-r/r0r.r)r4rrr r s$HI/E$c "23/rr cReZdZdZdZdeeefffd Zde e e effdZ xZ S)rzSomething went wrong with decryption. .. versionchanged:: 20.0 This class was previously named ``TelegramDecryptionError`` and was available via ``telegram.TelegramDecryptionError``. )_msgrcJt|d|t||_y)NzPassportDecryptionError: )rrr.rVr9s rrz PassportDecryptionError.__init__s# 4WI>?L rr c4|j|jffSr:)rrVr"s rr)z"PassportDecryptionError.__reduce__s~~ |++r) r%r*r+r,r-rr. Exceptionrr/r0r)r1r2s@rrrs>I!c9n 5!,E$c "23,rr)r,datetimerPtypingrrtelegram._utils.argumentparsingrtelegram._utils.datetimertelegram._utils.typesr__all__rYrr r r rrrr rr rr4rrr`s& "88, 3/I3/l   J= J}=( 1|1$3=32+I+I\/}/,m,r