File: //home/arjun/projects/env/lib/python3.10/site-packages/dns/__pycache__/rrset.cpython-310.pyc
o
!we�# � @ s� d Z ddlmZmZmZmZmZmZ ddlZ ddl
Z ddlZ ddlZ G dd� de j
j�Z ddee jjef ded ee jjef d
ee jjef dee dee jj d
ee jj dedee jj defdd�Zdee jjef ded ee jjef d
ee jjef dedefdd�Z ddee jjef dedee jj dee jj def
dd�Zdee jjef dededefdd�ZdS )z)DNS RRsets (an RRset is a named rdataset)� )�Any�
Collection�Dict�Optional�Union�castNc
sj e Zd ZdZddgZejjdfdejj dej
jdejjdejjde
ej
j f
� fdd �
Z� fd
d�Zdd
� Zdd� Z� fdd�Zdededef� fdd�Z d%dejj dej
jdejjdejjde
ej
j def� fdd�
Z d&de
ejj dedeeef def� fdd�
Z d'ded e
ejj de
ejj deeef def
� fd!d"�
Zdejjfd#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 � �|||� || _|| _dS )zCreate a new RRset.N)�super�__init__r r
��selfr r r r
r
�� __class__� �B/home/arjun/projects/env/lib/python3.10/site-packages/dns/rrset.pyr ) s
zRRset.__init__c s t � �� }| j|_| j|_|S �N)r �_cloner r
)r �objr r r r 7 s
zRRset._clonec C s� | j dkrd}ndtj�| j � d }| jd ur"dtj�| j� }nd}dt| j� d tj�| j� d tj�| 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
�������� �
��zRRset.__repr__c C s | � � S r )r �r r r r �__str__T s z
RRset.__str__c s: t |t�r| j|jkr
dS n t |tjj�sdS t� �|�S )NF)�
isinstancer r r �rdataset�Rdatasetr �__eq__)r �otherr r r r, W s
�zRRset.__eq__�args�kwargs�returnc s4 t |d tjj�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 zRRset.matchc s0 t � �|||�s
dS | j|ks| j|krdS dS )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 p s
zRRset.full_matchT�origin�
relativize�kwc s t � 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*.
)r r r r
)r r4 r5 r6 r r r r � s
��z
RRset.to_text�file�compressc s 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
)r r7 r8 r4 r6 r r r r9 � s
��z
RRset.to_wirec C s t j�| jt| ��S )zYConvert an RRset into an Rdataset.
Returns a ``dns.rdataset.Rdataset``.
)r r* �from_rdata_list�ttl�listr'