§
    u”j°  ã                  ó¸   — d dl mZ d dlZd dlmZ d dlmZmZmZ d dl	m
Z
mZmZ d dlmZ erd dlmZ d dlmZ d	Zg d
¢Z G d„ d¦  «        Z G d„ de¦  «        ZdS )é    )ÚannotationsN)ÚIterable)ÚTYPE_CHECKINGÚBinaryIOÚNoReturn)ÚHashMismatchÚHashMissingÚInstallationError)Úread_chunks)ÚMapping)Ú_HashÚsha256)r   Úsha384Úsha512c                  ó„   — e Zd ZdZd#d$d„Zd%d	„Zed&d„¦   «         Zd'd„Zd(d„Z	d)d„Z
d*d„Zd+d„Zd,d„Zd-d„Zd.d!„Zd&d"„ZdS )/ÚHasheszaA wrapper that builds multiple hashes at once and checks them against
    known-good values

    NÚhashesúdict[str, list[str]] | NoneÚreturnÚNonec                óˆ   — i }|�6|                      ¦   «         D ]!\  }}d„ t          |¦  «        D ¦   «         ||<   Œ"|| _        dS )zo
        :param hashes: A dict of algorithm names pointing to lists of allowed
            hex digests
        Nc                ó6   — g | ]}|                      ¦   «         ‘ŒS © )Úlower)Ú.0Úks     úi/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/pip/_internal/utils/hashes.pyú
<listcomp>z#Hashes.__init__.<locals>.<listcomp>'   s    € Ð@Ð@Ð@¨a §¢¡	¤	Ð@Ð@Ð@ó    )ÚitemsÚsortedÚ_allowed)Úselfr   ÚallowedÚalgÚkeyss        r   Ú__init__zHashes.__init__   sV   € ð
 ˆØÐØ#Ÿ\š\™^œ^ð Að A‘	��Tà@Ð@µ6¸$±<´<Ð@Ñ@Ô@�˜‘�ØˆŒˆˆr   Úotherc                óæ   ‡ ‡— t          |t          ¦  «        st          S |s‰ S ‰ s|S i }|j                             ¦   «         D ]!\  Š}‰‰ j        vrŒˆˆ fd„|D ¦   «         |‰<   Œ"t          |¦  «        S )Nc                ó2   •— g | ]}|‰j         ‰         v ¯|‘ŒS r   )r"   )r   Úvr%   r#   s     €€r   r   z"Hashes.__and__.<locals>.<listcomp>:   s*   ø€ ÐEÐEÐE˜a¨Q°$´-ÀÔ2DÐ-DÐ-D˜Ð-DÐ-DÐ-Dr   )Ú
isinstancer   ÚNotImplementedr"   r    )r#   r(   ÚnewÚvaluesr%   s   `   @r   Ú__and__zHashes.__and__*   s    øø€ Ý˜%¥Ñ(Ô(ð 	"Ý!Ð!ð ð 	ØˆKØð 	ØˆLð ˆØ œ>×/Ò/Ñ1Ô1ð 	Fð 	F‰KˆC�Ø˜$œ-Ð'Ð'ØØEÐEÐEÐEÐE 6ÐEÑEÔEˆC�‰HˆHÝ�c‰{Œ{Ðr   Úintc                ób   — t          d„ | j                             ¦   «         D ¦   «         ¦  «        S )Nc              3  ó4   K  — | ]}t          |¦  «        V — Œd S ©N)Úlen)r   Údigestss     r   ú	<genexpr>z&Hashes.digest_count.<locals>.<genexpr>?   s(   è è € ÐFÐF G•3�w‘<”<ÐFÐFÐFÐFÐFÐFr   )Úsumr"   r/   ©r#   s    r   Údigest_countzHashes.digest_count=   s-   € åÐFÐF¨t¬}×/CÒ/CÑ/EÔ/EÐFÑFÔFÑFÔFÐFr   Ú	hash_nameÚstrÚ
hex_digestÚboolc                ó<   — || j                              |g ¦  «        v S )z/Return whether the given hex digest is allowed.)r"   Úget)r#   r;   r=   s      r   Úis_hash_allowedzHashes.is_hash_allowedA   s   € à˜Tœ]×.Ò.¨y¸"Ñ=Ô=Ð=Ð=r   ÚchunksúIterable[bytes]c                óÈ  — i }| j                              ¦   «         D ]A}	 t          j        |¦  «        ||<   Œ# t          t
          f$ r t          d|› �¦  «        ‚w xY w|D ].}|                     ¦   «         D ]}|                     |¦  «         ŒŒ/| 	                    ¦   «         D ])\  }}| 
                    ¦   «         | j         |         v r dS Œ*|                      |¦  «         dS )z‚Check good hashes against ones built from iterable of chunks of
        data.

        Raise HashMismatch if none match.

        zUnknown hash name: N)r"   r&   Úhashlibr.   Ú
