3 ”Re]1ã@sNdZddlmZddlmZmZmZddlmZddl m Z e rºddl m Z m Z mZmZmZddlmZddlmZmZdd lmZdd lmZdd lmZer®dd lmZn dd lmZGdd„deƒZGdd„deƒZ Gdd„deƒZ!Gdd„deƒZ"Gdd„deƒZ#Gdd„de!ƒZ$Gdd„de!ƒZ%Gdd„deƒZ&Gdd„deƒZ'Gd d!„d!eƒZ(Gd"d#„d#eƒZ)Gd$d%„d%eƒZ*Gd&d'„d'eƒZ+Gd(d)„d)e!ƒZ,Gd*d+„d+e!ƒZ-Gd,d-„d-e!ƒZ.Gd.d/„d/e!ƒZ/Gd0d1„d1e!ƒZ0Gd2d3„d3e0ƒZ1Gd4d5„d5e0ƒZ2Gd6d7„d7e0ƒZ3Gd8d9„d9e0ƒZ4Gd:d;„d;e0ƒZ5Gdd?„d?e ƒZ7d@S)Az"Exceptions used throughout packageé)Úabsolute_import)ÚchainÚgroupbyÚrepeat)Ú iteritems)ÚMYPY_CHECK_RUNNING)ÚAnyÚOptionalÚListÚDictÚText)Ú Distribution)ÚResponseÚRequest)ÚPY3)Ú configparser)ÚInstallRequirement)Ú_Hash)Ú_hashc@seZdZdZdS)ÚPipErrorzBase pip exceptionN)Ú__name__Ú __module__Ú __qualname__Ú__doc__©rrú‡/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/exceptions.pyrsrc@seZdZdZdS)ÚConfigurationErrorz"General exception in configurationN)rrrrrrrrrsrc@seZdZdZdS)ÚInstallationErrorz%General exception during installationN)rrrrrrrrr#src@seZdZdZdS)ÚUninstallationErrorz'General exception during uninstallationN)rrrrrrrrr'src@s eZdZdZdd„Zdd„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"). cCs||_||_dS)zª :param dist: A Distribution object. :param metadata_name: The name of the metadata being accessed (can be "METADATA" or "PKG-INFO"). N)ÚdistÚ metadata_name)Úselfr r!rrrÚ__init__4szNoneMetadataError.__init__cCsdj|j|jƒS)Nz+None {} metadata found for distribution: {})Úformatr!r )r"rrrÚ__str__>szNoneMetadataError.__str__N)rrrrr#r%rrrrr+s rc@seZdZdZdS)ÚDistributionNotFoundzCRaised when a distribution cannot be found to satisfy a requirementN)rrrrrrrrr&Isr&c@seZdZdZdS)ÚRequirementsFileParseErrorzDRaised when a general error occurs parsing a requirements file line.N)rrrrrrrrr'Msr'c@seZdZdZdS)ÚBestVersionAlreadyInstalledzNRaised when the most up-to-date version of a package is already installed.N)rrrrrrrrr(Qsr(c@seZdZdZdS)Ú BadCommandz0Raised when virtualenv or a command is not foundN)rrrrrrrrr)Vsr)c@seZdZdZdS)Ú CommandErrorz7Raised when there is an error in command-line argumentsN)rrrrrrrrr*Zsr*c@seZdZdZdS)ÚSubProcessErrorzPRaised when there is an error raised while executing a command in subprocessN)rrrrrrrrr+^sr+c@seZdZdZdS)ÚPreviousBuildDirErrorz:Raised when there's a previous conflicting build directoryN)rrrrrrrrr,csr,cs*eZdZdZd‡fdd„ Zdd„Z‡ZS)ÚNetworkConnectionErrorzHTTP connection errorNcsP||_||_||_|jdk r8|j r8t|dƒr8|jj|_tt|ƒj|||ƒdS)zc Initialize NetworkConnectionError with `request` and `response` objects. NÚrequest)Úresponser.Ú error_msgÚhasattrÚsuperr-r#)r"r0r/r.)Ú __class__rrr#js   zNetworkConnectionError.__init__cCs t|jƒS)N)Ústrr0)r"rrrr%yszNetworkConnectionError.__str__)NN)rrrrr#r%Ú __classcell__rr)r3rr-gsr-c@seZdZdZdS)ÚInvalidWheelFilenamezInvalid wheel filename.N)rrrrrrrrr6~sr6c@seZdZdZdS)ÚUnsupportedWheelzUnsupported wheel.N)rrrrrrrrr7‚sr7c@s eZdZdZdd„Zdd„ZdS)ÚMetadataInconsistentzøBuilt 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. cCs||_||_||_dS)N)ÚireqÚfieldÚbuilt)r"r9r:r;rrrr#�szMetadataInconsistent.__init__cCsdj|j|j|jƒS)Nz/Requested {} has different {} in metadata: {!r})r$r9r:r;)r"rrrr%“szMetadataInconsistent.__str__N)rrrrr#r%rrrrr8†sr8c@s8eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd S) Ú HashErrorsz:Multiple HashError instances rolled into one for reportingcCs g|_dS)N)Úerrors)r"rrrr#�szHashErrors.__init__cCs|jj|ƒdS)N)r=Úappend)r"Úerrorrrrr>¡szHashErrors.appendcCsfg}|jjdd„d�x¨sz$HashErrors.__str__..)ÚkeycSs|jS)N)r3)rArrrrB©scss|]}|jƒVqdS)N)Úbody)Ú.0rArrrú «sz%HashErrors.__str__..Ú Ú)r=Úsortrr>ÚheadÚextendÚjoin)r"ÚlinesÚclsÚ errors_of_clsrrrr%¥s  zHashErrors.__str__cCs t|jƒS)N)Úboolr=)r"rrrÚ __nonzero__°szHashErrors.__nonzero__cCs|jƒS)N)rQ)r"rrrÚ__bool__´szHashErrors.__bool__N) rrrrr#r>r%rQrRrrrrr<šs  r<c@s4eZdZdZdZdZdZdd„Zdd„Zdd „Z dS) Ú 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. NrHcCsdj|jƒƒ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 {})r$Ú_requirement_name)r"rrrrDÍs zHashError.bodycCsdj|j|jƒƒS)Nz{} {})r$rJrD)r"rrrr%ÚszHashError.__str__cCs|jrt|jƒSdS)z¨Return a description of the requirement that triggered me. This default implementation returns long description of the req, with line numbers zunknown package)Úreqr4)r"rrrrTÞszHashError._requirement_name) rrrrrUrJr@rDr%rTrrrrrS¹s rSc@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)rrrrr@rJrrrrrVésrVc@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)rrrrr@rJrrrrrWòsrWc@s(eZdZdZdZdZdd„Zdd„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.)cCs ||_dS)zq :param gotten_hash: The hash of the (possibly malicious) archive we just downloaded N)Ú gotten_hash)r"r[rrrr#szHashMissing.__init__cCsHddlm}d}|jr4|jjr&|jjn t|jddƒ}dj|p>d||jƒS)Nr)Ú FAVORITE_HASHrUz {} --hash={}:{}zunknown package)Úpip._internal.utils.hashesr\rUÚ original_linkÚgetattrr$r[)r"r\ÚpackagerrrrDs  zHashMissing.bodyN)rrrrr@rJr#rDrrrrrYûs rYc@seZdZdZdZdZdS)Ú 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:N)rrrrr@rJrrrrra"srac@s0eZdZdZdZdZdd„Zdd„Zdd „Zd S) Ú 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. ézÞTHESE 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.cCs||_||_dS)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)ÚallowedÚgots)r"rerfrrrr#:szHashMismatch.__init__cCsdj|jƒ|jƒƒS)Nz {}: {})r$rTÚ_hash_comparison)r"rrrrDEs zHashMismatch.bodycshdd„}g}xPt|jƒD]B\}}||ƒ‰|j‡fdd„|Dƒƒ|jdj|j|jƒƒƒqWdj|ƒS)aE Return a comparison of actual and expected hash values. Example:: Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde or 123451234512345123451234512345123451234512345 Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef cSst|gtdƒƒS)Nz or)rr)Ú hash_namerrrÚ hash_then_orVsz3HashMismatch._hash_comparison..hash_then_orc3s|]}djtˆƒ|ƒVqdS)z Expected {} {}N)r$Únext)rErA)ÚprefixrrrF_sz0HashMismatch._hash_comparison..z Got {} rG)rrerKr>r$rfÚ hexdigestrL)r"rirMrhÚ expectedsr)rkrrgJs  zHashMismatch._hash_comparisonN) rrrrr@rJr#rDrgrrrrrc+s  rcc@seZdZdZdS)ÚUnsupportedPythonVersionzMUnsupported python version according to Requires-Python package metadata.N)rrrrrrrrrnfsrncs*eZdZdZd‡fdd„ Zdd„Z‡ZS) Ú!ConfigurationFileCouldNotBeLoadedz=When there are errors while loading a configuration file úcould not be loadedNcs&tt|ƒj|ƒ||_||_||_dS)N)r2ror#ÚreasonÚfnamer?)r"rqrrr?)r3rrr#osz*ConfigurationFileCouldNotBeLoaded.__init__cCs@|jdk rdj|jƒ}n|jdk s&t‚dj|jƒ}dj|j|ƒS)Nz in {}.z. {} zConfiguration file {}{})rrr$r?ÚAssertionErrorrq)r"Ú message_partrrrr%vs   z)ConfigurationFileCouldNotBeLoaded.__str__)rpNN)rrrrr#r%r5rr)r3rroksroN)8rÚ __future__rÚ itertoolsrrrZpip._vendor.sixrÚpip._internal.utils.typingrÚtypingrr r r r Zpip._vendor.pkg_resourcesr Zpip._vendor.requests.modelsrrrÚpip._vendor.six.movesrZpip._internal.req.req_installrÚhashlibrrÚ Exceptionrrrrrr&r'r(r)r*r+r,r-r6r7r8r<rSrVrWrYrarcrnrorrrrÚsN        0  ' ;