
    gA                        S r SSKrSSKr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\R,                  R.                  r " S S\R2                  R4                  5      r " S S\R2                  R4                  5      r " S S	\R,                  R.                  5      r\R<                  R<                   " S
 S\5      5       r    SS\
\R@                  RB                  \"4   S\
\RF                  RH                  \"4   S\%S\\"   S\	\RL                  RN                     S\	\RL                  RP                     S\)S\	\RL                  RP                     S\4S jjr*S\
\R@                  RB                  \"4   S\
\RF                  RH                  \"4   S\%S\S\4
S jr+S\%S\\RX                  RZ                     S\4S jr.S\%S\S\4S jr/g)zHDNS rdatasets (an rdataset is a set of rdatas of a given type and class)    N)Any
CollectionDictListOptionalUnioncastc                       \ rS rSrSrSrg)DifferingCovers'   zzAn attempt was made to add a DNS SIG/RRSIG whose covered type
is not the same as that of the other rdatas in the rdataset. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       E/home/matz/Project1/venv/lib/python3.13/site-packages/dns/rdataset.pyr   r   '   s    Dr   r   c                       \ rS rSrSrSrg)IncompatibleTypes,   z?An attempt was made to add DNS RR data of an incompatible type.r   Nr   r   r   r   r   r   ,   s    Ir   r   c                      ^  \ rS rSrSr/ SQr\R                  R                  S4S\R                  R                  S\R                  R                  S\R                  R                  S\4U 4S	 jjjrU 4S
 jrS\SS4S jr S&S\R                   R"                  S\\   SS4U 4S jjjrU 4S jrU 4S jrU 4S jrS rS rS rU 4S jrS r     S'S\\R8                  R:                     S\\R8                  R:                     S\S\\R                  R                     S\S\\ \!4   S\ 4S jjr"    S(S\R8                  R:                  S\!S \\R8                  RF                     S\\R8                  R:                     S\\R                  R                     S!\S\4S" jjr$S\R                  R                  S\R                  R                  S\R                  R                  S\4S# jr%S\&\R                   R"                     4S$ jr'S%r(U =r)$ ))Rdataset0   zA DNS rdataset.)rdclassrdtypecoversttlr   r   r   r   r    c                 R   > [         TU ]  5         Xl        X l        X0l        X@l        g)a  Create a new rdataset of the specified class and type.

*rdclass*, a ``dns.rdataclass.RdataClass``, the rdataclass.

*rdtype*, an ``dns.rdatatype.RdataType``, the rdatatype.

*covers*, an ``dns.rdatatype.RdataType``, the covered rdatatype.

*ttl*, an ``int``, the TTL.
N)super__init__r   r   r   r    )selfr   r   r   r    	__class__s        r   r#   Rdataset.__init__5   s$    $ 	/5/5r   c                    > [         TU ]  5       nU R                  Ul        U R                  Ul        U R                  Ul        U R
                  Ul        U$ N)r"   _cloner   r   r   r    )r$   objr%   s     r   r)   Rdataset._cloneM   s@    gnll[[
