
    e                         d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
mZ d dlmZmZ d dlmZmZ  ej        e          Z G d d	e          Zd
ededefdZdS )    N)Values)List)Command)ERRORSUCCESS)FAVORITE_HASHSTRONG_HASHES)read_chunkswrite_outputc                   B    e Zd ZdZdZdZd
dZdedee	         de
fd	ZdS )HashCommandz
    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                     | j                             dddt          dt          d                    d                    t                                         | j                            d| j                    d S )	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    R/var/www/html/api/venv/lib/python3.11/site-packages/pip/_internal/commands/hash.pyadd_optionszHashCommand.add_options   sw      !!7>>		-((  	! 
	
 
	
 
	
 	''4=99999    optionsargsc           
          |s+| j                             t          j                   t          S |j        }|D ]"}t          d||t          ||                     #t          S )Nz%s:
--hash=%s:%s)	r   print_usagesysstderrr   r   r   _hash_of_filer   )r   r!   r"   r   paths        r   runzHashCommand.run(   so     	K##CJ///L%	 	 	D#T9mD)6T6T    r    )r   N)__name__
__module____qualname____doc__usageignore_require_venvr   r   r   strintr)    r    r   r   r      sl          )E: : : :
6 
c 
s 
 
 
 
 
 
r    r   r(   r   r   c                     t          | d          5 }t          j        |          }t          |          D ]}|                    |           	 ddd           n# 1 swxY w Y   |                                S )z!Return the hash digest of a file.rbN)openhashlibnewr
   update	hexdigest)r(   r   archivehashchunks        r   r'   r'   5   s    	dD		 W{9%% )) 	 	EKK	               >>s   <AA!A)r6   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   r0   r'   r2   r    r   <module>rF      s     



             2 2 2 2 2 2 9 9 9 9 9 9 9 9 C C C C C C C C > > > > > > > >		8	$	$# # # # #' # # #L        r    