grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a àMÒeÒ#ã @sNdZddlmZmZmZmZmZmZddlZ ddl Z ddl Z ddl Z Gdd„de j jƒZdee jjefeee jjefee jjefeeee jjee jjeee jjedœ dd „Zee jjefeee jjefee jjefeed œd d „Zdee jjefeee jjee jjed œdd„Zee jjefeeedœdd„ZdS)z)DNS RRsets (an RRset is a named rdataset)é)ÚAnyÚ CollectionÚDictÚOptionalÚUnionÚcastNcs<eZdZdZddgZejjdfejj ej j ejj ejj e ej j dœ‡fdd„ Z‡fdd „Zd d „Zd d „Z‡fdd„Zeeedœ‡fdd„ Zd ejj ej j ejj ejj e ej j edœ‡fdd„ Zd!e ejj eeeefedœ‡fdd„ Zd"ee ejje ejj eeefedœ‡fdd„ Zejjdœdd„Z‡Z S)#ÚRRseta6A DNS RRset (named rdataset). RRset inherits from Rdataset, and RRsets can be treated as Rdatasets in most cases. There are, however, a few notable exceptions. RRsets have different to_wire() and to_text() method arguments, reflecting the fact that RRsets always have an owner name. ÚnameÚdeletingN)r ÚrdclassÚrdtypeÚcoversr cs tƒ |||¡||_||_dS)zCreate a new RRset.N)ÚsuperÚ__init__r r ©Úselfr r r r r ©Ú __class__©ú-/usr/lib/python3.9/site-packages/dns/rrset.pyr(s zRRset.__init__cstƒ ¡}|j|_|j|_|S©N)rÚ_cloner r )rÚobjrrrr6s z RRset._clonecCs’|jdkrd}ndtj |j¡d}|jdurDdtj |j¡}nd}dt|jƒdtj |j¡dtj |j ¡||d|  ¡d S) NrÚú(ú)z delete=z) r ÚdnsÚ rdatatypeÚto_textr Ú rdataclassÚstrr r r Z _rdata_repr)rZctextZdtextrrrÚ__repr__<s8  ÿþ ýü ûúùø ÷ öÿzRRset.__repr__cCs| ¡Sr)r ©rrrrÚ__str__Ssz RRset.__str__cs:t|tƒr|j|jkr.dSnt|tjjƒs.dStƒ |¡S)NF)Ú isinstancerr rÚrdatasetÚRdatasetrÚ__eq__)rÚotherrrrr)Vs   z RRset.__eq__)ÚargsÚkwargsÚreturncs8t|dtjjƒr"|j|i|¤ŽStƒj|i|¤ŽSdS)aÐDoes this rrset match the specified attributes? Behaves as :py:func:`full_match()` if the first argument is a ``dns.name.Name``, and as :py:func:`dns.rdataset.Rdataset.match()` otherwise. (This behavior fixes a design mistake where the signature of this method became incompatible with that of its superclass. The fix makes RRsets matchable as Rdatasets while preserving backwards compatibility.) rN)r&rr ÚNameÚ full_matchrÚmatch)rr+r,rrrr0^s z RRset.match)r r r r r r-cs0tƒ |||¡sdS|j|ks(|j|kr,dSdS)ztReturns ``True`` if this rrset matches the specified name, class, type, covers, and deletion state. FT)rr0r r rrrrr/os zRRset.full_matchT)ÚoriginÚ relativizeÚkwr-c stƒj|j|||jfi|¤ŽS)aïConvert the RRset 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. *origin*, a ``dns.name.Name`` or ``None``, the origin for relative names. *relativize*, a ``bool``. If ``True``, names will be relativized to *origin*. )rr r r )rr1r2r3rrrr ‚s  ÿÿz RRset.to_text)ÚfileÚcompressr1r3r-c s tƒj|j||||jfi|¤ŽS)zÖConvert the RRset to wire format. All keyword arguments are passed to ``dns.rdataset.to_wire()``; see that function for details. Returns an ``int``, the number of records emitted. )rÚto_wirer r )rr4r5r1r3rrrr6œs ÿÿz RRset.to_wire)r-cCstj |jt|ƒ¡S)zYConvert an RRset into an Rdataset. Returns a ``dns.rdataset.Rdataset``. )rr'Úfrom_rdata_listÚttlÚlistr$rrrÚ to_rdataset±szRRset.to_rdataset)N)NT)NN)!Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú __slots__rrZNONEr r.r!Ú RdataClassÚ RdataTyperrrr#r%r)rÚboolr0r/rr"r Z CompressTypeÚintr6r'r(r:Ú __classcell__rrrrrsV ú ú  ú ùý  ûü   úrT) r r8r r Ú text_rdatasÚ idna_codecr1r2Ú relativize_tor-c Cs‚t|tƒrtjj|d|d�}tjj |¡}tjj  |¡}t |||ƒ} |   |¡|D]*} tj  | j | j| ||||¡} |  | ¡qR| S)ayCreate an RRset with the specified name, TTL, class, and type, 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.rrset.RRset`` object. N©rF)r&r"rr Ú from_textr!r@ZmakerrArÚ update_ttlÚrdatar r Úadd) r r8r r rErFr1r2rGÚrÚtÚrdrrrÚfrom_text_list¹s   ÿ rP)r r8r r rEr-cGst||||ttt|ƒƒS)zŸCreate an RRset with the specified name, TTL, class, and type and with the specified rdatas in text format. Returns a ``dns.rrset.RRset`` object. )rPrrr")r r8r r rErrrrIäs ÿrI)r r8ÚrdatasrFr-cCszt|tƒrtjj|d|d�}t|ƒdkr0tdƒ‚d}|D]0}|dur^t||j|j ƒ}|  |¡|  |¡q8|dusvJ‚|S)a/Create an RRset with the specified name and TTL, and with the specified list of rdata objects. *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA encoder/decoder to use; if ``None``, the default IDNA 2003 encoder/decoder is used. Returns a ``dns.rrset.RRset`` object. NrHrzrdata list must not be empty) r&r"rr rIÚlenÚ ValueErrorrr r rJrL)r r8rQrFrMrOrrrr7ös     r7)r r8rQr-cGst||tttjj|ƒƒS)zŠCreate an RRset with the specified name and TTL, and with the specified rdata objects. Returns a ``dns.rrset.RRset`` object. )r7rrrrKÚRdata)r r8rQrrrÚ from_rdatasrU)NNTN)N) r>ÚtypingrrrrrrZdns.namerZdns.rdataclassZ dns.rdatasetZ dns.rendererr'r(rr r.r"rCr!r@rrAZ IDNACodecrBrPrIrKrTr7rUrrrrÚsN $÷   ö ,ú ü  û