
    ,Of7                        d dl mZ d dlmZ d dlmZmZ d dlZd dlZd dl	Zd dl
Zd dlZd dlZd dl
mZmZmZmZmZmZmZ d dlmZ erd dlmZ d dl	mZ d d	lmZ  G d
 de      Zy)    )annotations)datetime)TYPE_CHECKINGAnyN)	AttributeCompletableGithubObjectNotSetOpt_NotSetType
is_definedis_optional)PaginatedList)GistComment)GistHistoryState)InputFileContentc                     e Zd ZdZd"dZd#dZed$d       Zed#d       Zed#d       Z	ed%d       Z
ed#d       Zed&d	       Zed'd
       Zed(d       Zed#d       Zed#d       Zed#d       Zed)d       Zed#d       Zed#d       Zed*d       Zed+d       Zed%d       Zed#d       Zed*d       Zd,dZd-dZd"dZeefd.dZd/dZd0dZ d+dZ!d"dZ"d"dZ#d1d Z$y!)2Gistz
    This class represents Gists.

    The reference can be found here
    https://docs.github.com/en/rest/reference/gists

    c                   t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _	        t         | _
        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        y N)r	   	_comments_comments_url_commits_url_created_at_description_files_fork_of_forks
_forks_url_git_pull_url_git_push_url_history	_html_url_id_owner_public_updated_at_url_userselfs    +lib/python3.12/site-packages/github/Gist.py_initAttributeszGist._initAttributesJ   s    )/-3,206,2FL)/-3*0-3-3;A)/#)=C(.06$*	<B
    c                P    | j                  d| j                  j                  i      S )Nid)get__repr__r#   valuer)   s    r+   __repr__zGist.__repr___   s     txx~~ 677r-   c                d    | j                  | j                         | j                  j                  S r   )_completeIfNotSetr   r1   r)   s    r+   commentszGist.commentsb   $    t~~.~~###r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r   r1   r)   s    r+   comments_urlzGist.comments_urlg   (    t112!!'''r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r   r1   r)   s    r+   commits_urlzGist.commits_urll   (    t001  &&&r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r   r1   r)   s    r+   
