%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__/transaction.cpython-312.pyc

�

5��elX���ddlZddlmZmZmZmZmZmZmZddl	Z
ddlZ
ddlZ
ddl
Z
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
Gd�d�ZGd�de
j(j*�ZGd�de
j(j*�ZGd	�d
e
j(j*�Zd�Zd�Zed
e
j6j8e
j:j<gdfZed
e
j6j8e
j@jBe
j@jBgdfZ"ed
e
j6j8gdfZ#Gd�d
�Z$y)�N)�Any�Callable�Iterator�List�Optional�Tuple�Unionc��eZdZd
d�Zddeddfd�Zdeeejjeeejjffd�Zdejjfd�Zdeejjfd�Zy	)�TransactionManager�return�Transactionc��t�)zBegin a read-only transaction.��NotImplementedError��selfs �1/usr/lib/python3/dist-packages/dns/transaction.py�readerzTransactionManager.reader���!�!��replacementc��t�)aBegin a writable transaction.

        *replacement*, a ``bool``.  If `True`, the content of the
        transaction completely replaces any prior content.  If False,
        the default, then the content of the transaction updates the
        existing content.
        r)rrs  r�writerzTransactionManager.writers
��"�!rc��t�)aqReturns a tuple

            (absolute_origin, relativize, effective_origin)

        giving the absolute name of the default origin for any
        relative domain names, the "effective origin", and whether
        names should be relativized.  The "effective origin" is the
        absolute origin if relativize is False, and the empty name if
        relativize is true.  (The effective origin is provided even
        though it can be computed from the absolute_origin and
        relativize setting because it avoids a lot of code
        duplication.)

        If the returned names are `None`, then no origin information is
        available.

        This information is used by code working with transactions to
        allow it to coordinate relativization.  The transaction code
        itself takes what it gets (i.e. does not change name
        relativity).

        rrs r�origin_informationz%TransactionManager.origin_information s
��2"�!rc��t�)z%The class of the transaction manager.rrs r�	get_classzTransactionManager.get_class;rrc�4�|j�\}}}|r|Sy)z#Origin to use in from_wire() calls.N)r)r�absolute_origin�
relativize�_s    r�from_wire_originz#TransactionManager.from_wire_origin?s#��+/�+B�+B�+D�(��*�a��"�"�rN)rr
)F)�__name__�
__module__�__qualname__r�boolrrr�dns�name�Namer�
rdataclass�
RdataClassrr"�rrrrs|��"�"�$�"�=�"�"�	�x����
�
�&��h�s�x�x�}�}�.E�E�	F�"�6"�3�>�>�4�4�"��(�3�8�8�=�=�"9�rrc��eZdZdZy)�DeleteNotExactz>Existing data did not match data specified by an exact delete.N�r#r$r%�__doc__r,rrr.r.Hs��Hrr.c��eZdZdZy)�ReadOnlyz*Tried to write to a read-only transaction.Nr/r,rrr2r2L���4rr2c��eZdZdZy)�AlreadyEndedz*Tried to use an already-ended transaction.Nr/r,rrr5r5Pr3rr5c��|�$t|tjj�r|Stjj|�S�N)�
isinstancer'�rdataset�ImmutableRdataset)r9s r�_ensure_immutable_rdatasetr;Ts5����:�h����0N�0N�O����<�<�)�)�(�3�3rc�h�|�|j�r|Stjj|�Sr7)�is_immutabler'�node�
ImmutableNode)r>s r�_ensure_immutable_noder@Zs,���|�t�(�(�*����8�8�!�!�$�'�'rr
c	��eZdZ		d9dededefd�Zejjfde	e
ejje
fde
ejje
fde
ejje
fdejj fd	�Zdejjde	ej$j&fd
�Zd:d�Zd
eddfd�Zd
eddfd�Zd
eddfd�Zd
eddfd�Zde
ejje
fdefd�Zddejj8fdededejjddfd�Zd�Zdefd�Z d:d�Z!d:d�Z"de#ddfd�Z$de%ddfd�Z&de'ddfd�Z(de)e*ejjejj ffd �Z+de)ejjfd!�Z,d"�Z-d#�Z.d$�Z/d%�Z0d&�Z1d'�Z2d(�Z3d)�Z4d*�Z5d+�Z6d,�Z7d-�Z8d.�Z9d/�Z:d0�Z;d1�Z<d2�Z=d3�Z>d4�Z?d5�Z@d6�ZAd7�ZBd8�ZCy);r
�managerr�	read_onlyc�f�||_||_||_d|_g|_g|_g|_y�NF)rBrrC�_ended�_check_put_rdataset�_check_delete_rdataset�_check_delete_name)rrBrrCs    r�__init__zTransaction.__init__ks9�����&���"������?A�� �EG��#�=?��rr(�rdtype�coversrc�b�|j�t|t�r tjj|d�}tjjj|�}tjjj|�}|j|||�}t|�S)z�Return the rdataset associated with *name*, *rdtype*, and *covers*,
        or `None` if not found.

        Note that the returned rdataset is immutable.
        N)�_check_endedr8�strr'r(�	from_text�	rdatatype�	RdataType�make�
_get_rdatasetr;)rr(rKrLr9s     r�getzTransaction.get�s���	
�����d�C� ��8�8�%�%�d�D�1�D����(�(�-�-�f�5�����(�(�-�-�f�5���%�%�d�F�F�;��)�(�3�3rc�6�t|j|��S)z[Return the node at *name*, if any.

        Returns an immutable node or ``None``.
        )r@�	_get_node�rr(s  r�get_nodezTransaction.get_node�s��
&�d�n�n�T�&:�;�;rNc�(�|jrt�yr7)rCr2rs r�_check_read_onlyzTransaction._check_read_only�s���>�>��N�r�argsc�h�|j�|j�|jd|�y)z�Add records.

        The arguments may be:

            - rrset

            - name, rdataset...

            - name, ttl, rdata...
        FN�rNr[�_add�rr\s  r�addzTransaction.add�s*��	
���������	�	�%��rc�h�|j�|j�|jd|�y)a�Replace the existing rdataset at the name with the specified
        rdataset, or add the specified rdataset if there was no existing
        rdataset.

        The arguments may be:

            - rrset

            - name, rdataset...

            - name, ttl, rdata...

        Note that if you want to replace the entire node, you should do
        a delete of the name followed by one or more calls to add() or
        replace().
        TNr^r`s  r�replacezTransaction.replace�s*��"	
���������	�	�$��rc�h�|j�|j�|jd|�y)a Delete records.

        It is not an error if some of the records are not in the existing
        set.

        The arguments may be:

            - rrset

            - name

            - name, rdatatype, [covers]

            - name, rdataset...

            - name, rdata...
        FN�rNr[�_deleter`s  r�deletezTransaction.delete�s*��$	
�����������U�D�!rc�h�|j�|j�|jd|�y)a4Delete records.

        The arguments may be:

            - rrset

            - name

            - name, rdatatype, [covers]

            - name, rdataset...

            - name, rdata...

        Raises dns.transaction.DeleteNotExact if some of the records
        are not in the existing set.

        TNrer`s  r�delete_exactzTransaction.delete_exact�s*��&	
�����������T�4� rc��|j�t|t�r tjj|d�}|j
|�S)zDoes the specified name exist?N)rNr8rOr'r(rP�_name_existsrXs  r�name_existszTransaction.name_exists�s?�������d�C� ��8�8�%�%�d�D�1�D�� � ��&�&r�T�value�relativec��|j�|dkrtd��t|t�r tj
j
|d�}|j|tjjtjj�}|�t|�dk(rt�|r0tjj|dj�|z}ntjj|�}|j}|dk(rd}|dj!|��}tj"j%|j&|�}|j!||�y)a�Update the serial number.

        *value*, an `int`, is an increment if *relative* is `True`, or the
        actual value to set if *relative* is `False`.

        Raises `KeyError` if there is no SOA rdataset at *name*.

        Raises `ValueError` if *value* is negative or if the increment is
        so large that it would cause the new serial to be less than the
        prior value.
        rznegative update_serial() valueNrm)�serial)rN�
ValueErrorr8rOr'r(rPrTrQ�SOA�NONE�len�KeyErrorrq�Serialrnrcr9�
from_rdata�ttl)rrnror(r9rq�rdata�new_rdatasets        r�
update_serialzTransaction.update_serial�s��"	
�����1�9��=�>�>��d�C� ��8�8�%�%�d�D�1�D��%�%�d�C�M�M�,=�,=�s�}�}�?Q�?Q�R����s�8�}��1��N���Z�Z�&�&�x��{�'9�'9�:�U�B�F��Z�Z�&�&�u�-�F������Q�;��F����#�#�6�#�2���|�|�.�.�x�|�|�U�C�����T�<�(rc�B�|j�|j�Sr7�rN�_iterate_rdatasetsrs r�__iter__zTransaction.__iter__s�������&�&�(�(rc�B�|j�|j�S)aHas this transaction changed anything?

        For read-only transactions, the result is always `False`.

        For writable transactions, the result is `True` if at some time
        during the life of the transaction, the content was changed.
        )rN�_changedrs r�changedzTransaction.changeds��	
�����}�}��rc�&�|jd�y)a�Commit the transaction.

        Normally transactions are used as context managers and commit
        or rollback automatically, but it may be done explicitly if needed.
        A ``dns.transaction.Ended`` exception will be raised if you try
        to use a transaction after it has been committed or rolled back.

        Raises an exception if the commit fails (in which case the transaction
        is also rolled back.
        TN��_endrs r�commitzTransaction.commit)s��	
�	�	�$�rc�&�|jd�y)avRollback the transaction.

        Normally transactions are used as context managers and commit
        or rollback automatically, but it may be done explicitly if needed.
        A ``dns.transaction.AlreadyEnded`` exception will be raised if you try
        to use a transaction after it has been committed or rolled back.

        Rollback cannot otherwise fail.
        FNr�rs r�rollbackzTransaction.rollback6s��	
�	�	�%�r�checkc�:�|jj|�y)a�Call *check* before putting (storing) an rdataset.

        The function is called with the transaction, the name, and the rdataset.

        The check function may safely make non-mutating transaction method
        calls, but behavior is undefined if mutating transaction methods are
        called.  The check function should raise an exception if it objects to
        the put, and otherwise should return ``None``.
        N)rG�append�rr�s  r�check_put_rdatasetzTransaction.check_put_rdatasetBs��	
� � �'�'��.rc�:�|jj|�y)a�Call *check* before deleting an rdataset.

        The function is called with the transaction, the name, the rdatatype,
        and the covered rdatatype.

        The check function may safely make non-mutating transaction method
        calls, but behavior is undefined if mutating transaction methods are
        called.  The check function should raise an exception if it objects to
        the put, and otherwise should return ``None``.
        N)rHr�r�s  r�check_delete_rdatasetz!Transaction.check_delete_rdatasetNs��	
�#�#�*�*�5�1rc�:�|jj|�y)a�Call *check* before putting (storing) an rdataset.

        The function is called with the transaction and the name.

        The check function may safely make non-mutating transaction method
        calls, but behavior is undefined if mutating transaction methods are
        called.  The check function should raise an exception if it objects to
        the put, and otherwise should return ``None``.
        N)rIr�r�s  r�check_delete_namezTransaction.check_delete_name[s��	
���&�&�u�-rc�B�|j�|j�S)a@Iterate all the rdatasets in the transaction, returning
        (`dns.name.Name`, `dns.rdataset.Rdataset`) tuples.

        Note that as is usual with python iterators, adding or removing items
        while iterating will invalidate the iterator and may raise `RuntimeError`
        or fail to iterate over all entries.r~rs r�iterate_rdatasetszTransaction.iterate_rdatasetsgs��	
�����&�&�(�(rc�B�|j�|j�S)z�Iterate all the names in the transaction.

        Note that as is usual with python iterators, adding or removing names
        while iterating will invalidate the iterator and may raise `RuntimeError`
        or fail to iterate over all entries.)rN�_iterate_namesrs r�
iterate_nameszTransaction.iterate_namesss��	
�����"�"�$�$rc�<�t|�dk7rtd|����y)Nrzextra parameters to )ru�	TypeError)r�methodr\s   r�_raise_if_not_emptyzTransaction._raise_if_not_empty�s%���t�9��>��2�6�(�;�<�<�rc��	|j�}t|tjj�r|j�}|St|tjj�r|}|S|rd}n[t|t�r-|}|tjjkDrt|�d���t|�d���|j�}t|tjj�r"tjj||�}|St|�d���#t $r|rYyt|�d���wxYw)Nrz: TTL value too bigz: expected a TTLz: expected an Rdataz: expected more arguments)�popleftr8r'�rrset�RRset�to_rdatasetr9�Rdataset�intry�MAX_TTLrrr�rz�Rdatarx�
IndexError)rr��deletingr\�argr9rys       r�_rdataset_from_argszTransaction._rdataset_from_args�s$��	F��,�,�.�C��#�s�y�y���/��?�?�,��$�O�#�C����!6�!6�7��� �O���C�!�#�s�+�!��������0�",��x�7J�-K�"L�L�'�6�(�2B�(C�D�D��,�,�.�C��c�3�9�9�?�?�3�"�|�|�6�6�s�C�@�H��O�$�v�h�.A�$B�C�C���	F��� �6�(�*C� D�E�E�	F�s%�AD$�'D$�0B%D$�D$�$E�1Ec��	tj|�}|rd}nd}|j�}t|t�r t
jj|d�}t|t
jj�r|}|j|d|�}nQt|t
jj�r|}|j}|j�}nt|�d���|j|jj!�k7rt#|�d���|j$t
j&j(k(r'|j+�\}}}	||	k7rt#|�d���|j-||�|s�|j/||j$|j0�}
|
��t|
t
j2j4�rRt
j2j7|
j|
j$|
j0�}|j9|
�|}
|
j;|�}|j=||�y#t>$rtd����wxYw)Nz	replace()zadd()F�/ requires a name or RRset as the first argument�  has objects of wrong RdataClassz has non-origin SOA�not enough parameters to ) �collections�dequer�r8rOr'r(rPr)r�r�r�r�r��rdclassrBrrrrKrQrs�_origin_informationr�rTrLr9r:r��update�union�_checked_put_rdatasetr�)rrcr\r�r�r(r9r�r!�origin�existing�trdss            rr_zTransaction._add�s���)	B��$�$�T�*�D��$�� ���,�,�.�C��#�s�#��h�h�(�(��d�3���#�s�x�x�}�}�-����3�3�F�E�4�H���C������1����z�z��!�,�,�.����h�M�N������4�<�<�#9�#9�#;�;� �F�8�+K�!L�M�M����#�-�-�"3�"3�3�!%�!9�!9�!;���A�v��6�>�$��x�/B�%C�D�D��$�$�V�T�2���-�-�d�H�O�O�X�_�_�U���'�!�(�C�L�L�,J�,J�K�"�|�|�4�4�$�,�,�h�o�o�x��� �����H�-�#'��'�~�~�h�7�H��&�&�t�X�6���	B��7��x�@�A�A�	B�s�II�Ic��	tj|�}|rd}nd}|j�}t|t�r t
jj|d�}t|t
jj��r.|}t|�dkD�r	t|dt�st|dt�r�t
jjj|j��}t|�dkDr8t
jjj|j��}nt
jj}|j||�|j!|||�}|�|rt#|�d���y|j%|||�y|j'|d|�}	nAt|t
j(j*�r|}	|	j}nt-|�d���|j||�|	r�|	j.|j0j3�k7rt5|�d���|j!||	j6|	j8�}|��|r$|j;|	�}
|
|	k7rt#|�d���|j=|	�}	t|	�dk(r(|j?||	j6|	j8�y|jA||	�y|rAt#|�d���|r|jC|�st#|�d	���|jE|�yy#tF$rt-d
����wxYw)Nzdelete_exact()zdelete()rz: missing rdatasetTr�r�z: missing rdatasz: name not knownr�)$r�r�r�r8rOr'r(rPr)rur�rQrRrSrtr�rTr.�_delete_rdatasetr�r�r�r�r�rBrrrrKrL�intersection�
difference�_checked_delete_rdatasetr�rk�_checked_delete_namer�)r�exactr\r�r�r(rKrLr�r9r�s           rrfzTransaction._delete�s���=	B��$�$�T�*�D��)��#���,�,�.�C��#�s�#��h�h�(�(��d�3���#�s�x�x�}�}�-����t�9�q�=��t�A�w��,�
�4��7�C�0H�!�]�]�4�4�9�9�$�,�,�.�I�F��4�y�1�}�!$���!8�!8�!=�!=�d�l�l�n�!M��!$���!3�!3���,�,�V�T�:�#�1�1�$���G�H��'� �"0�F�8�;M�1N�"O�O���-�-�d�F�F�C��#�7�7���d�K�H��C������1����}�}����h�M�N���
�$�$�V�T�2���#�#�t�|�|�'=�'=�'?�?�$��x�/O�%P�Q�Q��-�-�d�H�O�O�X�_�_�U���'��'/�'<�'<�X�'F��'�8�3�"0�F�8�;K�1L�"M�M�'�2�2�8�<�H��8�}��)��5�5� �(�/�/�8�?�?���2�2�4��B��(�F�8�3E�)F�G�G���!2�!2�4�!8�(�F�8�3C�)D�E�E��)�)�$�/����	B��7��x�@�A�A�	B�s&�FL(�	L(�D3L(�L(�$AL(�(Mc�(�|jrt�yr7)rFr5rs rrNzTransaction._check_endeds���;�;���rc��|j�|jrt�	|j|�d|_y#d|_wxYw)NT)rNrFr5�_end_transaction�rr�s  rr�zTransaction._ends=�������;�;���	��!�!�&�)��D�K��$�D�K�s	�=�	Ac�^�|jD]}||||��|j||�yr7)rG�
_put_rdataset)rr(r9r�s    rr�z!Transaction._checked_put_rdatasets3���-�-�	(�E��$��h�'�	(����4��*rc�b�|jD]
}|||||��|j|||�yr7)rHr�)rr(rKrLr�s     rr�z$Transaction._checked_delete_rdataset s7���0�0�	.�E��$��f�f�-�	.����d�F�F�3rc�Z�|jD]}|||��
|j|�yr7)rI�_delete_name)rr(r�s   rr�z Transaction._checked_delete_name%s/���,�,�	�E��$���	����$�rc��|Sr7r,rs r�	__enter__zTransaction.__enter__.s���rc�b�|js#|�|j�y|j�yrE)rFr�r�)r�exc_type�exc_val�exc_tbs    r�__exit__zTransaction.__exit__1s+���{�{������
���
�
��rc��t�)zlReturn the rdataset associated with *name*, *rdtype*, and *covers*,
        or `None` if not found.
        r�rr(rKrLs    rrTzTransaction._get_rdataset>s
��"�!rc��t�)zStore the rdataset.r)rr(r9s   rr�zTransaction._put_rdatasetDrrc��t�)zhDelete all data associated with *name*.

        It is not an error if the name does not exist.
        rrXs  rr�zTransaction._delete_nameH�
��
"�!rc��t�)z�Delete all data associated with *name*, *rdtype*, and *covers*.

        It is not an error if the rdataset does not exist.
        rr�s    rr�zTransaction._delete_rdatasetOr�rc��t�)z2Does name exist?

        Returns a bool.
        rrXs  rrkzTransaction._name_existsVr�rc��t�)z&Has this transaction changed anything?rrs rr�zTransaction._changed]rrc��t�)z�End the transaction.

        *commit*, a bool.  If ``True``, commit the transaction, otherwise
        roll it back.

        If committing and the commit fails, then roll back and raise an
        exception.
        rr�s  rr�zTransaction._end_transactionas
��"�!rc��t�)z�Set the origin.

        This method is called when reading a possibly relativized
        source, and an origin setting operation occurs (e.g. $ORIGIN
        in a zone file).
        r)rr�s  r�_set_originzTransaction._set_originls
��"�!rc��t�)z7Return an iterator that yields (name, rdataset) tuples.rrs rrzTransaction._iterate_rdatasetsurrc��t�)z&Return an iterator that yields a name.rrs rr�zTransaction._iterate_namesyrrc��t�)zPReturn the node at *name*, if any.

        Returns a node or ``None``.
        rrXs  rrWzTransaction._get_node}r�rc�6�|jj�Sr7)rBrrs rr�zTransaction._origin_information�s���|�|�.�.�0�0r)FF)rN)Dr#r$r%rr&rJr'rQrtrr	r(r)rOrRr9r�rUr>�NoderYr[rrarcrgrirl�emptyr�r|r�r�r�r��CheckPutRdatasetTyper��CheckDeleteRdatasetTyper��CheckDeleteNameTyper�rrr�r�r�r�r_rfrNr�r�r�r�r�r�rTr�r�r�rkr�r�r�rr�rWr�r,rrr
r
js���"��	@�#�@��@��	@�27:�m�m�6H�6H�	4��u�S�X�X�]�]�C�/�0�1�4��c�m�m�-�-�s�2�3�4��c�m�m�-�-�s�2�3�	4�


���	�	�4�&<�S�X�X�]�]�<�x����
�
�/F�<��
��
��
��S��T��*"�C�"�D�"�,!�#�!�$�!�.'��c�h�h�m�m�S�&8� 9�'�d�'���!�h�h�n�n�	")��")��")��h�h�m�m�	")�

�")�H)�	��	��
�
/�(<�
/��
/�2�+B�2�t�2�
.�':�
.�t�
.�
)�	�%����
�
�s�|�|�'<�'<�<�=�	>�
)�%�x����
�
�6�%�=�F�<*B�X>B�@��+�
4�
 ���"�"�"�"�"�"�	"�"�"�"�"�1r)%r��typingrrrrrrr	�
dns.exceptionr'�dns.name�dns.node�dns.rdataclass�dns.rdataset�
dns.rdatatype�	dns.rrset�
dns.serial�dns.ttlr�	exception�DNSExceptionr.r2r5r;r@r(r)r9r�r�rQrRr�r�r
r,rr�<module>r�s���H�H�H����������4�4�nI�S�]�]�/�/�I�5�s�}�}�)�)�5�5�3�=�=�-�-�5�4�(� ��C�H�H�M�M�3�<�<�#8�#8�9�4�?���#��C�H�H�M�M�3�=�=�#:�#:�C�M�M�<S�<S�T��
����
�s�x�x�}�}�=�t�C�D��a1�a1r

Zerion Mini Shell 1.0