+
    WGjH                       ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
HtHtHt ^ RIHtHtHt ^ RIHtHtHt ^ RIHtHtHt ]	'       d!   ^ RIHtHtHtHt ^ RIHtHt ^ R	I Ht! ^ R
I"H#t# Rs$]]%]%3,          t&]]]%]]%,          3,          ,          t']PP                  ! ])4      t*R R lt+ ! R R]PX                  R7      t- ! R R]-4      t. ! R R]-4      t/R R lt0R R lt1 ! R R]4      t2R# )    )annotationsN)TYPE_CHECKINGLiteralOptionalTuplecast)SplitResulturlparseurlsplit)URLAuth	BasicAuth)commonprefixget_netrc_authsplit_auth_from_url)AnyCallable	GeneratorIterable)RequestResponse)r   )PreparedRequestFc               $    V ^8  d   QhRRRRRR/# )   funczCallable[..., Any]argnamestrreturnbool )formats   ",lib/python3.14/site-packages/unearth/auth.py__annotate__r#      s"     % %- % % %    c                H    ^ RI pVP                  V 4      pWP                  9   # )z1Return True if the function expects the argument.N)inspect	signature
parameters)r   r   r&   sigs   &&  r"   _expect_argumentr*      s"    


D
!Cnn$$r$   c                      ] tR t^&tRt]P                  R R l4       t]P                  R R l4       t]P                  R R l4       t	Rt
R	# )
KeyringBaseProviderz!Base class for keyring providers.c               $    V ^8  d   QhRRRRRR/# r   urlr   username
str | Noner   AuthInfo | Noner    )r!   s   "r"   r#    KeyringBaseProvider.__annotate__*   s!       
  r$   c                    R# )zNReturn the password for the given url and username.
The username can be None.
Nr    selfr/   r0   s   &&&r"   get_auth_info!KeyringBaseProvider.get_auth_info)   s    
 	r$   c               (    V ^8  d   QhRRRRRRRR/# r   r/   r   r0   passwordr   Noner    )r!   s   "r"   r#   r3   1   s(      #    r$   c                    R# )z0Set the password for the given url and username.Nr    r6   r/   r0   r;   s   &&&&r"   save_auth_info"KeyringBaseProvider.save_auth_info0        	r$   c               $    V ^8  d   QhRRRRRR/# r   r/   r   r0   r   r<   r    )r!   s   "r"   r#   r3   6   s!      C 3 4 r$   c                    R# )z3Delete the password for the given url and username.Nr    r5   s   &&&r"   delete_auth_info$KeyringBaseProvider.delete_auth_info5   rA   r$   r    N)__name__
__module____qualname____firstlineno____doc__abcabstractmethodr7   r?   rE   __static_attributes__r    r$   r"   r,   r,   &   sQ    +  	  	 r$   r,   )	metaclassc                  J    ] tR t^;tRtR R ltR R ltR R ltR R	 ltR
t	R# )KeyringModuleProviderz.Keyring provider that uses the keyring module.c                   V ^8  d   QhRR/# )r   r   r<   r    )r!   s   "r"   r#   "KeyringModuleProvider.__annotate__>   s      $ r$   c                	    ^ RI pWn         R# )r   Nkeyring)r6   rV   s   & r"   __init__KeyringModuleProvider.__init__>   s
    r$   c               $    V ^8  d   QhRRRRRR/# r.   r    )r!   s   "r"   r#   rS   C   !       
  r$   c                	\   \        V P                  R 4      '       dN   \        P                  RV4       V P                  P	                  W4      pVe   VP
                  VP                  3# Vf   Rp\        P                  RW!4       V P                  P                  W4      pV'       d   W$3# R# )get_credentialz,Getting credentials from keyring for url: %sN	__token__z(Getting password from keyring for: %s@%s)hasattrrV   loggerdebugr\   r0   r;   get_passwordr6   r/   r0   credr;   s   &&&  r"   r7   #KeyringModuleProvider.get_auth_infoC   s    4<<!122LLGM<<..s=D}}dmm33"H?O<<,,S;%%r$   c               (    V ^8  d   QhRRRRRRRR/# r:   r    )r!   s   "r"   r#   rS   R   (     ; ;# ; ; ; ;r$   c                	>    V P                   P                  WV4       R # N)rV   set_passwordr>   s   &&&&r"   r?   $KeyringModuleProvider.save_auth_infoR   s    !!#:r$   c               $    V ^8  d   QhRRRRRR/# rC   r    )r!   s   "r"   r#   rS   U   s!     4 4C 43 44 4r$   c                	<    V P                   P                  W4       R # rh   )rV   delete_passwordr5   s   &&&r"   rE   &KeyringModuleProvider.delete_auth_infoU   s    $$S3r$   rU   N)
rG   rH   rI   rJ   rK   rW   r7   r?   rE   rN   r    r$   r"   rQ   rQ   ;   s    8
;4 4r$   rQ   c                  b    ] tR t^YtR R ltR R ltR R ltR R ltRR	 R
 lltR R lt	Rt
