grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a àMÒeEã@sÆdZddlmZmZGdd„deƒZGdd„deƒZGdd„deƒZGd d „d eƒZGd d „d eƒZ Gd d„deƒZ Gdd„deƒZ Gdd„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<dZ eeed<‡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Úfmtcsp|j|i|¤Ž|r2|jfi|¤Ž|_t|ƒ|_ntƒ|_|jdurL|j|_|r^tƒj|Žntƒ |j¡dS©N) Ú _check_paramsÚ _check_kwargsÚkwargsÚstrrÚdictÚ__doc__ÚsuperÚ__init__©ÚselfÚargsr ©Ú __class__©ú1/usr/lib/python3.9/site-packages/dns/exception.pyr7s  zDNSException.__init__cOs |s|rdS)zsOld exceptions supported only args and not kwargs. For sanity we do not allow to mix old and new behavior.Nrrrrrr GszDNSException._check_paramscKs|r|Srr)rr rrrr PszDNSException._check_kwargscKsdi}| ¡D]R\}}t|ttfƒrVttt|ƒƒ||<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ÚlistÚsetÚmapr ÚlenÚpop)rr ÚfmtargsÚkwÚdatarrrÚ _fmt_kwargsWs zDNSException._fmt_kwargscs>|jr0|jr0|jfi|j¤Ž}|jjfi|¤ŽStƒ ¡SdSr)r rr#ÚformatrÚ__str__)rr rrrr%is zDNSException.__str__)Ú__name__Ú __module__Ú __qualname__rrrr Ú__annotations__rrrrrr r r#r%Ú __classcell__rrrrrs   rc@seZdZdZdS)Ú FormErrorzDNS message is malformed.N©r&r'r(rrrrrr+ssr+c@seZdZdZdS)Ú SyntaxErrorzText input is malformed.Nr,rrrrr-wsr-c@seZdZdZdS)Ú UnexpectedEndzText input ended unexpectedly.Nr,rrrrr.{sr.c@seZdZdZdS)ÚTooBigzThe DNS message is too big.Nr,rrrrr/sr/cs*eZdZdZdhZdZ‡fdd„Z‡ZS)ÚTimeoutzThe DNS operation timed out.Útimeoutz7The DNS operation timed out after {timeout:.3f} secondscstƒj|i|¤ŽdSr)rrrrrrr‹szTimeout.__init__)r&r'r(rrrrr*rrrrr0ƒsr0c@seZdZdZdS)ÚUnsupportedAlgorithmz&The DNSSEC algorithm is not supported.Nr,rrrrr2�sr2c@seZdZdZdS)ÚAlgorithmKeyMismatchz=The DNSSEC algorithm is not supported for the given key type.Nr,rrrrr3“sr3c@seZdZdZdS)ÚValidationFailurez The DNSSEC signature is invalid.Nr,rrrrr4—sr4c@seZdZdZdS)ÚDeniedByPolicyzDenied by DNSSEC policy.Nr,rrrrr5›sr5c@s$eZdZdd„Zdd„Zdd„ZdS)ÚExceptionWrappercCs ||_dSr)Úexception_class)rr7rrrr szExceptionWrapper.__init__cCs|Srr)rrrrÚ __enter__£szExceptionWrapper.__enter__cCs(|dur$t||jƒs$| t|ƒ¡|‚dS)NF)rr7r )rÚexc_typeZexc_valZexc_tbrrrÚ__exit__¦szExceptionWrapper.__exit__N)r&r'r(rr8r:rrrrr6Ÿsr6N)rÚtypingrrÚ Exceptionrr+r-r.r/r0r2r3r4r5r6rrrrÚsW