
    @(i$                       S r SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJrJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJrJr  SSKJr  SSKJr  SSK J!r!  SSK"J#r#  \(       a$  SSK$J%r%  SSK&J'r'  SSKJ(r(  SSKJ)r)  SSK*J+r+  SSK,J-r-  SSK.J/r/J0r0  \Rb                  " S\2 35      r3 " S S5      r4 " S S5      r5S!S  jr6g)"a)  
Solver-agnostic logic to compose the requests passed to the solver
and accumulate its results.

The state exposed to the solver is handled by two objects whose primary
function is to serve read-only information to the solver and its other helpers.

- ``SolverInputState``: fully solver agnostic. It handles:
    - The local state on disk, namely the prefix state. This includes the
      already installed packages in the prefix (if any), the explicit requests
      made in that prefix in the past (history), its pinned specs, packages
      configured as aggressive updates and others.
    - The runtime context, determined by the configuration file(s),
      `CONDA_*` environment variables, command line flags and the requested
      specs (if any).
- ``IndexHelper``: can be subclassed to add solver-specific logic
  (e.g. custom index building). It should, provide, at least, a method to
  query the index for the _explicit pool_ of packages for a given spec (e.g.
  its potential dependency tree). Note that the IndexHelper might need
  pieces of ``SolverInputState`` to build the index (e.g. installed packages,
  configured channels and subdirs...)

.. todo::

    Embed IndexHelper in SolverInputState?

Since ``conda`` follows an iterative approach to solve a request,
in addition the _input_ state, the Solver itself can store additional state
in a separate helper: the ``SolverOutputState`` object. This is meant to help
accumulate the following pieces of data:

- ``specs``: a mapping of package names to its corresponding ``MatchSpec``
  objects. These objects are passed to the actual Solver, hoping it will return
  a solution.
- ``records``: a mapping of package names to ``PackageRecord`` objects. It will
  end up containing the list of package records that will compose the final state
  of the prefix (the _solution_). Its default value is set to the currently installed
  packages in the prefix. The solver will alter this list as needed to accommodate
  the final solution.

If the algorithm was not iterative, the sole purpose of the solver would be to turn
the ``specs`` into ``records``. However, ``conda``'s logic will try to constrain the
solution to mimic the initial state as much as possible to reduce the amount of
changes in the prefix. Sometimes, the initial request is too constrained, which results
in a number of conflicts. These conflicts are then stored in the ``conflicts`` mapping,
which will determine which ``specs`` are relaxed in the next attempt. Additionally,
``conda`` stores other solve artifacts:

- ``for_history``: The explicitly requested specs in the command-line should end up
  in the history. Some modifier flags can affect how this mapping is populated (e.g.
  ``--update-deps``.)
- ``neutered``: Pieces of history that were found to be conflicting in the future and
  were annotated as such to avoid falling in the same conflict again.

The mappings stored in ``SolverOutputState`` are backed by ``TrackedMap`` objects,
which allow to keep the reasons _why_ those specs or records were added to the mappings,
as well as richer logging for each action.
    )annotationsN)MappingProxyType)TYPE_CHECKING)
IndexedSet)NULL)DepsModifierUpdateModifier)context)paths_equal)Index)
PrefixData)get_pinned_specs)PackagesNotFoundErrorSpecsConfigurationConflictError)History)Channel)	MatchSpec)PrefixGraph)Iterable)PathLike)Any)Solver)PackageRecord   )LibMambaIndexHelper)EnumAsBoolscompatible_specszconda.c            	         \ rS rSrSr\R                  \R                  \R                  \	R                  \	R                  \	R                  \	R                  \	R                  S.rSrS\	R                  \R                  SSSSSS4	                   S S jjr\4S!S	 jjr\S"S
 j5       r\S#S j5       r\S$S j5       r\S$S j5       r\S$S j5       r\S$S j5       r\S$S j5       r\S$S j5       r\S$S j5       r\S%S j5       r\S%S j5       r\S%S j5       r \S%S j5       r!\S&S j5       r"\S&S j5       r#\S%S j5       r$\S%S j5       r%\S%S j5       r&\S%S j5       r'S'S jr(S'S jr)Sr*g)(SolverInputStatec   a$  
Helper object to provide the input data needed to compute the state that will be
exposed to the solver.