R# )KeyringCliProviderc                    V ^8  d   QhRRRR/# )r   cmdr   r   r<   r    )r!   s   "r"   r#   KeyringCliProvider.__annotate__Z   s      C D r$   c                	    Wn         R # rh   rU   )r6   rr   s   &&r"   rW   KeyringCliProvider.__init__Z   s    r$   c               $    V ^8  d   QhRRRRRR/# r.   r    )r!   s   "r"   r#   rs   ]   rZ   r$   c                	   \         P                  R V4       T P                  Y;'       g    RRR7      pVe   VP                  4       w  r$W$3# Vf   Rp\         P                  RW!4       V P                  W4      pVe   W$3# R# )z0Getting credentials from keyring CLI for url: %s creds)modeNr]   z+Getting password from keyring CLI for %s@%s)r_   r`   _get_secret
splitlinesrb   s   &&&  r"   r7    KeyringCliProvider.get_auth_info]   s    GM^^'B!%!2H%%"HBHR##C2%%r$   c               (    V ^8  d   QhRRRRRRRR/# r:   r    )r!   s   "r"   r#   rs   l   rf   r$   c                	&    V P                  WV4      # rh   )_set_passwordr>   s   &&&&r"   r?   !KeyringCliProvider.save_auth_infol   s    !!#::r$   c               $    V ^8  d   QhRRRRRR/# rC   r    )r!   s   "r"   r#   rs   o   s!     1 1C 13 14 1r$   c                	    V P                   R W.p\        \        P                  RR7      p\        P
                  ! W4RR7       R# )delutf-8PYTHONIOENCODINGT)envcheckN)rV   dictosenviron
subprocessrun)r6   r/   r0   rr   r   s   &&&  r"   rE   #KeyringCliProvider.delete_auth_infoo   s0    ||UC22::8s40r$   c               (    V ^8  d   QhRRRRRRRR/# )r   service_namer   r0   rz   zLiteral['password', 'creds']r   r1   r    )r!   s   "r"   r#   rs   t   s2     < << < +	<
 
<r$   c                F   V P                   RV 2RW.p\        \        P                  RR7      p\        P
                  ! V\        P                  RVR7      pVP                  '       d   R# VP                  P                  R4      P                  \        P                  4      # )zHMirror the implementation of keyring.get_[password|credential] using cliz--mode=getr   r   T)stdincapture_outputr   N)rV   r   r   r   r   r   DEVNULL
returncodestdoutdecodestriplinesep)r6   r   r0   rz   rr   r   ress   &&&&   r"   r{   KeyringCliProvider._get_secrett   s|     ||wtf-ulM2::8nnz))$C
 >>>zz  )//

