Ë
    Ö—Äj>  ã                  óÈ   — d dl mZ d dlZd dlZd dlmZ d dlZd dlm	Z	 d dlm
Z
 d dlZd dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ  G d„ d«      Zy)é    )ÚannotationsN)ÚAny)Ú
deprecated)ÚRetry)ÚConsts)ÚAppAuth)Ú	GithubApp)ÚGithubException)ÚInstallation)ÚInstallationAuthorization)ÚPaginatedList)Ú	Requesterc                  ó6  — e Zd ZU dZded<   ded<   ded<   ddej                  fej                  ej                  ej                  d	ddej                  ej                  ej                  ej                  ej                  dd
ddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d d„Zd!d„Zd"d„Zd#d„Zd$d„Z	 d%	 	 	 	 	 d&d„Zed'd„«       Zd(d„Zd)d„Z ed«      d%d*d„«       Z	 d%	 	 	 	 	 d+d„Z ed«      d,d„«       Zd-d„Zd.d„Zd,d„Zd/d„Z d0d„Z!d1d„Z"y)2ÚGithubIntegrationz?
    Main class to obtain tokens for a GitHub integration.
    r   ÚauthÚstrÚbase_urlr   Ú_GithubIntegration__requesterNTF)ÚtimeoutÚ
user_agentÚper_pageÚverifyÚretryÚ	pool_sizeÚseconds_between_requestsÚseconds_between_writesÚ
jwt_expiryÚjwt_issued_atÚjwt_algorithmr   ÚlazyÚapi_versionc               óF  — |�t        |t        t        f«      sJ |«       ‚|�t        |t        «      sJ d«       ‚t        |t        «      sJ |«       ‚t        |t        «      sJ |«       ‚|�t        |t        «      sJ |«       ‚t        |t        «      sJ |«       ‚t        |t        t        f«      sJ |«       ‚|�;t        |t        «      s+t        |t        j
                  j                  «      sJ |«       ‚|	�t        |	t        «      sJ |	«       ‚|
�|
dk\  sJ ‚|�|dk\  sJ ‚t        |t        «      sJ |«       ‚t        j                  |cxk  rt        j                  k  sJ |«       ‚ J |«       ‚t        |t        «      sJ ‚t        |t        «      sJ |«       ‚|�t        |t        «      sJ |«       ‚|| _
        |€;|€9|t        j                  k7  s&|t        j                  k7  s|t        j                  k7  rct        j                  dt         d¬«       |t        j                  k7  r%t#        |dt#        j$                  ||«      ||¬«      }nt#        ||||¬«      }t        |t"        «      sJ d	t'        |«      › �«       ‚|| _        t+        || j                  ||||||	|
