
    Xi*                    z   S SK Jr  S SKrS SKrS SKrS SKJr  S SKJ	r	J
r
JrJr  \	(       a'  S SKrS SKJr  \R                  S:  a  S SKJr  OS SKJr  / SQrS%S	 jr\" S
5      r " S S\5      r\" S\S9rS&S jrS'S jrS(S jr        S)S jr\R6                  " S5      rS*S jrS+S jr " S S\5      r  " S S\ 5      r!\RD                  " SSS9 " S S5      5       r#\RD                  " SSS9 " S S 5      5       r$\RD                  " SSS9 " S! S"5      5       r%\RD                  " SSS9 " S# S$5      5       r&g),    )annotationsN)Mapping)TYPE_CHECKINGAnyProtocolTypeVar)
Collection)      )Self)ArchiveInfoDirInfo	DirectUrlDirectUrlValidationErrorVcsInfoc                     [         $ N)__all__     G/var/www/html/venv/lib/python3.13/site-packages/packaging/direct_url.py__dir__r      s    Nr   _Tc                  (    \ rS rSr\SS j5       rSrg)_FromMappingProtocol"   c                    g r   r   clsds     r   
_from_dict_FromMappingProtocol._from_dict#   s    7:r   r   Nr    Mapping[str, Any]returnr   )__name__
__module____qualname____firstlineno__classmethodr!   __static_attributes__r   r   r   r   r   "   s    : :r   r   _FromMappingProtocolT)boundc                F    U  VVs0 s H  u  pUc  M
  X_M     snn$ s  snnf r   r   )datakeyvalues      r   _json_dict_factoryr2   *   s"    )-C:3JCJCCCs   	c                    U R                  U5      =nc  g[        X15      (       d.  [        S[        U5      R                   SUR                   S3US9eU$ )zBGet a value from the dictionary and verify it's the expected type.NzUnexpected type z (expected )context)get
isinstancer   typer&   r    expected_typer0   r1   s       r   _getr<   .   sd    s$e++&tE{334 5&//03
 	

 Lr   c                :    [        XU5      =nc  [        U5      eU$ )zKGet a required value from the dictionary and verify it's the expected type.)r<   _DirectUrlRequiredKeyErrorr:   s       r   _get_requiredr?   ;   s$    a,,5(--Lr   c                    [        U [        U5      =nc  g UR                  U5      $ ! [         a  n[	        XBS9UeSnAff = f)zIGet a dictionary value from the dictionary and convert it to a dataclass.Nr5   )r<   r   r!   	Exceptionr   )r    target_typer0   r1   es        r   _get_objectrD   B   sN     a#&&/>%%e,, >&q6A=>s   ( 
A
<Az.^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$c                    SU ;  a  U $ U R                  SS5      u  p#X!;   a  U $ [        R                  U5      (       a  U $ U$ )N@   )split _PEP610_USER_PASS_ENV_VARS_REGEXmatch)netlocsafe_user_passwords	user_passnetloc_no_user_passs       r   _strip_auth_from_netlocrO   S   sI    
&%+\\#q%9"I''--i88r   c                   [         R                  R                  U 5      n[        UR                  U5      n[         R                  R                  UR                  UUR                  UR                  UR                  45      $ )zurl with user:password part removed unless it is formed with
environment variables as specified in PEP 610, or it is a safe user:password
such as `git`.
)
urllibparseurlsplitrO   rK   
urlunsplitschemepathqueryfragment)urlrL   
parsed_urlrK   s       r   
_strip_urlr[   ^   sl    
 &&s+J$Z%6%68KLF<<""OO	
 r   c                  X    \ rS rSr% SrSrS\S'   S\S'   SS.     SS	 jjrSS
 jrSr	g)r   p   z2Raised when when input data is not spec-compliant.N
