
    ,Of                    @   d dl mZ d dlZd dlmZ d dlmZ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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 d dlmZmZmZmZmZm Z m!Z!m"Z" d dl#m$Z$ d d	lm%Z% erd d
l&m'Z' d dlm(Z(  G d de
      Z) G d de      Z*y)    )annotationsN)datetime)TYPE_CHECKINGAny)NotRequired	TypedDict)Consts)	AttributeCompletableGithubObjectNotSetOpt
is_definedis_optionalis_optional_listis_undefined)Issue)PaginatedList)GitRef)	NamedUserc                  T    e Zd ZU ded<   ded<   ded<   ded<   ded<   ded	<   ded
<   y)ReviewCommentstrpathzNotRequired[int]positionbodylinezNotRequired[str]side
start_line
start_sideN)__name__
__module____qualname____annotations__     2lib/python3.12/site-packages/github/PullRequest.pyr   r   n   s*    
I
I

    r%   r   c                  p   e Zd ZdZdWdZdXdZedYd       ZedZd       Zed[d       Z	ed\d       Z
edXd       ZedYd	       Zed]d
       ZedYd       ZedXd       ZedYd       ZedXd       Zed^d       ZedYd       ZedXd       Zed_d       Zed\d       ZedXd       ZedYd       ZedXd       Zed`d       ZedXd       Zed_d       ZedXd       Zed_d       Zed]d       ZedZd       Z edad       Z!edYd       Z"edXd        Z#ed_d!       Z$edXd"       Z%edYd#       Z&edXd$       Z'edXd%       Z(edXd&       Z)ed]d'       Z*ed[d(       Z+edbd)       Z,edXd*       Z-edcd+       Z.ed_d,       Z/edXd-       Z0ddd.Z1	 	 	 	 	 	 	 	 	 	 ded/Z2e3e3e3e3e3e3d0f	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dfd1Z4dgd2Z5dhd3Z6e3e3e3e3f	 	 	 	 	 	 	 	 	 did4Z7e3e3f	 	 	 	 	 djd5Z8e3e3f	 	 	 	 	 djd6Z9e3e3e3e3e3f	 	 	 	 	 	 	 	 	 	 	 dkd7Z:dld8Z;dld9Z<e3e3e3f	 	 	 	 	 	 	 dmd:Z=e3e3e3d;	 	 	 	 	 	 	 dmd<Z>dnd=Z?dod>Z@dpd?ZAdqd@ZBdrdAZCdsdBZDdtdCZEdudDZFdvdEZGdwdFZHdxdGZIdWdHZJdydIZKdxdJZLd_dKZMdzdLZNd{d|dMZOdNe3e3e3e3e3f	 	 	 	 	 	 	 	 	 	 	 	 	 d}dOZPe3f	 	 	 d~dPZQe3e3e3e3d0f	 	 	 	 	 	 	 	 	 	 	 ddQZRddRZSddSZTe3fddTZUddUZVyV)PullRequestz
    This class represents PullRequests.

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

    c                   t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _	        t         | _
        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _         t         | _!        t         | _"        t         | _#        t         | _$        t         | _%        t         | _&        t         | _'        t         | _(        t         | _)        y N)*r   
_additions	_assignee
_assignees_base_body_changed_files
_closed_at	_comments_comments_url_commits_commits_url_created_at
_deletions	_diff_url_draft_head	_html_url_id
_issue_url_labels_merge_commit_sha
_mergeable_mergeable_state_merged
_merged_at
_merged_by
_milestone_number
_patch_url_rebaseable_requested_reviewers_review_comment_url_review_comments_review_comments_url_state_title_updated_at_url_user_maintainer_can_modify_node_idselfs    r&   _initAttributeszPullRequest._initAttributes   s.   *0@F6<HN
%+
.46<)/-3(.,206*0)/'-HN
)/#)*0<B17+106(.6<AGAG'-*0,2@F!39 064:!&,&,7=$*	<B
7=#(.r%   c                z    | j                  | j                  j                  | j                  j                  d      S )N)numbertitle)get__repr__rF   valuerN   rT   s    r&   __repr__zPullRequest.__repr__   s,    4<<+=+=HYHY Z[[r%   c                d    | j                  | j                         | j                  j                  S r*   )_completeIfNotSetr+   r[   rT   s    r&   	additionszPullRequest.additions   $    t/$$$r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r,   r[   rT   s    r&   assigneezPullRequest.assignee   $    t~~.~~###r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r-   r[   rT   s    r&   	assigneeszPullRequest.assignees   r`   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r.   r[   rT   s    r&   basezPullRequest.base   $    tzz*zzr%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r/   r[   rT   s    r&   r   zPullRequest.body   rh   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r0   r[   rT   s    r&   changed_fileszPullRequest.changed_files   s(    t223""(((r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r1   r[   rT   s    r&   	closed_atzPullRequest.closed_at   r`   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r2   r[   rT   s    r&   commentszPullRequest.comments   rc   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r3   r[   rT   s    r&   comments_urlzPullRequest.comments_url   s(    t112!!'''r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r4   r[   rT   s    r&   commitszPullRequest.commits   $    t}}-}}"""r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r5   r[   rT   s    r&   commits_urlzPullRequest.commits_url   s(    t001  &&&r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r6   r[   rT   s    r&   
created_atzPullRequest.created_at   (    t//0%%%r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r7   r[   rT   s    r&   	deletionszPullRequest.deletions   r`   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r8   r[   rT   s    r&   diff_urlzPullRequest.diff_url   rc   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r9   r[   rT   s    r&   draftzPullRequest.draft   $    t{{+{{   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r:   r[   rT   s    r&   headzPullRequest.head   rh   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r;   r[   rT   s    r&   html_urlzPullRequest.html_url   rc   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r<   r[   rT   s    r&   idzPullRequest.id  s"    txx(xx~~r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r=   r[   rT   s    r&   	issue_urlzPullRequest.issue_url	  r`   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r>   r[   rT   s    r&   labelszPullRequest.labels  $    t||,||!!!r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r?   r[   rT   s    r&   merge_commit_shazPullRequest.merge_commit_sha  s(    t556%%+++r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   r@   r[   rT   s    r&   	mergeablezPullRequest.mergeable  r`   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rA   r[   rT   s    r&   mergeable_statezPullRequest.mergeable_state  (    t445$$***r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rB   r[   rT   s    r&   mergedzPullRequest.merged"  r   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rC   r[   rT   s    r&   	merged_atzPullRequest.merged_at'  r`   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rD   r[   rT   s    r&   	merged_byzPullRequest.merged_by,  r`   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rE   r[   rT   s    r&   	milestonezPullRequest.milestone1  r`   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rF   r[   rT   s    r&   rX   zPullRequest.number6  r   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rG   r[   rT   s    r&   	patch_urlzPullRequest.patch_url;  r`   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rH   r[   rT   s    r&   
rebaseablezPullRequest.rebaseable@  ry   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rJ   r[   rT   s    r&   review_comment_urlzPullRequest.review_comment_urlE  s(    t778''---r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rK   r[   rT   s    r&   review_commentszPullRequest.review_commentsJ  r   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rL   r[   rT   s    r&   review_comments_urlzPullRequest.review_comments_urlO  (    t889((...r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rM   r[   rT   s    r&   statezPullRequest.stateT  r   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rN   r[   rT   s    r&   rY   zPullRequest.titleY  r   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rO   r[   rT   s    r&   
updated_atzPullRequest.updated_at^  ry   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rI   r[   rT   s    r&   requested_reviewerszPullRequest.requested_reviewersc  r   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   _requested_teamsr[   rT   s    r&   requested_teamszPullRequest.requested_teamsh  r   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rP   r[   rT   s    r&   urlzPullRequest.urlm  s"    tyy)yyr%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rQ   r[   rT   s    r&   userzPullRequest.userr  rh   r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rR   r[   rT   s    r&   maintainer_can_modifyz!PullRequest.maintainer_can_modifyw  s(    t::;**000r%   c                d    | j                  | j                         | j                  j                  S r*   )r^   rS   r[   rT   s    r&   node_idzPullRequest.node_id|  rt   r%   c                    | j                   j                  d| j                        \  }}t        j                  j	                  | j                   ||d      S )zy
        :calls: `GET /repos/{owner}/{repo}/issues/{number} <https://docs.github.com/en/rest/reference/issues>`_
        GETT	completed)
_requesterrequestJsonAndCheckr   githubr   rU   headersdatas      r&   as_issuezPullRequest.as_issue  sD     ;;E4>>R||!!$//7DD!QQr%   c                *    | j                  ||||      S )
        :calls: `POST /repos/{owner}/{repo}/pulls/{number}/comments <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
        )create_review_comment)rU   r   commitr   r   s        r&   create_commentzPullRequest.create_comment  s     ))$hGGr%   Fc                   t        |t              sJ |       t        |t        j                  j                        sJ |       t        |t              sJ |       t	        |t
              sJ |       t        |      s|dv sJ |       t	        |t
              sJ |       t        |      s|dv sJ |       t	        |t
              sJ |       t        |	      s|	dv sJ |	       t        |
t              sJ |
       |
rd| d}t        j                  ||j                  |||||||	d	      }| j                  j                  d| j                   d|	      \  }}t        j                  j                  | j                  ||d
      S )r   )LEFTRIGHT)r   r   r   )r   filez```suggestion
z
```)	r   	commit_idr   r   r   r   r   in_reply_tosubject_typePOST	/commentsinputTr   )
isinstancer   r   Commitr   intr   boolr   remove_unset_items	_identityr   r   r   PullRequestComment)rU   r   r   r   r   r   r   r   r   r   as_suggestionpost_parametersr   r   s                 r&   r   z!PullRequest.create_review_comment  s   " $$*d*$&&--"6"67??7$$*d*$4%+t+%D!T->%>DD>:s+7Z7+J': :
 ,
 	 		 

 ;,9k9,L)\ >
 .
 	 	 
 -.==.$TF%0D 33#--((* ,

 ;;FtxxjPYDZbq;r((;;DOOWVZfj;kkr%   c                "   t        |t              sJ |       t        |t              sJ |       d|i}| j                  j	                  d| j
                   d| d|      \  }}t        j                  j                  | j                  ||d      S )z
        :calls: `POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
        r   r   
/comments/z/repliesr   Tr   )r   r   r   r   r   r   r   r   )rU   
comment_idr   r   r   r   s         r&   create_review_comment_replyz'PullRequest.create_review_comment_reply  s     *c*6J6*$$*d*$!4.;;xxj
:,h7! < 

 ((;;DOOWVZfj;kkr%   c                    t        |t              sJ |       d|i}| j                  j                  d| j                   d|      \  }}t
        j                  j                  | j                  ||d      S )z
        :calls: `POST /repos/{owner}/{repo}/issues/{number}/comments <https://docs.github.com/en/rest/reference/issues#comments>`_
        r   r   r   r   Tr   )r   r   r   r   r   r   IssueComment)rU   r   r   r   r   s        r&   create_issue_commentz PullRequest.create_issue_comment  sy     $$*d*$D
 ;;Ft~~FVV_D`hw;x""//$Z^/__r%   c                J   t        |t        j                  j                        sJ |       t        |t              sJ |       t        |t              sJ |       t	        |t
              sJ |       t        j                  d|i      }t        |      rdn||d<   t        |      r|j                  |d<   t        |      r||d<   ng |d<   | j                  j                  d| j                   d|      \  }}t        j                  j                  | j                  ||d	
      S )z
        :calls: `POST /repos/{owner}/{repo}/pulls/{number}/reviews <https://docs.github.com/en/free-pro-team@latest/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request>`_
        r   COMMENTeventr   ro   r   /reviewsr   Tr   )r   r   r   r   r   dictr   r   r   r   shar   r   r   PullRequestReview)rU   r   r   r   ro   r   r   r   s           r&   create_reviewzPullRequest.create_review  s    66==#7#78@&@84%+t+%5#&--&$/99/*0*C*CVTN*S0<U0C9 f+1::OK(h*2OJ'*,OJ';;FtxxjPXDYap;q''99$//7TXdh9iir%   c                ,   t        |t              st        |t              sJ |       t        |t              st        |t              sJ |       t        j                  ||d      }| j
                  j                  d| j                   d|      \  }}y)z
        :calls: `POST /repos/{owner}/{repo}/pulls/{number}/requested_reviewers <https://docs.github.com/en/rest/reference/pulls#review-requests>`_
        	reviewersteam_reviewersr   /requested_reviewersr   Nr   r   r   r   r   r   r   r   rU   r   r   r   r   r   s         r&   create_review_requestz!PullRequest.create_review_request  s     9c*.>y#.NYPYYN>3/3CNTW3XhZhhX 33)_m4no;;txxj 45_ < 
r%   c                ,   t        |t              st        |t              sJ |       t        |t              st        |t              sJ |       t        j                  ||d      }| j
                  j                  d| j                   d|      \  }}y)z
        :calls: `DELETE /repos/{owner}/{repo}/pulls/{number}/requested_reviewers <https://docs.github.com/en/rest/reference/pulls#review-requests>`_
        r   DELETEr   r   Nr   r   s         r&   delete_review_requestz!PullRequest.delete_review_request	  s     9c*.>y#.NYPYYN>3/3CNTW3XhZhhX 33)_m4no;;
"67 < 
r%   c                   t        |t              sJ |       t        |t              sJ |       t        |t              sJ |       t        |t              sJ |       t        |t              sJ |       t        j                  |||||d      }| j
                  j                  d| j                  |      \  }}| j                  |       y)zy
        :calls: `PATCH /repos/{owner}/{repo}/pulls/{number} <https://docs.github.com/en/rest/reference/pulls>`_
        )rY   r   r   rg   r   PATCHr   N)	r   r   r   r   r   r   r   r   _useAttributes)	rU   rY   r   r   rg   r   r   r   r   s	            r&   editzPullRequest.edit  s     5#&--&4%+t+%5#&--&4%+t+%0$7N9NN7 33TE4bwx
 ;;GTXXUd;eD!r%   c                $    | j                  |      S )
        :calls: `GET /repos/{owner}/{repo}/pulls/comments/{number} <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
        )get_review_commentrU   r   s     r&   get_commentzPullRequest.get_comment1  s     &&r**r%   c                   t        |t              sJ |       | j                  j                  d| j	                  | j
                         d|       \  }}t        j                  j                  | j                  ||d      S )r   r   r   Tr   )r   r   r   r   
_parentUrlr   r   r   rU   r   r   r   s       r&   r   zPullRequest.get_review_comment7  sx     "c"&B&";;EdooVZV^V^F_E``jkmjnCop((;;DOOWVZfj;kkr%   c                *    | j                  |||      S )a  
        Warning: this only returns review comments. For normal conversation comments, use get_issue_comments.

        :calls: `GET /repos/{owner}/{repo}/pulls/{number}/comments <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
        :param sort: string 'created' or 'updated'
        :param direction: string 'asc' or 'desc'
        :param since: datetime
        sort	directionsince)get_review_comments)rU   r  r  r  s       r&   get_commentszPullRequest.get_comments?  s     ''TYe'TTr%   r  c               t   t        |t              sJ |       t        |t              sJ |       t        |t              sJ |       t        j                  ||d      }t        |      r|j                  d      |d<   t        t        j                  j                  | j                  | j                   d|      S )a  
        :calls: `GET /repos/{owner}/{repo}/pulls/{number}/comments <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
        :param sort: string 'created' or 'updated'
        :param direction: string 'asc' or 'desc'
        :param since: datetime
        )r  r  z%Y-%m-%dT%H:%M:%SZr  r   )r   r   r   r   r   r   strftimer   r   r   r   r   )rU   r  r  r  url_parameterss        r&   r  zPullRequest.get_review_commentsP  s     4%+t+%9c*5I5*5(+2U2+22Dy3YZe&+nn5I&JN7#%%88OOxxj	"	
 	
r%   c                    t        |t              sJ |       t        t        j                  j                  | j
                  | j                   d| dd      S )z
        :calls: `GET /repos/{owner}/{repo}/pulls/{number}/review/{id}/comments <https://docs.github.com/en/rest/reference/pulls#reviews>`_
        	/reviews/r   N)r   r   r   r   r   r   r   r   s     r&   get_single_review_commentsz&PullRequest.get_single_review_commentsl  sS     "c"&B&"%%88OOxxj	"Y/	
 	
r%   c                |    t        t        j                  j                  | j                  | j                   dd      S )z
        :calls: `GET /repos/{owner}/{repo}/pulls/{number}/commits <https://docs.github.com/en/rest/reference/pulls>`_
        z/commitsN)r   r   r   r   r   rT   s    r&   get_commitszPullRequest.get_commitsx  s0     V]]114??txxjPXDY[_``r%   c                |    t        t        j                  j                  | j                  | j                   dd      S )z}
        :calls: `GET /repos/{owner}/{repo}/pulls/{number}/files <https://docs.github.com/en/rest/reference/pulls>`_
        z/filesN)r   r   Filer   r   rT   s    r&   	get_fileszPullRequest.get_files~  s/     V[[--t488*F@SUYZZr%   c                   t        |t              sJ |       | j                  j                  d| j	                  | j
                         d|       \  }}t        j                  j                  | j                  ||d      S )z
        :calls: `GET /repos/{owner}/{repo}/issues/comments/{id} <https://docs.github.com/en/rest/reference/issues#comments>`_
        r   r   Tr   )r   r   r   r   r  r   r   r   r  s       r&   get_issue_commentzPullRequest.get_issue_comment  sw     "c"&B&";;EdooVZVdVdFeEffpqsptCuv""//$Z^/__r%   c                |    t        t        j                  j                  | j                  | j                   dd      S )z
        :calls: `GET /repos/{owner}/{repo}/issues/{number}/comments <https://docs.github.com/en/rest/reference/issues#comments>`_
        r   N)r   r   r   r   r   rT   s    r&   get_issue_commentszPullRequest.get_issue_comments  s9     ,,OO~~i(	
 	
r%   c                    t        t        j                  j                  | j                  | j                   dddt
        j                  i      S )z
        :calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/events <https://docs.github.com/en/rest/reference/issues#events>`_
        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueEvent.IssueEvent`
        z/eventsNAccept)r   )r   r   
IssueEventr   r   r	   mediaTypeLockReasonPreviewrT   s    r&   get_issue_eventszPullRequest.get_issue_events  sG    
 ((OO~~g&v@@A
 	
r%   c                    t        |t              sJ |       | j                  j                  d| j                   d|       \  }}t
        j                  j                  | j                  ||d      S )z
        :calls: `GET /repos/{owner}/{repo}/pulls/{number}/reviews/{id} <https://docs.github.com/en/rest/reference/pulls#reviews>`_
        :param id: integer
        :rtype: :class:`github.PullRequestReview.PullRequestReview`
        r   r  Tr   )r   r   r   r   r   r   r   r  s       r&   
