
    g=X                        S SK r S SKJrJrJrJrJrJrJr  S SK	r
S SKr
S SKr
S SKr
S SKr
S SKr
S SKr
S SKr
S SKr
 " S S5      r " S S\
R(                  R*                  5      r " S S\
R(                  R*                  5      r " S	 S
\
R(                  R*                  5      rS rS r\S\
R6                  R8                  \
R:                  R<                  /S4   r\S\
R6                  R8                  \
R@                  RB                  \
R@                  RB                  /S4   r"\S\
R6                  R8                  /S4   r# " S S5      r$g)    N)AnyCallableIteratorListOptionalTupleUnionc                      \ rS rSrSS jrSS\SS4S jjrS\\\	R                  R                     \\\	R                  R                     4   4S jrS\	R                  R                  4S jrS\\	R                  R                     4S	 jrS
rg)TransactionManager   returnTransactionc                     [         e)zBegin a read-only transaction.NotImplementedErrorselfs    H/home/matz/Project1/venv/lib/python3.13/site-packages/dns/transaction.pyreaderTransactionManager.reader       !!    replacementc                     [         e)zBegin 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   )r   r   s     r   writerTransactionManager.writer   s
     "!r   c                     [         e)a  Returns 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).

r   r   s    r   origin_information%TransactionManager.origin_information    s
    2 "!r   c                     [         e)z%The class of the transaction manager.r   r   s    r   	get_classTransactionManager.get_class;   r   r   c                 <    U R                  5       u  pnU(       a  U$ g)z#Origin to use in from_wire() calls.N)r   )r   absolute_origin