[[
((
r   returnNc                     [         R                  R                  U5      n[        U 5      S:X  a  Xl        gXR                  :  a  Xl        gg)zPerform TTL minimization.

Set the TTL of the rdataset to be the lesser of the set's current
TTL or the specified TTL.  If the set contains no rdatas, set the TTL
to the specified TTL.

*ttl*, an ``int`` or ``str``.
r   N)dnsr    makelenr$   r    s     r   
update_ttlRdataset.update_ttlU   s9     ggll3t9>H88^H r   rdc                   > U R                   UR                   :w  d  U R                  UR                  :w  a  [        eUb  U R                  U5        U R                  [        R
                  R                  :X  d(  U R                  [        R
                  R                  :X  ad  UR                  5       n[        U 5      S:X  a/  U R                  [        R
                  R                  :X  a  X0l        OU R                  U:w  a  [        e[        R
                  R                  UR                  5      (       a  [        U 5      S:  a  U R                  5         [        TU ]=  U5        g)a  Add the specified rdata to the rdataset.

If the optional *ttl* parameter is supplied, then
``self.update_ttl(ttl)`` will be called prior to adding the rdata.

*rd*, a ``dns.rdata.Rdata``, the rdata

*ttl*, an ``int``, the TTL.

Raises ``dns.rdataset.IncompatibleTypes`` if the type and class
do not match the type and class of the rdataset.

Raises ``dns.rdataset.DifferingCovers`` if the type is a signature
type and the covered type does not match that of the rdataset.
Nr   )r   r   r   r2   r.   	rdatatypeRRSIGSIGr   r0   NONEr   is_singletonclearr"   add)r$   r4   r    r   r%   s       r   r<   Rdataset.addd   s    2 <<2::%		)A##?OOC ;;#-----@Q@Q1QYY[F4yA~$++1C1C"C$&%%==%%bii00SY]JJLBr   c                 Z   > U R                  UR                  5        [        TU ]  U5        g r(   )r2   r    r"   union_updater$   otherr%   s     r   r?   Rdataset.union_update   s     		"U#r   c                 Z   > U R                  UR                  5        [        TU ]  U5        g r(   )r2   r    r"   intersection_updater@   s     r   rD   Rdataset.intersection_update   s     		"#E*r   c                 Z   > U R                  UR                  5        [        TU ]  U5        g)zkAdd all rdatas in other to self.

*other*, a ``dns.rdataset.Rdataset``, the rdataset from which
to update.
N)r2   r    r"   updater@   s     r   rG   Rdataset.update   s!     			"ur   c                 L   ^ S mSSR                  U4S jU  5       5      -   S-   $ )Nc                 4    [        U 5      S:  a  U S S S-   $ U $ )Nd   z...)r0   )ss    r   maybe_truncate,Rdataset._rdata_repr.<locals>.maybe_truncate   s"    1v|#w&Hr   [z, c              3   N   >#    U  H  nS T" [        U5      5       S3v   M     g7f)<>N)str).0rrrM   s     r   	<genexpr>'Rdataset._rdata_repr.<locals>.<genexpr>   s$     M">#b'#:";1=s   "%])join)r$   rM   s    @r   _rdata_reprRdataset._rdata_repr   s*    	
 TYYMMMMPSSSr   c                 l   U R                   S:X  a  SnO/S[        R                  R                  U R                   5      -   S-   nS[        R                  R                  U R
                  5      -   S-   [        R                  R                  U R                  5      -   U-   S-   U R                  5       -   S-   $ )	Nr    ()z<DNS  z rdataset: rR   )r   r.   r6   to_text
rdataclassr   r   rZ   )r$   ctexts     r   __repr__Rdataset.__repr__   s    ;;!E#--//<<sBEnn$$T\\23 mm##DKK01 	
   ! 		
r   c                 "    U R                  5       $ r(   )ra   r$   s    r   __str__Rdataset.__str__   s    ||~r   c                    > [        U[        5      (       d  gU R                  UR                  :w  d4  U R                  UR                  :w  d  U R                  UR                  :w  a  g[
        TU ]  U5      $ )NF)
isinstancer   r   r   r   r"   __eq__r@   s     r   rl   Rdataset.__eq__   sU    %**LLEMM){{ell*{{ell*w~e$$r   c                 .    U R                  U5      (       + $ r(   )rl   r$   rA   s     r   __ne__Rdataset.__ne__   s    ;;u%%%r   nameorigin
relativizeoverride_rdclasswant_commentskwc                    Ub  UR                  X#5      n[        U5      nSnOSnSn[        R                  " 5       n	Ub  Un
OU R                  n
[        U 5      S:X  a`  U	R                  U U [        R                  R                  U
5       S[        R                  R                  U R                  5       S35        OU  H  nSnU(       a   UR                  (       a  SUR                   3nU	R                  SUUU R                  [        R                  R                  U
5      [        R                  R                  U R                  5      UR                  " S
X#S.UD6U4-  5        M     U	R                  5       SS	 $ )a  Convert the rdataset into DNS zone file format.

See ``dns.name.Name.choose_relativity`` for more information
on how *origin* and *relativize* determine the way names
are emitted.

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

*name*, a ``dns.name.Name``.  If name is not ``None``, emit RRs with
*name* as the owner name.

*origin*, a ``dns.name.Name`` or ``None``, the origin for relative
names.

*relativize*, a ``bool``.  If ``True``, names will be relativized
to *origin*.

*override_rdclass*, a ``dns.rdataclass.RdataClass`` or ``None``.
If not ``None``, use this class instead of the Rdataset's class.

*want_comments*, a ``bool``.  If ``True``, emit comments for rdata
which have them.  The default is ``False``.
Nr`   r]   r   
z ;z%s%s%d %s %s %s%s
)rs   rt   r   )choose_relativityrS   ioStringIOr   r0   writer.   rb   ra   r6   r   	rdcommentr    getvalue)r$   rr   rs   rt   ru   rv   rw   ntextpadrL   r   r4   extras                r   ra   Rdataset.to_text   sO   D ))&=DIECECKKM'&GllGt9> GG'#s~~55g>?q==((56b:
  ||"$R\\N 3)..w7--dkk:

