Ë
    æØjj¥*  ã                  ó~  — d dl m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 e	r&d dlZd dlmZ ej                  dk\  rd dlmZ nd dlmZ g d¢Zd%d	„Z ed
«      Z G d„ de«      Z ede¬«      Zd&d„Zd'd„Zd(d„Z	 	 	 	 	 	 	 	 d)d„Z ej6                  d«      Zd*d„Zd+d„Z G d„ de«      Z  G d„ de «      Z! ejD                  dd¬«       G d„ d«      «       Z# ejD                  dd¬«       G d„ d «      «       Z$ ejD                  dd¬«       G d!„ d"«      «       Z% ejD                  dd¬«       G d#„ d$«      «       Z&y),é    )ÚannotationsN)ÚMapping)ÚTYPE_CHECKINGÚAnyÚProtocolÚTypeVar)Ú
Collection)é   é   )ÚSelf)ÚArchiveInfoÚDirInfoÚ	DirectUrlÚDirectUrlValidationErrorÚVcsInfoc                 ó   — t         S ©N)Ú__all__© ó    úV/opt/eval-harness/bench_task/venv/lib/python3.12/site-packages/packaging/direct_url.pyÚ__dir__r      s   € Ü€Nr   Ú_Tc                  ó   — e Zd Zedd„«       Zy)Ú_FromMappingProtocolc                 ó   — y r   r   ©ÚclsÚds     r   Ú
_from_dictz_FromMappingProtocol._from_dict#   s   € Ø7:r   N©r   úMapping[str, Any]Úreturnr   )Ú__name__Ú
__module__Ú__qualname__Úclassmethodr    r   r   r   r   r   "   s   „ ØÚ:ó Ù:r   r   Ú_FromMappingProtocolT)Úboundc                ó@   — | D ��ci c]  \  }}|€Œ	||“Œ c}}S c c}}w r   r   )ÚdataÚkeyÚvalues      r   Ú_json_dict_factoryr.   *   s#   € Ø)-×C™:˜3 °Ñ1BˆC�‰JÓCÐCùÓCs   †
‘c                ó¨   — | j                  |«      x}€yt        ||«      s1t        dt        |«      j                  › d|j                  › d�|¬«      ‚|S )zBGet a value from the dictionary and verify it's the expected type.NzUnexpected type z (expected ú)©Úcontext)ÚgetÚ
isinstancer   Útyper$   ©r   Úexpected_typer,   r-   s       r   Ú_getr8   .   sc   € à—‘�s“ÐˆÐ$ØÜ�e˜]Ô+Ü&Øœt E›{×3Ñ3Ð4ð 5Ø&×/Ñ/Ð0°ð3àô
ð 	
ð
 €Lr   c                ó:   — t        | ||«      x}€t        |«      ‚|S )zKGet a required value from the dictionary and verify it's the expected type.)r8   Ú_DirectUrlRequiredKeyErrorr6   s       r   Ú_get_requiredr;   ;   s&   € ä�a˜¨Ó,Ð,ˆÐ5Ü(¨Ó-Ð-Ø€Lr   c                óŒ   — t        | t        |«      x}€y	 |j                  |«      S # t        $ r}t	        ||¬«      |‚d}~ww xY w)zIGet a dictionary value from the dictionary and convert it to a dataclass.Nr1   )r8   r   r    Ú	Exceptionr   )r   Útarget_typer,   r-   Úes        r   Ú_get_objectr@   B   sP   € ô �aœ #Ó&Ð&ˆÐ/Øð>Ø×%Ñ% eÓ,Ð,øÜò >Ü& q°#Ô6¸AÐ=ûð>ús   –' §	A°>¾Az.^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$c                óv   — d| vr| S | j                  dd«      \  }}||v r| S t        j                  |«      r| S |S )Nú@é   )ÚsplitÚ _PEP610_USER_PASS_ENV_VARS_REGEXÚmatch)ÚnetlocÚsafe_user_passwordsÚ	user_passÚnetloc_no_user_passs       r   Ú_strip_auth_from_netlocrK   S   sL   € Ø
�&ÑØˆØ%+§\¡\°#°qÓ%9Ñ"€IÐ"ØÐ'Ñ'ØˆÜ'×-Ñ-¨iÔ8ØˆØÐr   c                ó  — t         j                  j                  | «      }t        |j                  |«      }t         j                  j                  |j                  ||j                  |j                  |j                  f«      S )z¥url 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ÚurlsplitrK   rG   Ú
urlunsplitÚschemeÚpathÚqueryÚfragment)ÚurlrH   Ú
parsed_urlrG   s       r   Ú
_strip_urlrW   ^   sl   € ô
 —‘×&Ñ& sÓ+€JÜ$ Z×%6Ñ%6Ð8KÓL€FÜ�<‰<×"Ñ"à×ÑØØ�O‰OØ×ÑØ×Ñð	