Parameters
----------
prefix
    Path to the prefix we are operating on. This will be used to expose
    ``PrefixData``, ``History``, pinned specs, among others.
requested
    The MatchSpec objects required by the user (either in the command line or
    through the Python API).
update_modifier
    A value of ``UpdateModifier``, which has an effect on which specs are added
    to the final list. The default value here must match the default value in the
    ``context`` object.
deps_modifier
    A value of ``DepsModifier``, which has an effect on which specs are added
    to the final list. The default value here must match the default value in the
    ``context`` object.
ignore_pinned
    Whether pinned specs can be ignored or not. The default value here must match
    the default value in the ``context`` object.
force_remove
    Remove the specs without solving the environment (which would also remove their)
    dependencies. The default value here must match the default value in the
    ``context`` object.
force_reinstall
    Uninstall and install the computed records even if they were already satisfied
    in the given prefix. The default value here must match the default value in the
    ``context`` object.
prune
    Remove dangling dependencies that ended up orphan. The default value here must
    match the default value in the ``context`` object.
command
    The subcommand used to invoke this operation (e.g. ``create``, ``install``, ``remove``...).
    It can have an effect on the computed list of records.
_pip_interop_enabled
    Internal only. Whether ``PrefixData`` will also expose packages not installed by
    ``conda`` (e.g. ``pip`` and others can put Python packages in the prefix).
)NOT_SETNO_DEPS	ONLY_DEPSSPECS_SATISFIED_SKIP_SOLVEFREEZE_INSTALLEDUPDATE_DEPSUPDATE_SPECS
UPDATE_ALL)anacondacondazconda-buildz
python.appconsole_shortcutpowershell_shortcut NFc                   Xl         [        XS9U l        Xl        [	        U5      R                  5       U l        [        U5       Vs0 s H  oR                  U_M     snU l	        [        R                   Vs0 s H  oR                  U_M     snU l        [        5       R                  nU Vs0 s H  oR                  U_M     snU l        0 U l        U H&  n[#        U5      nXR                   UR                  '   M(     U R%                  SU5      U l        U(       a3  U R&                  [(        R*                  :X  a  [(        R,                  U l        U R%                  SU5      U l        U R%                  SU5      U l        U R%                  SU5      U l        U R%                  SU5      U l        Xl        Xl        U R:                   Vs0 s H  o[#        U5      _M     snU l        g s  snf s  snf s  snf s  snf )N)interoperabilityupdate_modifierdeps_modifierignore_pinnedforce_removeforce_reinstall)prefixr   _prefix_data_pip_interop_enabledr   get_requested_specs_map_historyr   name_pinnedr
   aggressive_update_packages_aggressive_updatesr   system_packages_virtual
_requestedr   _default_to_context_if_null_update_modifierr	   r%   r'   _deps_modifier_ignore_pinned_force_remove_force_reinstall_prune_command_DO_NOT_REMOVE_NAMES_do_not_remove)selfr5   	requestedr0   r1   r2   r3   r4   prunecommandr7   specvirtualrecordps                  S/data/cameron/miniconda/lib/python3.13/site-packages/conda_libmamba_solver/state.py__init__SolverInputState.__init__   s    &vU$8!??A4DV4LM4LD		44LM@G@b@b#c@bIItO@b#c '));BC7f,7CDT?D)-OODII&  !% @ @!
 T**n.M.MM$2$?$?D!">>P]^">>P]^!==nl[ $ @ @!
  9=8Q8QR8Q1)A,8QR5 N#c D, Ss   G"6G',G,G1c                `    U[         L a  [        X15      $ U R                  R                  X"5      $ )zTObtain default value from the context if value is set to NULL; otherwise leave as is)r   getattr_ENUM_STR_MAPget)rK   r:   valuer
   s       rS   rA   ,SolverInputState._default_to_context_if_null   s*    ).$ww%`D<N<N<R<RSX<``    c                    U R                   $ )z
A direct reference to the ``PrefixData`` object for the given ``prefix``.
You will usually use this object through the ``installed`` property.
)r6   rK   s    rS   prefix_dataSolverInputState.prefix_data   s        r\   c                    [        [        [        U R                  R                  R                  5       5      5      5      $ )z
This exposes the installed packages in the prefix. Note that a ``PackageRecord``
can generate an equivalent ``MatchSpec`` object with ``.to_match_spec()``.
Records are toposorted.
)r   dictsortedr_   _prefix_recordsitemsr^   s    rS   	installedSolverInputState.installed   s.      VD,<,<,L,L,R,R,T%U VWWr\   c                ,    [        U R                  5      $ )z
These are the specs that the user explicitly asked for in previous operations
on the prefix. See :class:`History` for more details.
)r   r9   r^   s    rS   historySolverInputState.history   s      ..r\   c                d    U R                   (       a  [        0 5      $ [        U R                  5      $ )z
These specs represent hard constrains on what package versions can be installed
on the environment. The packages here returned don't need to be already installed.

If ``ignore_pinned`` is True, this returns an empty dictionary.
)r2   r   r;   r^   s    rS   pinnedSolverInputState.pinned   s'     #B''--r\   c                l    [        [        [        U R                  R	                  5       5      5      5      $ )z
System properties exposed as virtual packages (e.g. ``__glibc=2.17``). These packages
cannot be (un)installed, they only represent constrains for other packages. By convention,
their names start with a double underscore.
)r   rb   rc   r?   re   r^   s    rS   rP   SolverInputState.virtual   s&      VDMM,?,?,A%B CDDr\   c                ,    [        U R                  5      $ )z
Packages that the solver will always try to update. As such, they will never have an
associated version or build constrain. Note that the packages here returned do not need to
be installed.
)r   r=   r^   s    rS   aggressive_updates#SolverInputState.aggressive_updates  s       8 899r\   c                   U R                   nU R                  nU R                   Vs0 s H  o3U;   d  M
  U[        U5      _M     nn[        R
                  (       aD  [        U R                  [        R                  5      (       a  UR                  S[        S5      5        U R                  R                  (       a3  U H-  nUS:w  d  M  X2;  d  M  UR                  U[        U5      5        M/     [        U5      $ s  snf )z
Merged lists of packages that should always be updated, depending on the flags, including:
- aggressive_updates
- conda if auto_update_conda is true and we are on the base env
- almost all packages if update_all is true
- etc
r*   python)rf   rl   rq   r   r
   auto_update_condar   r5   root_prefix
setdefaultr0   r(   r   )rK   rf   rl   pkgpkgss        rS   always_updateSolverInputState.always_update  s     NN	/3/F/F[/FQZJZ#Ys^#/F[$$T[['BUBU)V)VOOGYw%78** (?s'8OOC38 !  %% \s
   	C8C8c                ,    [        U R                  5      $ )z
Packages that are protected by the solver so they are not accidentally removed. This list
is not configurable, but hardcoded for legacy reasons.
)r   rJ   r^   s    rS   do_not_removeSolverInputState.do_not_remove  s       3 344r\   c                ,    [        U R                  5      $ )zD
Packages that the user has explicitly asked for in this operation.
)r   r@   r^   s    rS   rL   SolverInputState.requested'  s    
  00r\   c                     U R                   S:H  $ )z.
True if the used subcommand was ``install``.
installrH   r^   s    rS   is_installingSolverInputState.is_installing0  s    
 }}	))r\   c                     U R                   S:H  $ )z-
True if the used subcommand was ``update``.
updater   r^   s    rS   is_updatingSolverInputState.is_updating7      
 }}((r\   c                     U R                   S:H  $ )z-
True if the used subcommand was ``create``.
creater   r^   s    rS   is_creatingSolverInputState.is_creating>  r   r\   c                     U R                   S:H  $ )z-
True if the used subcommand was ``remove``.
remover   r^   s    rS   is_removingSolverInputState.is_removingE  r   r\   c                ,    [        U R                  5      $ )z
Use attribute access to test whether the modifier is set to that value

>>> update_modifier = EnumAsBools(context.update_modifier)
>>> update_modifier.UPDATE_SPECS
    True
>>> update_modifier.UPDATE_DEPS
    False
)r   rB   r^   s    rS   r0    SolverInputState.update_modifierN  s     40011r\   c                ,    [        U R                  5      $ )z
Use attribute access to test whether the modifier is set to that value

>>> deps_modifier = EnumAsBools(context.deps_modifier)
>>> deps_modifier.NOT_SET
    True
>>> deps_modifier.DEPS_ONLY
    False
)r   rC   r^   s    rS   r1   SolverInputState.deps_modifier[  s     4..//r\   c                    U R                   $ N)rD   r^   s    rS   r2   SolverInputState.ignore_pinnedj  s    """r\   c                    U R                   $ r   )rE   r^   s    rS   r3   SolverInputState.force_removen  s    !!!r\   c                    U R                   $ r   )rF   r^   s    rS   r4    SolverInputState.force_reinstallr  s    $$$r\   c                    U R                   $ r   )rG   r^   s    rS   rM   SolverInputState.prunev  s    {{r\   c              #  :  #    U R                   R                  5        Hy  nUR                  S5      nU(       d  M  UR                  (       aG  UR                  R	                  S5      (       a'  [        UR                  R                  S5      S   5      nUv   M{     g7f)z
Collect all channels added with the `channel::package=*` syntax. For now,
we only collect those specifically requested by the user in the current command
(same as conda), but we should investigate whether history keeps channels around
too.
channelzfile://z::r   N)rL   valuesget_exact_valueoriginal_spec_str
startswithr   split)rK   rO   r   s      rS   channels_from_specs$SolverInputState.channels_from_specs|  sx      NN))+D**95Gw))d.D.D.O.OPY.Z.Z%d&<&<&B&B4&H&KLG ,s   4BA!Bc              #     #    [        [        SS 5      =n(       a  [        R                    OUc  [        [        SS 5      nU(       a  [        R                  " S5      v   g g 7f)N_restore_free_channelrestore_free_channelz#https://repo.anaconda.com/pkgs/free)rW   r
   custom_multichannelsr   from_url)rK   r   s     rS   maybe_free_channel#SolverInputState.maybe_free_channel  sQ     g'>EE7E((_g'=tDG""#HII s   AA!)r=   rH   rC   rJ   rF   rE   r9   rD   r;   r7   r6   rG   r@   rB   r?   r5   )r5   zstr | bytes | PathLikerL   z Iterable[str | MatchSpec] | Noner0   zUpdateModifier | Noner1   zDepsModifier | Noner2   bool | Noner3   r   r4   r   rM   r   rN   z
str | Noner7   r   )returnr   )r   r   )r   zdict[str, PackageRecord]r   zdict[str, MatchSpec])r   bool)r   r   )r   zIterable[Channel])+__name__
__module____qualname____firstlineno____doc__r   r!   r"   r#   r	   r$   r%   r&   r'   r(   rX   rI   rT   r
   rA   propertyr_   rf   ri   rl   rP   rq   rz   r}   rL   r   r   r   r   r0   r1   r2   r3   r4   rM   r   r   __static_attributes__r-   r\   rS   r   r   c   s   (V  ''''!++&4&O&O*;;%11&33$//	M 791?1L1L-9-A-A%)$)',"",0+S&+S 4+S /	+S
 ++S #+S "+S %+S +S +S *+SZ @G a ! ! X X / / 	. 	. E E : : & && 5 5 1 1 * * ) ) ) ) ) ) 
2 
2 
0 
0 # # " " % %  
Jr\   r   c                      \ rS rSrSrSSSSSS.           SS jjr\SS j5       r\SS j5       r\SS j5       r	\SS	 j5       r
SS
 jrSS jrSS jrSrg)SolverOutputStatei  a
  
This is the main mutable object we will massage before passing the result of the computation
(the ``specs`` mapping) to the solver. It will also store the result of the solve (in
``records``).

Parameters
----------
solver_input_state
    This instance provides the initial state for the output.
records
    Dict of package names to ``PackageRecord`` objects. If not provided, it will be
    initialized from the ``installed`` records in ``solver_input_state``.
for_history
    Dict of package names to ``MatchSpec`` objects. These specs will be written to
    the prefix history once the solve is complete. Its default initial value is taken from the
    explicitly requested packages in the ``solver_input_state`` instance.
neutered
    Dict of package names to ``MatchSpec`` objects. These specs are also written to
    the prefix history, as part of the neutered specs. If not provided, their default value is
    a blank mapping.
conflicts
    If a solve attempt is not successful, conflicting specs are kept here for further
    relaxation of the version and build constrains. If not provided, their default value is a
    blank mapping.
pins
    Packages that ended up being pinned. Mostly used for reporting and debugging. Deprecated.

Notes
-----
Almost all the attributes in this object map package names (``str``) to ``MatchSpec``
(_specs_ in short) objects. The only mapping with different values is ``records``, which
stores ``PackageRecord`` objects. A quick note on these objects:

* ``MatchSpec`` objects are a query language for packages, based on the ``PackageRecord``
  schema. ``PackageRecord`` objects is how packages that are already installed are
  represented. This is what you get from ``PrefixData.iter_records()``. Since they are
  related, ``MatchSpec`` objects can be created from a ``PackageRecord`` with
  ``.to_match_spec()``.
* ``MatchSpec`` objects also feature fields like ``target`` and ``optional``. These are,
  essentially, used by the low-level classic solver (:class:`conda.resolve.Resolve`) to
  mark specs as items it can optionally play with to satisfy the solver constrains. A
  ``target`` marked spec is _soft-pinned_ in the sense that the solver will try to satisfy
  that but it will stop trying if it gets in the way, so you might end up a different
  version or build. ``optional`` seems to be in the same lines, but maybe the entire spec
  can be dropped from the request? The key idea here is that these two fields might not be
  directly usable by the solver, but it might need some custom adaptation. For example, for
  ``libmamba`` we might need a separate pool that can be configured as a flexible task. See
  more details in the first comment of ``conda.core.solve.classic.Solver._add_specs``
N)recordsfor_historyneutered	conflictspinsc                   Xl         U=(       d    [        UR                  5      U l        U=(       d    [        UR                  5      U l        U=(       d    0 U l        U=(       d    0 U l        U=(       d    0 U l        g r   )	solver_input_staterb   rf   r   rL   r   r   r   r   )rK   r   r   r   r   r   r   s          rS   rT   SolverOutputState.__init__  s]     5G181^DASA]A]<^1<1bEWEaEa@b.6n"/8B*.*"	r\   c                n    [        [        U R                  R                  5       5      R                  5      $ )z
Massage currently stored records so they can be returned as the type expected by the
solver API. This is what you should return in ``Solver.solve_final_state()``.
)r   r   r   r   graphr^   s    rS   current_solution"SolverOutputState.current_solution  s'     +dll&9&9&;<BBCCr\   c                H   U R                   n0 nS HC  n[        [        X5      R                  5       [        SS9 H  u  pEUR                  XE5        M     ME     S HD  n[        X5      R                  5        H$  u  pGUR                  XGR                  5       5        M&     MF     U$ )z
Merge all possible sources of input package specs, sorted by their input category and
strictness. It's just meant to be an enumeration of all possible inputs, not a ready-to-use
list of specs for a solver.
)rL   rl   ri   rq   T)keyreverse)rf   rP   )r   rc   rW   re   sort_by_spec_strictnessrw   to_match_spec)rK   sisspecs_by_strictnessgroupr:   rO   record_grouprQ   s           rS   specsSolverOutputState.specs  s     %% 
E %#))++

 $..t:
 5L ' : @ @ B#..t5I5I5KL !C 5 #"r\   c                    U R                   R                  5        VVs0 s H  u  pUR                  S5      (       a  M  X_M!     snn$ s  snnf )z
Specs that are _not_ virtual.
__r   re   r   rK   r:   rO   s      rS   
real_specsSolverOutputState.real_specs  s=    
 .2ZZ-=-=-?]-?zttW[G\

-?]]]
   AAc                    U R                   R                  5        VVs0 s H  u  pUR                  S5      (       d  M  X_M!     snn$ s  snnf )z
Specs that are virtual.
r   r   r   s      rS   virtual_specsSolverOutputState.virtual_specs  s=    
 .2ZZ-=-=-?Y-?zt4??SWCX

-?YYYr   c                  ^ U R                   nUR                  (       a  UR                  (       a  U R                  n/ nUR                  R                  5        Hs  u  nmUR                  R                  5        H>  nTR                  U5      (       d  M  UR                  (       a  WR                  U5          M`     UR                  T5        Mu     U(       a  [        U5      nSUl        UeUR                  (       a  W$ gUR                  R                  (       au  UR                  R                  5        HK  u  nmXAR                  ;  a    g[        U4S jUR                  R                  5        5       5      (       a  MK    g   U R                  $ g)z^
Operations that do not need a solver and might result in returning
early are collected here.
Fc              3  F   >#    U  H  nTR                  U5      v   M     g 7fr   )match).0rQ   rO   s     rS   	<genexpr>/SolverOutputState.early_exit.<locals>.<genexpr>+  s     S<R&4::f--<Rs   !N)r   r   r3   r   rL   re   rf   r   r   r   appendr   allow_retryr0   r$   any)rK   r   force_remove_solutionnot_installedr:   rQ   excrO   s          @rS   
early_exitSolverOutputState.early_exit
  s8   
 %%?? (,(=(=%-/M!mm113
d!mm224Fzz&))++188@	 5 "((. 4 +M:"'	,,    ;;!mm113
d}},SCMM<P<P<RSSS	 4 ,,, <r\   c           	        U R                   n[        UR                  5      R                  UR                  5      nU GH  nUR                  U   nUR                  U   nUR
                  R                  U5      nUR                  (       a  U(       a  UR                  U5      (       a  [        XU45      (       a  M  [        UR                  R                  5       5       VVs/ s H3  u  pFUR                  (       a  UR
                  R                  XF5      OUPM5     nnn[        [        UR                  R                  5       S S9UUR                  S9n	SU	l        U	e   gs  snnf )a  
Last part of the logic, common to addition and removal of packages. Originally,
the legacy logic will also minimize the conflicts here by doing a pre-solve
analysis, but so far we have opted for a different approach in libmamba: let the
solver try, fail with conflicts, and annotate those as such so they are unconstrained.

Now, this method only ensures that the pins do not cause conflicts.
c                    U R                   $ r   )r:   )xs    rS   <lambda>;SolverOutputState.check_for_pin_conflicts.<locals>.<lambda>Q  s    QRQWQWr\   )r   )requested_specspinned_specsr5   FN)r   setrL   intersectionrl   rf   rY   is_name_only_specr   r   rc   re   r   r   r5   r   )
rK   indexr   requested_and_pinnedr:   rL   pinrf   r   r   s
             rS   check_for_pin_conflicts)SolverOutputState.check_for_pin_conflicts3  s&    %%"3==1>>szzJ(Dd+I**T"C))$/I &&9Y__Y=W=W'3/?@@ &,CJJ,<,<,>%? %?	 695J5JS]]&&t1PSS%?    6$*3==+?+?+AGW$X!-::
 #(	) ) s   ":E!c           
     4   U R                   nU R                  R                  UR                  5        UR                  R                  5        Ha  u  p4U R                  R                  U5      nU(       d  M)  UR                  U5      (       a  MA  [        X5R                  S9U R                  U'   Mc     UR                  R                  (       a  [        UR                  5      n0 nUR                  R                  5        HB  u  p4U R                  R!                  5        H  nUR                  U5      (       d  M  XWU'   M!     MD     UR"                  (       a  U H  nXc	 M     OUR                  5        H	  u  p5XVU'   M     U R                  R%                  5         U R                  R                  U5        GOUR                  R&                  (       Ga  UR(                  R*                  (       Gd  [-        U R                  R!                  5       UR                  R!                  5       5      nUR/                  5       n	/ n
UR"                  (       a[  U	 HT  nUR0                  UR                  ;  a  UR0                  UR                  ;   a  M9  U
R3                  UR0                  5        MV     OvU	 Hp  nUR4                   HB  n[        U5      nUR0                  U R6                  ;  d  M*  X@R                  UR0                  '   MD     U
R3                  UR0                  5        Mr     U
 HQ  nUR                  R                  U5      nU(       a  XR                  U'   M5  U R                  R9                  US5        MS     GOUR(                  R*                  (       Ga  0 n[-        U R                  R!                  5       5      nUR                  R                  5        HO  u  p4UR;                  U5      nUR=                  U5       H$  n[        UR0                  5      XR0                  '   M&     MQ     UR>                  R                  5        H  u  p4UR9                  US5        M     SU;   aL  UR                  S   nSRA                  UR                  RC                  S5      SS 5      S-   n[        SUS9US'   UR                  UR                  5        UR"                  (       a  Sn[E        URG                  5       5      nO[E        UR!                  5       5      nSn[H        RJ                  " S	S
5         URM                  URN                  URP                  URR                  UUSS9RU                  [V        RX                  URZ                  UR\                  UR^                  UR`                  S9nU Vs0 s H  oUR0                  U_M     nnSSS5        U R                  R%                  5         U R                  R                  W5        U R                  R%                  5         U R                  R                  U5        S
Ul1        UR`                  (       a  [-        [E        U R                  R!                  5       5      [E        UR                  R!                  5       5      5      nURa                  5         U R                  R%                  5         U R                  R                  URd                   Vs0 s H  oUR0                  U_M     sn5        ggs  snf ! , (       d  f       GNP= fs  snf )a  
These tasks are performed _after_ the solver has done its work. It essentially
post-processes the ``records`` mapping.

Parameters
----------
solver_cls
    The class used to instantiate the Solver. If not provided, defaults to the one
    specified in the context configuration.

Notes
-----
This method could be solver-agnostic  but unfortunately ``--update-deps`` requires a
second solve; that's why this method needs a solver class to be passed as an argument.
)versionNrt   .   z.*)r:   r   r-   quietFrecursive_call_for_update_deps)r5   channelssubdirsspecs_to_addspecs_to_removerN   )r0   r1   r2   r3   rM   )3r   r   r   rL   ri   re   r   rY   r   r   r   r   r1   r"   rb   rf   r   r   clearr#   r0   r&   r   +remove_youngest_descendant_nodes_with_specsr:   r   dependsr   popget_node_by_nameall_ancestorsrl   joinr   listkeysr
   	_override	__class__r5   r  r  solve_final_stater	   r'   rC   r2   r3   rM   rG   r   )rK   solverr   r:   rO   rQ   original_stateonly_change_theser   would_remove	to_remove
dependencyrf   	new_specsancestorr   r  r  r   s                      rS   
post_solveSolverOutputState.post_solveX  sj   " %%
 	. ++++-JD\\%%d+Fvdjj00&/nn&Md# . $$ "#--0N "!mm113
"ll113Fzz&))28$/ 4 4
 -D&, . %6$;$;$=LD+14( %> LL LL/(((1D1D1P1P1P   3 3 5s}}7K7K7MNE !LLNL I*F{{#--7FKK3==<X $$V[[1	 + +F&,nn
(499DJJ6:>,,TYY7	 '5
 $$V[[1 + "MM--d3	)2LL&LL$$T40 "   ,,, I 3 3 56E!mm113
//5 % 3 3F ;H/8/GImm, !< 4 "jj..0
dD) 1 9$x0((6>>#7#7#<Ra#@ADH&/Xw&O	(#S]]+!"&y~~'7"8#I$4$4$67"$""7E2 !**!==#__"NN!-$3< +  $#$2$?$?"%"4"4"%"3"3!$!1!1)) $   >EEW6;;.WE% 3( LL LL(""$##I. CJ 99T\\%8%8%: ;T#--BVBVBX=YZEKKMLL LL5;; O;f!4; OP	  F% 32F !Ps%   $A>\"[>8\\>\
\)r   r   r   r   r   r   )r   r   r   zdict[str, PackageRecord] | Noner   dict[str, MatchSpec] | Noner   r  r   r  r   r  )r   zIndexedSet[PackageRecord]r   )r   z IndexedSet[PackageRecord] | None)r   r   r   None)r  r   r   r  )r   r   r   r   r   rT   r   r   r   r   r   r   r   r  r   r-   r\   rS   r   r     s    0l 48370415,05 -5 1	5
 15 .5 /5 *5" D D # #2 ^ ^ Z Z'-R#JnQr\   r   c                (    U u  p[        USS5      U4$ )zJ
Helper function to sort a list of (key, value) tuples by spec strictness

strictnessr   )rW   )key_value_tupler:   rO   s      rS   r   r   	  s     !JD4q)4//r\   )r  ztuple[str, MatchSpec]r   ztuple[int, str])7r   
__future__r   loggingtypesr   typingr   boltons.setutilsr   conda.auxlibr   conda.base.constantsr   r	   conda.base.contextr
   conda.common.pathr   conda.core.indexr   conda.core.prefix_datar   conda.core.solver   conda.exceptionsr   r   conda.historyr   conda.models.channelr   conda.models.match_specr   conda.models.prefix_graphr   collections.abcr   osr   r   r   conda.models.recordsr   r   r   utilsr   r   	getLoggerr   logr   r   r   r-   r\   rS   <module>r7     s   9x #  "   '  = & ) " - - S ! ( - 1('2* 0&
+,pJ pJf	pQ pQf0r\   