Ë
    Eü´j  ã                  óæ  — d Z ddlmZ ddlmZmZ ddlmZ erddlZg d¢Z	 G d„ de
«      Z G d	„ d
e«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ d e«      Z G d!„ d"e«      Z G d#„ d$e«      Z G d%„ d&e«      Z G d'„ d(e«      Z G d)„ d*e«      Z G d+„ d,e«      Zy)-z3Provide exception classes for the prawcore package.é    )Úannotations)ÚTYPE_CHECKINGÚAny)ÚurlparseN)ÚBadJSONÚ
BadRequestÚConflictÚ	ForbiddenÚInsufficientScopeÚInvalidInvocationÚInvalidTokenÚNotFoundÚOAuthExceptionÚPrawcoreExceptionÚRedirectÚRequestExceptionÚResponseExceptionÚServerErrorÚSpecialErrorÚTooLargeÚTooManyRequestsÚ
URITooLongÚUnavailableForLegalReasonsc                  ó   — e Zd ZdZy)r   zCBase exception class for exceptions that occur within this package.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úQ/root/workspace/ytshorts/venv/lib/python3.12/site-packages/prawcore/exceptions.pyr   r   "   s   „ ÚMr!   r   c                  ó   — e Zd ZdZy)r   z6Indicate that the code to execute cannot be completed.Nr   r    r!   r"   r   r   &   s   „ Ú@r!   r   c                  ó   — e Zd ZdZddd„Zy)r   zAIndicate that there was an OAuth2 related error with the request.Nc               óz   — || _         || _        || _        |› d�}|r	|d|› d�z  }t        j	                  | |«       y)zïInitialize a OAuthException instance.

        :param response: A :class:`requests.Response` instance.
        :param error: The error type returned by Reddit.
        :param description: A description of the error when provided.

        z error processing requestz (ú)N)ÚerrorÚdescriptionÚresponser   Ú__init__)Úselfr)   r'   r(   Úmessages        r"   r*   zOAuthException.__init__-   sM   € ð ˆŒ
Ø&ˆÔØ ˆŒØ�GÐ4Ð5ˆÙØ˜˜K˜=¨Ð*Ñ*ˆGÜ×"Ñ" 4¨Õ1r!   )N)r'   Ústrr(   z
str | Noner)   úrequests.ResponseÚreturnÚNone©r   r   r   r   r*   r    r!   r"   r   r   *   s
   „ ÙKõ2r!   r   c                  ó4   ‡ — e Zd ZdZ	 	 	 	 	 	 	 	 dˆ fd„Zˆ xZS )r   zBIndicate that there was an error with the incomplete HTTP request.c                óT   •— || _         || _        || _        t        ‰| �  d|› �«       y)a  Initialize a RequestException instance.

        :param original_exception: The original exception that occurred.
        :param request_args: The arguments to the request function.
        :param request_kwargs: The keyword arguments to the request function.

        zerror with request N)Úoriginal_exceptionÚrequest_argsÚrequest_kwargsÚsuperr*   )r+   r4   r5   r6   Ú	__class__s       €r"   r*   zRequestException.__init__A   s4   ø€ ð #5ˆÔØ(ˆÔØ,ˆÔÜ‰ÑÐ.Ð/AÐ.BÐCÕDr!   )r4   Ú	Exceptionr5   ztuple[Any, ...]r6   zBdict[str, bool | (dict[str, int] | (dict[str, str] | str)) | None]r/   r0   ©r   r   r   r   r*   Ú__classcell__©r8   s   @r"   r   r   >   s=   ø„ ÙLðEà%ðEð &ðEð [ð	Eð
 
÷Eñ Er!   r   c                  ó$   ‡ — e Zd ZdZdˆ fd„Zˆ xZS )r   zAIndicate that there was an error with the completed HTTP request.c               óN   •— || _         t        ‰| �	  d|j                  › d�«       y)zsInitialize a ResponseException instance.

        :param response: A :class:`requests.Response` instance.

        ú	received ú HTTP responseN)r)   r7   r*   Ústatus_code)r+   r)   r8   s     €r"   r*   zResponseException.__init__W   s)   ø€ ð !ˆŒÜ‰Ñ˜9 X×%9Ñ%9Ð$:¸.ÐIÕJr!   ©r)   r.   r/   r0   r:   r<   s   @r"   r   r   T   s   ø„ ÙK÷Kñ Kr!   r   c                  ó   — e Zd ZdZy)r   z1Indicate the response did not contain valid JSON.Nr   r    r!   r"   r   r   a   s   „ Ú;r!   r   c                  ó   — e Zd ZdZy)r   z,Indicate invalid parameters for the request.Nr   r    r!   r"   r   r   e   s   „ Ú6r!   r   c                  ó   — e Zd ZdZy)r	   z5Indicate a conflicting change in the target resource.Nr   r    r!   r"   r	   r	   i   ó   „ Ú?r!   r	   c                  ó   — e Zd ZdZy)r
   z=Indicate the authentication is not permitted for the request.Nr   r    r!   r"   r
   r
   m   s   „ ÚGr!   r
   c                  ó   — e Zd ZdZy)r   z5Indicate that the request requires a different scope.Nr   r    r!   r"   r   r   q   rF   r!   r   c                  ó   — e Zd ZdZy)r   z7Indicate that the request used an invalid access token.Nr   r    r!   r"   r   r   u   s   „ ÚAr!   r   c                  ó   — e Zd ZdZy)r   z.Indicate that the requested URL was not found.Nr   r    r!   r"   r   r   y   s   „ Ú8r!   r   c                  ó   — e Zd ZdZdd„Zy)r   z–Indicate the request resulted in a redirect.

    This class adds the attribute ``path``, which is the path to which the response
    redirects.

    c               óö   — t        |j                  d   «      j                  }|j                  d«      | _        || _        d| j                  › �}|d| j                  v rdndz  }t
        j                  | |«       y)z�Initialize a Redirect exception instance.

        :param response: A :class:`requests.Response` instance containing a location
            header.

        Úlocationz.jsonzRedirect to z/login/zP (You may be trying to perform a non-read-only action via a read-only instance.)Ú N)r   ÚheadersÚpathÚremovesuffixr)   r   r*   )r+   r)   rP   Úmsgs       r"   r*   zRedirect.__init__…   sy   € ô ˜×(Ñ(¨Ñ4Ó5×:Ñ:ˆØ×%Ñ% gÓ.ˆŒ	Ø ˆŒØ˜TŸY™Y˜KÐ(ˆØà˜DŸI™IÑ%ñ _àñ	