óð r   c                  óJ   — e Zd ZU dZdZded<   ded<   ddœ	 	 	 	 	 d
d„Zdd	„Zy)r   z2Raised when when input data is not spec-compliant.Nú
str | Noner2   ÚstrÚmessager1   c               óæ   — t        |t        «      rJ|j                  r%|r|› d|j                  › �n|j                  | _        n|| _        |j                  | _        y || _        t	        |«      | _        y )Nú.)r4   r   r2   r[   rZ   )ÚselfÚcauser2   s      r   Ú__init__z!DirectUrlValidationError.__init__v   s]   € ô �eÔ5Ô6Ø�}Š}á4;�w�i˜q §¡ Ñ0ÀÇÁð •ð  '�”Ø Ÿ=™=ˆD�Là"ˆDŒLÜ˜u›:ˆD�Lr   c                óh   — | j                   r| j                  › d| j                   ›�S | j                  S )Nz in )r2   r[   ©r^   s    r   Ú__str__z DirectUrlValidationError.__str__ˆ   s-   € Ø�<Š<Ø—l‘l�^ 4¨¯©Ð'7Ð8Ð8Ø�|‰|Ðr   )r_   zstr | Exceptionr2   rY   r#   ÚNone)r#   rZ   )r$   r%   r&   Ú__doc__r2   Ú__annotations__r`   rc   r   r   r   r   r   p   s?   … Ù<à€GˆZÓØƒLð #ñ	&àð&ð ð	&ð
 
ó&ô$r   r   c                  ó    ‡ — e Zd Zdˆ fd„Zˆ xZS )r:   c                ó(   •— t         ‰| �  d|¬«       y )NzMissing required valuer1   )Úsuperr`   )r^   r,   Ú	__class__s     €r   r`   z#_DirectUrlRequiredKeyError.__init__�   s   ø€ Ü‰ÑÐ1¸3ÐÕ?r   )r,   rZ   r#   rd   )r$   r%   r&   r`   Ú__classcell__)rj   s   @r   r:   r:   Ž   s   ø„ ÷@ñ @r   r:   TF)ÚfrozenÚinitc                  ó^   — e Zd ZU ded<   ded<   dZded<   ddœ	 	 	 	 	 	 	 d
d„Zedd	„«       Zy)r   rZ   ÚvcsÚ	commit_idNrY   Úrequested_revision)rq   c               óŽ   — t         j                  | d|«       t         j                  | d|«       t         j                  | d|«       y )Nro   rp   rq   ©ÚobjectÚ__setattr__)r^   ro   rp   rq   s       r   r`   zVcsInfo.__init__™   s<   € ô 	×Ñ˜4 ¨Ô,Ü×Ñ˜4 ¨iÔ8Ü×Ñ˜4Ð!5Ð7IÕJr   c           	     ór   —  | t        |t        d«      t        |t        d«      t        |t        d«      ¬«      S )Nro   rq   rp   )ro   rq   rp   )r;   rZ   r8   r   s     r   r    zVcsInfo._from_dict¤   s6   € ñ Ü˜a¤ eÓ,Ü# A¤sÐ,@ÓAÜ# A¤s¨KÓ8ô
ð 	
r   )ro   rZ   rp   rZ   rq   rY   r#   rd   r!   )r$   r%   r&   rf   rq   r`   r'   r    r   r   r   r   r   “   sb   … à	ƒHØƒNØ%)Ð˜
Ó)ð *.ñ	Kð ð	Kð ð		Kð
 'ð	Kð 
