§
    þÊíjÏ  ã                   óÜ   — d Z ddlmZmZ  G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d	„ d
e¦  «        Z G d„ de¦  «        Z	 G d„ de¦  «        Z
 G d„ d¦  «        ZdS )z…Common DNS Exceptions.

Dnspython modules may also define their own exceptions, which will
always be subclasses of ``DNSException``.
é    )ÚOptionalÚSetc                   óž   ‡ — e Zd ZU dZdZee         ed<    e¦   «         Z	e
e         ed<   dZee         ed<   ˆ fd„Zd„ Zd„ Zd	„ Zˆ fd
„Zˆ xZS )ÚDNSExceptionaõ  Abstract base class shared by all dnspython exceptions.

    It supports two basic modes of operation:

    a) Old/compatible mode is used if ``__init__`` was called with
    empty *kwargs*.  In compatible mode all *args* are passed
    to the standard Python Exception class as before and all *args* are
    printed by the standard ``__str__`` implementation.  Class variable
    ``msg`` (or doc string if ``msg`` is ``None``) is returned from ``str()``
    if *args* is empty.

    b) New/parametrized mode is used if ``__init__`` was called with
    non-empty *kwargs*.
    In the new mode *args* must be empty and all kwargs must match
    those set in class variable ``supp_kwargs``. All kwargs are stored inside
    ``self.kwargs`` and used in a new ``__str__`` implementation to construct
    a formatted message based on the ``fmt`` class variable, a ``string``.

    In the simplest case it is enough to override the ``supp_kwargs``
    and ``fmt`` class variables to get nice parametrized messages.
    NÚmsgÚsupp_kwargsÚfmtc                 ó@  •—  | j         |i |¤Ž |r' | j        di |¤Ž| _        t          | ¦  «        | _        nt          ¦   «         | _        | j        €| j        | _        |r t          ¦   «         j        |Ž  d S t          ¦   «                              | j        ¦  «         d S ©N© )	Ú_check_paramsÚ_check_kwargsÚkwargsÚstrr   ÚdictÚ__doc__ÚsuperÚ__init__©ÚselfÚargsr   Ú	__class__s      €ú//usr/lib/python3/dist-packages/dns/exception.pyr   zDNSException.__init__7   sª   ø€ ØˆÔ˜DÐ+ FÐ+Ð+Ð+Øð 	!à,˜$Ô,Ð6Ð6¨vÐ6Ð6ˆDŒKÝ˜4‘y”yˆDŒHˆHå™&œ&ˆDŒKØŒ8Ðà”|ˆDŒHØð 	'Ø�E‰GŒGÔ˜dÐ#Ð#Ð#Ð#å‰GŒG×Ò˜TœXÑ&Ô&Ð&Ð&Ð&ó    c                 óf   — |s|r,t          |¦  «        t          |¦  «        k    s
J d¦   «         ‚dS dS )zsOld exceptions supported only args and not kwargs.

        For sanity we do not allow to mix old and new behavior.z=keyword arguments are mutually exclusive with positional argsN)Úbool)r   r   r   s      r   r   zDNSException._check_paramsG   sd   € ð ð 	O�6ð 	OÝ˜‘:”:¥Øñ"ô "ò ð ð àNñô ð ð ð ð	Oð 	Or   c                 ó‚   — |r<t          |                     ¦   «         ¦  «        | j        k    sJ d| j        z  ¦   «         ‚|S )Nz-following set of keyword args is required: %s)ÚsetÚkeysr   )r   r   s     r   r   zDNSException._check_kwargsP   sG   € Øð 	Tå�F—K’K‘M”MÑ"Ô" dÔ&6Ò6Ð6Ð6Ø>À$ÔBRÑSñ 7Ô6Ð6àˆr   c                 ó8  — i }|                      ¦   «         D ]‚\  }}t          |t          t          f¦  «        r\t          t	          t
          |¦  «        ¦  «        ||<   t          ||         ¦  «        dk    r||                              ¦   «         ||<   Œ}|||<   Œƒ|S )z˜Format kwargs before printing them.

        Resulting dictionary has to have keys necessary for str.format call
        on fmt class variable.
        é   )ÚitemsÚ
