
    DIe@                         d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZ d	 Z G d
 de          Zedd fdZ edd          d dd fd            Zedd fdZ edd          d             ZdS )zCommon collection classes.    )reduce)MappingSet   )
isiterable   )
frozendict)
deprecatedc                    t          | t                    rBt          | t                    r| S t          d |                                 D                       S t          | t                    r0t          | t
                    r| S t          d | D                       S t          |           r0t          | t                    r| S t          d | D                       S | S )Nc              3   >   K   | ]\  }}|t          |          fV  d S Nmake_immutable).0kvs      7lib/python3.11/site-packages/conda/auxlib/collection.py	<genexpr>z!make_immutable.<locals>.<genexpr>   s3      KKTQ1nQ//0KKKKKK    c              3   4   K   | ]}t          |          V  d S r   r   r   r   s     r   r   z!make_immutable.<locals>.<genexpr>   s*      ::q**::::::r   c              3   4   K   | ]}t          |          V  d S r   r   r   s     r   r   z!make_immutable.<locals>.<genexpr>   s*      661^A&&666666r   )
isinstancer   r	   itemsr   	frozensetr   tuple)values    r   r   r   
   s     %!! eZ(( 	LKKU[[]]KKKKKK	E3		 	eY'' 	L::E::::::	E		 eU## 	L66666666r   c                   "     e Zd ZdZ fdZ xZS )AttrDictzSub-classes dict, and further allows attribute-like access to dictionary items.

    Examples:
        >>> d = AttrDict({'a': 1})
        >>> d.a, d['a'], d.get('a')
        (1, 1, 1)
        >>> d.b = 2
        >>> d.b, d['b']
        (2, 2)
    c                 H     t                      j        |i | | | _        d S r   )super__init____dict__)selfargskwargs	__class__s      r   r"   zAttrDict.__init__)   s*    $)&)))r   )__name__
__module____qualname____doc__r"   __classcell__)r'   s   @r   r   r      sB        	 	        r   r   Nc                     | S r    xs    r   <lambda>r1   .   s    q r   c                 r    t          fd| D             t          |          r
 |            n|          S )a  Give the first value that satisfies the key test.

    Args:
        seq (iterable):
        key (callable): test for each element of iterable
        default: returned when all elements fail test
        apply (callable): applied to element before return, but not to default value

    Returns: first element in seq that passes key, mutated with optional apply

    Examples:
        >>> first([0, False, None, [], (), 42])
        42
        >>> first([0, False, None, [], ()]) is None
        True
        >>> first([0, False, None, [], ()], default='ohai')
        'ohai'
        >>> import re
        >>> m = first(re.match(regex, 'abc') for regex in ['b.*', 'a(.*)'])
        >>> m.group(1)
        'bc'

        The optional `key` argument specifies a one-argument predicate function
        like that used for `filter()`.  The `key` argument, if supplied, must be
        in keyword form.  For example:
        >>> first([1, 1, 3, 4, 5], key=lambda x: x % 2 == 0)
        4

    c              3   D   K   | ]} |           |          V  d S r   r.   r   r0   applykeys     r   r   zfirst.<locals>.<genexpr>L   s8      11a##a&&1q111111r   )nextcallableseqr6   defaultr5   s    ` `r   firstr<   .   sF    < 111113111@Q@Q3^77999W^___r   z24.3z24.9c                      t          |           S r   )boolr   r   s     r   r1   r1   P   s    DGG r   c                 
    | |fS r   r.   r?   s     r   r1   r1   P   s    qRSf r   c                 @    t          fd| D             |          S )Nc              3   N   K   | ]\  }} ||           ||          V   d S r   r.   )r   r   r   r5   r6   s      r   r   zfirstitem.<locals>.<genexpr>Q   s@      ::AAq		:q!::::::r   )r7   )mapr6   r;   r5   s    ` `r   	firstitemrD   O   s,    ::::::::GDDDr   c                     | S r   r.   r/   s    r   r1   r1   T   s    a r   c                 Z    t          fdt          |           D             |          S )Nc              3   D   K   | ]} |           |          V  d S r   r.   r4   s     r   r   zlast.<locals>.<genexpr>U   s8      ;;aCCFF;q;;;;;;r   )r7   reversedr9   s    ` `r   lastrI   T   s2    ;;;;;8C==;;;WEEEr   c                     	 t          d |            dS # t          $ r}t          |          dk    r Y d}~dS d}~ww xY w)zjCalls each element of sequence to invoke the side effect.

    Args:
        seq:

    Returns: None

    c                      |            S r   r.   )_ys     r   r1   zcall_each.<locals>.<lambda>c   s    AACC r   z0reduce() of empty sequence with no initial valueN)r   	TypeErrorstr)r:   es     r   	call_eachrQ   X   sj    %%%%%   q66GGG HGGGGGs    
>9>)r+   	functoolsr   collections.abcr   r   compatr   _vendor.frozendictr	   deprecationsr
   r   dictr   r>   r<   rD   rI   rQ   r.   r   r   <module>rX      s\             ( ( ( ( ( ( ( (       + + + + + + % % % % % %  (    t     [[ ` ` ` `B FF++TATAT E E E E KK F F F F FF    r   