
    $TXg
                         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
  e	d	d
d      d        Z G d de      Zedd fdZedd fdZy# e$ r	 ddlm
Z
 Y :w xY w)zCommon collection classes.    )reduce)MappingSet   )
isiterable   )
deprecated)
frozendictz24.9z25.3z$Use `frozendict.deepfreeze` instead.)addendumc                 P   t        | t              r2t        | t              r| S t        d | j                         D              S t        | t              r$t        | t
              r| S t        d | D              S t        |       r$t        | t              r| S t        d | D              S | S )Nc              3   <   K   | ]  \  }}|t        |      f  y wNmake_immutable).0kvs      7lib/python3.12/site-packages/conda/auxlib/collection.py	<genexpr>z!make_immutable.<locals>.<genexpr>   s     K]TQ1nQ/0]s   c              3   2   K   | ]  }t        |        y wr   r   r   r   s     r   r   z!make_immutable.<locals>.<genexpr>   s     :Eq*E   c              3   2   K   | ]  }t        |        y wr   r   r   s     r   r   z!make_immutable.<locals>.<genexpr>   s     61^A&r   )
isinstancer   r
   itemsr   	frozensetr   tuple)values    r   r   r      s     %!eZ(LKU[[]KKK	E3	eY'L:E:::	E	eU#L6666    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                 2    t        |   |i | | | _        y 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!   #   s    	 r   r!   Nc                     | S r    xs    r   <lambda>r3   3   s    qr   c                 ^    t        fd| D        t        |      r |             S |      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   @   K   | ]  } |      s |        y wr   r0   r   r2   applykeys     r   r   zfirst.<locals>.<genexpr>Q   s     13a#a&q3   )nextcallableseqr8   defaultr7   s    ` `r   firstr?   3   s*    < 131@Q79__W^__r   c                     | S r   r0   r1   s    r   r3   r3   T   s    ar   c                 D    t        fdt        |       D        |      S )Nc              3   @   K   | ]  } |      s |        y wr   r0   r6   s     r   r   zlast.<locals>.<genexpr>U   s     ;=aCFq=r9   )r:   reversedr<   s    ` `r   lastrD   T   s    ;8C=;WEEr   )r-   	functoolsr   collections.abcr   r   compatr   deprecationsr	   r
   ImportError_vendor.frozendictr   dictr!   boolr?   rD   r0   r   r   <module>rM      s{       (  %0%
 FF%KL M(t   [ `B K FU  0/0s   A AA