� ��^i�����ddlZddlZddlZddlmZddlmZddlmZddl m Z m Z ddl m Z mZddlmZmZeje��ZGd�d e��Zd ed ed efd �ZdS)�N)�Values)�List)�Command)�ERROR�SUCCESS)� FAVORITE_HASH� STRONG_HASHES)� read_chunks� write_outputc�B�eZdZdZdZdZd d�Zdedee de fd �Z dS) � 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] ...T�returnNc ���|j�dddtdtd�d�t�������|j�d|j��dS) 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 ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/commands/hash.py� add_optionszHashCommand.add_optionssw�� � � � � � ��!��!�7�>�>�� � �-�(�(��� !� � � � � �'�'��4�=�9�9�9�9�9��options�argsc ���|s+|j�tj��tS|j}|D]"}t d||t||�����#tS)Nz%s: --hash=%s:%s) r� print_usage�sys�stderrrrr � _hash_of_filer)rr!r"r�paths r�runzHashCommand.run(so��� � �K� #� #�C�J� /� /� /��L��%� �� � �D� �#�T�9�m�D�)�6T�6T� � � � ��r )rN) �__name__� __module__� __qualname__�__doc__�usage�ignore_require_venvrrr�str�intr)�r rr r sl�������� )�E��� :� :� :� :� �6� ��c�� �s� � � � � � r r r(rrc���t|d��5}tj|��}t|��D]}|�|��� ddd��n #1swxYwY|���S)z!Return the hash digest of a file.�rbN)�open�hashlib�newr �update� hexdigest)r(r�archive�hash�chunks rr'r'5s��� �d�D� � ��W��{�9�%�%�� ��)�)� � �E� �K�K�� � � � � ������������������� �>�>� � �s�rFs���������� � � � �������������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