§
    ïóÉjM0  ã                   óÂ  — d Z ddlmZ ddlmZ ddlmZmZmZmZm	Z	 ddl
mZ ddlmZ ed         Ze G d	„ d
¦  «        ¦   «         Ze G d„ de¦  «        ¦   «         Z G d„ de¦  «        Ze G d„ d¦  «        ¦   «         Ze G d„ de¦  «        ¦   «         Ze G d„ de¦  «        ¦   «         Ze G d„ de¦  «        ¦   «         Ze G d„ de¦  «        ¦   «         Zdedefd„ZdS )a  
Data structures to interact with Discussions and Pull Requests on the Hub.

See [the Discussions and Pull Requests guide](https://huggingface.co/docs/hub/repositories-pull-requests-discussions)
for more information on Pull Requests, Discussions, and the community tab.
é    )Ú	dataclass)Údatetime)ÚListÚLiteralÚOptionalÚ	TypedDictÚUnioné   )Ú	constants)Úparse_datetime)ÚopenÚclosedÚmergedÚdraftc                   ó²   — e Zd ZU dZeed<   eed<   eed<   eed<   eed<   eed<   eed<   e	ed	<   eed
<   e
dee         fd„¦   «         Ze
defd„¦   «         ZdS )Ú
Discussiona  
    A Discussion or Pull Request on the Hub.

    This dataclass is not intended to be instantiated directly.

    Attributes:
        title (`str`):
            The title of the Discussion / Pull Request
        status (`str`):
            The status of the Discussion / Pull Request.
            It must be one of:
                * `"open"`
                * `"closed"`
                * `"merged"` (only for Pull Requests )
                * `"draft"` (only for Pull Requests )
        num (`int`):
            The number of the Discussion / Pull Request.
        repo_id (`str`):
            The id (`"{namespace}/{repo_name}"`) of the repo on which
            the Discussion / Pull Request was open.
        repo_type (`str`):
            The type of the repo on which the Discussion / Pull Request was open.
            Possible values are: `"model"`, `"dataset"`, `"space"`.
        author (`str`):
            The username of the Discussion / Pull Request author.
            Can be `"deleted"` if the user has been deleted since.
        is_pull_request (`bool`):
            Whether or not this is a Pull Request.
        created_at (`datetime`):
            The `datetime` of creation of the Discussion / Pull Request.
        endpoint (`str`):
            Endpoint of the Hub. Default is https://huggingface.co.
        git_reference (`str`, *optional*):
            (property) Git reference to which changes can be pushed if this is a Pull Request, `None` otherwise.
        url (`str`):
            (property) URL of the discussion on the Hub.
    ÚtitleÚstatusÚnumÚrepo_idÚ	repo_typeÚauthorÚis_pull_requestÚ
