ó
    ÌÅLgA  ã                   ó  • S r SSKJrJr   " S S\5      r " S S\5      r " S S\5      r " S	 S
\5      r " S S\5      r	 " S S\5      r
 " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S5      rg)z…Common DNS Exceptions.

Dnspython modules may also define their own exceptions, which will
always be subclasses of ``DNSException``.
é    )ÚOptionalÚSetc                   ó’   ^ • \ rS rSr% SrSr\\   \S'   \	" 5       r
\\   \S'   Sr\\   \S'   U 4S jrS rS	 rS
 rU 4S jrSrU =r$ )ÚDNSExceptioné   aµ  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                 ó>  >• U R                   " U0 UD6  U(       a(  U R                  " S0 UD6U l        [        U 5      U l        O[        5       U l        U R                  c  U R                  U l        U(       a  [        TU ]   " U6   g [        TU ]!  U R                  5        g ©N© )	Ú_check_paramsÚ_check_kwargsÚkwargsÚstrr   ÚdictÚ__doc__ÚsuperÚ__init__©ÚselfÚargsr   Ú	__class__s      €Ú//usr/lib/python3/dist-packages/dns/exception.pyr   ÚDNSException.__init__7   sx   ø€ Ø×Ò˜DÐ+ FÒ+Þà×,Ò,Ñ6¨vÑ6ˆDŒKÜ˜4“yˆD�Hä›&ˆDŒKØ�8‰8Ñà—|‘|ˆDŒHÞÜ‰GÒ˜dÒ#ä‰GÑ˜TŸX™XÕ&ó    c                 ó`   • U(       d  U(       a   [        U5      [        U5      :w  d   S5       egg)zkOld 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   ÚDNSException._check_paramsG   s8   € ö –6Ü˜“:¤Øó"ó ð OàNóOñ ð r   c                 óŠ   • U(       a;  [        UR                  5       5      U R                  :X  d   SU R                   35       eU$ )Nz+following set of keyword args is required: )ÚsetÚkeysr	   )r   r   s     r   r   ÚDNSException._check_kwargsP   sC   € Þä�F—K‘K“MÓ" d×&6Ñ&6Ó6ðPà<¸T×=MÑ=MÐ<NÐOóPØ6àˆr   c                 ó  • 0 nUR                  5        Hh  u  p4[        U[        [        45      (       aD  [        [	        [
        U5      5      X#'   [        X#   5      S:X  a  X#   R                  5       X#'   Mb  Md  XBU'   Mj     U$ )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_kwargsÚDNSException._fmt_kwargsW   sr   € ð ˆØŸ™ž‰HˆBÜ˜$¤¤s ×,Ñ,ä"¤3¤s¨D£>Ó2�‘Ü�w‘{Ó# qÓ(à")¡+§/¡/Ó"3�G“Kñ )ð #˜“ñ 'ð ˆr   c                 óÔ   >• U R                   (       aI  U R                  (       a8  U R                  " S0 U R                   D6nU R                  R                  " S0 UD6$ [        TU ]  5       $ r   )r   r
   r/   Úformatr   Ú__str__)r   r,   r   s     €r   r3   ÚDNSException.__str__i   sL   ø€ Ø�;�;˜4Ÿ8Ÿ8à×&Ò&Ñ5¨¯©Ñ5ˆGØ—8‘8—?’?Ñ- WÑ-Ð-ô ‘7‘?Ó$Ð$r   )r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   r   r   Ú__annotations__r!   r	   r   r
   r   r   r   r/   r3   Ú__static_attributes__Ú__classcell__©r   s   @r   r   r      sU   ø‡ ñð, €Cˆ�#‰ÓÙ›E€K��S‘Ó!Ø€Cˆ�#‰Óõ'ò Oòò÷$%ó %r   r   c                   ó   • \ rS rSrSrSrg)Ú	FormErrorés   zDNS message is malformed.r   N©r5   r6   r7   r8   r   r:   r   r   r   r>   r>   s   s   † Ü#r   r>   c                   ó   • \ rS rSrSrSrg)ÚSyntaxErroréw   zText input is malformed.r   Nr@   r   r   r   rB   rB   w   ó   † Ü"r   rB   c                   ó   • \ rS rSrSrSrg)ÚUnexpectedEndé{   zText input ended unexpectedly.r   Nr@   r   r   r   rF   rF   {   s   † Ü(r   rF   c                   ó   • \ rS rSrSrSrg)ÚTooBigé   zThe DNS message is too big.r   Nr@   r   r   r   rI   rI      s   † Ü%r   rI   c                   ó6   ^ • \ rS rSrSrS1rSrU 4S jrSrU =r	$ )ÚTimeoutéƒ   zThe DNS operation timed out.Útimeoutz7The DNS operation timed out after {timeout:.3f} secondsc                 ó&   >• [         TU ]  " U0 UD6  g ©N)r   r   r   s      €r   r   ÚTimeout.__init__‹   s   ø€ Ü‰Ò˜$Ð) &Ó)r   r   )
r5   r6   r7   r8   r   r	   r
   r   r:   r;   r<   s   @r   rL   rL   ƒ   s   ø† Ù&à�+€KØ
C€C÷*ó *r   rL   c                   ó   • \ rS rSrSrSrg)ÚUnsupportedAlgorithmé�   z&The DNSSEC algorithm is not supported.r   Nr@   r   r   r   rS   rS   �   s   † Ü0r   rS   c                   ó   • \ rS rSrSrSrg)ÚAlgorithmKeyMismatché“   z=The DNSSEC algorithm is not supported for the given key type.r   Nr@   r   r   r   rV   rV   “   s   † ÜGr   rV   c                   ó   • \ rS rSrSrSrg)ÚValidationFailureé—   z The DNSSEC signature is invalid.r   Nr@   r   r   r   rY   rY   —   s   † Ü*r   rY   c                   ó   • \ rS rSrSrSrg)ÚDeniedByPolicyé›   zDenied by DNSSEC policy.r   Nr@   r   r   r   r\   r\   ›   rD   r   r\   c                   ó&   • \ rS rSrS rS rS rSrg)ÚExceptionWrapperéŸ   c                 ó   • Xl         g rP   ©Úexception_class)r   rc   s     r   r   ÚExceptionWrapper.__init__    s   € Ø.Õr   c                 ó   • U $ rP   r   )r   s    r   Ú	__enter__ÚExceptionWrapper.__enter__£   s   € Øˆr   c                 ót   • Ub5  [        X R                  5      (       d  U R                  [        U5      5      Ueg)NF)r'   rc   r   )r   Úexc_typeÚexc_valÚexc_tbs       r   Ú__exit__ÚExceptionWrapper.__exit__¦   s2   € ØÑ¬
°7×<PÑ<P×(QÑ(QØ×&Ñ&¤s¨7£|Ó4¸'ÐAØr   rb   N)r5   r6   r7   r8   r   rf   rl   r:   r   r   r   r_   r_   Ÿ   s   † ò/òõr   r_   N)r   Útypingr   r   Ú	Exceptionr   r>   rB   rF   rI   rL   rS   rV   rY   r\   r_   r   r   r   Ú<module>rp      s—   ðñ$÷ !ôT%�9ô T%ôn$�ô $ô#�,ô #ô)�Kô )ô&ˆ\ô &ô	*ˆlô 	*ô1˜<ô 1ôHÐ/ô Hô+˜ô +ô#�\ô #÷
ò 
r   