
    Eqg#                        d Z ddlmZmZmZmZmZm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e	j        j        ef         ded	ee	j        j        ef         d
ee	j        j        ef         dee         dee	j        j                 dee	j        j                 dedee	j        j                 defdZdee	j        j        ef         ded	ee	j        j        ef         d
ee	j        j        ef         dedefdZ	 ddee	j        j        ef         dedee	j        j                 dee	j        j                 def
dZdee	j        j        ef         dededefdZdS )z)DNS RRsets (an RRset is a named rdataset)    )Any
CollectionDictOptionalUnioncastNc                       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ej
        j                 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ej
        j                 def fdZ	 	 ddeej        j	                 dedeeef         def fdZ	 	 ddedeej        j                 deej        j	                 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         ;/var/www/html/env/lib/python3.11/site-packages/dns/rrset.pyr   zRRset.__init__(   s3     	&&111	     c                 x    t                                                      }| j        |_        | j        |_        |S N)r   _cloner   r   )r   objr   s     r   r   zRRset._clone6   s-    ggnn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__S   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   r2   zRRset.__eq__V   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   r4   r5   r   s      r   r:   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   r:   r   r   r   s         r   r9   zRRset.full_matcho   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@   rA   r<   r>   r   s        r   rC   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"   r0   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   r8   r%   
RdataClass	RdataTyper   r   r   r*   r-   r2   r   boolr:   r9   r   r&   r$   CompressTypeintrC   r0   r1   rH   __classcell__)r   s   @r   r
   r
      s         $I +.-*<8<! !hm! *! '	!
 '! 3>45! ! ! ! ! !    
 
 
.  % % % % %23 2# 2$ 2 2 2 2 2 2. 9= hm * '	
 ' 3>45 
     * +/
 
'
 
 38n	

 

 
 
 
 
 
: 59*.	
 

 3801
 '	

 38n
 

 
 
 
 
 
*BS\2 B B B B B B B Br   r
   Tr   rF   r   r   text_rdatas
idna_codecr<   r=   relativize_tor6   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rV   )r/   r&   r"   r   	from_textr%   rO   maker#   rP   r
   
update_ttlrdatar   r   add)r   rF   r   r   rU   rV   r<   r=   rW   rtrds               r   from_text_listrb      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.
    )rb   r   r   r&   )r   rF   r   r   rU   s        r   rZ   rZ      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.

    NrY   r   zrdata list must not be empty)r/   r&   r"   r   rZ   len
ValueErrorr
   r   r   r\   r^   )r   rF   rd   rV   r_   ra   s         r   rE   rE      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.
    )rE   r   r   r"   r]   Rdata)r   rF   rd   s      r   
from_rdatarj     s)     4d:cio+F&O&OPPPr   )NNTNr   ) rL   typingr   r   r   r   r   r   dns.namer"   dns.rdataclassdns.rdatasetdns.rendererr0   r1   r
   r   r8   r&   rS   r%   rO   r#   rP   	IDNACodecrQ   rb   rZ   r]   ri   rE   rj    r   r   <module>rr      s  $ 0 / ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?             ZB ZB ZB ZB ZBCL! ZB ZB ZBF 04&*-1( (
s"
#(	( 3>,c12( #-)3./	(
 C( +,( SX]#( ( CHM*( ( ( ( (V
s"
#	 3>,c12 #-)3./	
     , 04	 
s"
#	 sy' +,	
    @QU38=#-. QS Q3 Q5 Q Q Q Q Q Qr   