
    i#                     x   d Z ddlmZmZmZmZ ddlZddlZddl	Zddl
ZddlZddlZ G d dej        j                  Z	 	 	 	 ddej        j        ez  ded	ej        j        ez  d
ej        j        ez  dee         dej        j        dz  dej        j        dz  dedej        j        dz  defdZdej        j        ez  ded	ej        j        ez  d
ej        j        ez  dedefdZ	 ddej        j        ez  dedeej        j                 dej        j        dz  def
dZdej        j        ez  dededefdZdS )z)DNS RRsets (an RRset is a named rdataset)    )Any
CollectionDictcastNc                   d    e Zd ZdZddgZej        j        dfdej        j	        dej
        j        dej        j        dej        j        dej
        j        dz  f
 fdZ fd	Zd
 Zd Z fdZdededef fdZ	 ddej        j	        dej
        j        dej        j        dej        j        dej
        j        dz  def fdZ	 	 ddej        j	        dz  dedeeef         def fdZ	 	 ddedej        j        dz  dej        j	        dz  deeef         def
 fdZdej        j        fdZ xZS )RRseta6  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deletingNrdclassrdtypecoversc                 j    t                                          |||           || _        || _        dS )zCreate a new RRset.N)super__init__r	   r
   selfr	   r   r   r   r
   	__class__s         Y/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/dns/rrset.pyr   zRRset.__init__*   s3     	&&111	     c                     t          t          t                                                                }| j        |_        | j        |_        |S N)r   r   r   _cloner	   r
   )r   objr   s     r   r   zRRset._clone8   s7    5%''..**++9}
r   c                    | j         dk    rd}n*dt          j                            | j                   z   dz   }| j        (dt          j                            | j                  z   }nd}dt          | j                  z   dz   t          j                            | j                  z   dz   t          j                            | j	                  z   |z   |z   dz   | 
                                z   d	z   S )
Nr    ()z delete=z<DNS  z RRset: >)r   dns	rdatatypeto_textr
   
rdataclassstrr	   r   r   _rdata_repr)r   ctextdtexts      r   __repr__zRRset.__repr__>   s   ;!EE#-//<<<sBE=$!7!7!F!FFEEE$)nn n$$T\223 	
 m##DK001      	! 
	
r   c                 *    |                                  S r   )r"   r   s    r   __str__zRRset.__str__U   s    ||~~r   c                     t          |t                    r| j        |j        k    rdS n!t          |t          j        j                  sdS t                                          |          S )NF)
isinstancer   r	   r    rdatasetRdatasetr   __eq__)r   otherr   s     r   r0   zRRset.__eq__X   s`    eU## 	yEJ&&u 'E3<#899 	5ww~~e$$$r   argskwargsreturnc                     t          |d         t          j        j                  r | j        |i |S  t                      j        |i |S )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.)
        r   )r-   r    r	   Name
full_matchr   match)r   r2   r3   r   s      r   r8   zRRset.match`   sQ     d1gsx}-- 	2"4?D3F333 577=$1&111r   c                     t                                          |||          sdS | j        |k    s| j        |k    rdS dS )ztReturns ``True`` if this rrset matches the specified name, class,
        type, covers, and deletion state.
        FT)r   r8   r	   r
   r   s         r   r7   zRRset.full_matchq   sI     ww}}Wff55 	59 9 95tr   Torigin
relativizekwc                 R     t                      j        | j        ||| j        fi |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*.
        )r   r"   r	   r
   )r   r:   r;   r<   r   s       r   r"   zRRset.to_text   s9    , uwwIvz4=
 
<>
 
 	
r   filecompressc                 T     t                      j        | j        |||| j        fi |S )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   to_wirer	   r
   )r   r>   r?   r:   r<   r   s        r   rA   zRRset.to_wire   s;     uwwItXvt}
 
@B
 
 	
r   c                 f    t           j                            | j        t	          |                     S )zYConvert an RRset into an Rdataset.

        Returns a ``dns.rdataset.Rdataset``.
        )r    r.   from_rdata_listttllistr*   s    r   to_rdatasetzRRset.to_rdataset   s$    
 |++DHd4jjAAAr   r   )NT)NN) __name__
__module____qualname____doc__	__slots__r    r!   NONEr	   r6   r#   
RdataClass	RdataTyper   r   r(   r+   r0   r   boolr8   r7   r   r$   r"   CompressTypeintrA   r.   r/   rF   __classcell__)r   s   @r   r   r      s         $I +.-*<59! !hm! *! '	!
 '! .+d2! ! ! ! ! !    
 
 
.  % % % % %23 2# 2$ 2 2 2 2 2 2. 6: hm * '	
 ' .+d2 
     * (,
 
$
 
 38n	

 

 
 
 
 
 
: 26'+	
 

 ('$.
 $	

 38n
 

 
 
 
 
 
*BS\2 B B B B B B B Br   r   Tr	   rD   r   r   text_rdatas
idna_codecr:   r;   relativize_tor4   c	           
         t          | t                    r"t          j                            | d|          } t          j        j                            |          }t          j        j	                            |          }t          | ||          }	|	                    |           |D ]F}
t          j                            |	j        |	j        |
||||          }|	                    |           G|	S )ay  Create 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rT   )r-   r$   r    r	   	from_textr#   rM   maker!   rN   r   
update_ttlrdatar   r   add)r	   rD   r   r   rS   rT   r:   r;   rU   rtrds               r   from_text_listr`      s    : $ Ex!!$!DDn',,W55G]$))&11FdGV$$ALL  Y  IqxFJz
 
 	
b				Hr   c           
      d    t          | |||t          t          t                   |                    S )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.
    )r`   r   r   r$   )r	   rD   r   r   rS   s        r   rX   rX      s/     c7FDC+$F$F  r   rdatasc                 \   t          | t                    r"t          j                            | d|          } t          |          dk    rt          d          d}|D ]I}|0t          | |j        |j	                  }|
                    |           |                    |           J|J |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.

    NrW   r   zrdata list must not be empty)r-   r$   r    r	   rX   len
ValueErrorr   r   r   rZ   r\   )r	   rD   rb   rT   r]   r_   s         r   rC   rC      s    " $ Ex!!$!DD
6{{a7888A  9dBJ	22ALL	b				===Hr   c                 t    t          | |t          t          t          j        j                 |                    S )zCreate an RRset with the specified name and TTL, and with
    the specified rdata objects.

    Returns a ``dns.rrset.RRset`` object.
    )rC   r   r   r    r[   Rdata)r	   rD   rb   s      r   
from_rdatarh     s)     4d:cio+F&O&OPPPr   )NNTNr   ) rJ   typingr   r   r   r   dns.namer    	dns.rdatadns.rdataclassdns.rdatasetdns.rdatatypedns.rendererr.   r/   r   r	   r6   r$   rQ   r#   rM   r!   rN   	IDNACodecrO   r`   rX   r[   rg   rC   rh    r   r   <module>rr      s  $ 0 / . . . . . . . . . . . .                     ZB ZB ZB ZB ZBCL! ZB ZB ZBF -1#'*.( (
(-#
(	( ^&,( M#c)	(
 C( "T)( HMD ( ( 8=4'( ( ( ( (V
(-#
	 ^&, M#c)	
     , -1	 
(-#
	 sy' "T)	
    @QSX]S( Qs QS QU Q Q Q Q Q Qr   