
    BThQ                     V    d dl Z d dlmZmZ  G d de      Zd Zd Zd Zd Zd	 fd
Z	y)    N)MappingMutableMappingc                   N    e Zd ZdZddZd Zd Zd Zd Zd Z	d	 Z
d
 Zd Zd Zy)CaseInsensitiveDicta  
    A case-insensitive ``dict``-like object.
    Implements all methods and operations of
    ``collections.abc.MutableMapping`` as well as dict's ``copy``. Also
    provides ``lower_items``.
    All keys are expected to be strings. The structure remembers the
    case of the last key to be set, and ``iter(instance)``,
    ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()``
    will contain case-sensitive keys. However, querying and contains
    testing is case insensitive::
        cid = CaseInsensitiveDict()
        cid['Accept'] = 'application/json'
        cid['aCCEPT'] == 'application/json'  # True
        list(cid) == ['Accept']  # True
    For example, ``headers['content-encoding']`` will return the
    value of a ``'Content-Encoding'`` response header, regardless
    of how the header name was originally stored.
    If the constructor, ``.update``, or equality comparison
    operations are given keys that have equal ``.lower()``s, the
    behavior is undefined.
    Nc                 @    i | _         |i } | j                  |fi | y N)_storeupdate)selfdatakwargss      Z/var/www/catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/vcr/util.py__init__zCaseInsensitiveDict.__init__   s&    <DD#F#    c                 B    ||f| j                   |j                         <   y r   r	   lower)r   keyvalues      r   __setitem__zCaseInsensitiveDict.__setitem__#   s     %(<CIIK r   c                 B    | j                   |j                            d   S )N   r   r   r   s     r   __getitem__zCaseInsensitiveDict.__getitem__(   s    {{399;'**r   c                 :    | j                   |j                         = y r   r   r   s     r   __delitem__zCaseInsensitiveDict.__delitem__+   s    KK		$r   c                 D    d | j                   j                         D        S )Nc              3   &   K   | ]	  \  }}|  y wr    ).0casedkeymappedvalues      r   	<genexpr>z/CaseInsensitiveDict.__iter__.<locals>.<genexpr>/   s     K2X{Ks   )r	   valuesr   s    r   __iter__zCaseInsensitiveDict.__iter__.   s    Kdkk6H6H6JKKr   c                 ,    t        | j                        S r   )lenr	   r%   s    r   __len__zCaseInsensitiveDict.__len__1   s    4;;r   c                 D    d | j                   j                         D        S )z.Like iteritems(), but with all lowercase keys.c              3   0   K   | ]  \  }}||d    f  yw)r   Nr   )r    lowerkeykeyvals      r   r#   z2CaseInsensitiveDict.lower_items.<locals>.<genexpr>6   s     T*<8V6!9%Ts   )r	   itemsr%   s    r   lower_itemszCaseInsensitiveDict.lower_items4   s    T@Q@Q@STTr   c                     t        |t              rt        |      }nt        S t	        | j                               t	        |j                               k(  S r   )
isinstancer   r   NotImplementeddictr/   )r   others     r   __eq__zCaseInsensitiveDict.__eq__8   sC    eW%'.E!!D$$&'40A0A0C+DDDr   c                 H    t        | j                  j                               S r   )r   r	   r$   r%   s    r   copyzCaseInsensitiveDict.copyA   s    "4;;#5#5#788r   c                 F    t        t        | j                                     S r   )strr3   r.   r%   s    r   __repr__zCaseInsensitiveDict.__repr__D   s    4

%&&r   r   )__name__
__module____qualname____doc__r   r   r   r   r&   r)   r/   r5   r7   r:   r   r   r   r   r      s<    ,$0
+%L UE9'r   r   c                 f    i }i }|j                         D ]  \  }} | ||      r|n|}|||<    ||fS r   )r.   )	predicate
dictionary	true_dict
false_dictr   r   	this_dicts          r   partition_dictrE   H   sN    IJ &&( 
U!*3!6IJ		# j  r   c                        fd}|S )Nc                 B    | }t              D ]  }|s ||      } |S r   )reversed)incomingresfunction	functionss      r   composedzcompose.<locals>.composedR   s/     + 	$Hsm	$ 
r   r   )rL   rM   s   ` r   composerN   Q   s     Or   c                 j    t        | d      xr& t        | t        t        t        t
        t        f       S )Nr&   )hasattrr1   	bytearraybytesr3   listr9   )objs    r   _is_nonsequence_iteratorrU   \   s3    3
# J	E4s+- ) r   c                     t        | j                  d      r| j                  j                         S t        | j                        rt	        | j                        }|rt        |d   t              r dj                  |      j                  d      S t        |d   t        t        f      rdj                  |      S t        |d   t              rt        |      S t        dt        |d          d      y| j                  S )Nreadr    zutf-8r   z
Body type z not supported)rP   bodyrW   rU   rS   r1   r9   joinencoderR   rQ   int
ValueErrortype)requestrY   s     r   	read_bodyr`   c   s    w||V$||  ""-GLL!$q'3'wwt}++G44DGeY%78xx~%DGS)T{" :d47m_N!KLL<<r   c                 6    t        |t        j                        S r   )r1   typesFunctionType)namer   s     r   <lambda>re   u   s    :eUM_M_;` r   c                 :      fd G fddt               }|S )Nc                 *     | |      r |      }|S r   r   )	attributer   	decoratorr@   s     r   maybe_decoratez%auto_decorate.<locals>.maybe_decoratev   s    Y&e$Er   c                   .     e Zd Z fdZ fdZ xZS )"auto_decorate.<locals>.DecorateAllc                 2    t         |   | ||            S r   )super__setattr__)clsrh   r   	__class__rj   s      r   ro   z.auto_decorate.<locals>.DecorateAll.__setattr__|   s    7&y.E2RSSr   c           	          |j                         D ci c]  \  }}| ||       }}}t        | 	  | |||      S c c}}w r   )r.   rn   __new__)	rp   rd   basesattributes_dictrh   r   new_attributes_dictrq   rj   s	          r   rs   z*auto_decorate.<locals>.DecorateAll.__new__   sT    TcTiTiTk#@P	5	>)U;;# # 7?3e5HII#s   >)r;   r<   r=   ro   rs   __classcell__)rq   rj   s   @r   DecorateAllrl   {   s    	T	J 	Jr   rx   )r^   )ri   r@   rx   rj   s   `` @r   auto_decoratery   u   s    
Jd J r   )
rb   collections.abcr   r   r   rE   rN   rU   r`   ry   r   r   r   <module>r{      s7     3?'. ?'D!$ (a r   