%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/dns/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/dns/__pycache__/node.cpython-312.pyc

�

5��ew1���dZddlZddlZddlmZmZmZddlZddl	Zddl
ZddlZddlZddl
ZddlZejj hZejj$ejj&ejj(hZd�Zej.Gd�dej0��ZGd�d�Zej6j6Gd	�d
e��Zy)z)DNS nodes.  A node is a set of rdatasets.�N)�Any�Dict�Optionalc�T�||vxs#|tjjk(xr||vS�N)�dns�	rdatatype�RRSIG)�rdtypes�rdtype�coverss   �*/usr/lib/python3/dist-packages/dns/node.py�_matches_type_or_its_signaturer,s+���W��U��3�=�=�+>�+>�!>�!T�6�W�CT�U�c���eZdZdZdZdZdZedejjdejjddfd��Zed	ejjddfd
��Zy)�NodeKindzRdatasets in nodesr��rr
�returnc��tt||�rtjStt||�rtj
StjSr)r�_cname_typesr�CNAME�_neutral_types�NEUTRAL�REGULAR)�clsrr
s   r�classifyzNodeKind.classify8s>��*�,���G��>�>�!�
+�N�F�F�
K��#�#�#��#�#�#r�rdatasetc�N�|j|j|j�Sr)rrr
)rrs  r�classify_rdatasetzNodeKind.classify_rdatasetCs���|�|�H�O�O�X�_�_�=�=rN)�__name__�
__module__�__qualname__�__doc__rrr�classmethodrr	�	RdataTyperr�Rdatasetr �rrrr0s~����G��G�
�E��$��]�]�,�,�$�69�m�m�6M�6M�$�	�$��$��>����)>�)>�>�:�>��>rrc�l�eZdZdZdgZd�Zdejjde	e
efde
fd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zej&j(dfdej*j,dej&j.dej&j.dedej2j4f
d�Zej&j(dfdej*j,dej&j.dej&j.dedeej2j4f
d�Zej&j(fdej*j,dej&j.dej&j.ddfd�Zdej2j4ddfd�Zde fd�Z!defd�Z"y)�Nodea�A Node is a set of rdatasets.

    A node is either a CNAME node or an "other data" node.  A CNAME
    node contains only CNAME, KEY, NSEC, and NSEC3 rdatasets along with their
    covering RRSIG rdatasets.  An "other data" node contains any
    rdataset other than a CNAME or RRSIG(CNAME) rdataset.  When
    changes are made to a node, the CNAME or "other data" state is
    always consistent with the update, i.e. the most recent change
    wins.  For example, if you have a node which contains a CNAME
    rdataset, and then add an MX rdataset to it, then the CNAME
    rdataset will be deleted.  Likewise if you have a node containing
    an MX rdataset and add a CNAME rdataset, the MX rdataset will be
    deleted.
    �	rdatasetsc��g|_yr�r+��selfs r�__init__z
Node.__init__Zs	����r�name�kwrc��tj�}|jD]D}t|�dkDs�|j	|j
|fi|���|j	d��F|j
�ddS)a"Convert a node to text format.

        Each rdataset at the node is printed.  Any keyword arguments
        to this method are passed on to the rdataset's to_text() method.

        *name*, a ``dns.name.Name``, the owner name of the
        rdatasets.

        Returns a ``str``.

        r�
N���)�io�StringIOr+�len�write�to_text�getvalue)r/r1r2�s�rdss     rr:zNode.to_text^si��
�K�K�M���>�>�	�C��3�x�!�|��������D�/�B�/�0�����
�	��z�z�|�C�R� � rc�6�dtt|��zdzS)Nz
<DNS node �>)�str�idr.s r�__repr__z
Node.__repr__rs���c�"�T�(�m�+�c�1�1rc��|jD]}||jvs�y|jD]}||jvs�yy)NFTr-)r/�other�rds   r�__eq__zNode.__eq__usO���.�.�	�B�����(��	��/�/�	�B�����'��	�rc�&�|j|�Sr)rF)r/rDs  r�__ne__zNode.__ne__�s���;�;�u�%�%�%rc�,�t|j�Sr)r8r+r.s r�__len__zNode.__len__�s���4�>�>�"�"rc�,�t|j�Sr)�iterr+r.s r�__iter__z
Node.__iter__�s���D�N�N�#�#rc�
�t|j�dkDr�tj|�}|tjk(rF|jD�cgc]*}tj|�tj
k7r|��,c}|_nX|tj
k(rE|jD�cgc]*}tj|�tjk7r|��,c}|_|jj
|�ycc}wcc}w)a�Append rdataset to the node with special handling for CNAME and
        other data conditions.

        Specifically, if the rdataset being appended has ``NodeKind.CNAME``,
        then all rdatasets other than KEY, NSEC, NSEC3, and their covering
        RRSIGs are deleted.  If the rdataset being appended has
        ``NodeKind.REGULAR`` then CNAME and RRSIG(CNAME) are deleted.
        rN)r8r+rr rr�append)r/r�kindr=s    r�_append_rdatasetzNode._append_rdataset�s����t�~�~���"��-�-�h�7�D��x�~�~�%� $�~�~�"���1�1�#�6�(�:J�:J�J��"���
��)�)�)� $�~�~�"���1�1�#�6�(�.�.�H��"���	
�����h�'��"��"s�/C;�(/DF�rdclassrr
�createc���|jD]}|j|||�s�|cS|st�tjj|||�}|j
|�|S)a*Find an rdataset matching the specified properties in the
        current node.

        *rdclass*, a ``dns.rdataclass.RdataClass``, the class of the rdataset.

        *rdtype*, a ``dns.rdatatype.RdataType``, the type of the rdataset.

        *covers*, a ``dns.rdatatype.RdataType``, the covered type.
        Usually this value is ``dns.rdatatype.NONE``, but if the
        rdtype is ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``,
        then the covers value will be the rdata type the SIG/RRSIG
        covers.  The library treats the SIG and RRSIG types as if they
        were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA).
        This makes RRSIGs much easier to work with than if RRSIGs
        covering different rdata types were aggregated into a single
        RRSIG rdataset.

        *create*, a ``bool``.  If True, create the rdataset if it is not found.

        Raises ``KeyError`` if an rdataset of the desired type and class does
        not exist and *create* is not ``True``.

        Returns a ``dns.rdataset.Rdataset``.
        )r+�match�KeyErrorrrr'rQ�r/rRrr
rSr=s      r�
find_rdatasetzNode.find_rdataset�sb��@�>�>�	�C��y�y��&�&�1��
�	���N��l�l�#�#�G�V�V�<�����c�"��
rc�T�	|j||||�}|S#t$rd}Y|SwxYw)a�Get an rdataset matching the specified properties in the
        current node.

        None is returned if an rdataset of the specified type and
        class does not exist and *create* is not ``True``.

        *rdclass*, an ``int``, the class of the rdataset.

        *rdtype*, an ``int``, the type of the rdataset.

        *covers*, an ``int``, the covered type.  Usually this value is
        dns.rdatatype.NONE, but if the rdtype is dns.rdatatype.SIG or
        dns.rdatatype.RRSIG, then the covers value will be the rdata
        type the SIG/RRSIG covers.  The library treats the SIG and RRSIG
        types as if they were a family of
        types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA).  This makes RRSIGs much
        easier to work with than if RRSIGs covering different rdata
        types were aggregated into a single RRSIG rdataset.

        *create*, a ``bool``.  If True, create the rdataset if it is not found.

        Returns a ``dns.rdataset.Rdataset`` or ``None``.
        N)rXrVrWs      r�get_rdatasetzNode.get_rdataset�s?��>	��$�$�W�f�f�f�E�C��
���	��C��
�	�s��'�'Nc�f�|j|||�}|�|jj|�yy)aDDelete the rdataset matching the specified properties in the
        current node.

        If a matching rdataset does not exist, it is not an error.

        *rdclass*, an ``int``, the class of the rdataset.

        *rdtype*, an ``int``, the type of the rdataset.

        *covers*, an ``int``, the covered type.
        N)rZr+�remove)r/rRrr
r=s     r�delete_rdatasetzNode.delete_rdataset�s4��$������8���?��N�N�!�!�#�&�r�replacementc�N�t|tjj�st	d��t|tj
j�r|j�}|j|j|j|j�|j|�y)a�Replace an rdataset.

        It is not an error if there is no rdataset matching *replacement*.

        Ownership of the *replacement* object is transferred to the node;
        in other words, this method does not store a copy of *replacement*
        at the node, it stores *replacement* itself.

        *replacement*, a ``dns.rdataset.Rdataset``.

        Raises ``ValueError`` if *replacement* is not a
        ``dns.rdataset.Rdataset``.
        zreplacement is not an rdatasetN)