str | Noner6   strmessager5   c                   [        U[        5      (       aS  UR                  (       a*  U(       a  U SUR                   3OUR                  U l        OX l        UR                  U l        g X l        [	        U5      U l        g )N.)r8   r   r6   r`   r_   )selfcauser6   s      r   __init__!DirectUrlValidationError.__init__v   s\     e566}}4;wiq0   ' ==DL"Lu:DLr   c                t    U R                   (       a  U R                   SU R                   < 3$ U R                  $ )Nz in r6   r`   rc   s    r   __str__ DirectUrlValidationError.__str__   s-    <<ll^4'788||r   rh   )rd   zstr | Exceptionr6   r^   r%   None)r%   r_   )
r&   r'   r(   r)   __doc__r6   __annotations__re   rj   r+   r   r   r   r   r   p   s?    <GZL #	&& 	&
 
&$r   r   c                  ,   ^  \ rS rSrSU 4S jjrSrU =r$ )r>      c                "   > [         TU ]  SUS9  g )NzMissing required valuer5   )superre   )rc   r0   	__class__s     r   re   #_DirectUrlRequiredKeyError.__init__   s    13?r   r   )r0   r_   r%   rl   )r&   r'   r(   r)   re   r+   __classcell__)rs   s   @r   r>   r>      s    @ @r   r>   TF)frozeninitc                  l    \ rS rSr% S\S'   S\S'   SrS\S'   SS.       SS	 jjr\SS
 j5       rSr	g)r      r_   vcs	commit_idNr^   requested_revision)r|   c                   [         R                  U SU5        [         R                  U SU5        [         R                  U SU5        g )Nrz   r{   r|   object__setattr__)rc   rz   r{   r|   s       r   re   VcsInfo.__init__   s<     	4,4i84!57IJr   c           	     l    U " [        U[        S5      [        U[        S5      [        U[        S5      S9$ )Nrz   r|   r{   )rz   r|   r{   )r?   r_   r<   r   s     r   r!   VcsInfo._from_dict   s6     ae,#As,@A#AsK8
 	
r   r   )rz   r_   r{   r_   r|   r^   r%   rl   r#   )
r&   r'   r(   r)   rn   r|   re   r*   r!   r+   r   r   r   r   r      sb    	HN%)
) *.	K 	K 		K
 '	K 
	K 
 
r   r   c                  P    \ rS rSr% SrS\S'   SS.   S	S jjr\S
S j5       rSr	g)r      NMapping[str, str] | Nonehashesr   c               2    [         R                  U SU5        g )Nr   r~   )rc   r   s     r   re   ArchiveInfo.__init__   s    
 	462r   c                h   [        U[        S5      nUb/  [        S UR                  5        5       5      (       d
  [	        SSS9e[        U[
        S5      nUbV  SU;  a
  [	        SSS9eUR                  SS5      u  pEUc  XE0nO+XB;  a  [	        S	U< S
3SS9eX$   U:w  a  [	        S	U< S3SS9eU " US9$ )Nr   c              3  B   #    U  H  n[        U[        5      v   M     g 7fr   )r8   r_   ).0hs     r   	<genexpr>)ArchiveInfo._from_dict.<locals>.<genexpr>   s     )Vo*Q*<*<os   zHash values must be stringsr5   hash=z3Invalid hash format (expected '<algorithm>=<hash>')rG   z
Algorithm z2 used in hash field is not present in hashes fieldz7 used in hash field has different value in hashes fieldr   )r<   r   allvaluesr   r_   rH   )r   r    r   legacy_hashhash_algorithm
hash_values         r   r!   ArchiveInfo._from_dict   s    a(+c)Vfmmo)V&V&V*-x  1c6*"+%.I"  *5):):3)B&N~(5 "/2$^$6 79 : ( 
 )Z72$^$6 7> ? & 
 &!!r   r   )r   r   r%   rl   r#   )
r&   r'   r(   r)   r   rn   re   r*   r!   r+   r   r   r   r   r      s?    '+F$+
 ,03 )3 
	3 " "r   r   c                  P    \ rS rSr% SrS\S'   SS.   S	S jjr\S
S j5       rSr	g)r      Nbool | Noneeditabler   c               2    [         R                  U SU5        g )Nr   r~   )rc   r   s     r   re   DirInfo.__init__   s    
 	4X6r   c                ,    U " [        U[        S5      S9$ )Nr   r   )r<   boolr   s     r   r!   DirInfo._from_dict   s    !T:.
 	
r   r   )r   r   r%   rl   r#   )
r&   r'   r(   r)   r   rn   re   r*   r!   r+   r   r   r   r   r      s>     Hk 
 !%7 7 
	7 
 