get_reviewzPullRequest.get_review  sn     "c"&B&";;xxj	"&
 ''99$//7TXdh9iir%   c                |    t        t        j                  j                  | j                  | j                   dd      S )z
        :calls: `GET /repos/{owner}/{repo}/pulls/{number}/reviews <https://docs.github.com/en/rest/reference/pulls#reviews>`_
        :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequestReview.PullRequestReview`
        r   N)r   r   r   r   r   rT   s    r&   get_reviewszPullRequest.get_reviews  s8    
 $$66OOxxj!	
 	
r%   c                    t        t        j                  j                  | j                  | j                   ddd      t        t        j
                  j
                  | j                  | j                   ddd      fS )aW  
        :calls: `GET /repos/{owner}/{repo}/pulls/{number}/requested_reviewers <https://docs.github.com/en/rest/reference/pulls#review-requests>`_
        :rtype: tuple of :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` and of :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team`
        r   Nusers)	list_itemteams)r   r   r   r   r   TeamrT   s    r&   get_review_requestszPullRequest.get_review_requests  st       **88*01!   88*01!
 	
r%   c                |    t        t        j                  j                  | j                  | j                   dd      S )z
        :calls: `GET /repos/{owner}/{repo}/issues/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
        /labelsN)r   r   Labelr   r   rT   s    r&   
get_labelszPullRequest.get_labels  s1     V\\//T^^DTT[B\^bccr%   c                   t        d |D              sJ |       |D cg c]4  }t        |t        j                  j                        r|j                  n|6 }}| j
                  j                  d| j                   d|      \  }}yc c}w )z
        :calls: `POST /repos/{owner}/{repo}/issues/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
        c              3  p   K   | ].  }t        |t        j                  j                  t        f       0 y wr*   r   r   r*  r   .0elements     r&   	<genexpr>z,PullRequest.add_to_labels.<locals>.<genexpr>  &     Xg:g(:(:C'@AX   46r   r)  r   Nallr   r   r*  namer   r   r   rU   r   labelr   r   r   s         r&   add_to_labelszPullRequest.add_to_labels  s     XQWXX`Z``Xgmn^cE6<<;M;M)N5::TYYnn;;Ft~~FVV]D^fu;v o   9Bc                \    | j                   j                  d| j                   d      \  }}y)z
        :calls: `DELETE /repos/{owner}/{repo}/issues/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
        r   r)  N)r   r   r   r   s      r&   delete_labelszPullRequest.delete_labels  s+     ;;HHXX_F`ar%   c                b   t        |t        j                  j                  t        f      sJ |       t        |t        j                  j                        r|j                  }nt
        j                  j                  |      }| j                  j                  d| j                   d|       \  }}y)z
        :calls: `DELETE /repos/{owner}/{repo}/issues/{number}/labels/{name} <https://docs.github.com/en/rest/reference/issues#labels>`_
        r   z/labels/N)r   r   r*  r   r   urllibparsequoter   r   r   )rU   r9  r   r   s       r&   remove_from_labelszPullRequest.remove_from_labels  s     %&,,"4"4c!:;BUB;eV\\//0OOELL&&u-E;;HHXX`af`gFhir%   c                   t        d |D              sJ |       |D cg c]4  }t        |t        j                  j                        r|j                  n|6 }}| j
                  j                  d| j                   d|      \  }}yc c}w )z
        :calls: `PUT /repos/{owner}/{repo}/issues/{number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
        c              3  p   K   | ].  }t        |t        j                  j                  t        f       0 y wr*   r.  r/  s     r&   r2  z)PullRequest.set_labels.<locals>.<genexpr>  r3  r4  PUTr)  r   Nr5  r8  s         r&   
set_labelszPullRequest.set_labels  s     XQWXX`Z``Xgmn^cE6<<;M;M)N5::TYYnn;;EdnnEUU\C]et;u or;  c                f    | j                   j                  d| j                   d      \  }}}|dk(  S )z}
        :calls: `GET /repos/{owner}/{repo}/pulls/{number}/merge <https://docs.github.com/en/rest/reference/pulls>`_
        r   /merge   )r   requestJsonr   )rU   statusr   r   s       r&   	is_mergedzPullRequest.is_merged  s6     !% ; ;EdhhZvCV W}r%   c                    | j                   j                  j                  d| j                   j                   | j                   j                        S )zy
        Convenience function that calls :meth:`Repository.create_git_ref` :rtype: :class:`github.GitRef.GitRef`
        zrefs/heads/)r   )r   repocreate_git_refrefr   rT   s    r&   restore_branchzPullRequest.restore_branch  s>     yy~~,,{499==/-JPTPYPYP]P],^^r%   c                B   |sT| j                   j                  j                  | j                   j                        }|j                  dkD  rt        d      | j                   j                  j                  d| j                   j                         j                         S )zU
        Convenience function that calls :meth:`GitRef.delete` :rtype: bool.
        )r   r   zVThis branch is referenced by open pull requests, set force=True to delete this branch.zheads/)r   rN  	get_pullsrP  