�
isinstancerrr'�
ValueError�rrset�RRset�to_rdatasetr]rRrr
rQ�r/r^s  r�replace_rdatasetzNode.replace_rdataset
s}���+�s�|�|�'<�'<�=��=�>�>��k�3�9�9�?�?�3�&�1�1�3�K��������!3�!3�[�5G�5G�	
�	
���k�*rc���|jD]C}tj|j|j�}|tj
k7s�A|cStj
S)aTClassify a node.

        A node which contains a CNAME or RRSIG(CNAME) is a
        ``NodeKind.CNAME`` node.

        A node which contains only "neutral" types, i.e. types allowed to
        co-exist with a CNAME, is a ``NodeKind.NEUTRAL`` node.  The neutral
        types are NSEC, NSEC3, KEY, and their associated RRSIGS.  An empty node
        is also considered neutral.

        A node which contains some rdataset which is not a CNAME, RRSIG(CNAME),
        or a neutral type is a a ``NodeKind.REGULAR`` node.  Regular nodes are
        also commonly referred to as "other data".
        )r+rrrr
r)r/rrPs   rrz
Node.classify$sR�����	�H��$�$�X�_�_�h�o�o�F�D��x�'�'�'���	����rc��y)NFr(r.s r�is_immutablezNode.is_immutable9s��r)#r!r"r#r$�	__slots__r0rr1�Namerr@rr:rBrFrHrJrMrQr	�NONE�
rdataclass�
RdataClassr&�boolrr'rXrrZr]rfrrrir(rrr*r*Hs���
��
�I��!�C�H�H�M�M�!��c�3�h��!�C�!�(2�
�&�#�$�(�@+.�-�-�*<�*<��'����*�*�'��
�
�'�'�'��
�
�'�'�	'�
�'�

���	�	�
'�Z+.�-�-�*<�*<��#����*�*�#��
�
�'�'�#��
�
�'�'�	#�
�#�
�#�,�,�'�'�	(�
#�R+.�-�-�*<�*<�	'����*�*�'��
�
�'�'�'��
�
�'�'�	'�

�'�,+�C�L�L�,A�,A�+�d�+�4 �(� �*�d�rr*c���eZdZ�fd�Zej
jdfdejjdej
jdej
jde
dejjf
�fd�
Z
ej
jdfdejjdej
jdej
jde
deejjf
�fd	�
Zej
jfdejjdej
jdej
jdd
fd�Zdejjdd
fd
�Zde
fd�Z�xZS)�
ImmutableNodec���t�|��t|jD�cgc]!}tj
j
|���#c}�|_ycc}wr)�superr0�tupler+rr�ImmutableRdataset)r/�noder=�	__class__s   �rr0zImmutableNode.__init__?s>���
�����<@�N�N�K�S�S�\�\�
+�
+�C�
0�K�
����Ks�&AFrRrr
rSrc�B��|rtd��t�|�	|||d�S�N�	immutableF)�	TypeErrorrsrX�r/rRrr
rSrws     �rrXzImmutableNode.find_rdatasetEs)�����K�(�(��w�$�W�f�f�e�D�Drc�B��|rtd��t�|�	|||d�Sry)r{rsrZr|s     �rrZzImmutableNode.get_rdatasetPs)�����K�(�(��w�#�G�V�V�U�C�CrNc��td���Nrz�r{)r/rRrr
s    rr]zImmutableNode.delete_rdataset[s����$�$rr^c��td��rr�res  rrfzImmutableNode.replace_rdatasetcs
����$�$rc��y)NTr(r.s rrizImmutableNode.is_immutablefs��r)r!r"r#r0rr	rlrmrnr&rorr'rXrrZr]rfri�
__classcell__)rws@rrqrq=sx���
�+.�-�-�*<�*<��	E����*�*�	E��
�
�'�'�	E��
�
�'�'�		E�
�	E�

���	�	�
	E�+.�-�-�*<�*<��	D����*�*�	D��
�
�'�'�	D��
�
�'�'�		D�
�	D�
�#�,�,�'�'�	(�
	D�+.�-�-�*<�*<�	%����*�*�%��
�
�'�'�%��
�
�'�'�	%�

�%�%�C�L�L�,A�,A�%�d�%��d�rrq)r$�enumr6�typingrrr�
dns.immutabler�dns.name�dns.rdataclass�dns.rdataset�
dns.rdatatype�dns.renderer�	dns.rrsetr	rr�NSEC�NSEC3�KEYrr�unique�Enumrr*rzrqr(rr�<module>r�s���$0��	�&�&���������M�M������M�M����M�M����M�M�����V����>�t�y�y�>�
�>�.r�r�j�����)�D�)��)r

Zerion Mini Shell 1.0