r   r   c                      \ rS rSr% SrS\S'   SrS\S'   SrS\S	'   SrS
\S'   Sr	S\S'   SSSSS.           SS jjr
\SS j5       r\SS j5       rSSSS.       SS jjrSS jrSrg)r      z"A class representing a direct URL.r_   rY   NArchiveInfo | Nonearchive_infoVcsInfo | Nonevcs_infoDirInfo | Nonedir_infor^   subdirectory)r   r   r   r   c                   [         R                  U SU5        [         R                  U SU5        [         R                  U SU5        [         R                  U SU5        [         R                  U SU5        g )NrY   r   r   r   r   r~   )rc   rY   r   r   r   r   s         r   re   DirectUrl.__init__   s^     	4,4>4X64X64>r   c                   U " [        U[        S5      [        U[        S5      [        U[        S5      [        U[
        S5      [        U[        S5      S9n[        UR                  5      [        UR                  5      -   [        UR                  5      -   S:w  a  [        S5      eUR                  b*  UR                  R                  S	5      (       d
  [        S
SS9eU$ )NrY   r   r   r   r   )rY   r   r   r   r   rG   z?Exactly one of vcs_info, archive_info, dir_info must be presentzfile://z3URL scheme must be file:// when dir_info is presentr5   )r?   r_   rD   r   r   r   r<   r   r   r   r   r   rY   
startswith)r   r    
direct_urls      r   r!   DirectUrl._from_dict  s    ae,$Q^D GZ8 GZ8an5

 $$%:**+,:&&'( 	
 +Q  *:>>3L3LY3W3W*E 
 r   c               $    U R                  U5      $ )z@Create and validate a DirectUrl instance from a JSON dictionary.)r!   r   s     r   	from_dictDirectUrl.from_dict   s     ~~a  r   FT)git)generate_legacy_hashstrip_user_passwordrL   c               h   [         R                  " U [        S9nU(       aq  U R                  (       a`  U R                  R                  (       aE  [        [        U R                  R                  R                  5       5      5      u  pVU SU 3US   S'   U(       a  [        U R                  U5      US'   U$ )a>  Convert the DirectUrl instance to a JSON dictionary.

:param generate_legacy_hash: If True, include a legacy `hash` field in
    `archive_info` for backward compatibility with tools that don't
    support the `hashes` field.
:param strip_user_password: If True, strip user:password from the URL
    unless it is formed with environment variables as specified in PEP
    610, or it is a safe user:password such as `git`.
:param safe_user_passwords: A collection of user:password strings that
    should not be stripped from the URL even if `strip_user_password` is
    True.
)dict_factoryr   r   r   rY   )
dataclassesasdictr2   r   r   nextiteritemsr[   rY   )rc   r   r   rL   resr   r   s          r   to_dictDirectUrl.to_dict%  s    &   4FGD$5$5$:K:K:R:R)-d43D3D3K3K3Q3Q3S.T)U&N-;,<Aj\*JC'#DHH.ABCJ
r   c                B    U R                  U R                  5       5        g)zqValidate the DirectUrl instance against the specification.

Raises :class:`DirectUrlValidationError` if invalid.
N)r   r   ri   s    r   validateDirectUrl.validate@  s    
 	t||~&r   r   )rY   r_   r   r   r   r   r   r   r   r^   r%   rl   r#   )r   r   r   r   rL   Collection[str]r%   r$   )r%   rl   )r&   r'   r(   r)   rm   rn   r   r   r   r   re   r*   r!   r   r   r   r+   r   r   r   r   r      s    ,	H'+L$+#Hn##Hn##L*# ,0#'#'#'? ? )	?
 !? !? !? 
?  0 ! ! &+$(/7 # "	
 - 
6'r   r   )r%   z	list[str])r/   zlist[tuple[str, Any]]r%   zdict[str, Any])r    r$   r;   type[_T]r0   r_   r%   z	_T | None)r    r$   r;   r   r0   r_   r%   r   )r    r$   rB   ztype[_FromMappingProtocolT]r0   r_   r%   z_FromMappingProtocolT | None)rK   r_   rL   r   r%   r_   )rY   r_   rL   r   r%   r_   )'
__future__r   r   reurllib.parserQ   collections.abcr   typingr   r   r   r   sysr	   version_infor   typing_extensionsr   r   r   r   r,   r2   r<   r?   rD   compilerI   rO   r[   rA   r   r>   	dataclassr   r   r   r   r   r   r   <module>r      su   "  	  # 8 8*
7"* T];8 ;
   7?ST D
	>	>'B	>IL	>!	> $&::5$  
$y <@!9 @
 d/
 
 0
4 d/*" *" 0*"Z d/
 
 0
" d/V' V' 0V'r   