created_atzGist.created_atq   (    t//0%%%r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r   r1   r)   s    r+   descriptionzGist.descriptionv   r<   r-   c                N    | j                          | j                  j                  S r   )_completeIfNeededr   r1   r)   s    r+   filesz
Gist.files{   s     {{   r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r   r1   r)   s    r+   fork_ofzGist.fork_of   $    t}}-}}"""r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r   r1   r)   s    r+   forksz
Gist.forks   $    t{{+{{   r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r   r1   r)   s    r+   	forks_urlzGist.forks_url   s$    t/$$$r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r   r1   r)   s    r+   git_pull_urlzGist.git_pull_url   r9   r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r    r1   r)   s    r+   git_push_urlzGist.git_push_url   r9   r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r!   r1   r)   s    r+   historyzGist.history   rG   r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r"   r1   r)   s    r+   html_urlzGist.html_url   r6   r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r#   r1   r)   s    r+   r/   zGist.id   s"    txx(xx~~r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r$   r1   r)   s    r+   ownerz
Gist.owner   rJ   r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r%   r1   r)   s    r+   publiczGist.public   s$    t||,||!!!r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r&   r1   r)   s    r+   
updated_atzGist.updated_at   r?   r-   c                d    | j                  | j                         | j                  j                  S r   )r4   r'   r1   r)   s    r+   urlzGist.url   s"    tyy)yyr-   c                d    | j                  | j                         | j                  j                  S r   )r4   r(   r1   r)   s    r+   userz	Gist.user   s$    tzz*zzr-   c                    t        |t              sJ |       d|i}| j                  j                  d| j                   d|      \  }}t
        j                  j                  | j                  ||d      S )zv
        :calls: `POST /gists/{gist_id}/comments <https://docs.github.com/en/rest/reference/gists#comments>`_
        bodyPOST	/commentsinputT	completed)
isinstancestr
_requesterrequestJsonAndCheckr]   githubr   )r*   ra   post_parametersheadersdatas        r+   create_commentzGist.create_comment   sx     $$*d*$D
 ;;FtxxjPYDZbq;r!!--doowX\-]]r-   c                    | j                   j                  d| j                   d      \  }}t        | j                   ||d      S )ze
        :calls: `POST /gists/{id}/forks <https://docs.github.com/en/rest/reference/gists>`_
        rb   z/forksTrf   )rj   rk   r]   r   r*   rn   ro   s      r+   create_forkzGist.create_fork   s?     ;;FtxxjPVDWXDOOWddCCr-   c                V    | j                   j                  d| j                        \  }}y)za
        :calls: `DELETE /gists/{id} <https://docs.github.com/en/rest/reference/gists>`_
        DELETENrj   rk   r]   rr   s      r+   deletezGist.delete   s"     ;;HdhhOr-   c                   t        |t              sJ |       t        |t              s't	        d |j                         D              sJ |       i }t        |      r||d<   t        |      r5|j                         D ci c]  \  }}||dn|j                   c}}|d<   | j                  j                  d| j                  |      \  }}| j                  |       yc c}}w )z`
        :calls: `PATCH /gists/{id} <https://docs.github.com/en/rest/reference/gists>`_
        c              3  \   K   | ]$  }|d u xs t        |t        j                         & y wr   )rh   rl   r   ).0elements     r+   	<genexpr>zGist.edit.<locals>.<genexpr>   s.      5
PWGtOKz'63J3JKK5
s   *,rA   NrD   PATCHrd   )r   ri   rh   r   allvaluesr   items	_identityrj   rk   r]   _useAttributes)r*   rA   rD   rm   keyr1   rn   ro   s           r+   editz	Gist.edit   s     ;,9k9,%- 5
[`[g[g[i5
 2
 		 
 +-k"-8OM*ejojujujw'x\f\_afU]T(W'xOG$;;GTXXUd;eD! (ys   ?Cc                    t        |t              sJ |       | j                  j                  d| j                   d|       \  }}t
        j                  j                  | j                  ||d      S )zz
        :calls: `GET /gists/{gist_id}/comments/{id} <https://docs.github.com/en/rest/reference/gists#comments>`_
        GETz
/comments/Trf   )rh   intrj   rk   r]   rl   r   )r*   r/   rn   ro   s       r+   get_commentzGist.get_comment   si     "c"&B&";;EdhhZzZ\Y]C^_!!--doowX\-]]r-   c                |    t        t        j                  j                  | j                  | j                   dd      S )zu
        :calls: `GET /gists/{gist_id}/comments <https://docs.github.com/en/rest/reference/gists#comments>`_
        rc   N)r   rl   r   rj   r]   r)   s    r+   get_commentszGist.get_comments   s8     **OOxxj	"	
 	
r-   c                f    | j                   j                  d| j                   d      \  }}}|dk(  S )zc
        :calls: `GET /gists/{id}/star <https://docs.github.com/en/rest/reference/gists>`_
        r   /star   )rj   requestJsonr]   )r*   statusrn   ro   s       r+   
is_starredzGist.is_starred   s6     !% ; ;EdhhZuCU V}r-   c                \    | j                   j                  d| j                   d      \  }}y)zf
        :calls: `DELETE /gists/{id}/star <https://docs.github.com/en/rest/reference/gists>`_
        ru   r   Nrv   rr   s      r+   reset_starredzGist.reset_starred  s*     ;;H
RWFXYr-   c                \    | j                   j                  d| j                   d      \  }}y)zc
        :calls: `PUT /gists/{id}/star <https://docs.github.com/en/rest/reference/gists>`_
        PUTr   Nrv   rr   s      r+   set_starredzGist.set_starred
  s)     ;;EdhhZuCUVr-   c                0   d|v r| j                  |d         | _        d|v r| j                  |d         | _        d|v r| j                  |d         | _        d|v r| j                  |d         | _        d|v r| j                  |d         | _        d|v r2| j                  t        j                  j                  |d         | _        d|v r| j                  t        |d         | _        d|v r| j                  t        |d         | _        d	|v r| j                  |d	         | _        d
|v r| j                  |d
         | _        d|v r| j                  |d         | _        d|v r2| j                  t        j(                  j(                  |d         | _        d|v r| j                  |d         | _        d|v r| j                  |d         | _        d|v r2| j                  t        j0                  j0                  |d         | _        d|v r| j5                  |d         | _        d|v r| j                  |d         | _        d|v r| j                  |d         | _        d|v r3| j                  t        j0                  j0                  |d         | _        y y )Nr5   r8   r;   r>   rA   rD   rF   rI   rL   rN   rP   rR   rT   r/   rW   rY   r[   r]   r_   )_makeIntAttributer   _makeStringAttributer   r   _makeDatetimeAttributer   r   $_makeDictOfStringsToClassesAttributerl   GistFiler   _makeClassAttributer   r   _makeListOfClassesAttributer   r   r   r    r   r!   r"   r#   	NamedUserr$   _makeBoolAttributer%   r&   r'   r(   )r*   
attributess     r+   r   zGist._useAttributes  s   #!33Jz4JKDNZ'!%!:!::n;U!VDJ& $ 9 9*]:S TD:%#:::l;STDJ& $ 9 9*]:S TDj CCFOOD\D\^hip^qrDK
" 44T:i;PQDMj ::4GATUDK*$"77
;8OPDOZ'!%!:!::n;U!VDZ'!%!:!::n;U!VD
" <<''88*Y:ODM #!66z*7MNDN:00D1ABDHj 2263C3C3M3MzZaObcDKz!22:h3GHDL:%#:::l;STDJ11*U2CDDIZ11&2B2B2L2LjY_N`aDJ  r-   N)returnNone)r   ri   )r   r   )r   r   )r   z#dict[str, github.GistFile.GistFile])r   zgithub.Gist.Gist)r   z
list[Gist])r   zlist[GistHistoryState])r   zgithub.NamedUser.NamedUser)r   bool)ra   ri   r   r   )r   r   )rA   zOpt[str]rD   z'Opt[dict[str, InputFileContent | None]]r   r   )r/   r   r   r   )r   zPaginatedList[GistComment])r   zdict[str, Any]r   r   )%__name__
__module____qualname____doc__r,   r2   propertyr5   r8   r;   r>   rA   rD   rF   rI   rL   rN   rP   rR   rT   r/   rW   rY   r[   r]   r_   rp   rs   rw   r	   r   r   r   r   r   r   r    r-   r+   r   r   A   s   C*8 $ $ ( ( ' ' & & ' ' ! ! # # ! ! % % ( ( ( ( # # $ $   ! ! " " & &      	^DP ,2dj ""^	
ZW(br-   r   )
__future__r   r   typingr   r   github.GistCommentrl   github.GistFilegithub.GistHistoryStategithub.GithubObjectgithub.NamedUsergithub.PaginatedListr   r   r	   r
   r   r   r   r   r   r   github.InputFileContentr   r   r   r-   r+   <module>r      sL   Z #  %       u u u ..88wb" wbr-   