HEX
Server: LiteSpeed
System: Linux srv146.niagahoster.com 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
User: kodi1989 (1633)
PHP: 8.1.34
Disabled: symlink,shell_exec,exec,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source,pcntl_exec
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/dns/__pycache__/exception.cpython-37.pyc
B

��f��@s�dZddlmZmZGdd�de�ZGdd�de�ZGdd�de�ZGd	d
�d
e�ZGdd�de�Z	Gd
d�de�Z
Gdd�d�ZdS)z�Common DNS Exceptions.

Dnspython modules may also define their own exceptions, which will
always be subclasses of ``DNSException``.
�)�Optional�SetcsxeZdZUdZdZeeed<e�Z	e
eed<dZeeed<�fdd�Zdd	�Z
d
d�Zdd
�Z�fdd�Z�ZS)�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�fmtcsh|j||�|r*|jf|�|_t|�|_nt�|_|jdkrD|j|_|rVt�j|�nt��|j�dS)N)	�
_check_params�
_check_kwargs�kwargs�strr�dict�__doc__�super�__init__)�self�argsr
)�	__class__��>/opt/alt/python37/lib/python3.7/site-packages/dns/exception.pyr7s
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)rrr
rrrrGs
zDNSException._check_paramscKs(|r$t|���|jks$td|j��|S)Nz-following set of keyword args is required: %s)�set�keysrr)rr
rrrr	PszDNSException._check_kwargscKshi}x^|��D]R\}}t|ttf�rXttt|��||<t||�dkr`||��||<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_kwargsWszDNSException._fmt_kwargscs6|jr(|jr(|jf|j�}|jjf|�St���SdS)N)r
rr#�formatr�__str__)rr )rrrr%iszDNSException.__str__)�__name__�
__module__�__qualname__r
rrr�__annotations__rrrrrrr	r#r%�
__classcell__rr)rrrs
	rc@seZdZdZdS)�	FormErrorzDNS message is malformed.N)r&r'r(r
rrrrr+ssr+c@seZdZdZdS)�SyntaxErrorzText input is malformed.N)r&r'r(r
rrrrr,wsr,c@seZdZdZdS)�
UnexpectedEndzText input ended unexpectedly.N)r&r'r(r
rrrrr-{sr-c@seZdZdZdS)�TooBigzThe DNS message is too big.N)r&r'r(r
rrrrr.sr.cs*eZdZdZdhZdZ�fdd�Z�ZS)�TimeoutzThe DNS operation timed out.�timeoutz7The DNS operation timed out after {timeout:.3f} secondscst�j||�dS)N)rr)rrr
)rrrr�szTimeout.__init__)r&r'r(r
rrrr*rr)rrr/�sr/c@s$eZdZdd�Zdd�Zdd�ZdS)�ExceptionWrappercCs
||_dS)N)�exception_class)rr2rrrr�szExceptionWrapper.__init__cCs|S)Nr)rrrr�	__enter__�szExceptionWrapper.__enter__cCs(|dk	r$t||j�s$|�t|��|�dS)NF)rr2r)r�exc_type�exc_val�exc_tbrrr�__exit__�szExceptionWrapper.__exit__N)r&r'r(rr3r7rrrrr1�sr1N)r
�typingrr�	Exceptionrr+r,r-r.r/r1rrrr�<module>sW