ó
    pyüi%0  ã                   óV  • S r SSKJr  SSKJr  SSKJrJr  SSKJr  SSK	J
r
  \S   r\ " S	 S
5      5       r\ " S S\5      5       r " S S\5      r\ " S S5      5       r\ " S S\5      5       r\ " S S\5      5       r\ " S S\5      5       r\ " S S\5      5       rS\S\4S jrg)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)ÚLiteralÚ	TypedDicté   )Ú	constants)Úparse_datetime)ÚopenÚclosedÚmergedÚdraftc                   óª   • \ rS rSr% Sr\\S'   \\S'   \\S'   \\S'   \\S'   \\S'   \	\S	'   \
\S
'   \\S'   \S\S-  4S j5       r\S\4S j5       rSrg)Ú
Discussioné   a•  
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ÚreturnNc                 óD   • U R                   (       a  SU R                   3$ g)zq
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    ÚV/home/mande/repo/quber/.venv/lib/python3.13/site-packages/huggingface_hub/community.pyÚgit_referenceÚDiscussion.git_referenceE   s!   € ð ××Ø˜dŸh™h˜ZÐ(Ð(Øó    c                 ó  • U R                   b  U R                   [        R                  :X  a(  U R                   SU R                   SU R
                   3$ U R                   SU R                    SU R                   SU R
                   3$ )z-Returns the URL of the discussion on the Hub.Ú/z/discussions/zs/)r   r   ÚREPO_TYPE_MODELr   r   r   r   s    r   ÚurlÚDiscussion.urlO   sp   € ð �>‰>Ñ! T§^¡^´y×7PÑ7PÓ%PØ—m‘m�_ A d§l¡l ^°=ÀÇÁÀ
ÐKÐKØ—-‘-�  $§.¡.Ð!1°°D·L±L°>ÀÈtÏxÉxÈjÐYÐYr!   © )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚstrÚ__annotations__ÚDiscussionStatusÚintÚboolr   Úpropertyr   r%   Ú__static_attributes__r'   r!   r   r   r      su   ‡ ñ$ðL ƒJØÓØ	ƒHØƒLØƒNØƒKØÓØÓØƒMàð˜s T™zó ó ðð ðZ�Só Zó óZr!   r   c                   óv   • \ rS rSr% Sr\S   \S'   \\   \-  S-  \S'   \S-  \S'   \S-  \S'   \S-  \S	'   S
r	g)ÚDiscussionWithDetailséW   a{  
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Údiffr'   )
r(   r)   r*   r+   r,   Úlistr.   r-   r1   r3   r'   r!   r   r5   r5   W   sH   ‡ ñ0ðd Ð"Ñ#Ó#Ø˜C‘y 4Ñ'¨$Ñ.Ó.Ø˜‘:ÓØ˜D‘jÓ Ø
�‰*Ör!   r5   c                   óH   • \ rS rSr% \\S'   \\S'   \\S'   \\S'   \\S'   Srg)	ÚDiscussionEventArgsé’   ÚidÚtyper   r   Ú_eventr'   N)	r(   r)   r*   r+   r-   r.   r   Údictr3   r'   r!   r   r?   r?   ’   s   ‡ ØƒGØ
ƒIØÓØƒKØ†Lr!   r?   c                   óL   • \ rS rSr% Sr\\S'   \\S'   \\S'   \\S'   \\S'   Sr	g	)
r7   éš   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.
rA   rB   r   r   rC   r'   N)
r(   r)   r*   r+   r,   r-   r.   r   rD   r3   r'   r!   r   r7   r7   š   s&   ‡ ñð, 	ƒGØ
ƒIØÓØƒKàƒLÚMr!   r7   c                   ó¶   • \ rS rSr% Sr\\S'   \\S'   \\S'   \S\4S j5       r	\S\
4S j5       r\S\4S	 j5       r\S\\   4S
 j5       r\S\4S j5       rSrg)ÚDiscussionCommenté»   a.  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                 ó,   • U R                   S   S   S   $ )z&The rendered comment, as a HTML stringÚdataÚlatestÚhtml©rC   r   s    r   ÚrenderedÚDiscussionComment.renderedÙ   s   € ð �{‰{˜6Ñ" 8Ñ,¨VÑ4Ð4r!   c                 ó>   • [        U R                  S   S   S   5      $ )ú+The last edit time, as a `datetime` object.rN   rO   Ú	updatedAt)r	   rC   r   s    r   Úlast_edited_atÚ DiscussionComment.last_edited_atÞ   s"   € ô ˜dŸk™k¨&Ñ1°(Ñ;¸KÑHÓIÐIr!   c                 óf   • U R                   S   S   R                  S0 5      R                  SS5      $ )rU   rN   rO   r   ÚnameÚdeleted)rC   Úgetr   s    r   Úlast_edited_byÚ DiscussionComment.last_edited_byã   s2   € ð �{‰{˜6Ñ" 8Ñ,×0Ñ0°¸2Ó>×BÑBÀ6È9ÓUÐUr!   c                 ó&   • U R                   S   S   $ )zThe edit history of the commentrN   ÚhistoryrQ   r   s    r   Úedit_historyÚDiscussionComment.edit_historyè   s   € ð �{‰{˜6Ñ" 9Ñ-Ð-r!   c                 ó,   • [        U R                  5      $ )N)Úlenra   r   s    r   Únumber_of_editsÚ!DiscussionComment.number_of_editsí   s   € ä�4×$Ñ$Ó%Ð%r!   r'   N)r(   r)   r*   r+   r,   r-   r.   r1   r2   rR   r   rW   r]   r=   rD   ra   r0   re   r3   r'   r!   r   rH   rH   »   s§   ‡ ñð0 ƒLØƒLØƒLàð5˜#ó 5ó ð5ð ðJ ó Jó ðJð ðV ó Vó ðVð ð.˜d 4™jó .ó ð.ð ð& ó &ó ó&r!   rH   c                   ó$   • \ rS rSr% Sr\\S'   Srg)ÚDiscussionStatusChangeéò   a
  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_statusr'   N©r(   r)   r*   r+   r,   r-   r.   r3   r'   r!   r   rh   rh   ò   s   ‡ ñð. †Or!   rh   c                   ó.   • \ rS rSr% Sr\\S'   \\S'   Srg)ÚDiscussionCommiti  aŸ  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Úoidr'   Nrk   r'   r!   r   rm   rm     s   ‡ ñð* ƒLØ	†Hr!   rm   c                   ó.   • \ rS rSr% Sr\\S'   \\S'   Srg)ÚDiscussionTitleChangei)  a®  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_titler'   Nrk   r'   r!   r   rq   rq   )  s   ‡ ñð* ƒNØ†Nr!   rq   Úeventr   c                 ó®  • U S   nU S   n[        U S   5      nUUUU R                  S0 5      R                  SS5      U S.nUS:X  a&  [        S0 UDU S	   S
   U S	   S   U S	   S   S   S.D6$ US:X  a  [        S0 UDSU S	   S   0D6$ US:X  a  [	        S0 UDU S	   S   U S	   S   S.D6$ US:X  a  [        S0 UDU S	   S   U S	   S   S.D6$ [        S0 UD6$ )z.Instantiates a [`DiscussionEvent`] from a dictrA   rB   Ú	createdAtr   rZ   r[   )rA   rB   r   r   rC   ÚcommentrN   rK   rL   rO   Úraw)rK   rL   rJ   zstatus-changerj   r   ÚcommitÚsubjectro   )rn   ro   ztitle-changeÚfromÚto)rr   rs   r'   )r	   r\   rH   rh   rm   rq   r7   )rt   Úevent_idÚ
event_typer   Úcommon_argss        r   Údeserialize_eventr€   D  sX  € à˜$‘K€HØ˜F‘m€JÜ  kÑ 2Ó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   Úutilsr	   r/   r   r5   r?   r7   rH   rh   rm   rq   rD   r€   r'   r!   r   Ú<module>r…      s  ðñõ "Ý ß %å Ý !ð Ð>Ñ?Ð ð ÷@Zð @Zó ð@ZðF ô7˜Jó 7ó ð7ôt˜)ô ð ÷Nð Nó ðNð@ ô3&˜ó 3&ó ð3&ðl ô˜_ó ó ðð6 ô�ó ó ðð4 ô˜Oó ó ðð4'*˜Tð '* oõ '*r!   