
    h0                        S r SSK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)zCommon DNS Exceptions.

Dnspython modules may also define their own exceptions, which will
always be subclasses of ``DNSException``.
    )Setc                      ^  \ rS rSr% SrSr\S-  \S'   \" 5       r	\
\   \S'   Sr\S-  \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      bC:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\site-packages\dns/exception.pyr   DNSException.__init__7   sx    D+F+,,6v6DK4yDH&DK88||DHGd#GTXX&    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    FKKM"d&6&66P<T=M=M<NOP6r   c                    0 nUR                  5        Hi  u  p4[        U[        [        -  5      (       aD  [        [	        [
        U5      5      X#'   [        X#   5      S:X  a  X#   R                  5       X#'   Mc  Me  XBU'   Mk     U$ )zFormat 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     HB$s
++"3sD>2w{#q(")+//"3GK ) # ' 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   r2   DNSException.__str__i   sL    ;;488&&55G88??-W-- 7?$$r   )r   r   )__name__
__module____qualname____firstlineno__r   r   r   __annotations__r    r   r   r	   r   r   r   r.   r2   __static_attributes____classcell__r   s   @r   r   r      sU    , CtEKS!Ct' O$% %r   r   c                       \ rS rSrSrSrg)	FormErrors   zDNS message is malformed.r   Nr4   r5   r6   r7   r   r9   r   r   r   r=   r=   s   s    #r   r=   c                       \ rS rSrSrSrg)SyntaxErrorw   zText input is malformed.r   Nr?   r   r   r   rA   rA   w       "r   rA   c                       \ rS rSrSrSrg)UnexpectedEnd{   zText input ended unexpectedly.r   Nr?   r   r   r   rE   rE   {   s    (r   rE   c                       \ rS rSrSrSrg)TooBig   zThe DNS message is too big.r   Nr?   r   r   r   rH   rH      s    %r   rH   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   )
r4   r5   r6   r7   r   r   r	   r   r9   r:   r;   s   @r   rK   rK      s    &+K
CC* *r   rK   c                       \ rS rSrSrSrg)UnsupportedAlgorithm   z&The DNSSEC algorithm is not supported.r   Nr?   r   r   r   rR   rR      s    0r   rR   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   rU   rU      s    Gr   rU   c                       \ rS rSrSrSrg)ValidationFailure   z The DNSSEC signature is invalid.r   Nr?   r   r   r   rX   rX      s    *r   rX   c                       \ rS rSrSrSrg)DeniedByPolicy   zDenied by DNSSEC policy.r   Nr?   r   r   r   r[   r[      rC   r   r[   c                   &    \ rS rSrS rS rS rSrg)ExceptionWrapper   c                     Xl         g rO   exception_class)r   rb   s     r   r   ExceptionWrapper.__init__   s    .r   c                     U $ rO   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&   rb   r   )r   exc_typeexc_valexc_tbs       r   __exit__ExceptionWrapper.__exit__   s2    
7<P<P(Q(Q&&s7|4'Ar   ra   N)r4   r5   r6   r7   r   re   rk   r9   r   r   r   r^   r^      s    /r   r^   N)r   typingr   	Exceptionr   r=   rA   rE   rH   rK   rR   rU   rX   r[   r^   r   r   r   <module>ro      s   $ T%9 T%n$ $#, #)K )&\ &	*l 	*1< 1H/ H+ +#\ #
 
r   