
    .PhZ&                     2   d dl Z d dlmZ d dlmZ d dlmZmZmZm	Z	m
Z
mZmZmZmZ d dlZd dlmZ d dlmZmZmZmZ d dlmZ d dlmZ  G d	 d
e          Z G d de          Zde
eee	e         ef         f         dedee	e         ef         fdZde
eee	e         ef         f         ddfdZ ddddeeef         de
eee	e         ef         f         dee         de!deddfdZ"de j#        defdZ$	 d"dede j#        deee                  d e!ddf
d!Z%dS )#    N)defaultdict)dedent)	
CollectionDefaultDictDictListMappingOptionalSequenceSetUnion)Lockfile)LockedDependencyr   MetadataOptionlockfile_v1_to_v2conda_name_to_pypi_name)
Dependencyc                       e Zd ZdS )MissingLockfileVersionN__name__
__module____qualname__     \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/conda_lock/lockfile/__init__.pyr   r              Dr   r   c                       e Zd ZdS )UnknownLockfileVersionNr   r   r   r   r    r    "   r   r   r    dkeyreturnc                     	 | |         S # t           $ rN 	 | |                    dd                   cY S # t           $ r! | |                    dd                   cY cY S w xY ww xY w)N-_)KeyErrorreplace)r!   r"   s     r   _seperator_munge_getr)   &   s    ,v , , ,	,S[[c**++++ 	, 	, 	,S[[c**++++++	,,s)   
 
A"3A"&AA"AA"plannedc                     |                                  D ]0}t          |t                    s|g}|D ]}d|j        v rdh|_        1dS )z
    Given the package dependencies with their respective categories
    for any package that is in the main category, remove all other associated categories
    mainN)values
isinstancelist
categories)r*   targetstargets      r   _truncate_main_categoryr3   3   sm     >>## - -'4(( 	 iG 	- 	-F***%+H!	-- -r   )r,   devF)r0   convert_to_pip_names	requestedr0   r5   mapping_urlc                    i }t          t                    }dt          t          t                   t          f         dt          t                   ffd}dt
          dt
          dt
          dt
          ffd|                                 D ]\  }}	t                      }
t                      |}	  |t          ||                    }||k    r	                    |           |D ]+|

                    fd	j        D                        ,|
r|
                    d
          }nn|||<   ||	j                                     |	j                   g fd|D             t          t                    }D ]A}|                    |g           D ](}||         D ]}||                             |           )B| D ]}||                             |           |                                D ]^\  }}t          ||          }t#          |t                    s|g}|D ].}| |         }|D ]!}|j        	                    |j                   "/_t'          |           dS )zMmap each package onto the root request the with the highest-priority categoryplanned_itemsr#   c                 T    t          | t                    s| gS fd| D             S )Nc                 H    g | ]} |j         |j                   v|S )managerdepr7   )r=   name).0itemdep_namedepsr7   s     r   
<listcomp>zCapply_categories.<locals>.extract_planned_items.<locals>.<listcomp>d   sN     
 
 
x$)UUU    r   )r.   r/   )r9   rB   rC   r7   s    r   extract_planned_itemsz/apply_categories.<locals>.extract_planned_items^   sT     -.. 	#!?"
 
 
 
 
 
%
 
 
 	