ˆô
 	×"Ñ" 4¨Õ-r!   NrB   r1   r    r!   r"   r   r   }   s   „ ñô.r!   r   c                  ó   — e Zd ZdZy)r   zAIndicate issues on the server end preventing request fulfillment.Nr   r    r!   r"   r   r   ˜   s   „ ÚKr!   r   c                  ó   — e Zd ZdZdd„Zy)r   z*Indicate syntax or spam-prevention issues.c               ó  — || _         | j                   j                  «       }|j                  dd«      | _        |j                  dd«      | _        |j                  dg «      | _        t        j                  | d| j                  ›�«       y)z¶Initialize a SpecialError exception instance.

        :param response: A :class:`requests.Response` instance containing a message and
            a list of special errors.

        r,   rN   ÚreasonÚspecial_errorszSpecial error N)r)   ÚjsonÚgetr,   rV   rW   r   r*   )r+   r)   Ú	resp_dicts      r"   r*   zSpecialError.__init__Ÿ   sq   € ð !ˆŒà—M‘M×&Ñ&Ó(ˆ	Ø —}‘} Y°Ó3ˆŒØ—m‘m H¨bÓ1ˆŒØ'Ÿm™mÐ,<¸bÓAˆÔÜ×"Ñ" 4¨>¸$¿,¹,Ð9IÐ)JÕKr!   NrB   r1   r    r!   r"   r   r   œ   s   „ Ù4ôLr!   r   c                  ó   — e Zd ZdZy)r   z9Indicate that the request data exceeds the allowed limit.Nr   r    r!   r"   r   r   ¯   s   „ ÚCr!   r   c                  ó   — e Zd ZdZdd„Zy)r   zLIndicate that the user has sent too many requests in a given amount of time.c               ó  — || _         |j                  j                  d«      | _        |j                  | _        d|j                  › d�}| j                  r|dt        | j                  «      › d�z  }t        j                  | |«       y)z»Initialize a TooManyRequests exception instance.

        :param response: A :class:`requests.Response` instance that may contain a
            retry-after header and a message.

        zretry-afterr?   r@   z. Please wait at least z' seconds before re-trying this request.N)
r)   rO   rY   Úretry_afterÚtextr,   rA   Úfloatr   r*   )r+   r)   rR   s      r"   r*   zTooManyRequests.__init__¶   s~   € ð !ˆŒØ#×+Ñ+×/Ñ/°Ó>ˆÔØ—}‘}ˆŒà˜(×.Ñ.Ð/¨~Ð>ˆØ×ÒØÐ,¬U°4×3CÑ3CÓ-DÐ,EÐElÐmÑmˆCÜ×"Ñ" 4¨Õ-r!   NrB   r1   r    r!   r"   r   r   ³   s
   „ ÙVô.r!   r   c                  ó   — e Zd ZdZy)r   zFIndicate that the length of the request URI exceeds the allowed limit.Nr   r    r!   r"   r   r   Ç   s   „ ÚPr!   r   c                  ó   — e Zd ZdZy)r   zDIndicate that the requested URL is unavailable due to legal reasons.Nr   r    r!   r"   r   r   Ë   s   „ ÚNr!   r   )r   Ú
__future__r   Útypingr   r   Úurllib.parser   ÚrequestsÚ__all__r9   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r    r!   r"   ú<module>rh      s.  ðÙ 9å "ç %Ý !áÛò€ô.N˜	ô NôAÐ)ô Aô2Ð&ô 2ô(EÐ(ô Eô,
KÐ)ô 
Kô<Ðô <ô7Ð"ô 7ô@Ð ô @ôHÐ!ô Hô@Ð)ô @ôBÐ$ô Bô9Ð ô 9ô.Ð ô .ô6LÐ#ô LôLÐ$ô Lô&DÐ ô Dô.Ð'ô .ô(QÐ"ô QôOÐ!2õ Or!   