relativize_s       r   from_wire_origin#TransactionManager.from_wire_origin?   s!    +/+B+B+D(a""r    N)r   r   )F)__name__
__module____qualname____firstlineno__r   boolr   r   r   dnsnameNamer   
rdataclass
RdataClassr!   r'   __static_attributes__r)   r   r   r   r      s|    ""$ "= ""	x&hsxx}}.EE	F"6"3>>44 "(388=="9 r   r   c                       \ rS rSrSrSrg)DeleteNotExactH   z>Existing data did not match data specified by an exact delete.r)   Nr*   r+   r,   r-   __doc__r4   r)   r   r   r6   r6   H   s    Hr   r6   c                       \ rS rSrSrSrg)ReadOnlyL   z*Tried to write to a read-only transaction.r)   Nr8   r)   r   r   r;   r;   L       4r   r;   c                       \ rS rSrSrSrg)AlreadyEndedP   z*Tried to use an already-ended transaction.r)   Nr8   r)   r   r   r?   r?   P   r=   r   r?   c                     U b)  [        U [        R                  R                  5      (       a  U $ [        R                  R                  U 5      $ N)
isinstancer/   rdatasetImmutableRdataset)rD   s    r   _ensure_immutable_rdatasetrF   T   s8    :h0N0NOO<<))(33r   c                 t    U b  U R                  5       (       a  U $ [        R                  R                  U 5      $ rB   )is_immutabler/   nodeImmutableNode)rI   s    r   _ensure_immutable_noderK   Z   s/    |t((**88!!$''r   r   c            	       B   \ rS rSr  S;S\S\S\4S jjr\R                  R                  4S\
\\R                  R                  \4      S\\R                  R                  \4   S\\R                  R                  \4   S	\R                   R"                  4S
 jjrS\R                  R                  S	\
\R&                  R(                     4S jrS<S jrS\S	S4S jrS\S	S4S jrS\S	S4S jrS\S	S4S jrS\\R                  R                  \4   S	\4S jrSS\R                  R:                  4S\S\S\R                  R                  S	S4S jjrS r S	\4S jr!S<S jr"S<S jr#S\$S	S4S jr%S\&S	S4S jr'S\(S	S4S  jr)S	\*\+\R                  R                  \R                   R"                  4      4S! jr,S	\*\R                  R                     4S" jr-S# r.S$ r/S% r0S& r1S' r2S( r3S) r4S* r5S+ r6S, r7S- r8S. r9S/ r:S0 r;S1 r<S2 r=S3 r>S4 r?S5 r@S6 rAS7 rBS8 rCS9 rDS:rEg)=r   j   managerr   	read_onlyc                 `    Xl         X l        X0l        SU l        / U l        / U l        / U l        g NF)rN   r   rO   _ended_check_put_rdataset_check_delete_rdataset_check_delete_name)r   rN   r   rO   s       r   __init__Transaction.__init__k   s3     &"?A EG#=?r   r0   rdtypecoversr   c                 j   U R                  5         [        U[        5      (       a   [        R                  R                  US5      n[        R                  R                  R                  U5      n[        R                  R                  R                  U5      nU R                  XU5      n[        U5      $ )zReturn the rdataset associated with *name*, *rdtype*, and *covers*,
or `None` if not found.

Note that the returned rdataset is immutable.
N)_check_endedrC   strr/   r0   	from_text	rdatatype	RdataTypemake_get_rdatasetrF   )r   r0   rX   rY   rD   s        r   getTransaction.get   s     	dC  88%%dD1D((--f5((--f5%%dF;)(33r   c                 6    [        U R                  U5      5      $ )zKReturn the node at *name*, if any.

Returns an immutable node or ``None``.
)rK   	_get_noder   r0   s     r   get_nodeTransaction.get_node   s    
 &dnnT&:;;r   Nc                 2    U R                   (       a  [        eg rB   )rO   r;   r   s    r   _check_read_onlyTransaction._check_read_only   s    >>N r   argsc                 h    U R                  5         U R                  5         U R                  SU5        g)zeAdd records.

The arguments may be:

    - rrset

    - name, rdataset...

    - name, ttl, rdata...
FNr[   rj   _addr   rl   s     r   addTransaction.add   s*     			%r   c                 h    U R                  5         U R                  5         U R                  SU5        g)ak  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().
TNrn   rp   s     r   replaceTransaction.replace   s*    " 			$r   c                 h    U R                  5         U R                  5         U R                  SU5        g)zDelete 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r[   rj   _deleterp   s     r   deleteTransaction.delete   s*    $ 	UD!r   c                 h    U R                  5         U R                  5         U R                  SU5        g)zDelete 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.

TNrw   rp   s     r   delete_exactTransaction.delete_exact   s*    & 	T4 r   c                     U R                  5         [        U[        5      (       a   [        R                  R                  US5      nU R                  U5      $ )zDoes the specified name exist?N)r[   rC   r\   r/   r0   r]   _name_existsrf   s     r   name_existsTransaction.name_exists   sB    dC  88%%dD1D  &&r      Tvaluerelativec                    U R                  5         US:  a  [        S5      e[        U[        5      (       a   [        R
                  R                  US5      nU R                  U[        R                  R                  [        R                  R                  5      nUb  [        U5      S:X  a  [        eU(       a0  [        R                  R                  US   R                  5      U-   nO[        R                  R                  U5      nUR                  nUS:X  a  SnUS   R!                  US9n[        R"                  R%                  UR&                  U5      nU R!                  X75        g)aV  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.
r   znegative update_serial() valueNr   )serial)r[   
ValueErrorrC   r\   r/   r0   r]   ra   r^   SOANONElenKeyErrorr   Serialr   rt   rD   
from_rdatattl)r   r   r   r0   rD   r   rdatanew_rdatasets           r   update_serialTransaction.update_serial   s   " 	19=>>dC  88%%dD1D%%dCMM,=,=s}}?Q?QRs8}1NZZ&&x{'9'9:UBFZZ&&u-FQ;F##6#2||..x||UCT(r   c                 B    U R                  5         U R                  5       $ rB   r[   _iterate_rdatasetsr   s    r   __iter__Transaction.__iter__  s    &&((r   c                 B    U R                  5         U R                  5       $ )zHas 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.
)r[   _changedr   s    r   changedTransaction.changed  s     	}}r   c                 &    U R                  S5        g)ay  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_endr   s    r   commitTransaction.commit)  s     			$r   c                 &    U R                  S5        g)aF  Rollback 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   r   s    r   rollbackTransaction.rollback6  s     			%r   checkc                 :    U R                   R                  U5        g)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)rS   appendr   r   s     r   check_put_rdatasetTransaction.check_put_rdatasetB  s     	  ''.r   c                 :    U R                   R                  U5        g)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)rT   r   r   s     r   check_delete_rdataset!Transaction.check_delete_rdatasetN  s     	##**51r   c                 :    U R                   R                  U5        g)am  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)rU   r   r   s     r   check_delete_nameTransaction.check_delete_name[  s     	&&u-r   c                 B    U R                  5         U R                  5       $ )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   r   s    r   iterate_rdatasetsTransaction.iterate_rdatasetsg  s     	&&((r   c                 B    U R                  5         U R                  5       $ )zIterate 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.)r[   _iterate_namesr   s    r   iterate_namesTransaction.iterate_namess  s     	""$$r   c                 >    [        U5      S:w  a  [        SU 35      eg )Nr   zextra parameters to )r   	TypeError)r   methodrl   s      r   _raise_if_not_emptyTransaction._raise_if_not_empty  s%    t9>26(;<< r   c                     UR                  5       n[        U[        R                  R                  5      (       a  UR                  5       nU$ [        U[        R                  R                  5      (       a  UnU$ U(       a  SnOb[        U[        5      (       a/  UnU[        R                  R                  :  a  [        U S35      eO[        U S35      eUR                  5       n[        U[        R                  R                  5      (       a!  [        R                  R                  Xd5      nU$ [        U S35      e! [          a    U(       a   g [        U S35      ef = f)Nr   z: TTL value too bigz: expected a TTLz: expected an Rdataz: expected more arguments)popleftrC   r/   rrsetRRsetto_rdatasetrD   Rdatasetintr   MAX_TTLr   r   r   Rdatar   
IndexError)r   r   deletingrl   argrD   r   s          r   _rdataset_from_argsTransaction._rdataset_from_args  s5   	F,,.C#syy//??,$ O# C!6!677  O C!#s++!0",x7J-K"LL 1 (6(2B(CDD,,.Cc399??33"||66s@H O $vh.A$BCC 	F  6(*C DEE	Fs%   A
D> ,D> :B5D> 0D> >E E c                     [         R                  " U5      nU(       a  SnOSnUR                  5       n[        U[        5      (       a   [
        R                  R                  US 5      n[        U[
        R                  R                  5      (       a  UnU R                  USU5      nOV[        U[
        R                  R                  5      (       a  UnUR                  nUR                  5       nO[        U S35      eUR                  U R                  R!                  5       :w  a  [#        U S35      eUR$                  [
        R&                  R(                  :X  a&  U R+                  5       u    pXY:w  a  [#        U S35      eU R-                  X25        U(       d  U R/                  XVR$                  UR0                  5      n
U
b  [        U
[
        R2                  R4                  5      (       aR  [
        R2                  R7                  U
R                  U
R$                  U
R0                  5      nUR9                  U
5        Un
U
R;                  U5      nU R=                  XV5        g ! [>         a    [        SW 35      ef = f)Nz	replace()zadd()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   rC   r\   r/   r0   r]   r1   r   r   r   r   r   rdclassrN   r!   r   rX   r^   r   _origin_informationr   ra   rY   rD   rE   r   updateunion_checked_put_rdatasetr   )r   rt   rl   r   r   r0   rD   r   r&   originexistingtrdss               r   ro   Transaction._add  s    )	B$$T*D$ ,,.C#s##hh((d3#sxx}}--33FE4HC11zz !,,.hMN  4<<#9#9#;; F8+K!LMM#--"3"33!%!9!9!;A>$x/B%CDD$$V2--dOOX__U'!(CLL,J,JKK"||44$,,hoox  H-#''~~h7H&&t6 	B7x@AA	Bs   II! !I:c                     [         R                  " U5      nU(       a  SnOSnUR                  5       n[        U[        5      (       a   [
        R                  R                  US 5      n[        U[
        R                  R                  5      (       Ga>  Un[        U5      S:  Ga  [        US   [        5      (       d  [        US   [        5      (       a  [
        R                  R                  R                  UR                  5       5      n[        U5      S:  a8  [
        R                  R                  R                  UR                  5       5      nO[
        R                  R                  nU R                  X25        U R!                  XVU5      nUc  U(       a  [#        U S35      e g U R%                  XVU5        g U R'                  USU5      n	OF[        U[
        R(                  R*                  5      (       a  Un	U	R                  nO[-        U S35      eU R                  X25        U	(       a  U	R.                  U R0                  R3                  5       :w  a  [5        U S35      eU R!                  XYR6                  U	R8                  5      nUb  U(       a$  UR;                  U	5      n
X:w  a  [#        U S35      eUR=                  U	5      n	[        U	5      S:X  a'  U R%                  XYR6                  U	R8                  5        g U R?                  XY5        g U(       a  [#        U S35      eg U(       a$  U RA                  U5      (       d  [#        U S	35      eU RC                  U5        g ! [D         a    [-        S
W 35      ef = f)Nzdelete_exact()zdelete()r   z: missing rdatasetTr   r   z: missing rdatasz: name not knownr   )#r   r   r   rC   r\   r/   r0   r]   r1   r   r   r^   r_   r`   r   r   ra   r6   _checked_delete_rdatasetr   r   r   r   r   rN   r!   r   rX   rY   intersection
differencer   r   _checked_delete_namer   )r   exactrl   r   r   r0   rX   rY   r   rD   r   s              r   rx   Transaction._delete  s   =	B$$T*D)#,,.C#s##hh((d3#sxx}}--t9q=tAw,,
47C0H0H !]]4499$,,.IF4y1}!$!8!8!=!=dlln!M!$!3!3,,V:#11$GH' "0F8;M1N"OO !  55dFK#77dKHC11}}hMN  $$V2##t||'='='??$x/O%PQQ--dOOX__U''/'<'<X'F'3"0F8;K1L"MM'228<H8})55 //8?? 224B(F83E)FGG  !2!24!8!8(F83C)DEE))$/ 	B7x@AA	Bs+   F'M% *M% =EM%  M% M% (<M% %M>c                 2    U R                   (       a  [        eg rB   )rR   r?   r   s    r   r[   Transaction._check_ended  s    ;; r   c                 n    U R                  5          U R                  U5        SU l        g ! SU l        f = f)NT)r[   _end_transactionrR   r   r   s     r   r   Transaction._end  s0    	!!&)DK$DKs   + 	4c                 ^    U R                    H  nU" XU5        M     U R                  X5        g rB   )rS   _put_rdataset)r   r0   rD   r   s       r   r   !Transaction._checked_put_rdataset  s*    --E$h' .4*r   c                 `    U R                    H  nU" XX#5        M     U R                  XU5        g rB   )rT   _delete_rdataset)r   r0   rX   rY   r   s        r   r   $Transaction._checked_delete_rdataset  s,    00E$f- 1dF3r   c                 \    U R                    H  nU" X5        M     U R                  U5        g rB   )rU   _delete_name)r   r0   r   s      r   r    Transaction._checked_delete_name#  s(    ,,E$ -$r   c                     U $ rB   r)   r   s    r   	__enter__Transaction.__enter__,  s    r   c                 n    U R                   (       d$  Uc  U R                  5         gU R                  5         grQ   )rR   r   r   )r   exc_typeexc_valexc_tbs       r   __exit__Transaction.__exit__/  s+    {{  r   c                     [         e)z\Return the rdataset associated with *name*, *rdtype*, and *covers*,
or `None` if not found.
r   r   r0   rX   rY   s       r   ra   Transaction._get_rdataset<  s
     "!r   c                     [         e)zStore the rdataset.r   )r   r0   rD   s      r   r   Transaction._put_rdatasetB  r   r   c                     [         e)zXDelete all data associated with *name*.

It is not an error if the name does not exist.
r   rf   s     r   r   Transaction._delete_nameF  
    
 "!r   c                     [         e)ztDelete all data associated with *name*, *rdtype*, and *covers*.

It is not an error if the rdataset does not exist.
r   r   s       r   r   Transaction._delete_rdatasetM  r   r   c                     [         e)z"Does name exist?

Returns a bool.
r   rf   s     r   r   Transaction._name_existsT  r   r   c                     [         e)z&Has this transaction changed anything?r   r   s    r   r   Transaction._changed[  r   r   c                     [         e)zEnd 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.
r   r   s     r   r   Transaction._end_transaction_  s
     "!r   c                     [         e)zSet 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   )r   r   s     r   _set_originTransaction._set_originj  s
     "!r   c                     [         e)z7Return an iterator that yields (name, rdataset) tuples.r   r   s    r   r   Transaction._iterate_rdatasetss  r   r   c                     [         e)z&Return an iterator that yields a name.r   r   s    r   r   Transaction._iterate_namesw  r   r   c                     [         e)z@Return the node at *name*, if any.

Returns a node or ``None``.
r   rf   s     r   re   Transaction._get_node{  r   r   c                 6    U R                   R                  5       $ rB   )rN   r   r   s    r   r   Transaction._origin_information  s    ||..00r   )rU   rT   rS   rR   rN   rO   r   )FF)r   N)Fr*   r+   r,   r-   r   r.   rV   r/   r^   r   r   r	   r0   r1   r\   r_   rD   r   rb   rI   Noderg   rj   r   rq   rt   ry   r|   r   emptyr   r   r   r   r   r   CheckPutRdatasetTyper   CheckDeleteRdatasetTyper   CheckDeleteNameTyper   r   r   r   r   r   r   ro   rx   r[   r   r   r   r   r   r   ra   r   r   r   r   r   r   r	  r   r   re   r   r4   r)   r   r   r   r   j   s    "	@#@ @ 	@2 7:mm6H6H	4uSXX]]C/014 cmm--s234 cmm--s23	4
 
		4&<SXX]] <x/F <  S T *"C "D ",!# !$ !.'chhmmS&8 9 'd ' !hhnn	")") ") hhmm	")
 
")H)	 	

/(< 
/ 
/2+B 2t 2
.': 
.t 
.
)	%s||'<'<<=	>
)%x6 %=F<*BX>B@+
4
 """"""	"""""1r   )%r   typingr   r   r   r   r   r   r	   dns.exceptionr/   dns.namedns.nodedns.rdataclassdns.rdatasetdns.rdatatype	dns.rrset
dns.serialdns.ttlr   	exceptionDNSExceptionr6   r;   r?   rF   rK   r0   r1   rD   r   r  r^   r_   r  r  r   r)   r   r   <module>r$     s    H H H         4 4nIS]]// I5s}})) 553==-- 54(  CHHMM3<<#8#894?  #CHHMM3==#:#:CMM<S<ST
  sxx}}=tCD _1 _1r   