"Jd1zdZddlZddlmZmZmZddlmZmZm Z m Z m Z ddl m Z ddlmZmZerddlmZddlmZdd lmZGd d eZGd d eZGddeZGddeZGddeZGddeZGddeZGddeZGddeZ GddeZ!GddeZ"Gd d!eZ#Gd"d#eZ$Gd$d%eZ%Gd&d'eZ&Gd(d)eZ'Gd*d+eZ(Gd,d-eZ)Gd.d/eZ*Gd0d1eZ+Gd2d3e+Z,Gd4d5e+Z-Gd6d7e+Z.Gd8d9e+Z/Gd:d;e+Z0Gd<d=eZ1Gd>d?eZ2dS)@z"Exceptions used throughout packageN)chaingroupbyrepeat) TYPE_CHECKINGDictListOptionalUnion) Distribution)RequestResponse)_Hash)BaseDistribution)InstallRequirementceZdZdZdS)PipErrorzBase pip exceptionN__name__ __module__ __qualname____doc__K/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/exceptions.pyrrrrceZdZdZdS)ConfigurationErrorz"General exception in configurationNrrrrrrs,,,,rrceZdZdZdS)InstallationErrorz%General exception during installationNrrrrrrs////rrceZdZdZdS)UninstallationErrorz'General exception during uninstallationNrrrrr!r!s1111rr!cBeZdZdZdeedfdeddfdZdefdZdS) 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_namereturnNc"||_||_dS)z :param dist: A Distribution object. :param metadata_name: The name of the metadata being accessed (can be "METADATA" or "PKG-INFO"). N)r$r%)selfr$r%s r__init__zNoneMetadataError.__init__*s *rcBd|j|jS)Nz+None {} metadata found for distribution: {})formatr%r$r(s r__str__zNoneMetadataError.__str__7s'=CC   I   r) rrrrr r strr)r-rrrr#r#!st +L"445 + +  + + + +       rr#ceZdZdZdefdZdS)UserInstallationInvalidzBA --user install is requested on an environment without user site.r&cdS)Nz$User base directory is not specifiedrr,s rr-zUserInstallationInvalid.__str__Cs55rN)rrrrr.r-rrrr0r0@s5LL6666666rr0ceZdZdefdZdS)InvalidSchemeCombinationr&cdd|jddD}d|d|jddS)Nz, c34K|]}t|VdSN)r.).0as r z3InvalidSchemeCombination.__str__..Is(::a3q66::::::rz Cannot set z and z together)joinargs)r(befores rr-z InvalidSchemeCombination.__str__HsK::49SbS>:::::BVBB$)B-BBBBrN)rrrr.r-rrrr3r3Gs6CCCCCCCrr3ceZdZdZdS)DistributionNotFoundzCRaised when a distribution cannot be found to satisfy a requirementNrrrrr?r?MsMMMMrr?ceZdZdZdS)RequirementsFileParseErrorzDRaised when a general error occurs parsing a requirements file line.NrrrrrArAQsNNNNrrAceZdZdZdS)BestVersionAlreadyInstalledzNRaised when the most up-to-date version of a package is already installed.NrrrrrCrCUsrrCceZdZdZdS) BadCommandz0Raised when virtualenv or a command is not foundNrrrrrErEZs::::rrEceZdZdZdS) CommandErrorz7Raised when there is an error in command-line argumentsNrrrrrGrG^sAAAArrGceZdZdZdS)PreviousBuildDirErrorz:Raised when there's a previous conflicting build directoryNrrrrrIrIbsDDDDrrIc DeZdZdZ d dedededdffd ZdefdZxZ S) NetworkConnectionErrorzHTTP connection errorN error_msgresponserequestr&c||_||_||_|j(|js!t|dr|jj|_t |||dS)zc Initialize NetworkConnectionError with `request` and `response` objects. NrN)rMrNrLhasattrsuperr))r(rLrMrN __class__s rr)zNetworkConnectionError.__init__isn!  " M %L &),, & =0DL Hg66666rc*t|jSr6)r.rLr,s rr-zNetworkConnectionError.__str__{s4>"""r)NN) rrrrr.r r r)r- __classcell__rRs@rrKrKfsMQ777(07BI7 777777$#########rrKceZdZdZdS)InvalidWheelFilenamezInvalid wheel filename.NrrrrrWrWs!!!!rrWceZdZdZdS)UnsupportedWheelzUnsupported wheel.NrrrrrYrYrrrYc :eZdZdZdddedededdf d Zdefd 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&Nc>||_||_||_||_dSr6)r\r]r^r_)r(r\r]r^r_s rr)zMetadataInconsistent.__init__s$    rc^d}||j|j|j|jS)NzJRequested {} has inconsistent {}: filename has {!r}, but metadata has {!r})r+r\r]r^r_)r(templates rr-zMetadataInconsistent.__str__s. 7 ty$*dj$*MMMr)rrrrr.r)r-rrrr[r[s|(14=@IL NNNNNNNrr[c2eZdZdZdededdfdZdefdZdS)InstallationSubprocessErrorz-A subprocess call failed during installation. returncode descriptionr&Nc"||_||_dSr6)rerf)r(rerfs rr)z$InstallationSubprocessError.__init__s$&rcBd|j|jS)NzSCommand errored out with exit status {}: {} Check the logs for full command output.)r+rerfr,s rr-z#InstallationSubprocessError.__str__s  6 &$"2 3 3 4r)rrrrintr.r)r-rrrrdrds^77'3'S'T''''4444444rrdc:eZdZdZd dZd dZdefdZdefd Z dS) HashErrorsz:Multiple HashError instances rolled into one for reportingr&Ncg|_dSr6)errorsr,s rr)zHashErrors.__init__s )+ rerror HashErrorc:|j|dSr6)rmappend)r(rns rrqzHashErrors.appends 5!!!!!rcg}|jdt|jdD]>\}}||j|d|D?|rd|SdS)Nc|jSr6)orderes rz$HashErrors.__str__..sqwr)keyc|jSr6rUrus rrwz$HashErrors.__str__..src3>K|]}|VdSr6)body)r7rvs rr9z%HashErrors.__str__..s*99a999999r )rmsortrrqheadextendr;)r(linescls errors_of_clss rr-zHashErrors.__str__s ..///")$+7L7L"M"M : : C LL " " " LL99=999 9 9 9 9  $99U## #rrc*t|jSr6)boolrmr,s r__bool__zHashErrors.__bool__sDK   r)r&N)rnror&N) rrrrr)rqr.r-rrrrrrkrksxDD,,,,""""!$!!!!!!rrkcdeZdZUdZdZeded<dZdZe ed<de fd Z de fd Z de fd Z dS) roa 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}r:rtr&c0d|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,s rr{zHashError.bodys1d,,..000rc>|jd|S)Nr|)rr{r,s rr-zHashError.__str__s ),,tyy{{,,,rc<|jrt|jndS)zReturn a description of the requirement that triggered me. This default implementation returns long description of the req, with line numbers unknown package)rr.r,s rrzHashError._requirement_names!%?s48}}}.??r)rrrrrr __annotations__rrtrir.r{r-rrrrroros +/C& '... DE3OOO 1c 1 1 1 1-----@3@@@@@@rroceZdZdZdZdZdS)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:Nrrrrrtrrrrrrs)11 E ; DDrrceZdZdZdZdZdS)DirectoryUrlHashUnsupportedrzUCan't verify hashes for these file:// requirements because they point to directories:Nrrrrrrs)11 E  DDrrc6eZdZdZdZdZdeddfdZdefdZdS) 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&Nc||_dS)zq :param gotten_hash: The hash of the (possibly malicious) archive we just downloaded N)r)r(rs rr)zHashMissing.__init__s 'rcddlm}d}|jr.|jjr |jjnt |jdd}d|pd||jS)Nr) FAVORITE_HASHrz {} --hash={}:{}r)pip._internal.utils.hashesrr original_linkgetattrr+r)r(rpackages rr{zHashMissing.bodys~<<<<<< 8  8)4&&TXud33 %++  ((-9I   r) rrrrrtrr.r)r{rrrrrsf<< E  'C'D'''' c      rrceZdZdZdZdZdS) 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:Nrrrrrr2s) E 1 DDrrcreZdZdZdZdZdeeeefdeedfddfd Z defd Z defd Z 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.allowedgotsrr&Nc"||_||_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)rr)r(rrs rr)zHashMismatch.__init__Os  rcvd||S)Nz {}: {})r+r_hash_comparisonr,s rr{zHashMismatch.bodyYs0##D$:$:$<$S>S>U>UVVVrcldtddfd}g}|jD]v\}}|||fd|D|d|j|wd|S)aE Return a comparison of actual and expected hash values. Example:: Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde or 123451234512345123451234512345123451234512345 Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef hash_namer&z chain[str]c>t|gtdS)Nz or)rr)rs r hash_then_orz3HashMismatch._hash_comparison..hash_then_orhs)fX&6&677 7rc3^K|]'}dt|V(dS)z Expected {} {}N)r+next)r7rvprefixs rr9z0HashMismatch._hash_comparison..psKGH)00fqAArz Got {} r|) r.ritemsrrqr+r hexdigestr;)r(rrr expectedsrs @rrzHashMismatch._hash_comparison\s 8C 8L 8 8 8 8 $(L$6$6$8$8   Iy!\),,F LLLU    LL.55di 6J6T6T6V6VWW    yyr) rrrrrtrrr.rr)r{rrrrrr=s E / S$s)^ 4Dgrs((,,,,,,,,,,==============22222299999999A777777@@@@@@y--------0000000022222(222        >66666/666CCCCC0CCC NNNNN,NNNOOOOO!2OOO( ;;;;;;;;BBBBB8BBBEEEEEHEEE#####X###2""""","""(NNNNN,NNN0 4 4 4 4 4"3 4 4 4!!!!!"!!!.+@+@+@+@+@!+@+@+@\)' ' ' ' ' )' ' ' T99 9 9 9 9 99 9 9 x0 AAAAA(:AAAAAr