Ë
    Fü´jí  ã                  ó<  — d Z ddlmZ ddlm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«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Zy)aN  PRAW exception classes.

Includes two main exceptions: :class:`.RedditAPIException` for when something goes wrong
on the server side, and :class:`.ClientException` when something goes wrong on the
client side. Both of these classes extend :class:`.PRAWException`.

All other exceptions are subclassed from :class:`.ClientException`.

é    )Úannotations)Úcastc                  ó   — e Zd ZdZy)ÚPRAWExceptionz@The base PRAW Exception that all other exception classes extend.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úM/root/workspace/ytshorts/venv/lib/python3.12/site-packages/praw/exceptions.pyr   r      s   „ ÚJr   r   c                  ó   — e Zd ZdZy)ÚClientExceptionzEIndicate exceptions that don't involve interaction with Reddit's API.Nr   r   r   r   r   r      s   „ ÚOr   r   c                  ó$   ‡ — e Zd ZdZdˆ fd„Zˆ xZS )ÚDuplicateReplaceExceptionzKIndicate exceptions that involve the replacement of :class:`.MoreComments`.c                ó$   •— t         ‰| �  d«       y)z:Initialize a :class:`.DuplicateReplaceException` instance.ziA duplicate comment has been detected. Are you attempting to call 'replace_more_comments' more than once?N©ÚsuperÚ__init__©ÚselfÚ	__class__s    €r   r   z"DuplicateReplaceException.__init__   s   ø€ ä‰ÑØwõ	
r   ©ÚreturnÚNone©r   r	   r
   r   r   Ú__classcell__©r   s   @r   r   r      s   ø„ ÙU÷
ñ 
r   r   c                  ó$   ‡ — e Zd ZdZdˆ fd„Zˆ xZS )ÚInvalidFlairTemplateIDz@Indicate exceptions where an invalid flair template ID is given.c                ó,   •— t         ‰| �  d|› d�«       y)z8Initialize an :class:`.InvalidFlairTemplateID` instance.zThe flair template ID 'zO' is invalid. If you are trying to create a flair, please use the 'add' method.Nr   )r   Útemplate_idr   s     €r   r   zInvalidFlairTemplateID.__init__%   s!   ø€ ä‰ÑØ% k ]ð 3<ð <õ	
r   )r#   Ústrr   r   r   r   s   @r   r!   r!   "   s   ø„ ÙJ÷
ñ 
r   r!   c                  ó$   ‡ — e Zd ZdZdˆ fd„Zˆ xZS )ÚInvalidImplicitAuthzDIndicate exceptions where an implicit auth type is used incorrectly.c                ó$   •— t         ‰| �  d«       y)z5Initialize an :class:`.InvalidImplicitAuth` instance.z<Implicit authorization can only be used with installed apps.Nr   r   s    €r   r   zInvalidImplicitAuth.__init__0   s   ø€ ä‰ÑÐWÕXr   r   r   r   s   @r   r&   r&   -   s   ø„ ÙN÷Yñ Yr   r&   c                  ó*   ‡ — e Zd ZdZddœdˆ fd„Zˆ xZS )Ú
InvalidURLz4Indicate exceptions where an invalid URL is entered.zInvalid URL: {})Úmessagec               óB   •— t         ‰| �  |j                  |«      «       y)zïInitialize an :class:`.InvalidURL` instance.

        :param url: The invalid URL.
        :param message: The message to display. Must contain a format identifier (``{}``
            or ``{0}``) (default: ``"Invalid URL: {}"``).

        N)r   r   Úformat)r   Úurlr*   r   s      €r   r   zInvalidURL.__init__8   s   ø€ ô 	‰Ñ˜Ÿ™¨Ó,Õ-r   )r-   r$   r*   r$   r   r   r   r   s   @r   r)   r)   5   s   ø„ Ù>à3D÷ .ó .r   r)   c                  ó   — e Zd ZdZy)Ú!MissingRequiredAttributeExceptionzAIndicate exceptions caused by not including a required attribute.Nr   r   r   r   r/   r/   C   s   „ ÚKr   r/   c                  ó   — e Zd ZdZy)ÚReadOnlyExceptionzJRaised when a method call requires :attr:`.read_only` mode to be disabled.Nr   r   r   r   r1   r1   G   s   „ ÚTr   r1   c                  ó>   ‡ — e Zd ZdZe	 	 	 	 dd„«       Zdˆ fd„Zˆ xZS )ÚRedditAPIExceptionz/Container for error messages from Reddit's API.c                óº   — | D �cg c]K  }t        |t        «      r|n6t        |d   t        |d   «      r|d   ndt        |d   «      r|d   nd¬«      ‘ŒM c}S c c}w )z?Covert an exception list into a :class:`.RedditErrorItem` list.r   é   Ú é   )Ú