ValueErrorÚ	TypeErrorr
   r/   Úupdater    Ú	hexdigestÚ_raise)r#   rB   Úgotsr;   ÚchunkÚhashÚgots          r   Úcheck_against_chunkszHashes.check_against_chunksE   s  € ð ˆØœ×+Ò+Ñ-Ô-ð 	Kð 	KˆIðKÝ")¤+¨iÑ"8Ô"8��Y‘�øÝ¥	Ð*ð Kð Kð KÝ'Ð(I¸iÐ(IÐ(IÑJÔJÐJðKøøøð ð 	#ð 	#ˆEØŸš™œð #ð #�Ø—’˜EÑ"Ô"Ð"Ð"ð#ð #Ÿjšj™lœlð 	ð 	‰NˆI�sØ�}Š}‰Œ $¤-°	Ô":Ð:Ð:Ø��ð ;à�Š�DÑÔÐÐÐs	   Ÿ7·$ArK   údict[str, _Hash]r   c                ó,   — t          | j        |¦  «        ‚r4   )r   r"   ©r#   rK   s     r   rJ   zHashes._raise\   s   € Ý˜4œ=¨$Ñ/Ô/Ð/r   Úfiler   c                óF   — |                       t          |¦  «        ¦  «        S )zaCheck good hashes against a file-like object

        Raise HashMismatch if none match.

        )rO   r   )r#   rS   s     r   Úcheck_against_filezHashes.check_against_file_   s    € ð ×(Ò(­°TÑ):Ô):Ñ;Ô;Ð;r   Úpathc                ó€   — t          |d¦  «        5 }|                      |¦  «        cd d d ¦  «         S # 1 swxY w Y   d S )NÚrb)ÚopenrU   )r#   rV   rS   s      r   Úcheck_against_pathzHashes.check_against_pathg   s„   € Ý�$˜ÑÔð 	1 Ø×*Ò*¨4Ñ0Ô0ð	1ð 	1ð 	1ð 	1ñ 	1ô 	1ð 	1ð 	1ð 	1ð 	1ð 	1ð 	1øøøð 	1ð 	1ð 	1ð 	1ð 	1ð 	1s   ‘3³7º7úMapping[str, str]c                ól   — |                      ¦   «         D ]\  }}|                      ||¦  «        r dS ŒdS )z3Return whether any of the given hashes are allowed.TF)r    rA   )r#   r   r;   r=   s       r   Ú
