
    .Ph	              	          d dl Z d dlZd dlZd dlZ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  ed          Z	 ddee
         dee
e
f         de
d	e
fd
Zdeeej        f         d	efdZdedeeej        f         d	dfdZeded	eej                 fd            Zdeeej        f         d	efdZdeee                  d	ee         fdZdej        dej        d	efdZded	dfdZdS )    N)contextmanager)chain)	AnyDictIterableIteratorListMappingSequenceTypeVarUnionTkeysnested_dictdefaultreturnc                 z    ddl }ddlm} 	  ||j        | |          S # t          t
          t          f$ r |cY S w xY w)zX
    >>> foo = {'a': {'b': {'c': 1}}}
    >>> get_in(['a', 'b'], foo)
    {'c': 1}

    r   N)reduce)operator	functoolsr   getitemKeyError
IndexError	TypeError)r   r   r   r   r   s        Q/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/conda_lock/common.pyget_inr      sf     OOO      vh&k:::j),   s    ::filepathc                 |    t          |           5 }|                                cd d d            S # 1 swxY w Y   d S N)openreadr   fps     r   	read_filer$   ,   sz    	h 2wwyy                    155objc                     t          |d          5 }|                    |            d d d            d S # 1 swxY w Y   d S )Nw)mode)r    write)r&   r   r#   s      r   
write_filer+   1   s    	hS	!	!	! R
                 s   599contentc              #   ,  K   t          j        d          }	 |                                 t          | |j                   t          j        |j                  V  t          j        |j                   dS # t          j        |j                   w xY w)zGenerate a temporary file with the given content.  This file can be used by subprocesses

    On Windows, NamedTemporaryFiles can't be opened a second time, so we have to close it first (and delete it manually later)
    F)deleteN)	tempfileNamedTemporaryFilecloser+   namepathlibPathosunlink)r,   tfs     r   temporary_file_with_contentsr8   6   s       
	$E	2	2	2B



7BG$$$l27#####
	"'	"'s   AA8 8Bc                 |    t          |           5 }t          j        |          cd d d            S # 1 swxY w Y   d S r   )r    jsonloadr"   s     r   	read_jsonr<   E   sz    	h 2y}}                 r%   collectionsc                 |    t          d t          j        |           D                                                       S )Nc                     i | ]}||S  r@   ).0ks     r   
<dictcomp>z!ordered_union.<locals>.<dictcomp>K   s    @@@!A@@@    )listr   from_iterablevalues)r=   s    r   ordered_unionrH   J   s6    @@u2;??@@@GGIIJJJrD   sourcetargetc                    t          j        t          j                            |                     d          |                    d          f                    }dgt          |                                                     |          j                  z  }|                                                    |          j	        }t          t          j        | t          j        | z            S )z
    Get posix representation of the relative path from `source` to `target`.
    Both `source` and `target` must exist on the filesystem.
    T)strictz..)r3   PurePathr5   path
commonpathresolvelenrelative_toparentspartsstrPurePosixPath)rI   rJ   commonupdowns        r   relative_pathrZ   N   s    
 
FNN$N77t9T9TUVV F #fnn&&226::BCC	CB>>''//5Dw$b)G,A4,HHIIIrD   msgc                 2    t          j        | d           d S )N   )
stacklevel)warningswarn)r[   s    r   r`   r`   [   s    M#!$$$$$$rD   r   )r:   r5   r3   r/   r_   
contextlibr   	itertoolsr   typingr   r   r   r   r	   r
   r   r   r   r   r   rU   r4   r$   r+   r8   r<   rH   rZ   r`   r@   rD   r   <module>rd      s{    				    % % % % % %      
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 GCLL IM 
3-&-c3h&7BE   &c7</0 S    
C 5gl):#;     
 # (7<2H    c7</0 T    
Kx4 Ka K K K K
J', 
J 
J 
J 
J 
J 
J%c %d % % % % % %rD   