created_atÚendpointÚreturnc                 ó(   — | j         r
d| j        › �S dS )z‰
        If this is a Pull Request , returns the git reference to which changes can be pushed.
        Returns `None` otherwise.
        zrefs/pr/N)r   r   ©Úselfs    ú|/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib/python3.11/site-packages/huggingface_hub/community.pyÚgit_referencezDiscussion.git_referenceE   s$   € ð Ôð 	)Ø(˜dœhÐ(Ð(Ð(Øˆtó    c                 ó®   — | j         �| j         t          j        k    r| j        › d| j        › d| j        › �S | j        › d| j         › d| j        › d| j        › �S )z-Returns the URL of the discussion on the Hub.Nú/z/discussions/zs/)r   r   ÚREPO_TYPE_MODELr   r   r   r   s    r    ÚurlzDiscussion.urlO   si   € ð Œ>Ð! T¤^µyÔ7PÒ%PÐ%PØ”mÐKÐK d¤lÐKÐKÀÄÐKÐKÐKØ”-ÐYÐY $¤.ÐYÐY°D´LÐYÐYÈtÌxÐYÐYÐYr"   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚstrÚ__annotations__ÚDiscussionStatusÚintÚboolr   Úpropertyr   r!   r&   © r"   r    r   r      sÔ   € € € € € € ð$ð $ðL €J€J�JØÐÐÑØ	€H€H�HØ€L€L�LØ€N€N�NØ€K€K�KØÐÐÑØÐÐÑØ€M€M�Màð˜x¨œ}ð ð ð ñ „Xðð ðZ�Sð Zð Zð Zñ „XðZð Zð Zr"   r   c                   ó”   — e Zd ZU dZed         ed<   eee         edf         ed<   e	e         ed<   e	e         ed<   e	e         ed<   dS )	ÚDiscussionWithDetailsa7	  
    Subclass of [`Discussion`].

    Attributes:
        title (`str`):
            The title of the Discussion / Pull Request
        status (`str`):
            The status of the Discussion / Pull Request.
            It can be one of:
                * `"open"`
                * `"closed"`
                * `"merged"` (only for Pull Requests )
                * `"draft"` (only for Pull Requests )
        num (`int`):
            The number of the Discussion / Pull Request.
        repo_id (`str`):
            The id (`"{namespace}/{repo_name}"`) of the repo on which
            the Discussion / Pull Request was open.
        repo_type (`str`):
            The type of the repo on which the Discussion / Pull Request was open.
            Possible values are: `"model"`, `"dataset"`, `"space"`.
        author (`str`):
            The username of the Discussion / Pull Request author.
            Can be `"deleted"` if the user has been deleted since.
        is_pull_request (`bool`):
            Whether or not this is a Pull Request.
        created_at (`datetime`):
            The `datetime` of creation of the Discussion / Pull Request.
        events (`list` of [`DiscussionEvent`])
            The list of [`DiscussionEvents`] in this Discussion or Pull Request.
        conflicting_files (`Union[List[str], bool, None]`, *optional*):
            A list of conflicting files if this is a Pull Request.
            `None` if `self.is_pull_request` is `False`.
            `True` if there are conflicting files but the list can't be retrieved.
        target_branch (`str`, *optional*):
            The branch into which changes are to be merged if this is a
            Pull Request . `None`  if `self.is_pull_request` is `False`.
        merge_commit_oid (`str`, *optional*):
            If this is a merged Pull Request , this is set to the OID / SHA of
            the merge commit, `None` otherwise.
        diff (`str`, *optional*):
            The git diff if this is a Pull Request , `None` otherwise.
        endpoint (`str`):
            Endpoint of the Hub. Default is https://huggingface.co.
        git_reference (`str`, *optional*):
            (property) Git reference to which changes can be pushed if this is a Pull Request, `None` otherwise.
        url (`str`):
            (property) URL of the discussion on the Hub.
    ÚDiscussionEventÚeventsNÚconflicting_filesÚtarget_branchÚmerge_commit_oidÚdiff)
r'   r(   r)   r*   r   r,   r	   r+   r/   r   r1   r"   r    r3   r3   W   s}   € € € € € € ð0ð 0ðd Ð"Ô#Ð#Ð#Ñ#Ø˜T #œY¨¨dÐ2Ô3Ð3Ð3Ñ3Ø˜C”=Ð Ð Ñ Ø˜s”mÐ#Ð#Ñ#Ø
�3Œ-ÐÐÑÐÐr"   r3   c                   óB   — e Zd ZU eed<   eed<   eed<   eed<   eed<   dS )ÚDiscussionEventArgsÚidÚtyper   r   Ú_eventN)r'   r(   r)   r+   r,   r   Údictr1   r"   r    r;   r;   ’   s@   € € € € € € Ø€G€G�GØ
€I€I�IØÐÐÑØ€K€K�KØ€L€L�L€L€Lr"   r;   c                   óF   — e Zd ZU dZeed<   eed<   eed<   eed<   eed<   dS )r4   aÜ  
    An event in a Discussion or Pull Request.

    Use concrete classes:
        * [`DiscussionComment`]
        * [`DiscussionStatusChange`]
        * [`DiscussionCommit`]
        * [`DiscussionTitleChange`]

    Attributes:
        id (`str`):
            The ID of the event. An hexadecimal string.
        type (`str`):
            The type of the event.
        created_at (`datetime`):
            A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime)
            object holding the creation timestamp for the event.
        author (`str`):
            The username of the Discussion / Pull Request author.
            Can be `"deleted"` if the user has been deleted since.
    r<   r=   r   r   r>   N)r'   r(   r)   r*   r+   r,   r   r?   r1   r"   r    r4   r4   š   sN   € € € € € € ðð ð, 	€G€G�GØ
