\h01ddlZddlZddlZddlZddlmZmZmZmZm Z m Z m Z ddl m Z ddlmZmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lm Z dd l!m"Z"m#Z#ddl$m%Z%ddl&m'Z'm(Z(ddl)m*Z*ddl+m,Z,m-Z-ddl.m/Z/erddl0m1Z2e2e-e,e3fZ1ejhe5Z6Gdde"Zddde e3deee3e7ffdZ8de e3efdeee3e7fde e7e3ffdZ9y)N) TYPE_CHECKINGDictListOptionalSetTuplecastcanonicalize_name) BaseReporterResolutionImpossible)Resolver) DirectedGraph) WheelCache) PackageFinder)RequirementPreparer)install_req_extend_extras)InstallRequirement)RequirementSet) BaseResolverInstallRequirementProvider) PipProvider)PipDebuggingReporter PipReporter)get_requirement) Candidate Requirement)Factory)ResultceZdZhdZ ddededeedede de de d e d e d e d ee e d fffd Z deede defdZdedeefdZxZS)r>only-if-neededto-satisfy-onlyeagerpreparerfinder wheel_cachemake_install_req use_user_siteignore_dependenciesignore_installedignore_requires_pythonforce_reinstallupgrade_strategypy_version_info.c t || |jvsJt|||||| |||  |_||_| |_d|_y)N) r&r%r(r'r)r-r+r,r/)super__init___allowed_strategiesrfactoryr*r._result) selfr%r&r'r(r)r*r+r,r-r.r/ __class__s o/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/resolver.pyr2zResolver.__init__)sd 4#;#;;;;-#'+-#9+   $7 0)- root_reqscheck_supported_wheelsreturnc |jj|}t|j|j|j|j |j }dtjvr t}n t}t||} d}|j|j|x}|_t%|} t'|j(j+dD]} | j-} | | j.| j0k7rut3j4t65| j9| j0}| j;t=|t9| j.j>ddd|jjA| }|d | _!n|jjDrd | _!n|jF| jFk7rd | _!n| jHs |jJrd | _!nd| jLrV| jLjNr@| jLjPr"tRjUd | j.d | _!n| jL}|rX|jVrLd jY| j.| jF||jZxsd }tRj]|| j;| | j^}|jj`jc||D]}d |_2d |_3| S#t$r8} |jj!t#d| |j} | | d} ~ wwxYw#1swYxYw)N)r4 constraintsr*r.user_requestedPIP_RESOLVER_DEBUGi@ ) max_roundsz,ResolutionImpossible[Requirement, Candidate])r;c4|j|jk7SN)name project_name)cs r8z"Resolver.resolve..ps166Q^^3Kr9)keyFTz%s is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.zThe candidate selected for download or install is a yanked version: {name!r} candidate (version {version} at {link}) Reason for being yanked: {reason}z )rDversionlinkreason)4r4collect_root_requirementsrr>r*r.r?osenvironrr RLResolverresolve requirementsr5r get_installation_errorr rsortedmappingvaluesget_install_requirementrDrE contextlibsuppressKeyErrorradd_named_requirementrextrasget_dist_to_uninstallshould_reinstallr-rI is_editableeditable source_linkis_fileis_wheelloggerinfo is_yankedformat yanked_reasonwarningall_requirementsr% prepare_linked_requirements_morepreparedneeds_more_preparation)r6r:r; collectedproviderreporterresolver#limit_how_complex_resolution_can_beresulteerrorreq_set candidateireqreqinstalled_distrJmsgreqss r8rPzResolver.resolveIs6LL::9E LL!-- $ 8 8!22$33   2:: -%9%;H"}H>Y%;%;;#,,X6%55i6L6LM555 #_Y^^%D%K%K"\\?? JN%(-%--(,%''9+<+<<(,%&&.*A*A)-%&&9+@+@+H+H((11KK5  )-%((DD&"%----?  s#  ) )$ /CA 0F'' >>tD /CCL).C & /i$ LL77CQG%%EQ   &s%&L92AM=9 M:3M55M:=N ruc~|jJd|jsgS|jj}t|t |jj }t |jjtjt|d}|Dcgc]\}}| c}}Scc}}w)aZGet order for installation of requirements in RequirementSet. The returned list contains a requirement before another that depends on it. This helps ensure that the environment is kept consistent as they get installed one-by-one. The current implementation creates a topological ordering of the dependency graph, giving more weight to packages with less or no dependencies, while breaking any cycles in the graph at arbitrary points. We make no guarantees about where the cycle would be broken, other than it *would* be broken. zmust call resolve() first)weightsT)rHreverse) r5rQgraphget_topological_weightssetkeysrSitems functoolspartial_req_set_item_sorter)r6rurr} sorted_items_rws r8get_installation_orderzResolver.get_installation_orders||'D)DD'##I "")%W5I5I5N5N5P1QR  & & (!!"6H %11D111s) B9rC)__name__ __module__ __qualname__r3rrrrrboolstrrintr2rrrrPr __classcell__)r7s@r8rr&sH6:.%..j) . 5 .  ."..!%..."%S/2.@n01nKOn n`2%2  !2r9rrzDirectedGraph[Optional[str]]requirement_keysr<c ti dttddf fd t}D]-}|j|D]}|j |/|sn8t dz }|D] }|vr| |<|D]}j |w dt jj}|rJ| S)aAssign weights to each node based on how "deep" they are. This implementation may change at any point in the future without prior notice. We first simplify the dependency graph by pruning any leaves and giving them the highest weight: a package without any dependencies should be installed first. This is done again and again in the same way, giving ever less weight to the newly found leaves. The loop stops when no leaves are left: all remaining packages have at least one dependency left in the graph. Then we continue with the remaining graph, by taking the length for the longest path to any node from root, ignoring any paths that contain a single node twice (i.e. cycles). This is done through a depth-first search through the graph, while keeping track of the path to the node. Cycles in the graph result would result in node being revisited while also being on its own path. In this case, take no action. This helps ensure we don't get stuck in a cycle. When assigning weight, the longer path (i.e. larger length) is preferred. We are only interested in the weights of packages that are in the requirement_keys. noder<Nc|vryj|j|D] }| j||vryj|d}t |t |<y)Nr)add iter_childrenremovegetmaxlen)rchildlast_known_parent_countrpathrvisitr}s r8rz&get_topological_weights..visitsy 4<  ((. E %L  D ' ' ")++dA"63SY? r9r) rrrrrrrr difference) rrleavesrH_childweightleafrrrr}s `` @@@r8rrs8 #uD(*G@HSM@d@@,  C{--c2   3  Ua #D++"GDM #  D LL  + 4 $KW\\^$//0@AJ%:%> Nr9itemr}c,t|d}|||fS)a)Key function used to sort install requirements for installation. Based on the "weight" mapping calculated in ``get_installation_order()``. The canonical package name is returned as the second member as a tie- breaker to ensure the result is predictable, which is useful in tests. rr )rr}rDs r8rr2s! T!W %D 4=$ r9):rWrloggingrMtypingrrrrrrr pip._vendor.packaging.utilsr pip._vendor.resolvelibr r rrOpip._vendor.resolvelib.structsrpip._internal.cacher"pip._internal.index.package_finderr pip._internal.operations.preparerpip._internal.req.constructorsrpip._internal.req.req_installrpip._internal.req.req_setrpip._internal.resolution.baserr,pip._internal.resolution.resolvelib.providerr,pip._internal.resolution.resolvelib.reporterrrpip._internal.utils.packagingrbaserrr4r pip._vendor.resolvelib.resolversr RLResultr getLoggerrrcrrrr9r8rs HHH9E98*<@D<4RD:(C k9c1 2F   8 $p2|p2fV )V=@XV (3- Vr  '' (  (3-$ %  38_ r9