;;r$   c               (    V ^8  d   QhRRRRRRRR/# )r   r   r   r0   r;   r   r<   r    )r!   s   "r"   r#   rs      s)     ? ?# ? ? ?PT ?r$   c                    V P                   f   R# V P                   RW.pV\        P                  ,           P                  R4      p\	        \        P
                  RR7      p\        P                  ! WEVRR7       R# )z;Mirror the implementation of keyring.set_password using cliNsetr   r   T)inputr   r   )rV   r   r   encoder   r   r   r   )r6   r   r0   r;   rr   input_r   s   &&&&   r"   r    KeyringCliProvider._set_password   sX    <<||UL;RZZ'//82::8sc>r$   rU   N)r;   )rG   rH   rI   rJ   rW   r7   r?   rE   r{   r   rN   r    r$   r"   rp   rp   Y   s%    ;1
< ? ?r$   rp   c                   V ^8  d   QhRR/# )r   r   zKeyringBaseProvider | Noner    )r!   s   "r"   r#   r#      s      8 r$   c                     \         '       d   R#  \        4       #   \         d     M-\         d!   p \        P                  RT 4        Rp ? MRp ? ii ; i\        P                  ! R4      pTe   \        T4      # R# )z#Return the keyring provider to use.NzBImporting keyring failed: %s, trying to find a keyring executable.rV   )	KEYRING_DISABLEDrQ   ImportError	Exceptionr_   warningshutilwhichrp   )excrV   s     r"   get_keyring_providerr      so    
$&&  
P	
 	

 ll9%G!'**s   	 AAAAAc               $    V ^8  d   QhRRRRRR/# )r   r/   r1   r0   r   r2   r    )r!   s   "r"   r#   r#      s!      * 
  r$   c                    V '       g   R# \        4       pVf   R#  VP                  W4      #   \         d-   p\        P	                  R\        T4      4       Rs Rp?R# Rp?ii ; i)z3Return the tuple auth for a given url from keyring.Nz*Keyring is skipped due to an exception: %sT)r   r7   r   r_   r   r   r   )r/   r0   rV   r   s   &&  r"   get_keyring_authr      s_    "$G	$$S33 8H	

  s   - A$!AA$c                      ] tR t^tRtRR R lltR R ltRRRR	/R
 R lltR R ltR R lt	R R lt
RR R lltR R ltR R ltR R ltR R ltRtR# ) MultiDomainBasicAuthzSA multi-domain HTTP basic authentication handler supporting both requests and httpxTc               $    V ^8  d   QhRRRRRR/# )r   	promptingr   
index_urlszIterable[str]r   r<   r    )r!   s   "r"   r#   !MultiDomainBasicAuth.__annotate__   s'     F F$ F= FRV Fr$   c                	N    Wn         \        V4      V n        / V n        R V n        R # rh   )r   listr   _cached_passwords_credentials_to_save)r6   r   r   s   &&&r"   rW   MultiDomainBasicAuth.__init__   s#    "z*68AE!r$   c                    V ^8  d   QhRRRR/# )r   r/   r   r   ztuple[MaybeAuth, str | None]r    )r!   s   "r"   r#   r      s     4 4C 44P 4r$   c                  a V'       d   V P                   '       g   R# \        VP                  R4      R,           4      o. pV P                    Fv  pVP                  R4      R,           p\        V4      w  rE\        V4      pVS8X  d   WC3u # SP                  VP                  8X  g   K\  VP                  \        V4      4       Kx  	  V'       g   R# \        VV3R lR7      pVP                  4       p\        V4      ^ ,          V3# )zReturn the extracted auth and the original index URL matching
the requested url. The auth part should be already stripped from the URL.