€I€I�IØÐÐÑØ€K€K�Kà€L€L�LØMÐMr"   r4   c                   óÊ   — e Zd ZU dZeed<   eed<   eed<   edefd„¦   «         Zede	fd„¦   «         Z
edefd„¦   «         Zedee         fd	„¦   «         Zedefd
„¦   «         ZdS )ÚDiscussionCommentaz  A comment in a Discussion / Pull Request.

    Subclass of [`DiscussionEvent`].


    Attributes:
        id (`str`):
            The ID of the event. An hexadecimal string.
        type (`str`):
            The type of the event.
        created_at (`datetime`):
            A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime)
            object holding the creation timestamp for the event.
        author (`str`):
            The username of the Discussion / Pull Request author.
            Can be `"deleted"` if the user has been deleted since.
        content (`str`):
            The raw markdown content of the comment. Mentions, links and images are not rendered.
        edited (`bool`):
            Whether or not this comment has been edited.
        hidden (`bool`):
            Whether or not this comment has been hidden.
    ÚcontentÚeditedÚhiddenr   c                 ó4   — | j         d         d         d         S )z&The rendered comment, as a HTML stringÚdataÚlatestÚhtml©r>   r   s    r    ÚrenderedzDiscussionComment.renderedÙ   s   € ð Œ{˜6Ô" 8Ô,¨VÔ4Ð4r"   c                 óN   — t          | j        d         d         d         ¦  «        S )ú+The last edit time, as a `datetime` object.rG   rH   Ú	updatedAt)r   r>   r   s    r    Úlast_edited_atz DiscussionComment.last_edited_atÞ   s#   € õ ˜dœk¨&Ô1°(Ô;¸KÔHÑIÔIÐIr"   c                 óx   — | j         d         d                              di ¦  «                             dd¦  «        S )rM   rG   rH   r   ÚnameÚdeleted)r>   Úgetr   s    r    Úlast_edited_byz DiscussionComment.last_edited_byã   s6   € ð Œ{˜6Ô" 8Ô,×0Ò0°¸2Ñ>Ô>×BÒBÀ6È9ÑUÔUÐUr"   c                 ó(   — | j         d         d         S )zThe edit history of the commentrG   ÚhistoryrJ   r   s    r    Úedit_historyzDiscussionComment.edit_historyè   s   € ð Œ{˜6Ô" 9Ô-Ð-r"   c                 ó*   — t          | j        ¦  «        S )N)ÚlenrW   r   s    r    Únumber_of_editsz!DiscussionComment.number_of_editsí   s   € å�4Ô$Ñ%Ô%Ð%r"   N)r'   r(   r)   r*   r+   r,   r/   r0   rK   r   rO   rT   r   r?   rW   r.   rZ   r1   r"   r    rB   rB   »   s  € € € € € € ðð ð0 €L€L�LØ€L€L�LØ€L€L�Làð5˜#ð 5ð 5ð 5ñ „Xð5ð ðJ ð Jð Jð Jñ „XðJð ðV ð Vð Vð Vñ „XðVð ð.˜d 4œjð .ð .ð .ñ „Xð.ð ð& ð &ð &ð &ñ „Xð&ð &ð &r"   rB   c                   ó   — e Zd ZU dZeed<   dS )ÚDiscussionStatusChangeaV  A change of status in a Discussion / Pull Request.

    Subclass of [`DiscussionEvent`].

    Attributes:
        id (`str`):
            The ID of the event. An hexadecimal string.
        type (`str`):
            The type of the event.
        created_at (`datetime`):
            A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime)
            object holding the creation timestamp for the event.
        author (`str`):
            The username of the Discussion / Pull Request author.
            Can be `"deleted"` if the user has been deleted since.
        new_status (`str`):
            The status of the Discussion / Pull Request after the change.
            It can be one of:
                * `"open"`
                * `"closed"`
                * `"merged"` (only for Pull Requests )
    Ú
