o
    'h#                     @   s  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 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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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dZdee	jjef dededefddZdS )z)DNS RRsets (an RRset is a named rdataset)    )Any
CollectionDictOptionalUnioncastNc                       sj  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d	Z fd
dZdd Zdd Z fddZdededef fd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dZ		d&deejj	 dedeeef def fd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!d"Zdejjfd#d$Z  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                    s    t  ||| || _|| _dS )zCreate a new RRset.N)super__init__r	   r
   selfr	   r   r   r   r
   	__class__ E/var/www/html/olx_land/venv/lib/python3.10/site-packages/dns/rrset.pyr   (   s   

zRRset.__init__c                    s   t   }| j|_| j|_|S N)r   _cloner	   r
   )r   objr   r   r   r   6   s   
zRRset._clonec                 C   s   | j dkrd}ndtj| j  d }| jd ur"dtj| j }nd}dt| j d tj| j d tj| j	 | | d | 
  d	 S )
Nr    ()z delete=z<DNS  z RRset: >)r   dns	rdatatypeto_textr
   
rdataclassstrr	   r   r   _rdata_repr)r   ctextdtextr   r   r   __repr__<   s8   

	
zRRset.__repr__c                 C   s   |   S r   )r    r   r   r   r   __str__S   s   zRRset.__str__c                    s:   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   r   r   r,   V   s   
zRRset.__eq__argskwargsreturnc                    s4   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   r.   r/   r   r   r   r3   ^   s   zRRset.matchc                    s0   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   r3   r	   r
   r   r   r   r   r2   o   s
   zRRset.full_matchTorigin
relativizekwc                    s   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   r4   r5   r6   r   r   r   r       s
   zRRset.to_textfilecompressc                    s    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   r7   r8   r4   r6   r   r   r   r9      s
   zRRset.to_wirec                 C   s   t j| jt| S )zYConvert an RRset into an Rdataset.

        Returns a ``dns.rdataset.Rdataset``.
        )r   r*   from_rdata_listttllistr'   r   r   r   to_rdataset   s   zRRset.to_rdatasetr   )NT)NN)!__name__
__module____qualname____doc__	__slots__r   r   NONEr	   r1   r!   
RdataClass	RdataTyper   r   r   r&   r(   r,   r   boolr3   r2   r   r"   r    CompressTypeintr9   r*   r+   r=   __classcell__r   r   r   r   r      sx    	






r   Tr	   r;   r   r   text_rdatas
idna_codecr4   r5   relativize_tor0   c	              
   C   s   t | trtjj| d|d} tjj|}tjj	|}t
| ||}	|	| |D ]}
tj|	j|	j|
||||}|	| q)|	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rK   )r)   r"   r   r	   	from_textr!   rD   maker   rE   r   
update_ttlrdatar   r   add)r	   r;   r   r   rJ   rK   r4   r5   rL   rtrdr   r   r   from_text_list   s   

rV   c                 G   s   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.
    )rV   r   r   r"   )r	   r;   r   r   rJ   r   r   r   rN      s   rN   rdatasc                 C   sz   t | trtjj| d|d} t|dkrtdd}|D ]}|du r/t| |j|j	}|
| || q|dus;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.

    NrM   r   zrdata list must not be empty)r)   r"   r   r	   rN   len
ValueErrorr   r   r   rP   rR   )r	   r;   rW   rK   rS   rU   r   r   r   r:      s   

r:   c                 G   s   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.
    )r:   r   r   r   rQ   Rdata)r	   r;   rW   r   r   r   
from_rdata  s   r[   )NNTNr   ) rA   typingr   r   r   r   r   r   dns.namer   dns.rdataclassdns.rdatasetdns.rendererr*   r+   r   r	   r1   r"   rH   r!   rD   r   rE   	IDNACodecrF   rV   rN   rQ   rZ   r:   r[   r   r   r   r   <module>   sv     $


	

+



* 