
    df,                     |    d dl Zd dlmZ d dlmZ e G d dej                  j                               ZdedefdZ	y)	    N)Any)	immutablec                   6    e Zd Zd	dedefdZd Zd Zd Zd Z	y)
Dict
dictionaryno_copyc                 t    |rt        |t              r|| _        d| _        yt        |      | _        d| _        y)a  Make an immutable dictionary from the specified dictionary.

        If *no_copy* is `True`, then *dictionary* will be wrapped instead
        of copied.  Only set this if you are sure there will be no external
        references to the dictionary.
        N)
isinstancedict_odict_hash)selfr   r   s      F/home/api-vastappli/venv/lib/python3.12/site-packages/dns/immutable.py__init__zDict.__init__   s5     z*d3$DK 
 z*DK
    c                 8    | j                   j                  |      S N)r   __getitem__)r   keys     r   r   zDict.__getitem__   s    {{&&s++r   c                     | j                   Od}t        | j                  j                               D ]  }|t	        |      z  } t
        j                  | d|       | j                   S )Nr   r   )r   sortedr   keyshashobject__setattr__)r   hr   s      r   __hash__zDict.__hash__   s[    ::Adkk..01 T#YtWa0zzr   c                 ,    t        | j                        S r   )lenr   r   s    r   __len__zDict.__len__$   s    4;;r   c                 ,    t        | j                        S r   )iterr   r    s    r   __iter__zDict.__iter__'   s    DKK  r   N)F)
__name__
__module____qualname__r   boolr   r   r   r!   r$    r   r   r   r   	   s)    3  , !r   r   oreturnc                    t        | t              rt        |       S t        | t              r	 t	        |        | S t        | t              rt        d | D              S t        | t              r<t               }| j                         D ]  \  }}t        |      ||<    t        |d      S | S # t
        $ r t        d | D              cY S w xY w)z3
    Convert mutable types to immutable types.
    c              3   2   K   | ]  }t        |        y wr   constify.0elts     r   	<genexpr>zconstify.<locals>.<genexpr>6   s     43#4   c              3   2   K   | ]  }t        |        y wr   r.   r0   s     r   r3   zconstify.<locals>.<genexpr>8   s     0sXc]0r4   T)r
   	bytearraybytestupler   	Exceptionlistr   itemsr/   r   )r*   cdictkvs       r   r/   r/   +   s     !YQx!U	5GH !T0a000!TGGI 	#DAq{E!H	#E4  H  	54!444	5s   B* *CC)
collections.abccollectionstypingr   dns._immutable_ctxr   abcMappingr   r/   r)   r   r   <module>rE      sI      ( !;??"" ! !B  r   