grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a àMÒetAã @s–dZddlZddlZddlZddlmZmZmZmZm Z m Z m Z ddl Z ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ e jjZGdd„de jjƒZGdd„de jjƒZGdd „d e jjƒZe jjGd d „d eƒƒZde e j j!e"fe e j#j$e"fe%ee"e e j&j'e e j&j(e)e e j&j(ed œ dd„Z*e e j j!e"fe e j#j$e"fe%eedœdd„Z+e%ee j,j-edœdd„Z.e%eedœdd„Z/dS)zHDNS rdatasets (an rdataset is a set of rdatas of a given type and class)éN)ÚAnyÚ CollectionÚDictÚListÚOptionalÚUnionÚcastc@seZdZdZdS)ÚDifferingCoversz~An attempt was made to add a DNS SIG/RRSIG whose covered type is not the same as that of the other rdatas in the rdataset.N©Ú__name__Ú __module__Ú __qualname__Ú__doc__©rrú0/usr/lib/python3.9/site-packages/dns/rdataset.pyr 'sr c@seZdZdZdS)ÚIncompatibleTypesz?An attempt was made to add DNS RR data of an incompatible type.Nr rrrrr,src s€eZdZdZgd¢Zejjdfejj ejj ejj e dœ‡fdd„ Z ‡fdd„Z e dd œd d „Zd-ejjee dd œ‡fd d„ Z‡fdd„Z‡fdd„Z‡fdd„Zdd„Zdd„Zdd„Z‡fdd„Zdd„Zd.eejjeejjeeejj eeee fed!œd"d#„Z!d/ejje eejj"eejjeejj ee d$œd%d&„Z#ejj ejj ejj ed'œd(d)„Z$e%ejjd*œd+d,„Z&‡Z'S)0ÚRdatasetzA DNS rdataset.)ÚrdclassÚrdtypeÚcoversÚttlrcs&tƒ ¡||_||_||_||_dS)a5Create a new rdataset of the specified class and type. *rdclass*, a ``dns.rdataclass.RdataClass``, the rdataclass. *rdtype*, an ``dns.rdatatype.RdataType``, the rdatatype. *covers*, an ``dns.rdatatype.RdataType``, the covered rdatatype. *ttl*, an ``int``, the TTL. N)ÚsuperÚ__init__rrrr)Úselfrrrr©Ú __class__rrr5s  zRdataset.__init__cs.tƒ ¡}|j|_|j|_|j|_|j|_|S©N)rÚ_clonerrrr)rÚobjrrrrMs  zRdataset._cloneN)rÚreturncCs4tj |¡}t|ƒdkr ||_n||jkr0||_dS)aPerform TTL minimization. Set the TTL of the rdataset to be the lesser of the set's current TTL or the specified TTL. If the set contains no rdatas, set the TTL to the specified TTL. *ttl*, an ``int`` or ``str``. rN)ÚdnsrÚmakeÚlen©rrrrrÚ update_ttlUs   zRdataset.update_ttl)Úrdrrcs´|j|jks|j|jkrt‚|dur.| |¡|jtjjksJ|jtjjkr‚| ¡}t |ƒdkrt|jtjj krt||_n|j|kr‚t ‚tj  |j¡r¤t |ƒdkr¤|  ¡tƒ |¡dS)a!Add the specified rdata to the rdataset. If the optional *ttl* parameter is supplied, then ``self.update_ttl(ttl)`` will be called prior to adding the rdata. *rd*, a ``dns.rdata.Rdata``, the rdata *ttl*, an ``int``, the TTL. Raises ``dns.rdataset.IncompatibleTypes`` if the type and class do not match the type and class of the rdataset. Raises ``dns.rdataset.DifferingCovers`` if the type is a signature type and the covered type does not match that of the rdataset. Nr)rrrr$r Ú rdatatypeZRRSIGZSIGrr"ÚNONEr Z is_singletonÚclearrÚadd)rr%rrrrrr)ds  z Rdataset.addcs| |j¡tƒ |¡dSr)r$rrÚ union_update©rÚotherrrrr*‹s zRdataset.union_updatecs| |j¡tƒ |¡dSr)r$rrÚintersection_updater+rrrr-�s zRdataset.intersection_updatecs| |j¡tƒ |¡dS)zƒAdd all rdatas in other to self. *other*, a ``dns.rdataset.Rdataset``, the rdataset from which to update. N)r$rrÚupdater+rrrr.“s zRdataset.updatecs$dd„‰dd ‡fdd„|Dƒ¡S)NcSs t|ƒdkr|dd…dS|S)Nédz...)r")ÚsrrrÚmaybe_truncatežs z,Rdataset._rdata_repr..maybe_truncatez[%s]z, c3s|]}dˆt|ƒƒVqdS)z<%s>N)Ústr)Ú.0Zrr©r1rrÚ £óz'Rdataset._rdata_repr..)Újoin©rrr4rÚ _rdata_repr�szRdataset._rdata_reprcCs^|jdkrd}ndtj |j¡d}dtj |j¡dtj |j¡|d| ¡dS) NrÚú(ú)z)rr r&Úto_textÚ rdataclassrrr9)rZctextrrrÚ__repr__¥s&  ÿþ ýüûúùÿzRdataset.__repr__cCs| ¡Sr)r?r8rrrÚ__str__µszRdataset.__str__csBt|tƒsdS|j|jks2|j|jks2|j|jkr6dStƒ |¡S)NF)Ú isinstancerrrrrÚ__eq__r+rrrrD¸s  ÿ þ ýzRdataset.__eq__cCs | |¡ Sr)rDr+rrrÚ__ne__ÃszRdataset.__ne__TF)ÚnameÚoriginÚ relativizeÚoverride_rdclassÚ want_commentsÚkwrc Ksò|dur"| ||¡}t|ƒ}d}nd}d}t ¡} |dur@|} n|j} t|ƒdkr||  d ||tj   | ¡tj   |j ¡¡¡nf|D]`} d} |rž| j ržd| j ›�} |  d|||jtj   | ¡tj   |j ¡| j f||dœ|¤Ž| f¡q€|  ¡dd …S) auConvert the rdataset into DNS zone file format. See ``dns.name.Name.choose_relativity`` for more information on how *origin* and *relativize* determine the way names are emitted. Any additional keyword arguments are passed on to the rdata ``to_text()`` method. *name*, a ``dns.name.Name``. If name is not ``None``, emit RRs with *name* as the owner name. *origin*, a ``dns.name.Name`` or ``None``, the origin for relative names. *relativize*, a ``bool``. If ``True``, names will be relativized to *origin*. *override_rdclass*, a ``dns.rdataclass.RdataClass`` or ``None``. If not ``None``, use this class instead of the Rdataset's class. *want_comments*, a ``bool``. If ``True``, emit comments for rdata which have them. The default is ``False``. Nr=r:rz {}{}{} {} z ;z%s%s%d %s %s %s%s )rGrHéÿÿÿÿ)Zchoose_relativityr2ÚioÚStringIOrr"ÚwriteÚformatr r@r?r&rZ rdcommentrÚgetvalue) rrFrGrHrIrJrKZntextZpadr0rr%Zextrarrrr?ÆsJ"    üÿ    ùÿÿzRdataset.to_text)rFÚfileÚcompressrGrIÚ want_shufflerc Csæ|dur|}d}n|j}t|ƒdkrP| |||¡| t d|j|dd¡¡dS|rht|ƒ}t  |¡n|}|D]h} | |||¡| t d|j||j ¡¡t j   |d¡�|  |||¡Wdƒqp1sÎ0Yqpt|ƒSdS)atConvert the rdataset to wire format. *name*, a ``dns.name.Name`` is the owner name to use. *file* is the file where the name is emitted (typically a BytesIO file). *compress*, a ``dict``, is the compression table to use. If ``None`` (the default), names will not be compressed. *origin* is a ``dns.name.Name`` or ``None``. If the name is relative and origin is not ``None``, then *origin* will be appended to it. *override_rdclass*, an ``int``, is used as the class instead of the class of the rdataset. This is useful when rendering rdatasets associated with dynamic updates. *want_shuffle*, a ``bool``. If ``True``, then the order of the Rdatas within the Rdataset will be shuffled before rendering. Returns an ``int``, the number of records emitted. NFrz!HHIHéz!HHIé)rr"Úto_wirerOÚstructÚpackrÚlistÚrandomZshufflerr ZrendererZprefixed_length) rrFrRrSrGrIrTrÚlr%rrrrWs$!  .zRdataset.to_wire)rrrrcCs&|j|kr"|j|kr"|j|kr"dSdS)zaReturns ``True`` if this rdataset matches the specified class, type, and covers. TF)rrr)rrrrrrrÚmatchQs zRdataset.match)rcCs&t|ƒdkrgS|d t|ƒ¡SdS)aTReturn rdatas in a valid processing order according to the type's specification. For example, MX records are in preference order from lowest to highest preferences, with items of the same preference shuffled. For types that do not define a processing order, the rdatas are simply shuffled. rN)r"Z_processing_orderÚiterr8rrrÚprocessing_order^s zRdataset.processing_order)N)NNTNF)NNNT)(r r r rÚ __slots__r r&r'r@Ú RdataClassÚ RdataTypeÚintrrr$ÚrdataÚRdatarr)r*r-r.r9rArBrDrErFÚNameÚboolrr2rr?Z CompressTyperWr]rr_Ú __classcell__rrrrr0stûû ÿ þ'    ú    ø Wù   ø :û rcsÌeZdZdZeZedœ‡fdd„ Zdd„Zd(dd „Zd d „Z d d „Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Z‡fdd„Z‡fdd„Z‡fd d!„Z‡fd"d#„Z‡fd$d%„Z‡fd&d'„Z‡ZS))ÚImmutableRdatasetzAn immutable DNS rdataset.)Úrdatasetcs.tƒ |j|j|j|j¡tj |j ¡|_ dS)z9Create an immutable rdataset from the specified rdataset.N) rrrrrrr Ú immutablerÚitems)rrjrrrrssÿzImmutableRdataset.__init__cCs tdƒ‚dS©Nrk©Ú TypeErrorr#rrrr${szImmutableRdataset.update_ttlNcCs tdƒ‚dSrmrn)rr%rrrrr)~szImmutableRdataset.addcCs tdƒ‚dSrmrnr+rrrr*�szImmutableRdataset.union_updatecCs tdƒ‚dSrmrnr+rrrr-„sz%ImmutableRdataset.intersection_updatecCs tdƒ‚dSrmrnr+rrrr.‡szImmutableRdataset.updatecCs tdƒ‚dSrmrn)rÚirrrÚ __delitem__ŠszImmutableRdataset.__delitem__cCs tdƒ‚dSrmrnr+rrrÚ__ior__‘szImmutableRdataset.__ior__cCs tdƒ‚dSrmrnr+rrrÚ__iand__”szImmutableRdataset.__iand__cCs tdƒ‚dSrmrnr+rrrÚ__iadd__—szImmutableRdataset.__iadd__cCs tdƒ‚dSrmrnr+rrrÚ__isub__šszImmutableRdataset.__isub__cCs tdƒ‚dSrmrnr8rrrr(�szImmutableRdataset.clearcsttƒ ¡ƒSr©rirÚcopyr8rrrÚ__copy__ szImmutableRdataset.__copy__csttƒ ¡ƒSrrvr8rrrrw£szImmutableRdataset.copycsttƒ |¡ƒSr)rirÚunionr+rrrry¦szImmutableRdataset.unioncsttƒ |¡ƒSr)rirÚ intersectionr+rrrrz©szImmutableRdataset.intersectioncsttƒ |¡ƒSr)rirÚ differencer+rrrr{¬szImmutableRdataset.differencecsttƒ |¡ƒSr)rirÚsymmetric_differencer+rrrr|¯sz&ImmutableRdataset.symmetric_difference)N)r r r rrZ _clone_classrr$r)r*r-r.rqrrrsrtrur(rxrwryrzr{r|rhrrrrrims(      riT) rrrÚ text_rdatasÚ idna_codecrGrHÚ relativize_torc Csdtjj |¡}tjj |¡}t||ƒ}| |¡|D]*} tj  |j |j | ||||¡} |  | ¡q4|S)a|Create an rdataset with the specified class, type, and TTL, and with the specified list of rdatas in text format. *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA encoder/decoder to use; if ``None``, the default IDNA 2003 encoder/decoder is used. *origin*, a ``dns.name.Name`` (or ``None``), the origin to use for relative names. *relativize*, a ``bool``. If true, name will be relativized. *relativize_to*, a ``dns.name.Name`` (or ``None``), the origin to use when relativizing names. If not set, the *origin* value will be used. Returns a ``dns.rdataset.Rdataset`` object. ) r r@rar!r&rbrr$rdÚ from_textrrr)) rrrr}r~rGrHrÚrÚtr%rrrÚfrom_text_list³s  ÿ rƒ)rrrr}rcGst|||ttt|ƒƒS)z£Create an rdataset with the specified class, type, and TTL, and with the specified rdatas in text format. Returns a ``dns.rdataset.Rdataset`` object. )rƒrrr2)rrrr}rrrr€Ûs r€)rÚrdatasrcCsPt|ƒdkrtdƒ‚d}|D].}|dur@t|j|jƒ}| |¡| |¡q|S)z’Create an rdataset with the specified TTL, and with the specified list of rdata objects. Returns a ``dns.rdataset.Rdataset`` object. rzrdata list must not be emptyN)r"Ú ValueErrorrrrr$r))rr„r�r%rrrÚfrom_rdata_listês   r†cGst|tttjj|ƒƒS)zŠCreate an rdataset with the specified TTL, and with the specified rdata objects. Returns a ``dns.rdataset.Rdataset`` object. )r†rrr rdre)rr„rrrÚ from_rdataýsr‡)NNTN)0rrMr[rXÚtypingrrrrrrrZ dns.exceptionr Z dns.immutableZdns.nameZ dns.rdataZdns.rdataclassZ dns.rdatatypeZ dns.rendererZdns.setZdns.ttlÚsetÚSetZ SimpleSetÚ exceptionZ DNSExceptionr rrrkrir@rar2r&rbrcrFZ IDNACodecrfrgrƒr€rdrer†r‡rrrrÚsX$?Jø   ÷ )û