AlkantarClanX12

Your IP : 3.149.237.231


Current Path : /lib/python3.6/site-packages/dns/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/dns/__pycache__/rrset.cpython-36.pyc

3

�$�Wk�@sldZddlZddlZddlZddlZddlmZGdd�dejj	�Z
ddd�Zd	d
�Zddd�Z
d
d�ZdS)z)DNS RRsets (an RRset is a named rdataset)�N�)�string_typescs�eZdZdZddgZejjdf�fdd�	Z�fdd�Z	d	d
�Z
dd�Z�fd
d�Zd�fdd�	Z
d�fdd�	Zd�fdd�	Zdd�Z�ZS)�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�deletingNcs$tt|�j|||�||_||_dS)zCreate a new RRset.N)�superr�__init__rr)�selfr�rdclass�rdtype�coversr)�	__class__��/usr/lib/python3.6/rrset.pyr'szRRset.__init__cs"tt|�j�}|j|_|j|_|S)N)rr�_clonerr)r	�obj)r
rrr/szRRset._clonecCs�|jdkrd}ndtjj|j�d}|jdk	rDdtjj|j�}nd}dt|j�dtjj|j�dtjj|j	�||dS)	Nr��(�)z delete=z<DNS � z RRset>)
r�dns�	rdatatype�to_textr�
rdataclass�strrr
r)r	ZctextZdtextrrr�__repr__5s

zRRset.__repr__cCs|j�S)N)r)r	rrr�__str__Bsz
RRset.__str__cs.t|t�sdS|j|jkrdStt|�j|�S)zcTwo RRsets are equal if they have the same name and the same
        rdataset

        @rtype: boolF)�
isinstancerrr�__eq__)r	�other)r
rrrEs

zRRset.__eq__cs4tt|�j|||�sdS|j|ks,|j|kr0dSdS)zaReturns True if this rrset matches the specified class, type,
        covers, and deletion state.FT)rr�matchrr)r	rr
rrr)r
rrr Ps
zRRset.matchTcstt|�j|j|||jf|�S)a�Convert the RRset into DNS master file format.

        @see: L{dns.name.Name.choose_relativity} for more information
        on how I{origin} and I{relativize} determine the way names
        are emitted.

        Any additional keyword arguments are passed on to the rdata
        to_text() method.

        @param origin: The origin for relative names, or None.
        @type origin: dns.name.Name object
        @param relativize: True if names should names be relativized
        @type relativize: bool)rrrrr)r	�originZ
relativize�kw)r
rrrZsz
RRset.to_textcs tt|�j|j||||jf|�S)z!Convert the RRset to wire format.)rr�to_wirerr)r	�file�compressr!r")r
rrr#lsz
RRset.to_wirecCstjj|jt|��S)zYConvert an RRset into an Rdataset.

        @rtype: dns.rdataset.Rdataset object
        )r�rdataset�from_rdata_list�ttl�list)r	rrr�to_rdatasetrszRRset.to_rdataset)N)NT)NN)�__name__�
__module__�__qualname__�__doc__�	__slots__rrZNONErrrrrr rr#r*�
__classcell__rr)r
rrs	

rc	Cs�t|t�rtjj|d|d�}t|t�r2tjj|�}t|t�rHtjj|�}t|||�}|j|�x*|D]"}tj	j|j
|j|�}|j|�qdW|S)z�Create an RRset with the specified name, TTL, class, and type, and with
    the specified list of rdatas in text format.

    @rtype: dns.rrset.RRset object
    N)�
idna_codec)
rrrr�	from_textrrr�
update_ttlZrdatar
r�add)	rr(r
r�text_rdatasr1�r�t�rdrrr�from_text_listzs




r9cGst|||||�S)z�Create an RRset with the specified name, TTL, class, and type and with
    the specified rdatas in text format.

    @rtype: dns.rrset.RRset object
    )r9)rr(r
rr5rrrr2�sr2cCsrt|t�rtjj|d|d�}t|�dkr0td��d}x8|D]0}|dkr`t||j|j	�}|j
|�|j|�q:W|S)z�Create an RRset with the specified name and TTL, and with
    the specified list of rdata objects.

    @rtype: dns.rrset.RRset object
    N)r1rzrdata list must not be empty)rrrrr2�len�
ValueErrorrr
rr3r4)rr(�rdatasr1r6r8rrrr'�s


r'cGst|||�S)z�Create an RRset with the specified name and TTL, and with
    the specified rdata objects.

    @rtype: dns.rrset.RRset object
    )r')rr(r<rrr�
from_rdata�sr=)N)N)r.Zdns.namerZdns.rdatasetZdns.rdataclassZdns.rendererZ_compatrr&ZRdatasetrr9r2r'r=rrrr�<module>sa