new_statusN©r'   r(   r)   r*   r+   r,   r1   r"   r    r\   r\   ò   s%   € € € € € € ðð ð. €O€O�O€O€Or"   r\   c                   ó(   — e Zd ZU dZeed<   eed<   dS )ÚDiscussionCommitaã  A commit in a Pull Request.

    Subclass of [`DiscussionEvent`].

    Attributes:
        id (`str`):
            The ID of the event. An hexadecimal string.
        type (`str`):
            The type of the event.
        created_at (`datetime`):
            A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime)
            object holding the creation timestamp for the event.
        author (`str`):
            The username of the Discussion / Pull Request author.
            Can be `"deleted"` if the user has been deleted since.
        summary (`str`):
            The summary of the commit.
        oid (`str`):
            The OID / SHA of the commit, as a hexadecimal string.
    ÚsummaryÚoidNr^   r1   r"   r    r`   r`     s.   € € € € € € ðð ð* €L€L�LØ	€H€H�H€H€Hr"   r`   c                   ó(   — e Zd ZU dZeed<   eed<   dS )ÚDiscussionTitleChangeaò  A rename event in a Discussion / Pull Request.

    Subclass of [`DiscussionEvent`].

    Attributes:
        id (`str`):
            The ID of the event. An hexadecimal string.
        type (`str`):
            The type of the event.
        created_at (`datetime`):
            A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime)
            object holding the creation timestamp for the event.
        author (`str`):
            The username of the Discussion / Pull Request author.
            Can be `"deleted"` if the user has been deleted since.
        old_title (`str`):
            The previous title for the Discussion / Pull Request.
        new_title (`str`):
            The new title.
    Ú	old_titleÚ	new_titleNr^   r1   r"   r    rd   rd   )  s.   € € € € € € ðð ð* €N€N�NØ€N€N�N€N€Nr"   rd   Úeventr   c                 óH  — | d         }| d         }t          | d         ¦  «        }||||                      di ¦  «                             dd¦  «        | dœ}|dk    r<t          di |¤| d	         d
         | d	         d         | d	         d         d         dœ¤ŽS |dk    rt          di |¤d| d	         d         i¤ŽS |dk    r)t	          di |¤| d	         d         | d	         d         dœ¤ŽS |dk    r)t          di |¤| d	         d         | d	         d         dœ¤ŽS t          di |¤ŽS )z.Instantiates a [`DiscussionEvent`] from a dictr<   r=   Ú	createdAtr   rQ   rR   )r<   r=   r   r   r>   ÚcommentrG   rD   rE   rH   Úraw)rD   rE   rC   zstatus-changer]   r   ÚcommitÚsubjectrb   )ra   rb   ztitle-changeÚfromÚto)re   rf   r1   )r   rS   rB   r\   r`   rd   r4   )rg   Úevent_idÚ
event_typer   Úcommon_argss        r    Údeserialize_eventrs   D  sÈ  € à˜$”K€HØ˜F”m€JÝ  kÔ 2Ñ3Ô3€Jð ØØ Ø—)’)˜H bÑ)Ô)×-Ò-¨f°iÑ@Ô@Øð(ð (€Kð �YÒÐÝ ð 
ð 
Øð
à˜”= Ô*Ø˜”= Ô*Ø˜&”M (Ô+¨EÔ2ð	
ð 
ð 
ð 
ð 	
ð �_Ò$Ð$Ý%ð 
ð 
Øð
ð 
à˜V”} XÔ.ð
ð 
ð 
ð 	
ð �XÒÐÝð 
ð 
Øð
à˜&”M )Ô,Ø�f”˜eÔ$ð
ð 
ð 
ð 
ð 	
ð
 �^Ò#Ð#Ý$ð 
ð 
Øð
à˜F”m FÔ+Ø˜F”m DÔ)ð
ð 
ð 
ð 
ð 	
õ Ð)Ð)˜[Ð)Ð)Ð)r"   N)r*   Údataclassesr   r   Útypingr   r   r   r   r	   Ú r   Úutilsr   r-   r   r3   r;   r4   rB   r\   r`   rd   r?   rs   r1   r"   r    ú<module>rx      sy  ððð ð "Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð Ð Ð Ø <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <à Ð Ð Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !ð Ð>Ô?Ð ð ð@Zð @Zð @Zð @Zð @Zñ @Zô @Zñ „ð@ZðF ð7ð 7ð 7ð 7ð 7˜Jñ 7ô 7ñ „ð7ðtð ð ð ð ˜)ñ ô ð ð ðNð Nð Nð Nð Nñ Nô Nñ „ðNð@ ð3&ð 3&ð 3&ð 3&ð 3&˜ñ 3&ô 3&ñ „ð3&ðl ðð ð ð ð ˜_ñ ô ñ „ðð6 ðð ð ð ð �ñ ô ñ „ðð4 ðð ð ð ð ˜Oñ ô ñ „ðð4'*˜Tð '* oð '*ð '*ð '*ð '*ð '*ð '*r"   