3 )]b@sddZddlmZddlmZmZmZddlmZGddde Z Gddde Z Gd d d e Z Gd d d e Z Gd dde ZGddde ZGddde ZGddde ZGddde ZGddde ZGddde ZGddde ZGddde ZGdd d eZGd!d"d"eZGd#d$d$eZGd%d&d&eZGd'd(d(eZGd)d*d*e Zd+S),z"Exceptions used throughout package)absolute_import)chaingroupbyrepeat) iteritemsc@seZdZdZdS)PipErrorzBase pip exceptionN)__name__ __module__ __qualname____doc__r r /usr/lib/python3.6/exceptions.pyr src@seZdZdZdS)InstallationErrorz%General exception during installationN)rr r r r r r r r src@seZdZdZdS)UninstallationErrorz'General exception during uninstallationN)rr r r r r r r rsrc@seZdZdZdS)DistributionNotFoundzCRaised when a distribution cannot be found to satisfy a requirementN)rr r r r r r r rsrc@seZdZdZdS)RequirementsFileParseErrorzDRaised when a general error occurs parsing a requirements file line.N)rr r r r r r r rsrc@seZdZdZdS)BestVersionAlreadyInstalledzNRaised when the most up-to-date version of a package is already installed.N)rr r r r r r r rsrc@seZdZdZdS) BadCommandz0Raised when virtualenv or a command is not foundN)rr r r r r r r r"src@seZdZdZdS) CommandErrorz7Raised when there is an error in command-line argumentsN)rr r r r r r r r&src@seZdZdZdS)PreviousBuildDirErrorz:Raised when there's a previous conflicting build directoryN)rr r r r r r r r*src@seZdZdZdS)InvalidWheelFilenamezInvalid wheel filename.N)rr r r r r r r r.src@seZdZdZdS)UnsupportedWheelzUnsupported wheel.N)rr r r r r r r r2src@s8eZdZdZddZddZddZdd Zd d Zd S) HashErrorsz:Multiple HashError instances rolled into one for reportingcCs g|_dS)N)errors)selfr r r __init__9szHashErrors.__init__cCs|jj|dS)N)rappend)rerrorr r r r<szHashErrors.appendcCsfg}|jjdddxAsz$HashErrors.__str__..)keycSs|jS)N) __class__)rr r r r Bscss|]}|jVqdS)N)body).0rr r r Dsz%HashErrors.__str__.. )rsortrrheadextendjoin)rlinesclsZ errors_of_clsr r r __str__?s zHashErrors.__str__cCs t|jS)N)boolr)rr r r __nonzero__HszHashErrors.__nonzero__cCs|jS)N)r/)rr r r __bool__KszHashErrors.__bool__N) rr r r rrr-r/r0r r r r r6s  rc@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|jS)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_name)rr r r r#bs zHashError.bodycCsd|j|jfS)Nz%s %s)r(r#)rr r r r-nszHashError.__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 zunknown package)reqstr)rr r r r3qszHashError._requirement_name) rr r r r4r(r#r-r3r r r r r1Os  r1c@seZdZdZdZdZdS)VcsHashUnsupportedzuA 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:N)rr r r rr(r r r r r6{sr6c@seZdZdZdZdZdS)DirectoryUrlHashUnsupportedzuA hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.zUCan't verify hashes for these file:// requirements because they point to directories:N)rr r r rr(r r r r r7sr7c@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)rr;r r r rszHashMissing.__init__cCsHddlm}d}|jr4|jjr&|jjn t|jdd}d|p.hash_then_orc3s|]}dt|fVqdS)z Expected %s %sN)next)r$r)prefixr r r%sz0HashMismatch._hash_comparison..z Got %s z orr&)rrCr)rrDZ hexdigestr*)rrGr+rFZ expectedsr )rIr rEs  zHashMismatch._hash_comparisonN) rr r r rr(rr#rEr r r r rAs  rAc@seZdZdZdS)UnsupportedPythonVersionzMUnsupported python version according to Requires-Python package metadata.N)rr r r r r r r rJsrJN)r Z __future__r itertoolsrrrZpip._vendor.sixr Exceptionrrrrrrrrrrrrr1r6r7r9r?rArJr r r r s,  ,  $ 8