VULN_CHECK_I913V6 ,fEdZddlmZmZGddeZGddeZGddeZGd d eZGd d eZ Gd deZ GddeZ Gdde Z GddeZ GddeZGddZy)zCommon DNS Exceptions. Dnspython modules may also define their own exceptions, which will always be subclasses of ``DNSException``. )OptionalSetceZdZUdZdZeeed<eZ e eed<dZ eeed<fdZ dZ dZd Zfd ZxZS) DNSExceptionaAbstract 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. Nmsg supp_kwargsfmtc&|j|i||r(|jdi||_t||_nt |_|j|j |_|r t| |yt|!|jyN) _check_params _check_kwargskwargsstrrdict__doc__super__init__selfargsr __class__s 2/usr/lib/python3.12/site-packages/dns/exception.pyrzDNSException.__init__7s|D+F+ ,$,,6v6DK4yDH&DK 88 ||DH  G d # G TXX &c|s|ryyy)zsOld exceptions supported only args and not kwargs. For sanity we do not allow to mix old and new behavior.Nr )rrrs rr zDNSException._check_paramsGs  64rc |r|SNr )rrs rrzDNSException._check_kwargsPs  rc i}|jD]e\}}t|ttfrEtt t |||<t ||dk(sJ||j||<a|||<g|S)zFormat kwargs before printing them. Resulting dictionary has to have keys necessary for str.format call on fmt class variable. )items isinstancelistsetmaprlenpop)rrfmtargskwdatas r _fmt_kwargszDNSException._fmt_kwargsWsy   #HB$s ,"3sD>2 wr{#q(")"+//"3GBK"  #rc|jrD|jr8|jdi|j}|jjdi|St|Sr )rr r*formatr__str__)rr'rs rr-zDNSException.__str__isP ;;488&d&&55G"488??-W- -7?$ $r)__name__ __module__ __qualname__rrrr__annotations__r#rrr rr rr*r- __classcell__rs@rrrsU,C#EKS!C#' O$%%rrceZdZdZy) FormErrorzDNS message is malformed.Nr.r/r0rr rrr5r5ss#rr5ceZdZdZy) SyntaxErrorzText input is malformed.Nr6r rrr8r8w"rr8ceZdZdZy) UnexpectedEndzText input ended unexpectedly.Nr6r rrr;r;{s(rr;ceZdZdZy)TooBigzThe DNS message is too big.Nr6r rrr=r=s%rr=c,eZdZdZdhZdZfdZxZS)TimeoutzThe DNS operation timed out.timeoutz7The DNS operation timed out after {timeout:.3f} secondsc$t||i|yr)rrrs rrzTimeout.__init__s $)&)r)r.r/r0rrr rr2r3s@rr?r?s&+K CC**rr?ceZdZdZy)UnsupportedAlgorithmz&The DNSSEC algorithm is not supported.Nr6r rrrCrCs0rrCceZdZdZy)AlgorithmKeyMismatchz=The DNSSEC algorithm is not supported for the given key type.Nr6r rrrErEsGrrEceZdZdZy)ValidationFailurez The DNSSEC signature is invalid.Nr6r rrrGrGs*rrGceZdZdZy)DeniedByPolicyzDenied by DNSSEC policy.Nr6r rrrIrIr9rrIceZdZdZdZdZy)ExceptionWrapperc||_yr)exception_class)rrMs rrzExceptionWrapper.__init__s .rc|Srr )rs r __enter__zExceptionWrapper.__enter__s rcj|1t||js|jt||y)NF)r!rMr)rexc_typeexc_valexc_tbs r__exit__zExceptionWrapper.__exit__s1   7DrWs$!T%9T%n$ $#,#)K)&\& *l *1<1H/H+ +#\#  r