r   r=   r>   r7   c                 :    r| dk    rt          ||          S |S )Nconda)r7   r   )r=   r>   r7   r5   s      r   rB   z"apply_categories.<locals>.dep_namek   s0       	IGw$6$6*3KHHHH
r   Tc              3   p   K   | ]0}|v |                     d            j        |          V  1dS )__r<   N)
startswithr=   )r@   r>   rB   rC   r7   planned_items     r   	<genexpr>z#apply_categories.<locals>.<genexpr>   sd         4KK3>>$+?+?K H , 4#;  
 (KKK r   r   c              3   $   K   | ]
}|v|V  d S )Nr   )r@   kr0   s     r   rL   z#apply_categories.<locals>.<genexpr>   s-       O Oq1J;N;N;N;N;N;N O Or   N)r   r/   r   r   r   stritemssetr)   addextenddependenciespopcategoryappendr?   getr.   r0   r3   )r6   r*   r0   r5   r7   
dependentsby_categoryrE   r?   requesttodorA   r9   root_requestsrV   roottransitive_depr>   rootsr1   sourcer2   rB   rC   rK   s     ```                 @@@r   apply_categoriesrb   D   s=   . ')Jd##K
T"235EEF
		
 
 
 
 
 
 
 
S s         #** #; #;g&&	
 212FwPT2U2UVVMt||  -           ,8	        xx{{3	6  
4G$%,,W\:::: Q:P O O O OK O O OPJ1<T1B1BM ; ;OOHb11 	; 	;D",T"2 ; ;n-44T::::;	;  ) )d""4((((#))++ 	7 	7
U&w44'4(( 	 iG 	7 	7Dt_F! 7 7!%%fo66667	7 G$$$$$r   pathc                    |                                  st          |  d          |                                 5 }t          j        |          }d d d            n# 1 swxY w Y   |                    dd           }|dk    r"t          t          j        |                    }nC|dk    rt          j        |          }n(|t          |  d          t          |  d|           |                                 |S )Nz
 not foundversion      z is missing a versionz has unknown version )existsFileNotFoundErroropenyaml	safe_loadrU   r   
LockfileV1model_validater   r   r    toposort_inplace)rc   fcontentre   lockfiles        r   parse_conda_lock_filers      s8   ;;== 54 3 3 3444	 $.##$ $ $ $ $ $ $ $ $ $ $ $ $ $ $kk)T**G!||$Z%>w%G%GHH	A*733	$%C%C%CDDD$%L%L7%L%LMMMOs   AA #A Trq   metadata_choicesinclude_help_textc                   	 |                                   |                                  |                    d          5 	|r=d | j        D             }dt          dd f	fd}|2t          |          dk    rd                    d |D                       nd	} |d
|j         d           d|v r |d|j         d           t          |	                    ddh                    }|rJ |dd                    |           dd                    d |D                        d|j         d            |d| d|j         d| d                    d | j
        j        D                        d|j         d
           |                                                                 }t          j        |	d           d d d            d S # 1 swxY w Y   d S )Nwc                 &    h | ]}|j         D ]}|S r   )r0   )r@   prV   s      r   	<setcomp>z(write_conda_lock_file.<locals>.<setcomp>   s;     $ $ $!,$ $6>$ $ $ $r   textr#   c                 "   t          |                               d          }t          |          D ][\  }}|dk    s|t          |          dz
  k    rt          |          dk    r5t	          d|z                                              \d S )N
r   rf   z# )file)r   split	enumeratelenprintrstrip)r{   linesidxlinerp   s       r   write_sectionz,write_conda_lock_file.<locals>.write_section   s    t**400!*5!1!1 : :ICqC3u::>$9$9s4yyA~~ 4$;..00q99999: :r   r    c                 "    g | ]}d |j          S )z--md )value)r@   mds     r   rD   z)write_conda_lock_file.<locals>.<listcomp>   s#    HHH,"(,,HHHr    a  
                This lock file was generated by conda-lock (https://github.com/conda/conda-lock). DO NOT EDIT!

                A "lock file" contains a concrete list of package versions (with checksums) to be installed. Unlike
                e.g. `conda env create`, the resulting environment will not change as new package versions become
                available, unless you explicitly update the lock file.

                Install this environment as "YOURENV" with:
                    conda-lock install -n YOURENV z
                r4   z
                    This lock contains optional development dependencies. Include them in the installed environment with:
                        conda-lock install --dev-dependencies -n YOURENV z
                    r,   zG
                    This lock contains optional dependency categories z, z]. Include them in the installed environment with:
                        conda-lock install c              3       K   | ]	}d |z   V  
dS )z-e Nr   )r@   extras     r   rL   z(write_conda_lock_file.<locals>.<genexpr>   s&      4W4WuUU]4W4W4W4W4W4Wr   z -n YOURENV z
                To update a single package to the latest version compatible with the version constraints in the source:
                    conda-lock lock z --lockfile z --update PACKAGE
                To re-solve the entire environment, e.g. after changing a version constraint in the source file:
                    conda-lock c              3       K   | ]	}d |z   V  
dS )z-f Nr   )r@   rc   s     r   rL   z(write_conda_lock_file.<locals>.<genexpr>   s&      8k8k$8k8k8k8k8k8kr   F)stream	sort_keys)alphasort_inplacefilter_virtual_packages_inplacerj   packagerO   r   joinr?   sorted
differencemetadatasourcesto_v1dict_for_outputrk   dump)
rq   rc   rt   ru   r0   r   metadata_flagsextrasoutputrp   s
            @r   write_conda_lock_filer      s    ++---	3 751 4	$ $")/$ $ $J:C :D : : : : : : $/C8H4I4IQ4N4N HH7GHHHIII  M	 489	 	 	   
""JN)     J1165/BBCCF GKyyQWGXGX ,/HH4W4WPV4W4W4W,W,W eien     M%3 AE  !/	 148k8kRYRbRj8k8k8k0k0k	  z~  zC	     0022	&e4444o75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75s   E>G

GG)T)&pathlibcollectionsr   textwrapr   typingr   r   r   r   r	   r
   r   r   r   rk   conda_lock.lockfile.v1.modelsr   rm   #conda_lock.lockfile.v2prelim.modelsr   r   r   conda_lock.lookupr   conda_lock.models.lock_specr   
ValueErrorr   r    rO   r)   r3   boolrb   Pathrs   r   r   r   r   <module>r      s%    # # # # # #      
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  @ @ @ @ @ @            6 5 5 5 5 5 2 2 2 2 2 2	 	 	 	 	Z 	 	 		 	 	 	 	Z 	 	 	
,sE$/02BBCCD
,KN
,
4 !#334
, 
, 
, 
,-S%%5 68H HIIJ-	- - - -* !0!&k% k% k%CO$k% S%%5 68H HIIJk% 	k%
 k% k% 
k% k% k% k%\     . #	?5 ?5?5
,?5 z.9:?5 	?5
 
?5 ?5 ?5 ?5 ?5 ?5r   