ó	Kð ò
ó ñ
r   r   c                  óB   — e Zd ZU dZded<   ddœ	 	 	 dd„Zedd„«       Zy)	r   NúMapping[str, str] | NoneÚhashes©ry   c               ó2   — t         j                  | d|«       y )Nry   rs   )r^   ry   s     r   r`   zArchiveInfo.__init__²   s   € ô
 	×Ñ˜4 ¨6Õ2r   c                óp  — t        |t        d«      }|�-t        d„ |j                  «       D «       «      st	        dd¬«      ‚t        |t
        d«      }|�[d|vrt	        dd¬«      ‚|j                  dd«      \  }}|€||i}n.||vrt	        d	|›d
�d¬«      ‚||   |k7  rt	        d	|›d�d¬«      ‚ | |¬«      S )Nry   c              3  ó<   K  — | ]  }t        |t        «      –— Œ y ­wr   )r4   rZ   )Ú.0Úhs     r   ú	<genexpr>z)ArchiveInfo._from_dict.<locals>.<genexpr>¼   s   è ø€ Ò)VÀ¬*°Q¼×*<Ñ)Vùs   ‚zHash values must be stringsr1   Úhashú=z3Invalid hash format (expected '<algorithm>=<hash>')rC   z
Algorithm z2 used in hash field is not present in hashes fieldz7 used in hash field has different value in hashes fieldrz   )r8   r   ÚallÚvaluesr   rZ   rD   )r   r   ry   Úlegacy_hashÚhash_algorithmÚ
hash_values         r   r    zArchiveInfo._from_dict¹   sþ   € ä�aœ (Ó+ˆØÐ¤cÑ)VÀfÇmÁmÃoÔ)VÔ&VÜ*Ø-°xôð ô ˜1œc 6Ó*ˆØÐ"Ø˜+Ñ%Ü.ØIØ"ôð ð *5×):Ñ):¸3ÀÓ)BÑ&ˆN˜JØˆ~à(¨*Ð5‘ð "¨Ñ/Ü2Ø$ ^Ð$6ð 79ð :à (ôð ð
 ˜.Ñ)¨ZÒ7Ü2Ø$ ^Ð$6ð 7>ð ?à &ôð ñ
 ˜&Ô!Ð!r   )ry   rx   r#   rd   r!   )r$   r%   r&   ry   rf   r`   r'   r    r   r   r   r   r   ®   s?   … à'+€FÐ$Ó+ð
 ,0ñ3ð )ð3ð 
ó	3ð ò"ó ñ"r   r   c                  óB   — e Zd ZU dZded<   ddœ	 	 	 dd„Zedd„«       Zy)	r   Núbool | NoneÚeditable©rŠ   c               ó2   — t         j                  | d|«       y )NrŠ   rs   )r^   rŠ   s     r   r`   zDirInfo.__init__à   s   € ô
 	×Ñ˜4 ¨XÕ6r   c                ó2   —  | t        |t        d«      ¬«      S )NrŠ   r‹   )r8   Úboolr   s     r   r    zDirInfo._from_dictç   s   € áÜ˜!œT :Ó.ô
ð 	
r   )rŠ   r‰   r#   rd   r!   )r$   r%   r&   rŠ   rf   r`   r'   r    r   r   r   r   r   Ü   s>   … à €HˆkÓ ð
 !%ñ7ð ð7ð 
ó	7ð ò
ó ñ
r   r   c                  óÊ   — e Zd ZU dZded<   dZded<   dZded<   dZd	ed
<   dZded<   dddddœ	 	 	 	 	 	 	 	 	 	 	 dd„Z	e
dd„«       Ze
dd„«       Zddddœ	 	 	 	 	 	 	 dd„Zdd„Zy)r   z"A class representing a direct URL.rZ   rU   NúArchiveInfo | NoneÚarchive_infoúVcsInfo | NoneÚvcs_infoúDirInfo | NoneÚdir_inforY   Úsubdirectory)r‘   r“   r•   r–   c               óê   — t         j                  | d|«       t         j                  | d|«       t         j                  | d|«       t         j                  | d|«       t         j                  | d|«       y )NrU   r‘   r“   r•   r–   rs   )r^   rU   r‘   r“   r•   r–   s         r   r`   zDirectUrl.__init__ø   s^   € ô 	×Ñ˜4 ¨Ô,Ü×Ñ˜4 °Ô>Ü×Ñ˜4 ¨XÔ6Ü×Ñ˜4 ¨XÔ6Ü×Ñ˜4 °Õ>r   c                ó¼  —  | t        |t        d«      t        |t        d«      t        |t        d«      t        |t
        d«      t        |t        d«      ¬«      }t        |j                  «      t        |j                  «      z   t        |j                  «      z   dk7  rt        d«      ‚|j                  �(|j                  j                  d	«      st        d
d¬«      ‚|S )NrU   r‘   r“   r•   r–   )rU   r‘   r“   r•   r–   rC   z?Exactly one of vcs_info, archive_info, dir_info must be presentzfile://z3URL scheme must be file:// when dir_info is presentr1   )r;   rZ   r@   r   r   r   r8   rŽ   r“   r‘   r•   r   rU   Ú
startswith)r   r   Ú
direct_urls      r   r    zDirectUrl._from_dict  sÔ   € áÜ˜a¤ eÓ,Ü$ Q¬°^ÓDÜ  ¤G¨ZÓ8Ü  ¤G¨ZÓ8Ü˜a¤ nÓ5ô
ˆ
ô �×$Ñ$Ó%Ü�:×*Ñ*Ó+ñ,ä�:×&Ñ&Ó'ñ(ð ò	ô
 +ØQóð ð ×ÑÐ*°:·>±>×3LÑ3LÈYÔ3WÜ*ØEØôð ð
 Ðr   c               ó$   — | j                  |«      S )z@Create and validate a DirectUrl instance from a JSON dictionary.)r    r   s     r   Ú	from_dictzDirectUrl.from_dict   s   € ð �~‰~˜aÓ Ð r   FT)Úgit)Úgenerate_legacy_hashÚstrip_user_passwordrH   c               óF  — t        j                  | t        ¬«      }|rh| j                  r\| j                  j                  rFt        t        | j                  j                  j                  «       «      «      \  }}|› d|› �|d   d<   |rt        | j                  |«      |d<   |S )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�   rU   )
