\h`& ddlZddlZddlmZmZmZmZmZmZm Z m Z ddl m Z ddl mZmZmZddlmZddlmZerddl mZdd lmZeeefZe eeefZne Ze d Ze d Zd eeefd edede eeffdZGddeZy)N) TYPE_CHECKINGDictIterableIteratorMappingSequenceTypeVarUnion)AbstractProvider) Candidate Constraint Requirement)REQUIRES_PYTHON_IDENTIFIER)Factory) Preference)RequirementInformationDVmapping identifierdefaultreturncX||vr||S|jd\}}}|r ||vr||S|S)aiGet item from a package name lookup mapping with a resolver identifier. This extra logic is needed when the target mapping is keyed by package name, which cannot be directly looked up with an identifier (which may contain requested extras). Additional logic is added to also look up a value by "cleaning up" the extras from the identifier. [) partition)rrrname open_bracket_s o/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/provider.py_get_with_identifierr!5sHWz"" '005D,t} Nc :eZdZdZdedeeefdededeee fddf d Z d e e e fdefd Zd ed eee fdeeee fdeeedfdedddf dZd edeeee fdeeee fdee fdZde de defdZde dee fdZed ededdefdZy) PipProvideraPip's provider implementation for resolvelib. :params constraints: A mapping of constraints specified by the user. Keys are canonicalized project names. :params ignore_dependencies: Whether the user specified ``--no-deps``. :params upgrade_strategy: The user-specified upgrade strategy. :params user_requested: A set of canonicalized package names that the user supplied for pip to install/upgrade. factory constraintsignore_dependenciesupgrade_strategyuser_requestedrNc||_||_||_||_||_t j d|_y)Nc"tjSN)mathinfr"r z&PipProvider.__init__..fs txxr")_factory _constraints_ignore_dependencies_upgrade_strategy_user_requested collections defaultdict _known_depths)selfr%r&r'r(r)s r __init__zPipProvider.__init__Ys?  '$7!!1-/:/F/FGW/Xr"requirement_or_candidatec|jSr,)r)r9r;s r identifyzPipProvider.identifyhs',,,r"r resolutions candidates informationPreferenceInformationbacktrack_causesrc tt||d}|rd||D}t|\}} nd\}} d| DD cgc]} | D]} | j} } } |du} t d| D}t | } j|}d}|j|<jj|tj}|tk(}j||}| | | | ||| |fS#t$rd}YwxYwcc} } w#t$rItj}|r$fd ||D}td |Ddz}ntj}YwxYw) aProduce a sort key for given requirement based on preference. The lower the return value is, the more preferred this group of arguments is. Currently pip considers the following in order: * Prefer if any of the known requirements is "direct", e.g. points to an explicit URL. * If equal, prefer if any requirement is "pinned", i.e. contains operator ``===`` or ``==``. * If equal, calculate an approximate "depth" and resolve requirements closer to the user-specified requirements first. If the depth cannot by determined (eg: due to no matching parents), it is considered infinite. * Order user-specified requirements by the order they are specified. * If equal, prefers "non-free" requirements, i.e. contains at least one operator, such as ``>=`` or ``<``. * If equal, order alphabetically for consistency (helps debuggability). TFc3BK|]\}}|jywr,)get_candidate_lookup).0rrs r z-PipProvider.get_preference..sTDAqq--/Ts)Nr/c3:K|]}|s|jywr,) specifier)rFireqs r rHz-PipProvider.get_preference..s!KTd$..!KsNc3,K|] }|dddk(yw)Nz==r/)rFops r rHz-PipProvider.get_preference..s8RVt^8sg?c3^K|]$\}}|j|jnd&yw)Ng)r8r)rFrparentr9s r rHz-PipProvider.get_preference..s6!!68>7ID&&v{{3sR!s*-c3 K|]}|ywr,r/)rFds r rHz-PipProvider.get_preference..s$>1Q$>s )nextiter StopIterationzipoperatoranyboolr5KeyErrorr-r.minr8getris_backtrack_cause)r9rr>r?r@rBhas_informationlookups candidateireqs specifier_setrJ operatorsdirectpinnedunfreerequested_orderinferred_depth parent_depthsrequires_pythonbacktrack_causes` r get_preferencezPipProvider.get_preferenceks8 # k*-. / #O TK NO JJ   J   e $$O $  *"hhO!%0%<! "%$> $>!>!D!% *s*C:D D: DDAE#"E# requirementsincompatibilitiescdtdtffd }tj|t j }j j||||| |S)Nrrc|jdk(ryjdk(rtj|d}|duSy)aAre upgrades allowed for this project? This checks the upgrade strategy, and whether the project was one that the user specified in the command line, in order to decide whether we should upgrade if there's a newer version available. (Note that we don't need access to the `--upgrade` flag, because an upgrade strategy of "to-satisfy-only" means that `--upgrade` was not specified). eagerTzonly-if-neededNrF)r4r!r5)r user_orderr9s r _eligible_for_upgradez7PipProvider.find_matches.._eligible_for_upgradesN%%0''+;;1((  "--r"rr)rrm constraintprefers_installedrn)strrYr!r2remptyr1find_candidates)r9rrmrnrtrus` r find_matcheszPipProvider.find_matchesso  c d ,*    $$& }},,!%!#8#DD/ -  r" requirementr`c$|j|Sr,)is_satisfied_by)r9r{r`s r r}zPipProvider.is_satisfied_bys**955r"cj|j }|j|Dcgc]}|| c}Scc}wr,)r3iter_dependencies)r9r` with_requiresrGs r get_dependencieszPipProvider.get_dependenciess3 555 $66}EWaWWWs00c|D]E}||jjk(ry|js+||jjk(sEyy)NTF)r{rrP)rrBrks r r]zPipProvider.is_backtrack_causesN 0 O_88===%%*8N8N8S8S*S   r")__name__ __module__ __qualname____doc__rrrwrrYintr:r rr r=rrrrrlrzr}r staticmethodr]r/r"r r$r$Ns Y Y#z/* Y" Y  Y S#X Y  Y-{I7M1N-SV-Y Y S)^,Y C)!445 Y S(+B"CCD Y ##:; Y  Y v' ' c8K#889' #3(;#;< ' )  ' R6;696QU6X)X8MX+34K+L r"r$)r6r-typingrrrrrrr r pip._vendor.resolvelib.providersr baser rrr?rr%rr pip._vendor.resolvelib.resolversrrArw _ProviderBaserrr!r$r/r"r rs    >442;G2; 3IJ$[)S%@AM$M* CL CL S!V_ 1a4[ 2q-qr"