totalCountRuntimeErrorget_git_refdelete)rU   forceremaining_pullss      r&   delete_branchzPullRequest.delete_branch  s{     "iinn66DIIMM6JO))A-"l  yy~~))F499==/*BCJJLLr%   MERGEc                   t        |t              sJ |       t        |t              sJ |       t        |t              sJ |       t        |t              sJ |       t        |t              sJ |       t        |t              r|dv sJ |       | j                  ||||||d}| j                  j                  ddt        j                  |      id      \  }}	|	S )z
        :calls: `POST /graphql <https://docs.github.com/en/graphql>`_ with a mutation to enable pull request auto merge
        <https://docs.github.com/en/graphql/reference/mutations#enablepullrequestautomerge>
        )r[  REBASESQUASH)pullRequestIdauthorEmailclientMutationId
commitBodycommitHeadlineexpectedHeadOidmergeMethodenable_pull_request_auto_merger   ;actor { avatarUrl login resourcePath url } clientMutationIdmutation_name	variablesoutput)r   r   r   r   r   graphql_named_mutationr   r   )
rU   merge_methodauthor_emailclient_mutation_idcommit_bodycommit_headlineexpected_head_oidrj  _r   s
             r&   enable_automergezPullRequest.enable_automerge  s     <-;|;--s3G5GG3;,9k9,?C0A/A0,c2E4EE2,,A^1^l`ll^ "\\' 2%-0'
	 //88: 9 9) DEP 9 
4
 r%   c                    t        |t              sJ |       | j                  |d}| j                  j	                  ddt        j                  |      id      \  }}|S )z
        :calls: `POST /graphql <https://docs.github.com/en/graphql>`_ with a mutation to disable pull request auto merge
        <https://docs.github.com/en/graphql/reference/mutations#disablepullrequestautomerge>
        )r_  ra  disable_pull_request_auto_merger   rg  rh  )r   r   r   r   rl  r   r   )rU   ro  rj  rs  r   s        r&   disable_automergezPullRequest.disable_automerge:  sm     -s3G5GG3 "\\ 2
	 //88; 9 9) DEP 9 
4
 r%   c                   t        |t              sJ |       t        |t              sJ |       t        |t              sJ |       t        |t              sJ |       t        j                  ||||d      }| j                  j                  d| j                   d|      \  }}|r| j                          t        j                  j                  | j                  ||d      S )z}
        :calls: `PUT /repos/{owner}/{repo}/pulls/{number}/merge <https://docs.github.com/en/rest/reference/pulls>`_
        )commit_messagecommit_titlerm  r   rE  rH  r   Tr   )
r   r   r   r   r   r   r   rZ  r   PullRequestMergeStatus)	rU   ry  rz  rm  r   rZ  r   r   r   s	            r&   mergezPullRequest.mergeR  s     >3/??/<-;|;-<-;|;-3$)c)$ 33-|]iruv
 ;;EdhhZvCV^m;n ,,CCDOOU\^bnrCssr%   c                L   t        d |D              sJ |       d|D cg c]4  }t        |t        j                  j                        r|j                  n|6 c}i}| j
                  j                  d| j                   d|      \  }}| j                  d|d   i       yc c}w )z
        :calls: `POST /repos/{owner}/{repo}/issues/{number}/assignees <https://docs.github.com/en/rest/issues/assignees?apiVersion=2022-11-28#add-assignees-to-an-issue>`_
        c              3  p   K   | ].  }t        |t        j                  j                  t        f       0 y wr*   r   r   r   r   r/  s     r&   r2  z/PullRequest.add_to_assignees.<locals>.<genexpr>n  (     cg:g(8(8(B(BC'HIcr4  re   r   
/assigneesr   N	r6  r   r   r   loginr   r   r   r   rU   re   rb   r   r   r   s         r&   add_to_assigneeszPullRequest.add_to_assigneesj  s     cYbccnennc ) #-Xv7G7G7Q7Q"RX``
 ;;t~~&j1 < 
 	[${*;<=   9B!c                L   t        d |D              sJ |       d|D cg c]4  }t        |t        j                  j                        r|j                  n|6 c}i}| j
                  j                  d| j                   d|      \  }}| j                  d|d   i       yc c}w )z
        :calls: `DELETE /repos/{owner}/{repo}/issues/{number}/assignees <https://docs.github.com/en/rest/reference/issues#assignees>`_
        c              3  p   K   | ].  }t        |t        j                  j                  t        f       0 y wr*   r  r/  s     r&   r2  z4PullRequest.remove_from_assignees.<locals>.<genexpr>  r  r4  re   r   r  r   Nr  r  s         r&   remove_from_assigneesz!PullRequest.remove_from_assignees{  s     cYbccnennc ) #-Xv7G7G7Q7Q"RX``
 ;;(
3? < 
 	[${*;<=r  c                    t        |t              sJ |       t        j                  d|i      }| j                  j                  d| j                   d|dt        j                  i      \  }}}|dk(  S )z
        :calls `PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch <https://docs.github.com/en/rest/reference/pulls>`_
        expected_head_sharE  z/update-branchr  )r   r      )	r   r   r   r   r   rJ  r   r	   updateBranchPreview)rU   r  r   rK  r   r   s         r&   update_branchzPullRequest.update_branch  s     ,c2E4EE2 335HJ[4\] $ ; ;xxj'!v99:	 !< !
 }r%   c                X   d|v r| j                  |d         | _        d|v r2| j                  t        j                  j                  |d         | _        d|v r3| j                  t        j                  j                  |d         | _        nld|v rh|d   4| j                  t        j                  j                  |d   g      | _        n/| j                  t        j                  j                  g       | _        d|v r2| j                  t        j                  j                  |d         | _	        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 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 r| j-                  |d         | _        d|v r2| j                  t        j                  j                  |d         | _        d|v r| j                  |d         | _        d|v r| j                  |d         | _        d|v r| j                  |d         | _        d|v r2| j                  t        j8                  j8                  |d         | _        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 r| j                  |d         | _#        d|v r2| j                  t        j                  j                  |d         | _$        d|v r2| j                  t        jJ                  jJ                  |d         | _&        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 r| j                  |d"         | _,        d#|v r| j                  |d#         | _-        d$|v r| j                  |d$         | _.        d%|v r| j                  |d%         | _/        d&|v r| j                  |d&         | _0        d'|v r2| j                  t        j                  j                  |d'         | _1        d(|v r2| j                  t        j                  j                  |d(         | _2        d)|v r2| j                  t        jf                  jf                  |d)         | _4        d*|v r| j                  |d*         | _5        y y )+Nr_   rb   re   rg   r   rk   rm   ro   rq   rs   rv   rx   r{   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rX   r   r   r   r   r   r   rY   r   r   r   r   r   r   )6_makeIntAttributer+   _makeClassAttributer   r   r,   _makeListOfClassesAttributer-   PullRequestPartr.   _makeStringAttributer/   r0   _makeDatetimeAttributer1   r2   r3   r4   r5   r6   r7   r8   _makeBoolAttributer9   r:   r;   r<   r=   r*  r>   rR   r?   r@   rA   rB   rC   rD   	MilestonerE   rF   rG   rH   rJ   rK   rL   rM   rN   rO   rP   rQ   rI   r&  r   rS   )rU   
attributess     r&   r   zPullRequest._useAttributes  s.   *$"44Z5LMDO#!55f6F6F6P6PR\]gRhiDN*$">>v?O?O?Y?Y[efq[rsDO:%*%1"&"B"B6CSCSC]C]`jku`v_w"x"&"B"B6CSCSC]C]_a"bZ11&2H2H2X2XZdekZlmDJZ22:f3EFDJj("&"8"8O9T"UD*$"99*[:QRDO#!33Jz4JKDNZ'!%!:!::n;U!VD
" 22:i3HIDMJ& $ 9 9*]:S TD:%#:::l;STD*$"44Z5LMDO#!66z*7MNDNj 11*W2EFDKZ11&2H2H2X2XZdekZlmDJ#!66z*7MNDN:--j.>?DH*$"77
;8OPDOz!;;FLL<N<NPZ[cPdeDL"j0*.*A*A*MdBe*fD'+%)%>%>zJ\?]%^D"*$"55j6MNDO
*$($=$=jIZ>[$\D!z!22:h3GHDL*$"99*[:QRDO*$"66v7G7G7Q7QS]^iSjkDO*$"66v7G7G7Q7QS]^iSjkDOz!11*X2FGDL*$"77
;8OPDO:%#66z,7OPD:-'+'@'@L`Aa'bD$
*$($:$::FW;X$YD! J.(,(A(A*MbBc(dD%j 33Jw4GHDKj 33Jw4GHDK:%#:::l;STDJ11*U2CDDIZ11&2B2B2L2LjY_N`aDJ J.(,(H(H  **J7L,M)D% 
*$($D$DV[[EUEUWabsWt$uD!
" 55j6KLDM #r%   N)returnNone)r  r   )r  r   )r  zgithub.NamedUser.NamedUser)r  z list[github.NamedUser.NamedUser])r  z&github.PullRequestPart.PullRequestPart)r  zdatetime | None)r  r   )r  r   )r  zlist[github.Label.Label])r  zgithub.Milestone.Milestone)r  zlist[github.Team.Team])r  r   )r  r   )
r   r   r   github.Commit.Commitr   r   r   r   r  ,github.PullRequestComment.PullRequestComment)r   r   r   r  r   r   r   Opt[int]r   Opt[str]r   r  r   r  r   r  r   r  r   r   r  r  )r   r   r   r   r  r  )r   r   r   github.IssueComment.IssueComment)
r   zOpt[github.Commit.Commit]r   r  r   r  ro   zOpt[list[ReviewComment]]r  *github.PullRequestReview.PullRequestReview)r   Opt[list[str] | str]r   r  r  r  )rY   r  r   r  r   r  rg   r  r   z	Opt[bool]r  r  )r   r   r  r  )r  r  r  r  r  zOpt[datetime]r  ;PaginatedList[github.PullRequestComment.PullRequestComment])r   r   r  r  )r  z#PaginatedList[github.Commit.Commit])r  zPaginatedList[github.File.File])r   r   r  r  )r  z/PaginatedList[github.IssueComment.IssueComment])r  z+PaginatedList[github.IssueEvent.IssueEvent])r   r   r  r  )r  z9PaginatedList[github.PullRequestReview.PullRequestReview])r  z@tuple[PaginatedList[NamedUser], PaginatedList[github.Team.Team]])r  z!PaginatedList[github.Label.Label])r   github.Label.Label | strr  r  )r9  r  r  r  )r  r   )F)rX  r   r  r  )rm  r  rn  r  ro  r  rp  r  rq  r  rr  r  r  dict[str, Any])ro  r  r  r  )ry  r  rz  r  rm  r  r   r  rZ  r   r  z4github.PullRequestMergeStatus.PullRequestMergeStatus)re   z github.NamedUser.NamedUser | strr  r  )r  r  r  r   )r  r  r  r  )Wr    r!   r"   __doc__rV   r\   propertyr_   rb   re   rg   r   rk   rm   ro   rq   rs   rv   rx   r{   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   rX   r   r   r   r   r   r   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r	  r  r  r  r  r  r  r  r  r!  r'  r+  r:  r=  rB  rF  rL  rQ  rZ  rt  rw  r|  r  r  r  r   r$   r%   r&   r(   r(   x   s   )/V\ % % $ $ % %         ) ) % % $ $ ( ( # # ' ' & & % % $ $ ! !     $ $   % % " " , , % % + + " " % % % % % % " " % % & & . . + + / / ! ! ! ! & & / / + +       1 1 # #RHH!5H=@HLOH	5H  %% &!'#4l4l %4l 	4l 4l 4l 4l 4l 4l 4l 4l 
64lll	` -3 -3j)j j 	j
 +j 
4j6 +1/5
'
 -
 
	
& +1/5
'
 -
 
	
& ! +1"" " 	"
 "  )" 
".+l  $%	UU U 	U
 
EU(  $%
 
 	

 
 
E
8

a[`	

j


,dwb	jv_
M ")!''- &$*&,%% % %	%
 % "% $% 
%R (.$ 
4 $*!'!'#t t t 	t
 t t 
>t0>">" ;A [Mr%   r(   )+
__future__r   urllib.parser?  r   typingr   r   typing_extensionsr   r   github.Commitr   github.Filegithub.IssueCommentgithub.IssueEventgithub.Labelgithub.Milestonegithub.NamedUsergithub.PaginatedListgithub.PullRequestCommentgithub.PullRequestMergeStatusgithub.PullRequestPartgithub.PullRequestReviewgithub.Teamr	   github.GithubObjectr
   r   r   r   r   r   r   r   github.Issuer   r   github.GitRefr   r   r   r(   r$   r%   r&   <module>r     s~   L #   % 4           $    	 	 	  .$*!I !}M) }Mr%   