HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/dns/__pycache__/exception.cpython-310.pyc
o

!weE�@s�dZddlmZmZGdd�de�ZGdd�de�ZGdd�de�ZGd	d
�d
e�ZGdd�de�Z	Gd
d�de�Z
Gdd�de�ZGdd�de�ZGdd�de�Z
Gdd�de�ZGdd�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�fmtcsr|j|i|��|r|jdi|��|_t|�|_nt�|_|jdur&|j|_|r0t�j|�dSt��|j�dS�N�)	�
_check_params�
_check_kwargs�kwargs�strr�dict�__doc__�super�__init__��self�argsr��	__class__r	�F/home/arjun/projects/env/lib/python3.10/site-packages/dns/exception.pyr7s
zDNSException.__init__cOs(|s|rt|�t|�ksJd��dSdS)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)�boolrr	r	rr
Gs���zDNSException._check_paramscKs(|rt|���|jksJd|j��|S)Nz-following set of keyword args is required: %s)�set�keysr)rrr	r	rrPs
�zDNSException._check_kwargscKsdi}|��D])\}}t|ttf�r+ttt|��||<t||�dkr*||��||<q|||<q|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�datar	r	r�_fmt_kwargsWs�
zDNSException._fmt_kwargscs:|jr|jr|jdi|j��}|jjdi|��St���Sr)rrr%�formatr�__str__)rr"rr	rr'is
zDNSException.__str__)�__name__�
__module__�__qualname__rrrr
�__annotations__rrrrrr
rr%r'�
__classcell__r	r	rrrs
	rc@�eZdZdZdS)�	FormErrorzDNS message is malformed.N�r(r)r*rr	r	r	rr.s�r.c@r-)�SyntaxErrorzText input is malformed.Nr/r	r	r	rr1wr0r1c@r-)�
UnexpectedEndzText input ended unexpectedly.Nr/r	r	r	rr2{r0r2c@r-)�TooBigzThe DNS message is too big.Nr/r	r	r	rr3r0r3cs*eZdZdZdhZdZ�fdd�Z�ZS)�TimeoutzThe DNS operation timed out.�timeoutz7The DNS operation timed out after {timeout:.3f} secondscst�j|i|��dS�N)rrrrr	rr�szTimeout.__init__)r(r)r*rrrrr,r	r	rrr4�s
r4c@r-)�UnsupportedAlgorithmz&The DNSSEC algorithm is not supported.Nr/r	r	r	rr7�r0r7c@r-)�AlgorithmKeyMismatchz=The DNSSEC algorithm is not supported for the given key type.Nr/r	r	r	rr8�r0r8c@r-)�ValidationFailurez The DNSSEC signature is invalid.Nr/r	r	r	rr9�r0r9c@r-)�DeniedByPolicyzDenied by DNSSEC policy.Nr/r	r	r	rr:�r0r:c@s$eZdZdd�Zdd�Zdd�ZdS)�ExceptionWrappercCs
||_dSr6)�exception_class)rr<r	r	rr�s
zExceptionWrapper.__init__cCs|Sr6r	)rr	r	r�	__enter__�szExceptionWrapper.__enter__cCs(|durt||j�s|�t|��|�dS)NF)rr<r
)r�exc_type�exc_val�exc_tbr	r	r�__exit__�szExceptionWrapper.__exit__N)r(r)r*rr=rAr	r	r	rr;�sr;N)r�typingrr�	Exceptionrr.r1r2r3r4r7r8r9r:r;r	r	r	r�<module>sW