U .e@sddlmZddlZddlZddlZddlmZddlmZddl m Z m Z ddl m Z mZeeZGdddeZd d ZdS) )absolute_importN)Command)ERROR) FAVORITE_HASH STRONG_HASHES) read_chunks write_outputcs0eZdZdZdZdZfddZddZZS) 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] ...Tc sJtt|j|||jjdddtdtddtd|j d|jdS) Nz-az --algorithm algorithmZstorez$The hash algorithm to use: one of %sz, )destchoicesactiondefaulthelpr) superr __init__Zcmd_optsZ add_optionrrjoinparserZinsert_option_group)selfargskw __class__?/usr/lib/python3.8/site-packages/pip/_internal/commands/hash.pyrszHashCommand.__init__cCs>|s|jtjtS|j}|D]}td||t||q dS)Nz%s: --hash=%s:%s)rZ print_usagesysstderrrr r _hash_of_file)rZoptionsrr pathrrrrun)szHashCommand.run) __name__ __module__ __qualname____doc__ZusageZignore_require_venvrr __classcell__rrrrr s  r c Cs@t|d(}t|}t|D]}||qW5QRX|S)z!Return the hash digest of a file.rb)openhashlibnewrupdateZ hexdigest)rr archivehashchunkrrrr4s    r)Z __future__rr'ZloggingrZpip._internal.cli.base_commandrZpip._internal.cli.status_codesrZpip._internal.utils.hashesrrZpip._internal.utils.miscrrZ getLoggerr Zloggerr rrrrrs    "