has_one_ofzHashes.has_one_ofk   sG   € à%+§\¢\¡^¤^ð 	ð 	Ñ!ˆI�zØ×#Ò# I¨zÑ:Ô:ð Ø�t�tðàˆur   c                ó*   — t          | j        ¦  «        S )z,Return whether I know any known-good hashes.)r>   r"   r9   s    r   Ú__bool__zHashes.__bool__r   s   € å�D”MÑ"Ô"Ð"r   Úobjectc                óZ   — t          |t          ¦  «        st          S | j        |j        k    S r4   )r,   r   r-   r"   )r#   r(   s     r   Ú__eq__zHashes.__eq__v   s)   € Ý˜%¥Ñ(Ô(ð 	"Ý!Ð!ØŒ} ¤Ò.Ð.r   c           	     ó¢   — t          d                     t          d„ | j                             ¦   «         D ¦   «         ¦  «        ¦  «        ¦  «        S )Nú,c              3  óT   K  — | ]#\  }}|D ]}d                       ||f¦  «        V — ŒŒ$dS )ú:N)Újoin)r   r%   Údigest_listÚdigests       r   r7   z"Hashes.__hash__.<locals>.<genexpr>~   sa   è è € ð ð á(˜˜[Ø"-ðð ð ð —H’H˜c 6˜]Ñ+Ô+ðð ð ð ð ð ð r   )rM   rg   r!   r"   r    r9   s    r   Ú__hash__zHashes.__hash__{   s\   € ÝØ�HŠHÝð ð à,0¬M×,?Ò,?Ñ,AÔ,Aðñ ô ñ ô ñô ñ
ô 
ð 	
r   r4   )r   r   r   r   )r(   r   r   r   )r   r1   )r;   r<   r=   r<   r   r>   )rB   rC   r   r   ©rK   rP   r   r   )rS   r   r   r   )rV   r<   r   r   )r   r[   r   r>   )r   r>   )r(   r`   r   r>   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r'   r0   Úpropertyr:   rA   rO   rJ   rU   rZ   r]   r_   rb   rj   r   r   r   r   r      s#  € € € € € ðð ð

 ð 
 ð 
 ð 
 ð 
 ðð ð ð ð& ðGð Gð Gñ „XðGð>ð >ð >ð >ðð ð ð ð.0ð 0ð 0ð 0ð<ð <ð <ð <ð1ð 1ð 1ð 1ðð ð ð ð#ð #ð #ð #ð/ð /ð /ð /ð
	
ð 	
ð 	
ð 	
ð 	
ð 	
r   r   c                  ó,   ‡ — e Zd ZdZd	ˆ fd„Zd
d„Zˆ xZS )ÚMissingHasheszÀA workalike for Hashes used when we're missing a hash for a requirement

    It computes the actual hash of the requirement and raises a HashMissing
    exception showing it to the user.

    r   r   c                óZ   •— t          ¦   «                              t          g i¬¦  «         dS )z!Don't offer the ``hashes`` kwarg.)r   N)Úsuperr'   ÚFAVORITE_HASH)r#   Ú	__class__s    €r   r'   zMissingHashes.__init__�   s+   ø€ õ 	‰Œ×Ò¥°Ð 3ÐÑ4Ô4Ð4Ð4Ð4r   rK   rP   r   c                óZ   — t          |t                                        ¦   «         ¦  «        ‚r4   )r	   ru   rI   rR   s     r   rJ   zMissingHashes._raise•   s!   € Ý˜$�}Ô-×7Ò7Ñ9Ô9Ñ:Ô:Ð:r   )r   r   rk   )rl   rm   rn   ro   r'   rJ   Ú__classcell__)rv   s   @r   rr   rr   ‡   s[   ø€ € € € € ðð ð5ð 5ð 5ð 5ð 5ð 5ð;ð ;ð ;ð ;ð ;ð ;ð ;ð ;r   rr   )Ú
__future__r   rE   Úcollections.abcr   Útypingr   r   r   Úpip._internal.exceptionsr   r	   r
   Úpip._internal.utils.miscr   r   r   ru   ÚSTRONG_HASHESr   rr   r   r   r   ú<module>r      s%  ðØ "Ð "Ð "Ð "Ð "Ð "à €€€Ø $Ð $Ð $Ð $Ð $Ð $Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4à QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QØ 0Ð 0Ð 0Ð 0Ð 0Ð 0àð Ø'Ð'Ð'Ð'Ð'Ð'ØÐÐÐÐÐð €ð
 /Ð.Ð.€ðl
ð l
ð l
ð l
ð l
ñ l
ô l
ð l
ð^;ð ;ð ;ð ;ð ;�Fñ ;ô ;ð ;ð ;ð ;r   