U ja@sddlZddlZddlZddlmZddlmZddlmZddl m Z m Z ddl m Z mZddlmZmZeeZGdd d eZeeed d d ZdS) N)Values)List)Command)ERRORSUCCESS) FAVORITE_HASH STRONG_HASHES) read_chunks write_outputc@s<eZdZdZdZdZddddZeee e dd d 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] ...TN)returnc Cs:|jjdddtdtddtd|jd|jdS) Nz-az --algorithm algorithmstorez$The hash algorithm to use: one of {}z, )destchoicesactiondefaulthelpr)cmd_opts add_optionrrformatjoinparserinsert_option_group)selfrs/private/var/folders/k6/_7fsz4ts3b78x3b3xwrxjh_c8s8xv7/T/pip-unpacked-wheel-bug3gbve/pip/_internal/commands/hash.py add_optionsszHashCommand.add_options)optionsargsr cCs>|s|jtjtS|j}|D]}td||t||q tS)Nz%s: --hash=%s:%s) r print_usagesysstderrrr r _hash_of_filer)rrrr pathrrrrun%szHashCommand.run) __name__ __module__ __qualname____doc__usageignore_require_venvrrrstrintr%rrrrr s  r )r$r r c Cs@t|d(}t|}t|D]}||qW5QRX|S)z!Return the hash digest of a file.rb)openhashlibnewr update hexdigest)r$r archivehashchunkrrrr#1s    r#)r0loggingr!optparsertypingrpip._internal.cli.base_commandrpip._internal.cli.status_codesrrpip._internal.utils.hashesrrpip._internal.utils.miscr r getLoggerr&loggerr r,r#rrrrs    "