Your IP : 3.142.197.111


Current Path : /usr/lib/python3.6/site-packages/dns/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/dns/__pycache__/exception.cpython-36.pyc

3

d��W�@shdZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGd	d
�d
e�ZGdd�de�Zd
S)zCommon DNS Exceptions.csReZdZdZdZe�ZdZ�fdd�Zdd�Z	dd�Z
d	d
�Z�fdd�Z�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 standard Python Exception class
    as before and all *args are printed by 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 has to be empty and all kwargs has to exactly match
    set in class variable self.supp_kwargs. All kwargs are stored inside
    self.kwargs and used in new __str__ implementation to construct
    formatted message based on self.fmt string.

    In the simplest case it is enough to override supp_kwargs and fmt
    class variables to get nice parametrized messages.
    Ncsp|j||�|r*|jf|�|_t|�|_nt�|_|jdkrD|j|_|rZtt|�j	|�ntt|�j	|j�dS)N)
�
_check_params�
_check_kwargs�kwargs�str�msg�dict�__doc__�superr�__init__)�self�argsr)�	__class__��/usr/lib/python3.6/exception.pyr
.s
zDNSException.__init__cOs$|s|r t|�t|�ks td��dS)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�AssertionError)rrrrrrr=szDNSException._check_paramscKs(|r$t|j��|jks$td|j��|S)Nz-following set of keyword args is required: %s)�set�keys�supp_kwargsr)rrrrrrEs

zDNSException._check_kwargscKshi}x^|j�D]R\}}t|ttf�rXttt|��||<t||�dkr`||j�||<q|||<qW|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)rr�fmtargs�kw�datarrr�_fmt_kwargsLszDNSException._fmt_kwargscs:|jr(|jr(|jf|j�}|jjf|�Stt|�j�SdS)N)r�fmtr�formatr	r�__str__)rr)r
rrr"^szDNSException.__str__)�__name__�
__module__�__qualname__rrrrr r
rrrr"�
__classcell__rr)r
rrsrc@seZdZdZdS)�	FormErrorzDNS message is malformed.N)r#r$r%rrrrrr'hsr'c@seZdZdZdS)�SyntaxErrorzText input is malformed.N)r#r$r%rrrrrr(msr(c@seZdZdZdS)�
UnexpectedEndzText input ended unexpectedly.N)r#r$r%rrrrrr)rsr)c@seZdZdZdS)�TooBigzThe DNS message is too big.N)r#r$r%rrrrrr*wsr*c@seZdZdZedg�ZdZdS)�TimeoutzThe DNS operation timed out.Ztimeoutz3The DNS operation timed out after {timeout} secondsN)r#r$r%rrrr rrrrr+|s
r+N)r�	Exceptionrr'r(r)r*r+rrrr�<module>sU

?>