ÚdataclassesÚasdictr.   r‘   ry   ÚnextÚiterÚitemsrW   rU   )r^   rž   rŸ   rH   Úresr†   r‡   s          r   Úto_dictzDirectUrl.to_dict%  s‘   € ô& × Ñ  Ô4FÔGˆÙ D×$5Ò$5¸$×:KÑ:K×:RÒ:RÜ)-¬d°4×3DÑ3D×3KÑ3K×3QÑ3QÓ3SÓ.TÓ)UÑ&ˆN˜JØ-;Ð,<¸A¸j¸\Ð*JˆC�Ñ Ñ'ÙÜ# D§H¡HÐ.AÓBˆC�‰JØˆ
r   c                óB   — | j                  | j                  «       «       y)z�Validate the DirectUrl instance against the specification.

        Raises :class:`DirectUrlValidationError` if invalid.
        N)rœ   r¨   rb   s    r   ÚvalidatezDirectUrl.validate@  s   € ð
 	�‰�t—|‘|“~Õ&r   )rU   rZ   r‘   r�   r“   r’   r•   r”   r–   rY   r#   rd   r!   )rž   rŽ   rŸ   rŽ   rH   úCollection[str]r#   r"   )r#   rd   )r$   r%   r&   re   rf   r‘   r“   r•   r–   r`   r'   r    rœ   r¨   rª   r   r   r   r   r   î   sç   … á,à	ƒHØ'+€LÐ$Ó+Ø#€HˆnÓ#Ø#€HˆnÓ#Ø#€L�*Ó#ð ,0Ø#'Ø#'Ø#'ñ?ð ð?ð )ð	?ð
 !ð?ð !ð?ð !ð?ð 
ó?ð òó ðð0 ò!ó ð!ð &+Ø$(Ø/7ñð #ðð "ð	ð
 -ðð 
óô6'r   r   )r#   z	list[str])r+   zlist[tuple[str, Any]]r#   zdict[str, Any])r   r"   r7   útype[_T]r,   rZ   r#   z	_T | None)r   r"   r7   r¬   r,   rZ   r#   r   )r   r"   r>   ztype[_FromMappingProtocolT]r,   rZ   r#   z_FromMappingProtocolT | None)rG   rZ   rH   r«   r#   rZ   )rU   rZ   rH   r«   r#   rZ   )'Ú
__future__r   r¢   ÚreÚurllib.parserM   Úcollections.abcr   Útypingr   r   r   r   Úsysr	   Úversion_infor   Útyping_extensionsr   r   r   r   r(   r.   r8   r;   r@   ÚcompilerE   rK   rW   r=   r   r:   Ú	dataclassr   r   r   r   r   r   r   ú<module>r·      s  ðÝ "ã Û 	Û Ý #ß 8Ó 8áÛÝ*à
×Ñ˜7Ò"Þå*ò€óñ ˆTƒ]€ô;˜8ô ;ñ
  Ð 7Ð?SÔTÐ óDó
óð	>Øð	>Ø'Bð	>ØILð	>à!ó	>ð $. 2§:¡:Ø5ó$Ð  ó
óô$˜yô ô<@Ð!9ô @ð
 €×Ñ˜d¨Ô/÷
ð 
ó 0ð
ð4 €×Ñ˜d¨Ô/÷*"ð *"ó 0ð*"ðZ €×Ñ˜d¨Ô/÷
ð 
ó 0ð
ð" €×Ñ˜d¨Ô/÷V'ð V'ó 0ñV'r   