o Ec1@s4dZddlZddlmZmZmZddlmZmZm Z m Z m Z ddl m Z ddlmZmZer@ddlmZddlmZdd lmZGd d d eZGd d d eZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZ GdddeZ!GdddeZ"Gd d!d!eZ#Gd"d#d#eZ$Gd$d%d%eZ%Gd&d'd'eZ&Gd(d)d)eZ'Gd*d+d+eZ(Gd,d-d-eZ)Gd.d/d/eZ*Gd0d1d1eZ+Gd2d3d3e+Z,Gd4d5d5e+Z-Gd6d7d7e+Z.Gd8d9d9e+Z/Gd:d;d;e+Z0Gdd?d?eZ2dS)@z"Exceptions used throughout packageN)chaingroupbyrepeat) TYPE_CHECKINGDictListOptionalUnion) Distribution)RequestResponse)_Hash)BaseDistribution)InstallRequirementc@eZdZdZdS)PipErrorzBase pip exceptionN__name__ __module__ __qualname____doc__rrK/opt/alt/python310/lib/python3.10/site-packages/pip/_internal/exceptions.pyrrc@r)ConfigurationErrorz"General exception in configurationNrrrrrrrrc@r)InstallationErrorz%General exception during installationNrrrrrrrrc@r)UninstallationErrorz'General exception during uninstallationNrrrrrrrrc@s<eZdZdZdeedfdeddfddZdefd d ZdS) NoneMetadataErrora Raised when accessing "METADATA" or "PKG-INFO" metadata for a pip._vendor.pkg_resources.Distribution object and `dist.has_metadata('METADATA')` returns True but `dist.get_metadata('METADATA')` returns None (and similarly for "PKG-INFO"). distr metadata_namereturnNcC||_||_dS)z :param dist: A Distribution object. :param metadata_name: The name of the metadata being accessed (can be "METADATA" or "PKG-INFO"). N)rr)selfrrrrr__init__*s zNoneMetadataError.__init__cCd|j|jS)Nz+None {} metadata found for distribution: {})formatrrr"rrr__str__7szNoneMetadataError.__str__) rrrrr r strr#r'rrrrr!s   rc@seZdZdZdefddZdS)UserInstallationInvalidzBA --user install is requested on an environment without user site.r cCsdS)Nz$User base directory is not specifiedrr&rrrr'CszUserInstallationInvalid.__str__N)rrrrr(r'rrrrr)@sr)c@seZdZdefddZdS)InvalidSchemeCombinationr cCs6ddd|jddD}d|d|jddS)Nz, css|]}t|VqdSN)r().0arrr Iz3InvalidSchemeCombination.__str__..z Cannot set z and z together)joinargs)r"Zbeforerrrr'Hsz InvalidSchemeCombination.__str__N)rrrr(r'rrrrr*Gsr*c@r)DistributionNotFoundzCRaised when a distribution cannot be found to satisfy a requirementNrrrrrr3Mrr3c@r)RequirementsFileParseErrorzDRaised when a general error occurs parsing a requirements file line.Nrrrrrr4Qrr4c@r)BestVersionAlreadyInstalledzNRaised when the most up-to-date version of a package is already installed.Nrrrrrr5Urr5c@r) BadCommandz0Raised when virtualenv or a command is not foundNrrrrrr6Zrr6c@r) CommandErrorz7Raised when there is an error in command-line argumentsNrrrrrr7^rr7c@r)PreviousBuildDirErrorz:Raised when there's a previous conflicting build directoryNrrrrrr8brr8c sDeZdZdZ d dedededdffdd Zdefd d ZZ S) NetworkConnectionErrorzHTTP connection errorN error_msgresponserequestr csJ||_||_||_|jdur|jst|dr|jj|_t|||dS)zc Initialize NetworkConnectionError with `request` and `response` objects. Nr<)r;r<r:hasattrsuperr#)r"r:r;r< __class__rrr#is zNetworkConnectionError.__init__cC t|jSr+)r(r:r&rrrr'{ zNetworkConnectionError.__str__)NN) rrrrr(r r r#r' __classcell__rrr?rr9fsr9c@r)InvalidWheelFilenamezInvalid wheel filename.NrrrrrrDrrDc@r)UnsupportedWheelzUnsupported wheel.NrrrrrrErrEc @s<eZdZdZdddedededdf d d Zdefd d ZdS) MetadataInconsistentzBuilt metadata contains inconsistent information. This is raised when the metadata contains values (e.g. name and version) that do not match the information previously obtained from sdist filename or user-supplied ``#egg=`` value. ireqrfieldf_valm_valr NcCs||_||_||_||_dSr+)rGrHrIrJ)r"rGrHrIrJrrrr#s zMetadataInconsistent.__init__cCsd}||j|j|j|jS)NzJRequested {} has inconsistent {}: filename has {!r}, but metadata has {!r})r%rGrHrIrJ)r"templaterrrr'szMetadataInconsistent.__str__)rrrrr(r#r'rrrrrFs rFc@s4eZdZdZdededdfddZdefdd ZdS) InstallationSubprocessErrorz-A subprocess call failed during installation. returncode descriptionr NcCs||_||_dSr+)rMrN)r"rMrNrrrr#s z$InstallationSubprocessError.__init__cCr$)NzSCommand errored out with exit status {}: {} Check the logs for full command output.)r%rMrNr&rrrr's z#InstallationSubprocessError.__str__)rrrrintr(r#r'rrrrrLsrLc@s@eZdZdZdddZddd Zdefd d Zdefd d Z dS) HashErrorsz:Multiple HashError instances rolled into one for reportingr NcCs g|_dSr+)errorsr&rrrr#rBzHashErrors.__init__error HashErrorcCs|j|dSr+)rQappend)r"rRrrrrTszHashErrors.appendcCsbg}|jjdddt|jddD]\}}||j|dd|Dq|r/d|SdS) NcS|jSr+)ordererrrz$HashErrors.__str__..)keycSrUr+r?rWrrrrYrZcss|]}|VqdSr+)bodyr,rXrrrr.r/z%HashErrors.__str__.. )rQsortrrTheadextendr1)r"linesclsZ errors_of_clsrrrr's  zHashErrors.__str__cCrAr+)boolrQr&rrr__bool__rBzHashErrors.__bool__)r N)rRrSr N) rrrrr#rTr(r'rerfrrrrrPs    rPc@s\eZdZUdZdZeded<dZdZe ed<de fd d Z de fd d Z de fd dZ dS)rSa 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. Nrreqr_r0rVr cCsd|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 its link already populated by the resolver's _populate_link(). z )_requirement_namer&rrrr\s zHashError.bodycCs|jd|S)Nr^)rar\r&rrrr'zHashError.__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)rgr(r&rrrrhszHashError._requirement_name)rrrrrgr__annotations__rarVrOr(r\r'rhrrrrrSs   rSc@eZdZdZdZdZdS)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:NrrrrrVrarrrrrm rmc@rl)DirectoryUrlHashUnsupportedrnzUCan't verify hashes for these file:// requirements because they point to directories:Nrorrrrrqrprqc@s8eZdZdZdZdZdeddfddZdefd d ZdS) 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.) gotten_hashr NcCs ||_dS)zq :param gotten_hash: The hash of the (possibly malicious) archive we just downloaded N)ru)r"rurrrr#s zHashMissing.__init__cCsHddlm}d}|jr|jjr|jjnt|jdd}d|pd||jS)Nr) FAVORITE_HASHrgz {} --hash={}:{}rj)Zpip._internal.utils.hashesrvrgZ original_linkgetattrr%ru)r"rvpackagerrrr\s   zHashMissing.body) rrrrrVrar(r#r\rrrrrss rsc@rl) HashUnpinnedzPA requirement had a hash specified but was not pinned to a specific version.zaIn --require-hashes mode, all requirements must have their versions pinned with ==. These do not:Nrorrrrry2rpryc@s^eZdZdZdZdZdeeeefdeedfddfd d Z defd d Z defd dZ dS) HashMismatchz Distribution file hash values don't match. :ivar package_name: The name of the package that triggered the hash mismatch. Feel free to write to this after the exception is raise to improve its error message. zTHESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.allowedgotsr r NcCr!)z :param allowed: A dict of algorithm names pointing to lists of allowed hex digests :param gots: A dict of algorithm names pointing to hashes we actually got from the files under suspicion N)r}r~)r"r}r~rrrr#Os zHashMismatch.__init__cCsd||S)Nz {}: {})r%rh_hash_comparisonr&rrrr\YrizHashMismatch.bodycsndtddfdd}g}|jD]!\}}|||fdd|D|d|j|qd |S) aE Return a comparison of actual and expected hash values. Example:: Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde or 123451234512345123451234512345123451234512345 Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef hash_namer z chain[str]cSst|gtdS)Nz or)rr)rrrr hash_then_orhsz3HashMismatch._hash_comparison..hash_then_orc3s |] }dt|VqdS)z Expected {} {}N)r%nextr]prefixrrr.ps z0HashMismatch._hash_comparison..z Got {} r^) r(r}itemsrbrTr%r~Z hexdigestr1)r"rrcrZ expectedsrrrr\s  zHashMismatch._hash_comparison) rrrrrVrarr(rr#r\rrrrrr{=s * r{c@r)UnsupportedPythonVersionzMUnsupported python version according to Requires-Python package metadata.Nrrrrrryrrc sReZdZdZ   d dedeedeejddffdd Zdefd d Z Z S) !ConfigurationFileCouldNotBeLoadedz8When there are errors while loading a configuration filecould not be loadedNreasonfnamerRr cs"t|||_||_||_dSr+)r>r#rrrR)r"rrrRr?rrr#s  z*ConfigurationFileCouldNotBeLoaded.__init__cCsF|jdur d|jd}n|jdusJd|jd}d|j|S)Nz in .z. r^zConfiguration file )rrRr)r"Z message_partrrrr's z)ConfigurationFileCouldNotBeLoaded.__str__)rNN) rrrrr(r configparserErrorr#r'rCrrr?rr~s r)3rr itertoolsrrrtypingrrrrr Zpip._vendor.pkg_resourcesr Zpip._vendor.requests.modelsr r Zhashlibr Zpip._internal.metadatarZpip._internal.req.req_installr Exceptionrrrrrr)r*r3r4r5r6r7r8r9rDrErFrLrPrSrmrqrsryr{rrrrrrsJ    .  * <