
    h#                     |   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                   j0                  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j8                  j:                     dej                   j0                  dz  def
dZdej                   j"                  ez  dededefdZy)z)DNS RRsets (an RRset is a named rdataset)    )Any
CollectionDict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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                  j2                  dz  dej                  j                  dz  deeef   def
 fdZdej8                  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                 D    t         |   |||       || _        || _        y)zCreate a new RRset.N)super__init__r	   r
   selfr	   r   r   r   r
   	__class__s         G/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/dns/rrset.pyr   zRRset.__init__*   s$     	&&1	     c                     t        t        t        |                }| j                  |_        | j
                  |_        |S N)r   r   r   _cloner	   r
   )r   objr   s     r   r   zRRset._clone8   s1    5%'.*+99}}
r   c                    | j                   dk(  rd}n/dt        j                  j                  | j                         z   dz   }| j                  -dt        j
                  j                  | j                        z   }nd}dt        | j                        z   dz   t        j
                  j                  | j                        z   dz   t        j                  j                  | j                        z   |z   |z   dz   | j                         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    ;;!E#--//<<sBE==$!7!7!FFEE$))n nn$$T\\23 	
 mm##DKK01     	! 
	
r   c                 "    | j                         S r   )r"   r   s    r   __str__zRRset.__str__U   s    ||~r   c                     t        |t              r| j                  |j                  k7  r&yt        |t        j                  j
                        syt        |   |      S )NF)
isinstancer   r	   r    rdatasetRdatasetr   __eq__)r   otherr   s     r   r0   zRRset.__eq__X   sF    eU#yyEJJ&E3<<#8#89w~e$$r   argskwargsreturnc                     t        |d   t        j                  j                        r | j                  |i |S t        |   |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`   sE     d1gsxx}}-"4??D3F337=$1&11r   c                 h    t         |   |||      sy| j                  |k7  s| j                  |k7  ryy)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   s5     w}Wff599 9r   origin
relativizekwc                 R    t        |   | 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   s/    , wIIvz4==
<>
 	
r   filecompressc                 T    t        |   | 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   s1     wIItXvt}}
@B
 	
r   c                 h    t         j                  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#    
 ||++DHHd4j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!hhmm! **! ''	!
 ''! ..++d2!
.%23 2# 2$ 2. 6:hhmm ** ''	
 '' ..++d2 
* (,
$
 
 38n	

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

 38n
 

*BS\\22 Br   r   r	   rD   r   r   text_rdatas
idna_codecr:   r;   relativize_tor4   c	           
         t        | t              r"t        j                  j	                  | d|      } t        j
                  j                  j                  |      }t        j                  j                  j                  |      }t        | ||      }	|	j                  |       |D ]L  }
t        j                  j	                  |	j                  |	j                  |
||||      }|	j                  |       N |	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    : $xx!!$!Dnn'',,W5G]]$$))&1FdGV$ALL YY  IIqxxFJz
 	
b		
 Hr   c           
      J    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 r   rdatasc                 @   t        | t              r"t        j                  j	                  | d|      } t        |      dk(  rt        d      d}|D ]G  }|2t        | |j                  |j                        }|j                  |       |j                  |       I |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    " $xx!!$!D
6{a788A 9dBJJ		2ALL	b		
 ==Hr   c                 n    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:ciioo+F&O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CLL!! ZBF -1#'*.(
((--#
(	( ^^&&,( MM##c)	(
 C( ""T)( HHMMD ( ( 88==4'( (V
((--#
	 ^^&&, MM##c)	
  , -1	
((--#
	 syy' ""T)	
 @QSXX]]S( Qs QS QU Qr   