N&N2N	 ( zz|CR  r   filecompresswant_shufflec           	         Ub  UnSnOU R                   n[        U 5      S:X  aF  UR                  X#U5        UR                  [        R
                  " SU R                  USS5      5        gU(       a"  [        U 5      n[        R                  " U5        OU nU H  n	UR                  X#U5        UR                  [        R
                  " SU R                  XpR                  5      5        [        R                  R                  US5         U	R                  X#U5        SSS5        M     [        U 5      $ ! , (       d  f       M  = f)a  Convert the rdataset to wire format.

*name*, a ``dns.name.Name`` is the owner name to use.

*file* is the file where the name is emitted (typically a
BytesIO file).

*compress*, a ``dict``, is the compression table to use.  If
``None`` (the default), names will not be compressed.

*origin* is a ``dns.name.Name`` or ``None``.  If the name is
relative and origin is not ``None``, then *origin* will be appended
to it.

*override_rdclass*, an ``int``, is used as the class instead of the
class of the rdataset.  This is useful when rendering rdatasets
associated with dynamic updates.

*want_shuffle*, a ``bool``.  If ``True``, then the order of the
Rdatas within the Rdataset will be shuffled before rendering.

Returns an ``int``, the number of records emitted.
NFr   z!HHIH   z!HHI   )r   r0   to_wirer~   structpackr   listrandomshuffler    r.   rendererprefixed_length)
r$   rr   r   r   rs   ru   r   r   lr4   s
             r   r   Rdataset.to_wire  s    B '&G LllGt9>LL0JJv{{7DKK!QGH Jq!TV4

6;;vt{{GXXNO\\11$:JJtv6 ;: 
 t9 ;:s   D11
E 	c                 f    U R                   U:X  a!  U R                  U:X  a  U R                  U:X  a  gg)zQReturns ``True`` if this rdataset matches the specified class,
type, and covers.
TF)r   r   r   )r$   r   r   r   s       r   matchRdataset.matchM  s-     <<7"t{{f'<PVAVr   c                 ^    [        U 5      S:X  a  / $ U S   R                  [        U 5      5      $ )a$  Return rdatas in a valid processing order according to the type's
specification.  For example, MX records are in preference order from
lowest to highest preferences, with items of the same preference
shuffled.

For types that do not define a processing order, the rdatas are
simply shuffled.
r   )r0   _processing_orderiterrg   s    r   processing_orderRdataset.processing_orderZ  s-     t9>I7,,T$Z88r   )r   r   r   r    r(   )NNTNF)NNNT)*r   r   r   r   r   	__slots__r.   r6   r9   rb   
RdataClass	RdataTypeintr#   r)   r2   rdataRdatar   r<   r?   rD   rG   rZ   rd   rh   rl   rp   rr   Nameboolr   rS   r   ra   CompressTyper   r   r   r   r   __classcell__r%   s   @r   r   r   0   sf   6I +.--*<*<** '' ''	
  0c d   9=%))//%(0%	% %N$+T
 	%&
 )-*.@D#M!sxx}}%M! 'M! 	M!
 #3>>#<#<=M! M! 38nM! 
M!f 59*.@D!6hhmm6 6 388001	6
 '6 #3>>#<#<=6 6 
6p** '' ''	
 
9$syy"7 9 9r   r   c                      ^  \ rS rSrSr\rS\4U 4S jjrS rSS jr	S r
S rS	 rS
 rS rS rS rS rS rU 4S jrU 4S jrU 4S jrU 4S jrU 4S jrU 4S jrSrU =r$ )ImmutableRdatasetii  zAn immutable DNS rdataset.rdatasetc                    > [         TU ]  UR                  UR                  UR                  UR
                  5        [        R                  R                  UR                  5      U l	        g)z9Create an immutable rdataset from the specified rdataset.N)
r"   r#   r   r   r   r    r.   	immutabler   items)r$   r   r%   s     r   r#   ImmutableRdataset.__init__o  sI     	hoox	
 ]]''7
