o Ec@sddlZddlZddlZddlmZddlmZddlmZddl m Z m Z ddl m Z mZddlmZmZeeZGdd d eZd ed ed efd dZdS)N)Values)List)Command)ERRORSUCCESS) FAVORITE_HASH STRONG_HASHES) read_chunks write_outputc@s<eZdZdZdZdZd ddZded ee de fd 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] ...TreturnNc Cs:|jjdddtdtddtd|jd|jdS) Nz-az --algorithm algorithmZstorez$The hash algorithm to use: one of {}z, )destchoicesactiondefaulthelpr)Zcmd_optsZ add_optionrrformatjoinparserZinsert_option_group)selfrN/opt/alt/python310/lib/python3.10/site-packages/pip/_internal/commands/hash.py add_optionss zHashCommand.add_optionsoptionsargscCs>|s |jtjtS|j}|D] }td||t||qtS)Nz%s: --hash=%s:%s) rZ print_usagesysstderrrr r _hash_of_filer)rrrr pathrrrrun(szHashCommand.run)r N) __name__ __module__ __qualname____doc__ZusageZignore_require_venvrrrstrintr rrrrr s  r rr r cCsZt|d}t|}t|D]}||qWd|S1s$wY|S)z!Return the hash digest of a file.rbN)openhashlibnewr updateZ hexdigest)rr archivehashchunkrrrr5s     r)r)ZloggingrZoptparsertypingrZpip._internal.cli.base_commandrZpip._internal.cli.status_codesrrZpip._internal.utils.hashesrrZpip._internal.utils.miscr r Z getLoggerr!Zloggerr r%rrrrrs    &