error_typeÚfieldr*   )Ú
isinstanceÚRedditErrorItemÚbool)Ú
exceptionsÚ	exceptions     r   Úparse_exception_listz'RedditAPIException.parse_exception_listN   sn   € ð (ö
ð ô ˜i¬Ô9ñ ä$Ø(¨™|Ü*.¨y¸©|Ô*<˜) Aš,À"Ü,0°¸1±Ô,>˜I ašLÀBôñò
ð 	
ùò 
s   …AAc                óØ   •— t        |t        «      r!t        |d   t        «      rt        d|«      g}nt        d|«      }| j	                  |«      | _        t        ‰| �  | j
                  Ž  y)zÇInitialize a :class:`.RedditAPIException` instance.

        :param items: Either a list of instances of :class:`.RedditErrorItem` or a list
            containing lists of unformed errors.

        r   z	list[str]ú!list[RedditErrorItem | list[str]]N)r:   Úlistr$   r   r?   Úitemsr   r   )r   rC   Úparsed_itemsr   s      €r   r   zRedditAPIException.__init__`   s\   ø€ ô �eœTÔ"¤z°%¸±(¼CÔ'@Ü?CÀKÐQVÓ?WÐ>X‰LäÐ CÀUÓKˆLØ×.Ñ.¨|Ó<ˆŒ
Ü‰Ñ˜$Ÿ*™*Ò%r   )r=   rA   r   zlist[RedditErrorItem])rC   z'list[RedditErrorItem | list[str] | str]r   r   )r   r	   r
   r   Ústaticmethodr?   r   r   r   s   @r   r3   r3   K   s2   ø„ Ù9àð
Ø5ð
à	ò
ó ð
÷"&ñ &r   r3   c                  ól   ‡ — e Zd ZdZed
d„«       Zdˆ fd„Zdd„Zdddœ	 	 	 	 	 	 	 dd„Zd
d„Z	d
d	„Z
ˆ xZS )r;   z5Represents a single error returned from Reddit's API.c                ó–   — | j                   }| j                  r|d| j                  ›�z  }| j                  r|d| j                  ›�z  }|S )z#The completed error message string.z: z
 on field ©r8   r*   r9   )r   Ú	error_strs     r   Úerror_messagezRedditErrorItem.error_messager   sL   € ð —O‘Oˆ	Ø�<Š<Ø˜2˜dŸl™lÐ-Ð.Ñ.ˆIØ�:Š:Ø˜: d§j¡j ^Ð4Ñ4ˆIØÐr   c                óÐ   •— t        |t        «      rG| j                  | j                  | j                  f|j                  |j                  |j                  fk(  S t
        ‰| �  |«      S )zCheck for equality.)r:   r;   r8   r*   r9   r   Ú__eq__)r   Úotherr   s     €r   rL   zRedditErrorItem.__eq__|   s[   ø€ ä�eœ_Ô-Ø—O‘O T§\¡\°4·:±:Ð>Ø× Ñ Ø—‘Ø—‘ðCñ ð ô
 ‰w‰~˜eÓ$Ð$r   c                óš   — t        | j                  j                  «      t        | j                  | j                  | j
                  f«      z  S )z(Return the hash of the current instance.)Úhashr   r   r8   r*   r9   ©r   s    r   Ú__hash__zRedditErrorItem.__hash__†   s7   € ä�D—N‘N×+Ñ+Ó,¬t°T·_±_ÀdÇlÁlÐTX×T^ÑT^Ð4_Ó/`Ñ`Ð`r   N)r9   r*   c               ó.   — || _         || _        || _        y)a  Initialize a :class:`.RedditErrorItem` instance.

        :param error_type: The error type set on Reddit's end.
        :param field: The input field associated with the error, if available.
        :param message: The associated message for the error.

        NrH   )r   r8   r9   r*   s       r   r   zRedditErrorItem.__init__Š   s   € ð %ˆŒØˆŒØˆ�
r   c                ó‚   — | j                   j                  › d| j                  ›d| j                  ›d| j                  ›d�S )z?Return an object initialization representation of the instance.z(error_type=z
, message=z, field=ú))r   r   r8   r*   r9   rP   s    r   Ú__repr__zRedditErrorItem.__repr__œ   sG   € ð �~‰~×&Ñ&Ð' |°D·O±OÐ3FÀjÐQU×Q]ÑQ]ÐP`Ð`hÐim×isÑisÐhvÐvwÐxð	
r   c                ó   — | j                   S )z(Get the message returned from str(self).)rJ   rP   s    r   Ú__str__zRedditErrorItem.__str__¢   s   € à×!Ñ!Ð!r   )r   r$   )rM   Úobjectr   r<   )r   Úint)r8   r$   r9   ú
str | Noner*   rZ   r   r   )r   r	   r
   r   ÚpropertyrJ   rL   rQ   r   rU   rW   r   r   s   @r   r;   r;   o   s`   ø„ Ù?àòó ðõ%óað !Ø"ñàðð ð	ð
 ðð 
óó$
÷"r   r;   c                  ó$   ‡ — e Zd ZdZdˆ fd„Zˆ xZS )ÚTooLargeMediaExceptionz:Indicate exceptions from uploading media that's too large.c               óN   •— || _         || _        t        ‰| �  d|› d|› d�«       y)zÅInitialize a :class:`.TooLargeMediaException` instance.

        :param actual: The actual size of the uploaded media.
        :param maximum_size: The maximum size of the uploaded media.

        z;The media that you uploaded was too large (maximum size is z bytes, uploaded z bytes)N)Úmaximum_sizeÚactualr   r   )r   r`   r_   r   s      €r   r   zTooLargeMediaException.__init__ª   s7   ø€ ð )ˆÔØˆŒÜ‰ÑØIÈ,ÈÐWhÐioÐhpÐpwÐxõ	
r   )r`   rY   r_   rY   r   r   r   r   s   @r   r]   r]   §   s   ø„ ÙD÷
ñ 
r   r]   c                  ó$   ‡ — e Zd ZdZdˆ fd„Zˆ xZS )ÚWebSocketExceptionz0Indicate exceptions caused by use of WebSockets.c                ó$   •— t         ‰| �  |«       y)zmInitialize a :class:`.WebSocketException` instance.

        :param message: The exception message.

        Nr   )r   r*   r   s     €r   r   zWebSocketException.__init__»   s   ø€ ô 	‰Ñ˜Õ!r   )r*   r$   r   r   r   r   s   @r   rb   rb   ¸   s   ø„ Ù:÷"ñ "r   rb   c                  ó$   ‡ — e Zd ZdZdˆ fd„Zˆ xZS )ÚMediaPostFailedz0Indicate exceptions where media uploads failed..c                ó$   •— t         ‰| �  d«       y)z0Initialize a :class:`.MediaPostFailed` instance.z£The attempted media upload action has failed. Possible causes include the corruption of media files. Check that the media file can be opened on your local machine.Nr   r   s    €r   r   zMediaPostFailed.__init__Ç   s   ø€ ä‰Ñð#õ	
r   r   r   r   s   @r   re   re   Ä   s   ø„ Ù:÷
ñ 
r   re   N)r   Ú
__future__r   Útypingr   Ú	Exceptionr   r   r   r!   r&   r)   r/   r1   r3   r;   r]   rb   re   r   r   r   ú<module>rj      s¹   ðñõ #å ôK�Iô KôP�mô Pô
 ô 
ô
˜_ô 
ôY˜/ô Yô.�ô .ôL¨ô LôU˜ô Uô!&˜ô !&÷H5"ñ 5"ôp
˜_ô 
ô"	"˜ô 	"ô	
Ð(õ 	
r   