
                             S r SSKrSSKrSSKrSSKrSSKJr   " S S\R                  R                  5      r
 SS jrS rSS	 jrS
 rg)z)DNS RRsets (an RRset is a named rdataset)    N   )string_typesc                      ^  \ rS rSrSrSS/r\R                  R                  S4U 4S jjr	U 4S jr
S rS	 rU 4S
 jrSU 4S jjrSU 4S jjrSU 4S jjrS rSrU =r$ )RRset   a  A 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deletingNc                 F   > [         [        U ]  X#U5        Xl        XPl        g)zCreate a new RRset.N)superr   __init__r   r	   selfr   rdclassrdtypecoversr	   	__class__s         lib/third_party/dns/rrset.pyr   RRset.__init__)   s      	eT#GV<	     c                 p   > [         [        U ]  5       nU R                  Ul        U R                  Ul        U$ N)r   r   _cloner   r	   )r   objr   s     r   r   RRset._clone1   s-    E4')99}}
r   c                    U R                   S:X  a  SnO/S[        R                  R                  U R                   5      -   S-   nU R                  b-  S[        R
                  R                  U R                  5      -   nOSnS[        U R                  5      -   S-   [        R
                  R                  U R                  5      -   S-   [        R                  R                  U R                  5      -   U-   U-   S-   $ )	Nr    ()z delete=z<DNS  z RRset>)
r   dns	rdatatypeto_textr	   
rdataclassstrr   r   r   )r   ctextdtexts      r   __repr__RRset.__repr__7   s    ;;!E#--//<<sBE==$!7!7!FFEETYY'#-~~%%dll3469:}}$$T[[1249:<ABDMN 	Nr   c                 "    U R                  5       $ r   )r"   r   s    r   __str__RRset.__str__D   s    ||~r   c                    > [        U[        5      (       d  gU R                  UR                  :w  a  g[        [        U ]  U5      $ )NF)
isinstancer   r   r   __eq__)r   otherr   s     r   r/   RRset.__eq__G   s8    %''99

"UD(//r   c                 |   > [         [        U ]  X#U5      (       d  gU R                  U:w  d  U R                  U:w  a  gg)z^Returns ``True`` if this rrset matches the specified class, type,
covers, and deletion state.
FT)r   r   matchr   r	   r   s         r   r3   RRset.matchN   s9    
 UD'@@99 9r   c                 Z   > [         [        U ]
  " U R                  XU R                  40 UD6$ )a  Convert the RRset into DNS master 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*.
)r   r   r"   r   r	   )r   origin
relativizekwr   s       r   r"   RRset.to_textY   s0    " UD)$))V*.--?;=? 	?r   c                 \   > [         [        U ]
  " U R                  XUU R                  40 UD6$ )zConvert 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   r   to_wirer   r	   )r   filecompressr6   r8   r   s        r   r;   RRset.to_wirem   s2     UD)$))TV*.--?;=? 	?r   c                 h    [         R                  R                  U R                  [	        U 5      5      $ )zIConvert an RRset into an Rdataset.

Returns a ``dns.rdataset.Rdataset``.
)r    rdatasetfrom_rdata_listttllistr*   s    r   to_rdatasetRRset.to_rdatasety   s#    
 ||++DHHd4jAAr   )r	   r   r   )NT)NN)__name__
__module____qualname____firstlineno____doc__	__slots__r    r!   NONEr   r   r'   r+   r/   r3   r"   r;   rD   __static_attributes____classcell__)r   s   @r   r   r      sY     $I58]]5G5G!N0	?(
?B Br   r   c                    [        U [        5      (       a  [        R                  R	                  U SUS9n [        U[        5      (       a  [        R
                  R	                  U5      n[        U[        5      (       a  [        R                  R	                  U5      n[        XU5      nUR                  U5        U HI  n[        R                  R	                  UR                  UR                  U5      nUR                  U5        MK     U$ )zCreate an RRset with the specified name, TTL, class, and type, and with
the specified list of rdatas in text format.

Returns a ``dns.rrset.RRset`` object.
N
idna_codec)r.   r   r    r   	from_textr#   r!   r   
update_ttlrdatar   r   add)	r   rB   r   r   text_rdatasrQ   rtrds	            r   from_text_listrZ      s     $%%xx!!$!D'<((..**73&,''((0dV$ALLYY  AHHa8	b	  Hr   c                     [        XX#U5      $ )zCreate an RRset with the specified name, TTL, class, and type and with
the specified rdatas in text format.

Returns a ``dns.rrset.RRset`` object.
)rZ   )r   rB   r   r   rV   s        r   rR   rR      s     $WkBBr   c                 B   [        U [        5      (       a  [        R                  R	                  U SUS9n [        U5      S:X  a  [        S5      eSnU HH  nUc1  [        XR                  UR                  5      nUR                  U5        UR                  U5        MJ     U$ )zCreate an RRset with the specified name and TTL, and with
the specified list of rdata objects.

Returns a ``dns.rrset.RRset`` object.
NrP   r   zrdata list must not be empty)r.   r   r    r   rR   len
ValueErrorr   r   r   rS   rU   )r   rB   rdatasrQ   rW   rY   s         r   rA   rA      s     $%%xx!!$!D
6{a788A9dJJ		2ALL	b		 
 Hr   c                     [        XU5      $ )z~Create an RRset with the specified name and TTL, and with
the specified rdata objects.

Returns a ``dns.rrset.RRset`` object.
)rA   )r   rB   r_   s      r   
from_rdatara      s     4f--r   r   )rJ   dns.namer    dns.rdatasetdns.rdataclassdns.renderer_compatr   r@   Rdatasetr   rZ   rR   rA   ra    r   r   <module>ri      sP   $ 0     !bBCLL!! bBL #,C*.r   