
    uiE                     .   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
 S5      rg)    Nc                   6    \ rS rSrS rS	S jrS rS rS rSr	g)
TransactionManager   c                     [         e)zBegin a read-only transaction.NotImplementedErrorselfs    F/home/kodi/.kodi/addons/script.module.dnspython/lib/dns/transaction.pyreaderTransactionManager.reader       !!    c                     [         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
   replacements     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
    . "!r   c                     [         e)z.The class of the transaction manager.
        r   r	   s    r   	get_classTransactionManager.get_class7   s
     "!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#     ,0+B+B+D(a""r    N)F)
__name__
__module____qualname____firstlineno__r   r   r   r   r   __static_attributes__r    r   r   r   r      s    """2"
r   r   c                       \ rS rSrSrSrg)DeleteNotExactF   z>Existing data did not match data specified by an exact delete.r    Nr!   r"   r#   r$   __doc__r%   r    r   r   r'   r'   F   s    Hr   r'   c                       \ rS rSrSrSrg)ReadOnlyJ   z*Tried to write to a read-only transaction.r    Nr)   r    r   r   r,   r,   J       4r   r,   c                       \ rS rSrSrSrg)AlreadyEndedN   z*Tried to use an already-ended transaction.r    Nr)   r    r   r   r0   r0   N   r.   r   r0   c                   ,   \ rS rSrS$S jr\R                  R                  4S jrS r	S r
S rS rS rS	 rS
S\R                  R                   4S jrS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S r"S r#S r$S  r%S! r&S"r'g#)%TransactionR   c                 6    Xl         X l        X0l        SU l        g NF)managerr   	read_only_ended)r
   r7   r   r8   s       r   __init__Transaction.__init__T   s    &"r   c                    U R                  5         [        U[        5      (       a   [        R                  R                  US5      n[        R                  R                  R                  U5      nU R                  XU5      nUbH  [        U[        R                  R                  5      (       d  [        R                  R                  U5      nU$ )zReturn the rdataset associated with *name*, *rdtype*, and *covers*,
or `None` if not found.

Note that the returned rdataset is immutable.
N)_check_ended
isinstancestrdnsname	from_text	rdatatype	RdataTypemake_get_rdatasetrdatasetImmutableRdataset)r
   rA   rdtypecoversrG   s        r   getTransaction.get^   s     	dC  88%%dD1D((--f5%%dF;(CLL$B$BCC||55h?Hr   c                 2    U R                   (       a  [        eg N)r8   r,   r	   s    r   _check_read_onlyTransaction._check_read_onlyn   s    >>N r   c                 f    U R                  5         U R                  5         U R                  SU5      $ )zeAdd records.

The arguments may be:

    - rrset

    - name, rdataset...

    - name, ttl, rdata...
Fr=   rO   _addr
   argss     r   addTransaction.addr   s-     	yy%%r   c                 f    U R                  5         U R                  5         U R                  SU5      $ )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().
TrR   rT   s     r   replaceTransaction.replace   s-    " 	yyt$$r   c                 f    U R                  5         U R                  5         U R                  SU5      $ )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, rdataclass, rdatatype, [covers]

    - name, rdataset...

    - name, rdata...
Fr=   rO   _deleterT   s     r   deleteTransaction.delete   s-    $ 	||E4((r   c                 f    U R                  5         U R                  5         U R                  SU5      $ )zDelete records.

The arguments may be:

    - rrset

    - name

    - name, rdataclass, rdatatype, [covers]

    - name, rdataset...

    - name, rdata...

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

Tr\   rT   s     r   delete_exactTransaction.delete_exact   s-    & 	||D$''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=   r>   r?   r@   rA   rB   _name_existsr
   rA   s     r   name_existsTransaction.name_exists   sB    dC  88%%dD1D  &&r      Tc                    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() valueNrh   )serial)r=   
ValueErrorr>   r?   r@   rA   rB   rF   rC   SOANONElenKeyErrorrj   SerialvaluerY   rG   
from_rdatattl)r
   rq   relativerA   rG   rj   rdatanew_rdatasets           r   update_serialTransaction.update_serial   s    	19=>>dC  88%%dD1D%%dCMM,=,=&)mm&8&8: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       $ rN   )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.rollback  s     			%r   c                 >    [        U5      S:w  a  [        SU 35      eg )Nr   zextra parameters to )rn   	TypeError)r
   methodrU   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)popleftr>   r@   rrsetRRsetto_rdatasetrG   Rdatasetintrs   MAX_TTLrk   r   ru   Rdatarr   
IndexError)r
   r   deletingrU   argrG   rs   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OY[        U[
        R                  R                  5      (       a  UnUR                  nUR                  5       nO[        U S3S-   5      eUR                  U R                  R!                  5       :w  a  [#        U S35      eUR$                  [
        R&                  R(                  :X  a0  U R                  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   r>   r?   r@   rA   rB   Namer   r   r   r   r   rdclassr7   r   rk   rI   rC   rl   r   r   rF   rJ   rG   rH   r   updateunion_put_rdatasetr   )r
   rY   rU   r   r   rA   rG   r   r   originexistingtrdss               r   rS   Transaction._add8  s   )	B$$T*D$ ,,.C#s##hh((d3#sxx}}--33FE4HC11zz !,,.6(*D E 7!8 9 94<<#9#9#;; F8+K!LMM#--"3"33!%!@!@!BA>$x/B%CDD$$V2--dOO.6oo?'!(CLL,J,JKK"||44X5E5E5=__5=__ F H-#''~~h7Ht. 	B7x@AA	Bs   I+I. .J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	OI[        U[
        R(                  R*                  5      (       a  Un	U	R                  nO[-        U S3S-   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   r   z: missing rdatasz: name not knownr   )#r   r   r   r>   r?   r@   rA   rB   r   rn   r   rC   rD   rE   rm   r   rF   r'   _delete_rdatasetr   r   r   r   r   r7   r   rk   rI   rJ   intersection
differencer   rd   _delete_namer   )r
   exactrU   r   r   rA   rI   rJ   r   rG   r   s              r   r]   Transaction._deleted  s   <	B$$T*D)#,,.C#s##hh((d3#sxx}}--t9q=ja#&>&>&0a#&>&> ]]4499$,,.IF4y1}!$!8!8!=!=dlln!M!$!3!3,,V:#11$GH' "0F8;M1N"OO !  --dFC#77dKHC11}}6(*D E 7!8 9 9$$V2##t||'='='??$x 02 &2 3 3--dOO.6oo?''/'<'<X'F'3"0F8;K1L"MM'228<H8})--dOO.6oo? **4:(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( (Nc                 2    U R                   (       a  [        eg rN   )r9   r0   r	   s    r   r=   Transaction._check_ended  s    ;; r   c                     U R                  5         U R                  (       a  [        e U R                  U5        SU l        g ! SU l        f = f)NT)r=   r9   r0   _end_transactionr
   r   s     r   r   Transaction._end  s=    ;;	!!&)DK$DKs   A 	Ac                     U $ rN   r    r	   s    r   	__enter__Transaction.__enter__  s    r   c                 n    U R                   (       d$  Uc  U R                  5         gU R                  5         gr6   )r9   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
   rA   rI   rJ   s       r   rF   Transaction._get_rdataset  s
     "!r   c                     [         e)zStore the rdataset.r   )r
   rA   rG   s      r   r   Transaction._put_rdataset  r   r   c                     [         e)z\Delete all data associated with *name*.

It is not an error if the rdataset does not exist.
r   re   s     r   r   Transaction._delete_name  
    
 "!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_rdataset  r   r   c                     [         e)z"Does name exist?

Returns a bool.
r   re   s     r   rd   Transaction._name_exists  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 adn 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_origin  s
     "!r   c                     [         e)zhReturn an iterator that yields (name, rdataset) tuples.

Not all Transaction subclasses implement this.
r   r	   s    r   rz   Transaction._iterate_rdatasets  r   r   )r9   r7   r8   r   N)FF)(r!   r"   r#   r$   r:   r@   rC   rm   rK   rO   rV   rY   r^   ra   rf   rA   emptyrw   r{   r   r   r   r   r   rS   r]   r=   r   r   r   rF   r   r   r   rd   r~   r   r   rz   r%   r    r   r   r3   r3   R   s     (+}}'9'9  &%*),(.' #$d )@)	
 =F<*BX=B~""""""	"""r   r3   )r   dns.exceptionr@   dns.namedns.rdataclassdns.rdatasetdns.rdatatype	dns.rrset
dns.serialdns.ttlr   	exceptionDNSExceptionr'   r,   r0   r3   r    r   r   <module>r      s}            4 4nIS]]// I5s}})) 553==-- 5n" n"r   