
    ?De                     X    d Z ddlZddlmZ ddlmZ  G d de          Zd Zd Zd	 Z	dS )
z
This is a convenience wrapper for dictionaries
returned from LDAP servers containing attribute
names of variable case.

See https://www.python-ldap.org/ for details.
    N)MutableMapping)__version__c                   n    e Zd ZdZdZddZd Zd Zd Zd Z	d	 Z
d
 Zd Zd ZeZd Zed             ZdS )cidictz:
    Case-insensitive but case-respecting dictionary.
    )_keys_dataNc                 T    i | _         i | _        |r|                     |           d S d S N)r   r   update)selfdefaults     /./ldap/cidict.py__init__zcidict.__init__   s:    

 	!KK     	! 	!    c                 @    | j         |                                         S r
   )r   lowerr   keys     r   __getitem__zcidict.__getitem__   s    z#))++&&r   c                 V    |                                 }|| j        |<   || j        |<   d S r
   r   r   r   )r   r   value	lower_keys       r   __setitem__zcidict.__setitem__   s-    IIKK	 #
9 %
9r   c                 N    |                                 }| j        |= | j        |= d S r
   r   )r   r   r   s      r   __delitem__zcidict.__delitem__$   s)    IIKK	Jy!Jy!!!r   c                 N    t          | j                                                  S r
   )iterr   valuesr   s    r   __iter__zcidict.__iter__)   s    DJ%%''(((r   c                 *    t          | j                  S r
   )lenr   r    s    r   __len__zcidict.__len__,   s    4:r   c                 8    |                                 | j        v S r
   )r   r   r   s     r   __contains__zcidict.__contains__1   s    yy{{dj((r   c                 j    | j                                          | j                                         d S r
   )r   clearr   r    s    r   r(   zcidict.clear4   s0    

r   c                     | j                             | j                   }| j                                        |_        | j                                        |_        |S r
   )	__class____new__r   copyr   )r   insts     r   r,   zcidict.copy8   sD    ~%%dn55Z__&&
Z__&&
r   c                 
    || v S )z"Compatibility with python-ldap 2.x r   s     r   has_keyzcidict.has_keyB   s    d{r   c                 H    t          j        dt          d           | j        S )z>Compatibility with older IterableUserDict-based implementationzOldap.cidict.cidict.data is an internal attribute; it may be removed at any time   category
stacklevel)warningswarnDeprecationWarningr   r    s    r   datazcidict.dataF   s2     	"'		
 	
 	
 	
 zr   r
   )__name__
__module____qualname____doc__	__slots__r   r   r   r   r!   r$   r&   r(   r,   __copy__r0   propertyr9   r/   r   r   r   r      s          #I! ! ! !' ' '& & &
" " "
) ) )  
) ) )     H     X  r   r   c                     t          j        dt          d           t                      |D ]}||<   fd| D             }|S )z{
  Return list of all items in a which are not in b (a - b).
  a,b are supposed to be lists of case-insensitive strings.
  ;strlist functions are deprecated and will be removed in 3.5r2   r3   c                     g | ]}|v|	S r/   r/   .0elttemps     r   
<listcomp>z!strlist_minus.<locals>.<listcomp>_   s*       
$ r   r6   r7   r8   r   abrF   resultrG   s       @r   strlist_minusrN   R   s{    
 -A   
 
$  cDII     &
 
-r   c                     t          j        dt          d           t                      | D ]}||<   fd|D             }|S )zG
  Return intersection of two lists of case-insensitive strings a,b.
  rB   r2   r3   c                 (    g | ]}|v |         S r/   r/   rD   s     r   rH   z(strlist_intersection.<locals>.<listcomp>s   s.       
d{{ 	I{{r   rI   rJ   s       @r   strlist_intersectionrQ   g   s{     -A   
 
$  cDII     &
 
-r   c                     t          j        dt          d           t                      }| D ]}|||<   |D ]}|||<   |                                S )z@
  Return union of two lists of case-insensitive strings a,b.
  rB   r2   r3   )r6   r7   r8   r   r   )rK   rL   rG   rF   s       r   strlist_unionrS   {   ss     -A   
 
$  cDII  cDII	r   )
r=   r6   collections.abcr   ldapr   r   rN   rQ   rS   r/   r   r   <module>rV      s      * * * * * *      A A A A A^ A A AH  *  (    r   