isinstanceÚlistr   Úmapr   ÚlenÚpop)r   r   ÚfmtargsÚkwÚdatas        r   Ú_fmt_kwargszDNSException._fmt_kwargsW   s’   € ð ˆØŸš™œð 	#ð 	#‰HˆB�Ý˜$¥¥s Ñ,Ô,ð #å"¥3¥s¨D¡>¤>Ñ2Ô2�˜‘Ý�w˜r”{Ñ#Ô# qÒ(Ð(à")¨"¤+§/¢/Ñ"3Ô"3�G˜B‘Køà"�˜‘�Øˆr   c                 ó¨   •— | j         r+| j        r$ | j        di | j         ¤Ž} | j        j        di |¤ŽS t	          ¦   «                              ¦   «         S r   )r   r	   r+   Úformatr   Ú__str__)r   r(   r   s     €r   r.   zDNSException.__str__i   s`   ø€ ØŒ;ð 	%˜4œ8ð 	%à&�dÔ&Ð5Ð5¨¬Ð5Ð5ˆGØ"�4”8”?Ð-Ð- WÐ-Ð-Ð-õ ‘7”7—?’?Ñ$Ô$Ð$r   )Ú__name__Ú
__module__Ú__qualname__r   r   r   r   Ú__annotations__r   r   r   r	   r   r   r   r+   r.   Ú__classcell__©r   s   @r   r   r      sÑ   ø€ € € € € € ðð ð, €Cˆ�#ŒÐÐÑØ˜C™EœE€K��S”Ð!Ð!Ñ!Ø€Cˆ�#ŒÐÐÑð'ð 'ð 'ð 'ð 'ð Oð Oð Oðð ð ðð ð ð$%ð %ð %ð %ð %ð %ð %ð %ð %r   r   c                   ó   — e Zd ZdZdS )Ú	FormErrorzDNS message is malformed.N©r/   r0   r1   r   r   r   r   r6   r6   s   s   € € € € € Ø#Ð#Ð#Ð#r   r6   c                   ó   — e Zd ZdZdS )ÚSyntaxErrorzText input is malformed.Nr7   r   r   r   r9   r9   w   s   € € € € € Ø"Ð"Ð"Ð"r   r9   c                   ó   — e Zd ZdZdS )ÚUnexpectedEndzText input ended unexpectedly.Nr7   r   r   r   r;   r;   {   s   € € € € € Ø(Ð(Ð(Ð(r   r;   c                   ó   — e Zd ZdZdS )ÚTooBigzThe DNS message is too big.Nr7   r   r   r   r=   r=      s   € € € € € Ø%Ð%Ð%Ð%r   r=   c                   ó,   ‡ — e Zd ZdZdhZdZˆ fd„Zˆ xZS )ÚTimeoutzThe DNS operation timed out.Útimeoutz7The DNS operation timed out after {timeout:.3f} secondsc                 ó:   •—  t          ¦   «         j        |i |¤Ž d S ©N)r   r   r   s      €r   r   zTimeout.__init__‹   s%   ø€ Ø�‰ŒÔ˜$Ð) &Ð)Ð)Ð)Ð)Ð)r   )r/   r0   r1   r   r   r	   r   r3   r4   s   @r   r?   r?   ƒ   sJ   ø€ € € € € Ø&Ð&à�+€KØ
C€Cð*ð *ð *ð *ð *ð *ð *ð *ð *r   r?   c                   ó    — e Zd Zd„ Zd„ Zd„ ZdS )ÚExceptionWrapperc                 ó   — || _         d S rB   )Úexception_class)r   rF   s     r   r   zExceptionWrapper.__init__�   s   € Ø.ˆÔÐÐr   c                 ó   — | S rB   r   )r   s    r   Ú	__enter__zExceptionWrapper.__enter__“   s   € Øˆr   c                 óz   — |�8t          || j        ¦  «        s#|                      t          |¦  «        ¦  «        |‚dS )NF)r#   rF   r   )r   Úexc_typeÚexc_valÚexc_tbs       r   Ú__exit__zExceptionWrapper.__exit__–   s;   € ØÐ­
°7¸DÔ<PÑ(QÔ(QÐØ×&Ò&¥s¨7¡|¤|Ñ4Ô4¸'ÐAØˆur   N)r/   r0   r1   r   rH   rM   r   r   r   rD   rD   �   sA   € € € € € ð/ð /ð /ðð ð ðð ð ð ð r   rD   N)r   Útypingr   r   Ú	Exceptionr   r6   r9   r;   r=   r?   rD   r   r   r   ú<module>rP      s`  ðð$ð ð !Ð  Ð  Ð  Ð  Ð  Ð  Ð  ðT%ð T%ð T%ð T%ð T%�9ñ T%ô T%ð T%ðn$ð $ð $ð $ð $�ñ $ô $ð $ð#ð #ð #ð #ð #�,ñ #ô #ð #ð)ð )ð )ð )ð )�Kñ )ô )ð )ð&ð &ð &ð &ð &ˆ\ñ &ô &ð &ð	*ð 	*ð 	*ð 	*ð 	*ˆlñ 	*ô 	*ð 	*ð
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð 
ð 
r   