HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib64/python3.10/site-packages/dns/__pycache__/rrset.cpython-310.pyc
o

!we�#�@s�dZddlmZmZmZmZmZmZddlZ	ddl
Z	ddlZ	ddlZ	Gdd�de	j
j�Z				ddee	jjefded	ee	jjefd
ee	jjefdeedee	jjd
ee	jjdedee	jjdefdd�Zdee	jjefded	ee	jjefd
ee	jjefdedefdd�Z	ddee	jjefdedee	jjdee	jjdef
dd�Zdee	jjefdededefdd�ZdS)z)DNS RRsets (an RRset is a named rdataset)�)�Any�
Collection�Dict�Optional�Union�castNc
sjeZdZdZddgZejjdfdejj	dej
jdejjdejjde
ej
jf
�fdd	�
Z�fd
d�Zdd
�Zdd�Z�fdd�Zdededef�fdd�Z	d%dejj	dej
jdejjdejjde
ej
jdef�fdd�
Z		d&de
ejj	dedeeefdef�fdd�
Z		d'ded e
ejjde
ejj	deeefdef
�fd!d"�
Zdejjfd#d$�Z�Z S)(�RRseta6A 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�coverscs t��|||�||_||_dS)zCreate a new RRset.N)�super�__init__r	r
��selfr	rrr
r
��	__class__��B/home/arjun/projects/env/lib/python3.10/site-packages/dns/rrset.pyr)s

zRRset.__init__cst���}|j|_|j|_|S�N)r�_cloner	r
)r�objrrrr7s
zRRset._clonecCs�|jdkrd}ndtj�|j�d}|jdur"dtj�|j�}nd}dt|j�dtj�|j�dtj�|j	�||d|�
�d	S)
Nr��(�)z delete=z<DNS � z RRset: �>)r
�dns�	rdatatype�to_textr
�
rdataclass�strr	rr�_rdata_repr)r�ctext�dtextrrr�__repr__=s8

��������	�
��zRRset.__repr__cCs|��Sr)r �rrrr�__str__Tsz
RRset.__str__cs:t|t�r|j|jkr
dSn	t|tjj�sdSt��|�S)NF)�
isinstancerr	r�rdataset�Rdatasetr�__eq__)r�otherrrrr,Ws
�zRRset.__eq__�args�kwargs�returncs4t|dtjj�r|j|i|��St�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)rr	�Name�
full_matchr�match)rr.r/rrrr3_szRRset.matchcs0t��|||�s
dS|j|ks|j|krdSdS)ztReturns ``True`` if this rrset matches the specified name, class,
        type, covers, and deletion state.
        FT)rr3r	r
rrrrr2ps
zRRset.full_matchT�origin�
relativize�kwcst�j|j|||jfi|��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*.
        )rr r	r
)rr4r5r6rrrr �s
��z
RRset.to_text�file�compresscs t�j|j||||jfi|��S)z�Convert 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
)rr7r8r4r6rrrr9�s
��z
RRset.to_wirecCstj�|jt|��S)zYConvert an RRset into an Rdataset.

        Returns a ``dns.rdataset.Rdataset``.
        )rr*�from_rdata_list�ttl�listr'rrr�to_rdataset�szRRset.to_rdatasetr)NT)NN)!�__name__�
__module__�__qualname__�__doc__�	__slots__rr�NONEr	r1r!�
RdataClass�	RdataTyperrrr&r(r,r�boolr3r2rr"r �CompressType�intr9r*r+r=�
__classcell__rrrrrsx	�����
������
���
��
����
�
�
��rTr	r;rr�text_rdatas�
idna_codecr4r5�
relativize_tor0c	
Cs�t|t�rtjj|d|d�}tjj�|�}tjj	�|�}t
|||�}	|	�|�|D]}
tj�|	j
|	j|
||||�}|	�|�q)|	S)ayCreate 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"rr	�	from_textr!rD�makerrEr�
update_ttl�rdatarr�add)r	r;rrrJrKr4r5rL�r�t�rdrrr�from_text_list�s

�rVcGst||||ttt|��S)z�Create an RRset with the specified name, TTL, class, and type and with
    the specified rdatas in text format.

    Returns a ``dns.rrset.RRset`` object.
    )rVrrr")r	r;rrrJrrrrN�s
�rN�rdatascCszt|t�rtjj|d|d�}t|�dkrtd��d}|D]}|dur/t||j|j	�}|�
|�|�|�q|dus;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.

    NrMrzrdata list must not be empty)r)r"rr	rN�len�
ValueErrorrrrrPrR)r	r;rWrKrSrUrrrr:�s

r:cGst||tttjj|��S)z�Create an RRset with the specified name and TTL, and with
    the specified rdata objects.

    Returns a ``dns.rrset.RRset`` object.
    )r:rrrrQ�Rdata)r	r;rWrrr�
from_rdatasr[)NNTNr) rA�typingrrrrrr�dns.namer�dns.rdataclass�dns.rdataset�dns.rendererr*r+rr	r1r"rHr!rDrrE�	IDNACodecrFrVrNrQrZr:r[rrrr�<module>sv %������
�
��
	�

�+�����
����
�
�
�*