|||¬
«      | _        y)a<  
        :param integration_id: int deprecated, use auth=github.Auth.AppAuth(...) instead
        :param private_key: string deprecated, use auth=github.Auth.AppAuth(...) instead
        :param base_url: string
        :param timeout: integer
        :param user_agent: string
        :param per_page: int
        :param verify: boolean or string
        :param retry: int or urllib3.util.retry.Retry object
        :param pool_size: int
        :param seconds_between_requests: float
        :param seconds_between_writes: float
        :param jwt_expiry: int deprecated, use auth=github.Auth.AppAuth(...) instead
        :param jwt_issued_at: int deprecated, use auth=github.Auth.AppAuth(...) instead
        :param jwt_algorithm: string deprecated, use auth=github.Auth.AppAuth(...) instead
        :param auth: authentication method
        :param lazy: completable objects created from this instance are lazy,
                     as well as completable objects created from those, and so on
        :param api_version: string, GitHub API version to use (see https://docs.github.com/en/rest/about-the-rest-api/api-versions).
                            Note that some PyGithub methods might downgrade this version if it is not supported by the implementation.
                            Set to None to not specify any version
        Nz'supplied private key should be a stringr   z“Arguments integration_id, private_key, jwt_expiry, jwt_issued_at and jwt_algorithm are deprecated, please use auth=github.Auth.AppAuth(...) insteadé   )ÚcategoryÚ
stacklevel)Úprivate_keyÚ	sign_funcr   r   )r   r   zCGithubIntegration requires github.Auth.AppAuth authentication, not )r   r   r   r   r   r   r   r   r   r   r    r!   )Ú
isinstanceÚintr   ÚboolÚurllib3Úutilr   r   ÚMIN_JWT_EXPIRYÚMAX_JWT_EXPIRYr   ÚDEFAULT_JWT_EXPIRYÚDEFAULT_JWT_ISSUED_ATÚDEFAULT_JWT_ALGORITHMÚwarningsÚwarnÚDeprecationWarningr   Úcreate_jwt_signÚtyper   r   r   )ÚselfÚintegration_idr&   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   s                     ú]C:\Users\pivot\Documents\cueki\casual-preloader\Lib\site-packages\github/GithubIntegration.pyÚ__init__zGithubIntegration.__init__I   s¹  € ðX Ð%Ü˜n¬s´C¨jÔ9ÐI¸>ÓIÐ9ØÐ"Ü˜k¬3Ô/ÐZÐ1ZÓZÐ/Ü˜(¤CÔ(Ð2¨(Ó2Ð(Ü˜'¤3Ô'Ð0¨Ó0Ð'ØÐ!¤Z°
¼CÔ%@ÐLÀ*ÓLÐ@Ü˜(¤CÔ(Ð2¨(Ó2Ð(Ü˜&¤4¬ +Ô.Ð6°Ó6Ð.Øˆ}¤
¨5´#Ô 6¼*ÀUÌGÏLÉL×L^ÑL^Ô:_ÐfÐafÓfÐ_ØÐ ¤J¨y¼#Ô$>ÐIÀ	ÓIÐ>Ø'Ð/Ð3KÈqÒ3PÐPÐPØ%Ð-Ð1GÈ1Ò1LÐLÐLÜ˜*¤cÔ*Ð6¨JÓ6Ð*Ü×$Ñ$¨
ÔK´f×6KÑ6KÒKÐWÈZÓWÑKÐWÈZÓWÐKÜ˜-¬Ô-Ð-Ð-Ü˜$¤Ô%Ð+ tÓ+Ð%ØÐ"¤j°¼cÔ&BÐOÀKÓOÐBà ˆŒð Ð&ØÐ&ØœV×6Ñ6Ò6Ø¤× <Ñ <Ò<Ø¤× <Ñ <Ò<ä�M‰MðCä+Øõ	ð ¤× <Ñ <Ò<ÜØ"Ø $Ü%×5Ñ5°kÀ=ÓQØ)Ø"/ô‘ô Ø"ØØ)Ø"/ô	�ô Ø”'ô
ð 	^àPÔQUÐVZÓQ[ÐP\Ð]ó	^ð 
ð ˆŒ	ä$ØØ—]‘]ØØ!ØØØØØ%=Ø#9ØØ#ô
ˆÕó    c                óh   — | j                   j                  }|j                  |¬«       t        di |¤ŽS )a,  
        Create a GithubIntegration instance with identical configuration but the given lazy setting.

        :param lazy: completable objects created from this instance are lazy, as well as completable objects created
            from those, and so on
        :return: new Github instance

        )r    © )r   ÚkwargsÚupdater   )r7   r    r>   s      r9   ÚwithLazyzGithubIntegration.withLazy¼   s1   € ð ×!Ñ!×(Ñ(ˆØ�‰˜4ˆÔ Ü Ñ* 6Ñ*Ð*r;   c                ó8   — | j                   j                  «        y)zçClose connections to the server. Alternatively, use the
        GithubIntegration object as a context manager:

        .. code-block:: python

          with github.GithubIntegration(...) as gi:
            # do something
        N)r   Úclose©r7   s    r9   rB   zGithubIntegration.closeÉ   s   € ð 	×Ñ×ÑÕ r;   c                ó   — | S ©Nr=   rC   s    r9   Ú	__enter__zGithubIntegration.__enter__Ô   s   € Øˆr;   c                ó$   — | j                  «        y rE   )rB   )r7   Úexc_typeÚexc_valÚexc_tbs       r9   Ú__exit__zGithubIntegration.__exit__×   s   € Ø�
‰
�r;   c                óÀ   — | j                   j                  ||| j                  «      }t        j                  di | j                  j                  |«      j                  ¤ŽS )Nr=   )r   Úget_installation_authr   ÚgithubÚGithubÚwithAuthr>   )r7   Úinstallation_idÚtoken_permissionsr   s       r9   Úget_github_for_installationz-GithubIntegration.get_github_for_installationÚ   sM   € ð �y‰y×.Ñ.¨Ð@QÐSW×ScÑScÓdˆÜ�}‰}ÑF˜t×/Ñ/×8Ñ8¸Ó>×EÑEÑFÐFr;   c                ó   — | j                   S )z…
        Return my Requester object.

        For example, to make requests to API endpoints not yet supported by PyGitHub.

        )r   rC   s    r9   Ú	requesterzGithubIntegration.requesterá   s   € ð ×ÑÐr;   c                ó&   — dt         j                  iS )z/
        Get headers for the requests.
        ÚAccept)r   ÚmediaTypeIntegrationPreviewrC   s    r9   Ú_get_headerszGithubIntegration._get_headersë   s   € ð
 ”f×8Ñ8ð
