eaiovnaovbqoebvqoeavibavo 3 $Wk@sldZddlZddlZddlZddlZddlmZGdddejj Z dddZ d d Z dd d Z d dZdS)z)DNS RRsets (an RRset is a named rdataset)N) string_typescseZdZdZddgZejjdffdd ZfddZ d d Z d d Z fd dZ dfdd Z dfdd Zdfdd ZddZZS)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. namedeletingNcs$tt|j|||||_||_dS)zCreate a new RRset.N)superr__init__rr)selfrrdclassrdtypecoversr) __class__/usr/lib/python3.6/rrset.pyr'szRRset.__init__cs"tt|j}|j|_|j|_|S)N)rr_clonerr)r obj)r rrr/sz RRset._clonecCs|jdkrd}ndtjj|jd}|jdk rDdtjj|j}nd}dt|jdtjj|jdtjj|j ||dS) Nr()z delete=z) r dns rdatatypeto_textr rdataclassstrrr r )r ZctextZdtextrrr__repr__5s  zRRset.__repr__cCs|jS)N)r)r rrr__str__Bsz RRset.__str__cs.t|tsdS|j|jkrdStt|j|S)zcTwo RRsets are equal if they have the same name and the same rdataset @rtype: boolF) isinstancerrr__eq__)r other)r rrrEs   z RRset.__eq__cs4tt|j|||sdS|j|ks,|j|kr0dSdS)zaReturns True if this rrset matches the specified class, type, covers, and deletion state.FT)rrmatchrr)r rr r r r)r rrr Ps z RRset.matchTc stt|j|j|||jf|S)aConvert the RRset into DNS master file format. @see: L{dns.name.Name.choose_relativity} for more information on how I{origin} and I{relativize} determine the way names are emitted. Any additional keyword arguments are passed on to the rdata to_text() method. @param origin: The origin for relative names, or None. @type origin: dns.name.Name object @param relativize: True if names should names be relativized @type relativize: bool)rrrrr)r originZ relativizekw)r rrrZsz RRset.to_textc s tt|j|j||||jf|S)z!Convert the RRset to wire format.)rrto_wirerr)r filecompressr!r")r rrr#lsz RRset.to_wirecCstjj|jt|S)zYConvert an RRset into an Rdataset. @rtype: dns.rdataset.Rdataset object )rrdatasetfrom_rdata_listttllist)r rrr to_rdatasetrszRRset.to_rdataset)N)NT)NN)__name__ __module__ __qualname____doc__ __slots__rrZNONErrrrrr rr#r* __classcell__rr)r rrs     rc Cst|trtjj|d|d}t|tr2tjj|}t|trHtjj|}t|||}|j|x*|D]"}tj j|j |j |}|j |qdW|S)zCreate an RRset with the specified name, TTL, class, and type, and with the specified list of rdatas in text format. @rtype: dns.rrset.RRset object N) idna_codec) rrrr from_textrrr update_ttlZrdatar r add) rr(r r text_rdatasr1rtrdrrrfrom_text_listzs        r9cGst|||||S)zCreate an RRset with the specified name, TTL, class, and type and with the specified rdatas in text format. @rtype: dns.rrset.RRset object )r9)rr(r r r5rrrr2sr2cCsrt|trtjj|d|d}t|dkr0tdd}x8|D]0}|dkr`t||j|j }|j ||j |q:W|S)zCreate an RRset with the specified name and TTL, and with the specified list of rdata objects. @rtype: dns.rrset.RRset object N)r1rzrdata list must not be empty) rrrrr2len ValueErrorrr r r3r4)rr(rdatasr1r6r8rrrr's    r'cGs t|||S)zCreate an RRset with the specified name and TTL, and with the specified rdata objects. @rtype: dns.rrset.RRset object )r')rr(r<rrr from_rdatasr=)N)N)r.Zdns.namerZ dns.rdatasetZdns.rdataclassZ dns.rendererZ_compatrr&ZRdatasetrr9r2r'r=rrrrs a