Returns None if no matching index was found, or if --no-index
was specified by the user.
/c                b   < \        V P                  SP                  4      P                  R 4      # )r   )r   pathrfind)xtargets   &r"   <lambda>?MultiDomainBasicAuth._get_auth_from_index_url.<locals>.<lambda>   s    l1666;;&G&M&Mc&Rr$   )key)NN)r   r   rstripr   netlocappendmaxgeturl)	r6   r/   
candidatesindexauthurl_no_authparsed
best_matchr   s	   &&      @r"   _get_auth_from_index_url-MultiDomainBasicAuth._get_auth_from_index_url   s     $///#**S/C/0(*
__ELL%+E 3E :Dk*F{"}}-!!(5/2 % R

 !!#"5)!,e33r$   allow_netrcallow_keyringFc               (    V ^8  d   QhRRRRRRRR/# )r   original_urlr   r   r   r   r   ztuple[str | None, str | None]r    )r!   s   "r"   r#   r      s2     7" 7"7" 	7"
 7" 
'7"r$   c                  \        V4      w  rE\        V4      P                  pRRrV'       d/   Vw  rxVe'   \        P	                  RV4       \        \        V4      # \        V P                  R4      '       d   V P                  V4      w  rMV P                  V4      w  rV
'       dY   \        P	                  RV
4       V	e?   V	^,          e'   \        P	                  RV4       \        \        V	4      # Vf
   V	^ ,          pV'       d:   \        V4      pV'       d'   \        P	                  RV4       \        \        V4      # V'       d?   \        W4      ;'       g    \        Wg4      pV'       d   \        P	                  RV4       V# Wx3# )z2Find and return credentials for the specified URL.NzFound credentials in url for %sr   zFound index url %sz%Found credentials in index url for %sz!Found credentials in netrc for %sz#Found credentials in keyring for %s)r   r
   r   r_   r`   r   AuthInfor*   r   r   r   )r6   r   r   r   r   r/   r   r0   r;   
index_auth	index_url
netrc_authkr_auths   &&$$         r"   _get_new_credentials)MultiDomainBasicAuth._get_new_credentials   sV    (5	#%% "4(!%H#>GHd++ D998DD$($A$A&$I!J	$($A$A#$F!JLL-y9 %a=,LL!H&Q*55#)!}H '5J@&IHj11 &y;  ?O@G BFK!!r$   c                    V ^8  d   QhRRRR/# )r   r   r   r   z"tuple[str, str | None, str | None]r    )r!   s   "r"   r#   r     s     "' "'"'	+"'r$   c                F   \        V4      w  r#\        V4      P                  pV P                  VRRR7      w  rVVe   Vf2   W@P                  9   d"   V P                  V,          w  rxVe   WW8X  d   YxreVf   Ve&   T;'       g    RT;'       g    R3V P                  V&   W5V3# )a/  Return the credentials to use for the provided URL.

If allowed, netrc and keyring may be used to obtain the
correct credentials.

Returns (url_without_credentials, username, password). Note
that even if the original URL contains credentials, this
function may return a different username and password.
TFr   r   rx   )r   r
   r   r   r   )	r6   r   _r/   r   r0   r;   unpws	   &&       r"   _get_url_and_credentials-MultiDomainBasicAuth._get_url_and_credentials  s     %\2#%%!66d% 7 
  0f@V@V6V++F3FB 8>%'(8#7.6nn"hnn"-MD""6*h&&r$   c                    V ^8  d   QhRRRR/# )r   reqr   r   r    )r!   s   "r"   r#   r   ?  s      O  r$   c                	    ^ RI Hp V P                  \        \        VP
                  4      4      w  r4pW1n        Ve   Ve   V! WE4      ! V4      pVP                  RV P                  4       V# )r   HTTPBasicAuthresponse)requests.authr   r   r   r   r/   register_hook
handle_401)r6   r   r   r/   r0   r;   s   &&    r"   __call__MultiDomainBasicAuth.__call__?  s_    /"&"?"?S#''@R"SxH$83C8C 	*doo6
r$   c                    V ^8  d   QhRRRR/# )r   requestr   r   z"Generator[Request, Response, None]r    )r!   s   "r"   r#   r   N  s     3, 3, 3,-O 3,r$   c              #  	  "   V P                  \        VP                  4      4      w  r#p\        V4      Vn        Ve*   Ve&   \	        W44      p\        VP                  V4      4      pVx pVP                  R8w  d   R # V P                  VRRR7      w  r4RpVP                  P                  P                  4       pVfZ   V P                  '       g   R # \        V P                  R4      '       d   V P                  W4      w  r4pMV P                  V4      w  r4pR V n        Ve<   Ve8   W43V P                  V&   V'       d    V P!                  4       '       d
   WV3V n        \	        T;'       g    RT;'       g    R4      p\        VP                  V4      4      pVx pV P#                  V4       V P                  '       d   V P%                  V4       R # R # 5i)N  FTr   r0   rx   )r   r   r/   r   r   next	auth_flowstatus_coder   r   r   r   r*   _prompt_for_passwordr   r    _should_save_password_to_keyringwarn_on_401save_credentials)	r6   r   r/   r0   r;   
basic_authr   saver   s	   &&       r"   r   MultiDomainBasicAuth.auth_flowN  s    "&"?"?GKK@P"Qx#hH$8"86J://89G =3& "66U$ 7 

 $$++->>> 9 9:FF+/+D+DV+V(D+/+D+DV+L(D %)!H$8.6-AD""6* ==??-3x,H) x~~2x~~2>
z++G45 ="
 $$$!!(+ %s    CGBGG+
G6AGNc               $    V ^8  d   QhRRRRRR/# )r   r   r   r0   r1   r   z#tuple[str | None, str | None, bool]r    )r!   s   "r"   r#   r     s$     ( ((%/(	,(r$   c                	    VfA   \        RV R24      p\        W4      pV'       d   V^ ,          e   V^,          e   . VORN5# M\        P                  RV4       V'       g   R# \        P                  ! R4      pW$R3# )Nz	User for z: FzUsername: %sz
Password: T)NNF)r   r   r_   infogetpass)r6   r   r0   r   r;   s   &&&  r"   r   )MultiDomainBasicAuth._prompt_for_password  s{     y34H#F5DQ+Q0C%~u~%KK1$$??<04''r$   c                   V ^8  d   QhRR/# )r   r   r   r    )r!   s   "r"   r#   r     s     C C$ Cr$   c                	:    \        4       f   R# \        R4      R8H  # )NFz#Save credentials to keyring [y/N]: y)r   r   )r6   s   &r"   r   5MultiDomainBasicAuth._should_save_password_to_keyring  s    !):;sBBr$   c               $    V ^8  d   QhRRRRRR/# )r   respRequestsResponsekwargsr   r   r   r    )r!   s   "r"   r#   r     s"     = =/ =3 =8 =r$   c                	   ^ RI Hp VP                  R8w  d   V# \        \	        \
        VP                  4      4      pV P                  VP                  RRR7      w  rVRpVfo   V P                  '       g   V# \        V P                  R4      '       d!   V P                  VP                  V4      w  rVpMV P                  VP                  4      w  rVpRV n        VeP   VeL   WV3V P                  VP                  &   V'       d*   V P                  4       '       d   VP                  WV3V n        VP                   VP                   P#                  4        T! T;'       g    RT;'       g    R4      ! VP$                  4      pVP'                  R	V P(                  4       V P                  '       d   VP'                  R	V P*                  4       VP,                  P.                  ! V3/ VB p	V	P0                  P3                  V4       V	# )
r   r   r   FTr   Nr0   rx   r   )r   r   r   r
   r   r   r/   r   r   r*   r   r   r   r   r   contentrawrelease_connr   r   r   r   
connectionsendhistoryr   )
r6   r  r  r   r   r0   r;   r   r   new_resps
   &&,       r"   r   MultiDomainBasicAuth.handle_401  s    	0s"K$sDHH-. "66HH 7 
 >>> 9 9:FF+/+D+DMM8,(D ,0+D+DV]]+S(D %)!H$85=4HD""6==1 ==??-3]]H,O) 	 HNNHNN;DLLI 	*d&6&67
 $$$j$*?*?@ ??''6v6%r$   c               $    V ^8  d   QhRRRRRR/# r   r  zResponse | RequestsResponser  r   r   r<   r    )r!   s   "r"   r#   r     s"       ; s t r$   c                    VP                   R8X  d8   \        P                  RVP                   VP                  P                  4       R# R# )z6Response callback to warn about incorrect credentials.r   z(%s Error, Credentials not correct for %sN)r   r_   r   r   r/   )r6   r  r  s   &&,r"   r    MultiDomainBasicAuth.warn_on_401  s:    s"NN:     #r$   c               $    V ^8  d   QhRRRRRR/# r  r    )r!   s   "r"   r#   r     s$     ? ?/?;>?	?r$   c                *   \        4       pVf   Q R4       hV P                  pRV n        V'       d<   VP                  R8  d)    \        P	                  R4       VP
                  ! V!   R# R# R#   \         d    \        P                  R4        R# i ; i)z1Response callback to save credentials on success.Nz'should never reach here without keyringi  zSaving credentials to keyringzFailed to save credentials)r   r   r   r_   r  r?   r   	exception)r6   r  r  rV   ry   s   &&,  r"   r   %MultiDomainBasicAuth.save_credentials  s     '("M$MM"))$(!T%%+?;<&&. ,5  ?  !=>?s   %A. . BB)r   r   r   r   )Tr    rh   )rG   rH   rI   rJ   rK   rW   r   r   r   r   r   r   r   r   r   r   rN   r    r$   r"   r   r      s[    ]F4>7" !	7"
 $7"r"'H3,l( C
=~? ?r$   r   )3
__future__r   rL   r  loggingr   r   r   typingr   r   r   r   r   urllib.parser	   r
   r   httpxr   r   r   unearth.utilsr   r   r   r   r   r   r   r   r   requestsr  requests.modelsr   r   r   r   	MaybeAuth	getLoggerrG   r_   r*   ABCMetar,   rQ   rp   r   r   r   r    r$   r"   <module>r+     s    " 
   	   @ @ 8 8 & & K K99'5/ c?U3-./				8	$%CKK *4/ 4<3?, 3?l,(v?4 v?r$   