
    q"h                         S SK r S SKrS SKrS SKJr  S SKJr  S SKJr  S SK	J
r
Jr  S SKJrJr  S SKJrJr  \R$                  " \5      r " S S	\5      rS
\S\S\4S jrg)    N)Values)List)Command)ERRORSUCCESS)FAVORITE_HASHSTRONG_HASHES)read_chunkswrite_outputc                   F    \ rS rSrSrSrSrSS jrS\S	\	\
   S\4S
 jrSrg)HashCommand   z}
Compute a hash of a local package archive.

These can be used with --hash in a requirements file to do repeatable
installs.
z%prog [options] <file> ...TreturnNc                     U R                   R                  SSS[        S[        SR	                  SR                  [        5      5      S9  U R                  R                  SU R                   5        g )	Nz-az--algorithm	algorithmstorez$The hash algorithm to use: one of {}z, )destchoicesactiondefaulthelpr   )cmd_opts
add_optionr	   r   formatjoinparserinsert_option_group)selfs    M/var/www/html/env/lib/python3.13/site-packages/pip/_internal/commands/hash.pyadd_optionsHashCommand.add_options   s_      !!7>>		-( 	! 
	
 	''4==9    optionsargsc           
          U(       d/  U R                   R                  [        R                  5        [        $ UR
                  nU H  n[        SXC[        XC5      5        M     [        $ )Nz%s:
--hash=%s:%s)	r   print_usagesysstderrr   r   r   _hash_of_filer   )r   r#   r$   r   paths        r   runHashCommand.run(   sP    KK##CJJ/L%%	D#TmD6T  r"    )r   N)__name__
__module____qualname____firstlineno____doc__usageignore_require_venvr    r   r   strintr+   __static_attributes__r-   r"   r   r   r      s7     )E:
6 
c 
s 
r"   r   r*   r   r   c                     [        U S5       n[        R                  " U5      n[        U5       H  nUR	                  U5        M     SSS5        UR                  5       $ ! , (       d  f       WR                  5       $ = f)z!Return the hash digest of a file.rbN)openhashlibnewr
   update	hexdigest)r*   r   archivehashchunks        r   r)   r)   5   sc    	dD	W{{9% )EKK * 
 >>	 
	 >>s   :A
A<)r;   loggingr'   optparser   typingr   pip._internal.cli.base_commandr   pip._internal.cli.status_codesr   r   pip._internal.utils.hashesr   r	   pip._internal.utils.miscr
   r   	getLoggerr.   loggerr   r5   r)   r-   r"   r   <module>rK      sW      
   2 9 C >			8	$#' #L   r"   