r   c                     [        S5      eNr   	TypeErrorr1   s     r   r2   ImmutableRdataset.update_ttlw      $$r   c                     [        S5      er   r   )r$   r4   r    s      r   r<   ImmutableRdataset.addz  r   r   c                     [        S5      er   r   ro   s     r   r?   ImmutableRdataset.union_update}  r   r   c                     [        S5      er   r   ro   s     r   rD   %ImmutableRdataset.intersection_update  r   r   c                     [        S5      er   r   ro   s     r   rG   ImmutableRdataset.update  r   r   c                     [        S5      er   r   )r$   is     r   __delitem__ImmutableRdataset.__delitem__  r   r   c                     [        S5      er   r   ro   s     r   __ior__ImmutableRdataset.__ior__  r   r   c                     [        S5      er   r   ro   s     r   __iand__ImmutableRdataset.__iand__  r   r   c                     [        S5      er   r   ro   s     r   __iadd__ImmutableRdataset.__iadd__  r   r   c                     [        S5      er   r   ro   s     r   __isub__ImmutableRdataset.__isub__  r   r   c                     [        S5      er   r   rg   s    r   r;   ImmutableRdataset.clear  r   r   c                 2   > [        [        TU ]	  5       5      $ r(   r   r"   copyr$   r%   s    r   __copy__ImmutableRdataset.__copy__       00r   c                 2   > [        [        TU ]	  5       5      $ r(   r   r   s    r   r   ImmutableRdataset.copy  r   r   c                 4   > [        [        TU ]	  U5      5      $ r(   )r   r"   unionr@   s     r   r   ImmutableRdataset.union  s     u!566r   c                 4   > [        [        TU ]	  U5      5      $ r(   )r   r"   intersectionr@   s     r   r   ImmutableRdataset.intersection  s     !5e!<==r   c                 4   > [        [        TU ]	  U5      5      $ r(   )r   r"   
differencer@   s     r   r   ImmutableRdataset.difference  s     !3E!:;;r   c                 4   > [        [        TU ]	  U5      5      $ r(   )r   r"   symmetric_differencer@   s     r   r   &ImmutableRdataset.symmetric_difference  s     !=e!DEEr   )r   r(   )r   r   r   r   r   r   _clone_classr#   r2   r<   r?   rD   rG   r   r   r   r   r   r;   r   r   r   r   r   r   r   r   r   s   @r   r   r   i  ss    $L8 8%%%%%%%%%%%117><F Fr   r   r   r   r    text_rdatas
idna_codecrs   rt   relativize_tor,   c           
         [         R                  R                  R                  U 5      n [         R                  R
                  R                  U5      n[        X5      nUR                  U5        U HK  n	[         R                  R                  UR                  UR                  XXgU5      n
UR                  U
5        MM     U$ )aP  Create an rdataset with the specified class, type, and TTL, and with
the specified list of rdatas in text format.

*idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA
encoder/decoder to use; if ``None``, the default IDNA 2003
encoder/decoder is used.

*origin*, a ``dns.name.Name`` (or ``None``), the
origin to use for relative names.

*relativize*, a ``bool``.  If true, name will be relativized.

*relativize_to*, a ``dns.name.Name`` (or ``None``), the origin to use
when relativizing names.  If not set, the *origin* value will be used.

Returns a ``dns.rdataset.Rdataset`` object.
)r.   rb   r   r/   r6   r   r   r2   r   	from_textr   r   r<   )r   r   r    r   r   rs   rt   r   rtr4   s              r   from_text_listr     s    8 nn'',,W5G]]$$))&1F!ALLYY  IIqxxJz
 	
b		 
 Hr   c           	      F    [        XU[        [        [           U5      5      $ )zCreate an rdataset with the specified class, type, and TTL, and with
the specified rdatas in text format.

Returns a ``dns.rdataset.Rdataset`` object.
)r   r	   r   rS   )r   r   r    r   s       r   r   r     s     '3Z_k0RSSr   rdatasc                     [        U5      S:X  a  [        S5      eSnU HH  nUc1  [        UR                  UR                  5      nUR                  U 5        UR                  U5        MJ     Uc   eU$ )zCreate an rdataset with the specified TTL, and with
the specified list of rdata objects.

Returns a ``dns.rdataset.Rdataset`` object.
r   zrdata list must not be emptyN)r0   
ValueErrorr   r   r   r2   r<   )r    r   r   r4   s       r   from_rdata_listr     sl     6{a788A9RYY/ALL	b		 
 ==Hr   c                 l    [        U [        [        [        R                  R
                     U5      5      $ )z~Create an rdataset with the specified TTL, and with
the specified rdata objects.

Returns a ``dns.rdataset.Rdataset`` object.
)r   r	   r   r.   r   r   )r    r   s     r   
from_rdatar     s%     3Z		%@& IJJr   )NNTN)0r   r|   r   r   typingr   r   r   r   r   r   r	   dns.exceptionr.   dns.immutabledns.name	dns.rdatadns.rdataclassdns.rdatatypedns.rendererdns.setdns.ttlsetSet	SimpleSet	exceptionDNSExceptionr   r   r   r   r   rb   r   rS   r6   r   r   rr   	IDNACodecr   r   r   r   r   r   r   r   r   r   r   <module>r     s  $ O 	   E E E          GGKK	Dcmm00 D
J22 Jv9sww{{ v9r	 BF BF BFT 04&*-1%3>>,,c12%#--))3./% 
% C	%
 ++,% SXX]]#% % CHHMM*% %PT3>>,,c12T#--))3./T 
T 	T
 T j&A h &KC K# K( Kr   