U .e(@sdZddlmZddlmZmZmZddlmZddl m Z e rdddl m Z ddl mZddlmZGd d d eZGd d d eZGd ddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdd d eZGd!d"d"eZGd#d$d$eZGd%d&d&eZ Gd'd(d(e Z!Gd)d*d*e Z"Gd+d,d,e Z#Gd-d.d.e Z$Gd/d0d0e Z%Gd1d2d2eZ&Gd3d4d4eZ'd5S)6z"Exceptions used throughout package)absolute_import)chaingroupbyrepeat) iteritems)MYPY_CHECK_RUNNING)Optional) Distribution)InstallRequirementc@seZdZdZdS)PipErrorzBase pip exceptionN__name__ __module__ __qualname____doc__rrnz$HashErrors.__str__..)keycSs|jSr' __class__r,rrrr.or/css|]}|VqdSr')body.0r-rrr qsz%HashErrors.__str__.. )r(sortrr)headextendjoin)rlinesclsZ errors_of_clsrrrrls zHashErrors.__str__cCs t|jSr')boolr(rrrr __nonzero__uszHashErrors.__nonzero__cCs|Sr')r?rrrr__bool__xszHashErrors.__bool__N) r rrrrr)rr?r@rrrrr&cs  r&c@s0eZdZdZdZdZddZddZdd ZdS) HashErrora A failure to verify a package against known-good hashes :cvar order: An int sorting hash exception classes by difficulty of recovery (lower being harder), so the user doesn't bother fretting about unpinned packages when he has deeper issues, like VCS dependencies, to deal with. Also keeps error reports in a deterministic order. :cvar head: A section heading for display above potentially many exceptions of this kind :ivar req: The InstallRequirement that triggered this error. This is pasted on after the exception is instantiated, because it's not typically available earlier. NcCs d|S)a)Return a summary of me for display under the heading. This default implementation simply prints a description of the triggering requirement. :param req: The InstallRequirement that provoked this error, with populate_link() having already been called z %s)_requirement_namerrrrr3s zHashError.bodycCsd|j|fS)Nz%s %s)r9r3rrrrrszHashError.__str__cCs|jrt|jSdS)zReturn a description of the requirement that triggered me. This default implementation returns long description of the req, with line numbers unknown package)reqstrrrrrrCszHashError._requirement_name) r rrrrEr9r3rrCrrrrrA|s  rAc@seZdZdZdZdZdS)VcsHashUnsupporteduA hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.rzlCan't verify hashes for these requirements because we don't have a way to hash version control repositories:Nr rrrr+r9rrrrrGsrGc@seZdZdZdZdZdS)DirectoryUrlHashUnsupportedrHzUCan't verify hashes for these file:// requirements because they point to directories:NrIrrrrrJsrJc@s(eZdZdZdZdZddZddZdS) HashMissingz2A hash was needed for a requirement but is absent.awHashes are required in --require-hashes mode, but they are missing from some requirements. Here is a list of those requirements along with the hashes their downloaded archives actually had. Add lines like these to your requirements files to prevent tampering. (If you did not enable --require-hashes manually, note that it turns on automatically when any package has a hash.)cCs ||_dS)zq :param gotten_hash: The hash of the (possibly malicious) archive we just downloaded N) gotten_hash)rrNrrrrszHashMissing.__init__cCsHddlm}d}|jr4|jjr&|jjn t|jdd}d|p.hash_then_orc3s|]}dt|fVqdS)z Expected %s %sN)nextr4prefixrrr6sz0HashMismatch._hash_comparison..z Got %s r7)rrVr:r)rWZ hexdigestr;)rrZr<rYZ expectedsrr\rrXs  zHashMismatch._hash_comparisonN) r rrrr+r9rr3rXrrrrrTs  rTc@seZdZdZdS)UnsupportedPythonVersionzMUnsupported python version according to Requires-Python package metadata.Nr rrrrr^sr^cs*eZdZdZdfdd ZddZZS) !ConfigurationFileCouldNotBeLoadedz=When there are errors while loading a configuration file could not be loadedNcs&tt||||_||_||_dSr')superr_rreasonfnamer*)rrbrcr*r1rrr(sz*ConfigurationFileCouldNotBeLoaded.__init__cCs4|jdk rd|j}nd|jj}d|j|S)Nz in {}.z. {} zConfiguration file {}{})rcrr*messagerb)rZ message_partrrrr.s z)ConfigurationFileCouldNotBeLoaded.__str__)r`NN)r rrrrr __classcell__rrr1rr_$sr_N)(rZ __future__r itertoolsrrrZpip._vendor.sixrZpip._internal.utils.typingrtypingrZpip._vendor.pkg_resourcesr Zpip._internal.req.req_installr Exceptionr rrrrrrr r!r"r#r$r%r&rArGrJrLrRrTr^r_rrrrs<      ,  % 7