ð 	
r;   c                ó�   — | j                   j                  d|| j                  «       ¬«      \  }}t        | j                   ||¬«      S )z5
        Get installation for the given URL.
        ÚGET©Úheaders©rU   r]   Ú
attributes)r   ÚrequestJsonAndCheckrY   r   )r7   Úurlr]   Úresponses       r9   Ú_get_installed_appz$GithubIntegration._get_installed_appó   sL   € ð !×,Ñ,×@Ñ@ÀÈÐUY×UfÑUfÓUhÐ@ÓiÑˆ�äØ×&Ñ&ØØô
ð 	
r;   z|Use github.Github(auth=github.Auth.AppAuth), github.Auth.AppAuth.token or github.Auth.AppAuth.create_jwt(expiration) insteadc                ó8   — | j                   j                  |«      S )z¬
        Create a signed JWT
        https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app
        )r   Ú
create_jwt)r7   Ú
expirations     r9   re   zGithubIntegration.create_jwtÿ   s   € ð �y‰y×#Ñ# JÓ/Ð/r;   c                óê   — |€i }t        |t        «      st        dddid¬«      ‚d|i}| j                  j	                  dd|› d	�| j                  «       |¬
«      \  }}t        | j                  ||¬«      S )z®
        :calls: `POST /app/installations/{installation_id}/access_tokens <https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app>`
        Ni�  ÚmessagezInvalid permissions)ÚstatusÚdatar]   ÚpermissionsÚPOSTú/app/installations/z/access_tokens)r]   Úinputr^   )r(   Údictr
   r   r`   rY   r   )r7   rQ   rk   Úbodyr]   rb   s         r9   Úget_access_tokenz"GithubIntegration.get_access_token	  s—   € ð ÐØˆKä˜+¤tÔ,Ü!¨°IÐ?TÐ3UÐ_cÔdÐdà˜{Ð+ˆØ ×,Ñ,×@Ñ@ØØ! /Ð!2°.ÐAØ×%Ñ%Ó'Øð	 Aó 
Ñˆ�ô )Ø×&Ñ&ØØô
ð 	
r;   zUse get_repo_installationc                ó°   — t         j                  j                  |«      }t         j                  j                  |«      }| j                  d|› d|› d�¬«      S )zã
        Deprecated by get_repo_installation.

        :calls: `GET /repos/{owner}/{repo}/installation <https://docs.github.com/en/rest/reference/apps#get-a-repository-
        installation-for-the-authenticated-app>`

        ú/repos/Ú/ú/installation©ra   ©ÚurllibÚparseÚquoterc   ©r7   ÚownerÚrepos      r9   Úget_installationz"GithubIntegration.get_installation#  sO   € ô —‘×"Ñ" 5Ó)ˆÜ�|‰|×!Ñ! $Ó'ˆØ×&Ñ&¨W°U°G¸1¸T¸FÀ-Ð+PÐ&ÓQÐQr;   c                ó\   — t        t        | j                  dd| j                  «       d¬«      S )zŽ
        :calls: GET /app/installations <https://docs.github.com/en/rest/reference/apps#list-installations-for-the-authenticated-app>
        z/app/installationsNÚinstallations)ÚcontentClassrU   ÚfirstUrlÚfirstParamsr]   Ú	list_item)r   r   r   rY   rC   s    r9   Úget_installationsz#GithubIntegration.get_installations0  s2   € ô Ü%Ø×&Ñ&Ø)ØØ×%Ñ%Ó'Ø%ô
ð 	
r;   c                óp   — t         j                  j                  |d¬«      }| j                  d|› d�¬«      S )zŸ
        :calls: `GET /orgs/{org}/installation <https://docs.github.com/en/rest/apps/apps#get-an-organization-installation-for-the-authenticated-app>`
        Ú )Úsafez/orgs/ru   rv   rw   )r7   Úorgs     r9   Úget_org_installationz&GithubIntegration.get_org_installation=  s:   € ô �l‰l× Ñ  ¨2Ð Ó.ˆØ×&Ñ&¨V°C°5¸Ð+FÐ&ÓGÐGr;   c                ó°   — t         j                  j                  |«      }t         j                  j                  |«      }| j                  d|› d|› d�¬«      S )z«
        :calls: `GET /repos/{owner}/{repo}/installation <https://docs.github.com/en/rest/reference/apps#get-a-repository-installation-for-the-authenticated-app>`
        rs   rt   ru   rv   rw   r{   s      r9   Úget_repo_installationz'GithubIntegration.get_repo_installationD  sO   € ô —‘×"Ñ" 5Ó)ˆÜ�|‰|×!Ñ! $Ó'ˆØ×&Ñ&¨W°U°G¸1¸T¸FÀ-Ð+PÐ&ÓQÐQr;   c                ól   — t         j                  j                  |«      }| j                  d|› d�¬«      S )zœ
        :calls: `GET /users/{username}/installation <https://docs.github.com/en/rest/apps/apps#get-a-user-installation-for-the-authenticated-app>`
        z/users/ru   rv   rw   )r7   Úusernames     r9   Úget_user_installationz'GithubIntegration.get_user_installationL  s5   € ô —<‘<×%Ñ% hÓ/ˆØ×&Ñ&¨W°X°J¸mÐ+LÐ&ÓMÐMr;   c                ó,   — | j                  d|› �¬«      S )zž
        :calls: `GET /app/installations/{installation_id} <https://docs.github.com/en/rest/apps/apps#get-an-installation-for-the-authenticated-app>`
        rm   rv   )rc   )r7   rQ   s     r9   Úget_app_installationz&GithubIntegration.get_app_installationS  s!   € ð ×&Ñ&Ð-@ÀÐ@QÐ+RÐ&ÓSÐSr;   c                ó’   — | j                   j                  dd| j                  «       ¬«      \  }}t        | j                   ||d¬«      S )zp
        :calls: `GET /app <https://docs.github.com/en/rest/reference/apps#get-the-authenticated-app>`_
        r[   z/appr\   T)rU   r]   r_   Ú	completed)r   r`   rY   r	   )r7   r]   rj   s      r9   Úget_appzGithubIntegration.get_appY  sH   € ð
 ×(Ñ(×<Ñ<¸UÀFÐTX×TeÑTeÓTgÐ<Óh‰ˆ�Ü 4×#3Ñ#3¸WÐQUÐaeÔfÐfr;   )$r8   zint | str | Noner&   ú
str | Noner   r   r   r)   r   r   r   r)   r   z
bool | strr   zint | Retry | Noner   ú
int | Noner   úfloat | Noner   r—   r   r)   r   r)   r   r   r   zAppAuth | Noner    r*   r!   r•   ÚreturnÚNone)r    r*   r˜   r   )r˜   r™   )r˜   r   )rH   r   rI   r   rJ   r   r˜   r™   rE   )rQ   r)   rR   údict[str, str] | Noner˜   zgithub.Github)r˜   r   )r˜   zdict[str, str])ra   r   r˜   r   )rf   r–   r˜   r   )rQ   r)   rk   rš   r˜   r   )r|   r   r}   r   r˜   r   )r˜   zPaginatedList[Installation])r‰   r   r˜   r   )rŽ   r   r˜   r   )rQ   r)   r˜   r   )r˜   r	   )#Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   ÚDEFAULT_BASE_URLÚDEFAULT_TIMEOUTÚDEFAULT_USER_AGENTÚDEFAULT_PER_PAGEÚ DEFAULT_SECONDS_BETWEEN_REQUESTSÚDEFAULT_SECONDS_BETWEEN_WRITESr/   r0   r1   r:   r@   rB   rF   rK   rS   ÚpropertyrU   rY   rc   r   re   rq   r~   r…   rŠ   rŒ   r�   r‘   r”   r=   r;   r9   r   r   :   s3  … ñð ƒMØƒMØÓð ,0Ø"&Ø×/Ñ/ð	q
ð ×-Ñ-Ø ×3Ñ3Ø×/Ñ/Ø!Ø$(Ø $Ø17×1XÑ1XØ/5×/TÑ/TØ ×3Ñ3Ø#×9Ñ9Ø#×9Ñ9Ø#àØ"&ñ)q
à(ðq
ð  ðq
ð ð	q
ð ðq
ð ðq
ð ðq
ð ðq
ð "ðq
ð ðq
ð #/ðq
ð !-ðq
ð ðq
ð ðq
ð  ð!q
ð" ð#q
ð& ð'q
ð(  ð)q
ð* 
ó+q
óf+ó	!óóð PTðGØ"ðGØ7LðGà	óGð ò ó ð ó
ó

ñ ð 	Góó0óð0ð JNð
Ø"ð
Ø1Fð
à	"ó
ñ4 Ð+Ó,ò
Ró -ð
Ró
óHóRóNóTôgr;   r   )Ú
__future__r   Úurllib.parserx   r2   Útypingr   r+   Útyping_extensionsr   r   rN   r   Úgithub.Authr   Úgithub.GithubAppr	   Úgithub.GithubExceptionr
   Úgithub.Installationr   Ú github.InstallationAuthorizationr   Úgithub.PaginatedListr   Úgithub.Requesterr   r   r=   r;   r9   Ú<module>r²      sF   ðõJ #ã Û Ý ã Ý (Ý ã Ý Ý Ý &Ý 2Ý ,Ý FÝ .Ý &÷egò egr;   