
    gv                        S r SSK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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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!J"r"J#r#J$r$   " S S\RJ                  RL                  5      r' " S S\'5      r( " S	 S
\'5      r) " S S\'5      r* " S S\RJ                  RL                  5      r+ " S S\RJ                  RL                  5      r, " S S\RJ                  RL                  5      r- " S S\RJ                  RL                  5      r.S\R^                  R`                  S\\R^                  R`                     S\1S\R^                  R`                  4S jr2 " S S\Rf                  Rh                  5      r5 " S S\Rl                  Rn                  5      r8\Rr                  Rr                   " S S\85      5       r: " S  S!5      r; " S" S#\;5      r<\Rr                  Rr                   " S$ S%\;5      5       r= " S& S'\Rf                  R|                  5      r>S\R~                  R                  S(\5SS)S(SS(4	S*\S\\\R^                  R`                  \A4      S+\R~                  R                  S\1S,\S-\\A   S.\1S/\1S0\\R^                  R                     S1\\1\\A   4   S\54S2 jjrDS\R~                  R                  S(\5SS)S(SS(4	S*\AS\\\R^                  R`                  \A4      S+\R~                  R                  S\1S,\S-\\A   S.\1S/\1S0\\R^                  R                     S1\\1\\A   4   S\54S3 jjrES\R~                  R                  S(\5SS(S(SS(4	S4\S\\\R^                  R`                  \A4      S+\R~                  R                  S\1S,\S-\\A   S.\1S/\1S0\\R^                  R                     S1\\1\\A   4   S\54S5 jjrF\5S(S(4S6\S,\S\1S/\1S\54
S7 jjrGg)8z
DNS Zones.    N)
AnyCallableIterableIteratorListMutableMappingOptionalSetTupleUnion)DigestHashAlgorithmDigestScheme_digest_hashersc                       \ rS rSrSrSrg)BadZone8   zThe DNS zone is malformed. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       A/home/matz/Project1/venv/lib/python3.13/site-packages/dns/zone.pyr   r   8   s    $r   r   c                       \ rS rSrSrSrg)NoSOA<   z)The DNS zone has no SOA RR at its origin.r   Nr   r   r   r   r   r   <   s    3r   r   c                       \ rS rSrSrSrg)NoNS@   z+The DNS zone has no NS RRset at its origin.r   Nr   r   r   r   r!   r!   @   s    5r   r!   c                       \ rS rSrSrSrg)UnknownOriginD   z!The DNS zone's origin is unknown.r   Nr   r   r   r   r$   r$   D   s    +r   r$   c                       \ rS rSrSrSrg)UnsupportedDigestSchemeH   z(The zone digest's scheme is unsupported.r   Nr   r   r   r   r'   r'   H       2r   r'   c                       \ rS rSrSrSrg)UnsupportedDigestHashAlgorithmL   z(The zone digest's origin is unsupported.r   Nr   r   r   r   r+   r+   L   r)   r   r+   c                       \ rS rSrSrSrg)NoDigestP   z/The DNS zone has no ZONEMD RRset at its origin.r   Nr   r   r   r   r.   r.   P   s    9r   r.   c                       \ rS rSrSrSrg)DigestVerificationFailureT   z#The ZONEMD digest failed to verify.r   Nr   r   r   r   r1   r1   T   s    -r   r1   nameorigin
relativizereturnc                 R   Uc  [        S5      eU R                  5       (       a;  U R                  U5      (       d  [        S5      eU(       a  U R                  U5      n U $  U R	                  U5      nU(       d  Un U $ ! [
        R                  R                   a    [        S5      ef = f)Nzno zone origin is definedz5name parameter must be a subdomain of the zone originzrelative name too long for zone)KeyErroris_absoluteis_subdomainr5   derelativizednsr3   NameTooLong)r3   r4   r5   abs_names       r   _validate_namer?   X   s     ~ 233  ((RSS??6*D K	>((0H
  DK xx## 	> <==	>s    A< <*B&c                      \ rS rSr% Sr\R                  R                  r\	/ \R                  R                  4   \
S'   \r\	/ \\R                  R                  \R                  R                  4   4   \
S'   Sr\\	/ S4      \
S'   Sr\\	/ S4      \
S	'   / S
Qr\R(                  R*                  S4S\\\R                  R                  \4      S\R(                  R0                  S\4S jjrS rS rS\\R                  R                  \4   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& SHS\\R                  R                  \4   S\S\R                  R                  4S  jjr' SHS\\R                  R                  \4   S\S\\R                  R                     4S! jjr(S\\R                  R                  \4   SS4S" jr)\RT                  RV                  S4S\\R                  R                  \4   S#\\RT                  RX                  \4   S$\\RT                  RX                  \4   S\S\RZ                  R\                  4
S% jjr/\RT                  RV                  S4S\\R                  R                  \4   S#\\RT                  RX                  \4   S$\\RT                  RX                  \4   S\S\\RZ                  R\                     4
S& jjr0\RT                  RV                  4S\\R                  R                  \4   S#\\RT                  RX                  \4   S$\\RT                  RX                  \4   SS4S' jjr1S\\R                  R                  \4   S(\RZ                  R\                  SS4S) jr2\RT                  RV                  4S\\R                  R                  \4   S#\\RT                  RX                  \4   S$\\RT                  RX                  \4   S\Rf                  Rh                  4S* jjr5\RT                  RV                  4S\\R                  R                  \4   S#\\RT                  RX                  \4   S$\\RT                  RX                  \4   S\\Rf                  Rh                     4S+ jjr6\RT                  Rn                  \RT                  RV                  4S#\\RT                  RX                  \4   S$\\RT                  RX                  \4   S\8\9\R                  R                  \RZ                  R\                  4      4S, jjr:\RT                  Rn                  \RT                  RV                  4S#\\RT                  RX                  \4   S$\\RT                  RX                  \4   S\8\9\R                  R                  \;\Rx                  Rz                  4      4S- jjr>     SIS.\?S/\S\S0\\   S1\S2\SS4S3 jjr@     SIS/\S\S0\\   S1\S2\S\4S4 jjrASJS5 jrB SKS6\\R                  R                     S\R                  Rn                  R                  R                  4S7 jjrG\HR                  4S8\JS9\HS\K4S: jjrL\HR                  4S8\JS9\HS\R                  Rn                  R                  R                  4S; jjrN SKS<\\R                  Rn                  R                  R                     SS4S= jjrOSLS? jrPSHS(\SS>4S@ jjrQS\9\\R                  R                     \\\R                  R                     4   4SA jrRSB rSSC rTSD rUSE rVSF rWSGrXg)MZonex   a^  A DNS zone.

A ``Zone`` is a mapping from names to nodes.  The zone object may be
treated like a Python dictionary, e.g. ``zone[name]`` will retrieve
the node associated with that name.  The *name* may be a
``dns.name.Name object``, or it may be a string.  In either case,
if the name is relative it is treated as relative to the origin of
the zone.
node_factorymap_factoryNWritableVersionwritable_version_factoryImmutableVersionimmutable_version_factory)rdclassr4   nodesr5   Tr4   rI   r5   c                 j   Ub  [        U[        5      (       a   [        R                  R	                  U5      nO4[        U[        R                  R
                  5      (       d  [        S5      eUR                  5       (       d  [        S5      eXl        X l	        U R                  5       U l        X0l        g)a  Initialize a zone object.

*origin* is the origin of the zone.  It may be a ``dns.name.Name``,
a ``str``, or ``None``.  If ``None``, then the zone's origin will
be set by the first ``$ORIGIN`` line in a zone file.

*rdclass*, an ``int``, the zone's rdata class; the default is class IN.

*relativize*, a ``bool``, determine's whether domain names are
relativized to the zone's origin.  The default is ``True``.
Nz2origin parameter must be convertible to a DNS namez)origin parameter must be an absolute name)
isinstancestrr<   r3   	from_textName
ValueErrorr9   r4   rI   rD   rJ   r5   )selfr4   rI   r5   s       r   __init__Zone.__init__   s    $ &#&&++F366 !UVV%%'' !LMMCGCSCSCU
$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g)zYTwo zones are equal if they have the same origin, class, and
nodes.

Returns a ``bool``.
FT)rL   rA   rI   r4   rJ   rQ   others     r   __eq__Zone.__eq__   sJ     %&&LLEMM){{ell*zzU[[(r   c                 .    U R                  U5      (       + $ )z.Are two zones not equal?

Returns a ``bool``.
)rW   rU   s     r   __ne__Zone.__ne__   s     ;;u%%%r   r3   r6   c                    [        U[        5      (       a!  [        R                  R	                  US 5      nO4[        U[        R                  R
                  5      (       d  [        S5      e[        XR                  U R                  5      $ )Nz0name parameter must be convertible to a DNS name)
rL   rM   r<   r3   rN   rO   r8   r?   r4   r5   rQ   r3   s     r   r?   Zone._validate_name   s]     dC  88%%dD1DD#((--00MNNdKKAAr   c                 B    U R                  U5      nU R                  U   $ Nr?   rJ   rQ   keys     r   __getitem__Zone.__getitem__   s     !!#&zz#r   c                 B    U R                  U5      nX R                  U'   g r`   ra   )rQ   rc   values      r   __setitem__Zone.__setitem__   s    !!#&

3r   c                 @    U R                  U5      nU R                  U	 g r`   ra   rb   s     r   __delitem__Zone.__delitem__   s    !!#&JJsOr   c                 6    U R                   R                  5       $ r`   )rJ   __iter__rQ   s    r   rn   Zone.__iter__   s    zz""$$r   c                 6    U R                   R                  5       $ r`   rJ   keysro   s    r   rs   	Zone.keys       zz  r   c                 6    U R                   R                  5       $ r`   )rJ   valuesro   s    r   rw   Zone.values   s    zz  ""r   c                 6    U R                   R                  5       $ r`   rJ   itemsro   s    r   r{   
Zone.items       zz!!r   c                 Z    U R                  U5      nU R                  R                  U5      $ r`   r?   rJ   getrb   s     r   r   Zone.get   s%    !!#&zz~~c""r   c                 @    U R                  U5      nXR                  ;   $ r`   ra   rb   s     r   __contains__Zone.__contains__   s    !!#&jj  r   Fcreatec                     U R                  U5      nU R                  R                  U5      nUc+  U(       d  [        eU R	                  5       nX0R                  U'   U$ )a  Find a node in the zone, possibly creating it.

*name*: the name of the node to find.
The value may be a ``dns.name.Name`` or a ``str``.  If absolute, the
name must be a subdomain of the zone's origin.  If ``zone.relativize``
is ``True``, then the name will be relativized.

*create*, a ``bool``.  If true, the node will be created if it does
not exist.

Raises ``KeyError`` if the name is not known and create was
not specified, or if the name was not a subdomain of the origin.

Returns a ``dns.node.Node``.
)r?   rJ   r   r8   rC   rQ   r3   r   nodes       r   	find_nodeZone.find_node   sR    & ""4(zz~~d#<$$&D#JJtr   c                 P     U R                  X5      nU$ ! [         a    Sn U$ f = f)a(  Get a node in the zone, possibly creating it.

This method is like ``find_node()``, except it returns None instead
of raising an exception if the node does not exist and creation
has not been requested.

*name*: the name of the node to find.
The value may be a ``dns.name.Name`` or a ``str``.  If absolute, the
name must be a subdomain of the zone's origin.  If ``zone.relativize``
is ``True``, then the name will be relativized.

*create*, a ``bool``.  If true, the node will be created if it does
not exist.

Returns a ``dns.node.Node`` or ``None``.
N)r   r8   r   s       r   get_nodeZone.get_node  s7    (	>>$/D   	D	s    %%c                 `    U R                  U5      nXR                  ;   a  U R                  U	 gg)a;  Delete the specified node if it exists.

*name*: the name of the node to find.
The value may be a ``dns.name.Name`` or a ``str``.  If absolute, the
name must be a subdomain of the zone's origin.  If ``zone.relativize``
is ``True``, then the name will be relativized.

It is not an error if the node does not exist.
Nra   r]   s     r   delete_nodeZone.delete_node   s/     ""4(::

4  r   rdtypecoversc                 $   U R                  U5      n[        R                  R                  R	                  U5      n[        R                  R                  R	                  U5      nU R                  X5      nUR                  U R                  X#U5      $ )a  Look for an rdataset with the specified name and type in the zone,
and return an rdataset encapsulating it.

The rdataset returned is not a copy; changes to it will change
the zone.

KeyError is raised if the name or type are not found.

*name*: the name of the node to find.
The value may be a ``dns.name.Name`` or a ``str``.  If absolute, the
name must be a subdomain of the zone's origin.  If ``zone.relativize``
is ``True``, then the name will be relativized.

*rdtype*, a ``dns.rdatatype.RdataType`` or ``str``, the rdata type desired.

*covers*, a ``dns.rdatatype.RdataType`` or ``str`` 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, the node will be created if it does
not exist.

Raises ``KeyError`` if the name is not known and create was
not specified, or if the name was not a subdomain of the origin.

Returns a ``dns.rdataset.Rdataset``.
)r?   r<   	rdatatype	RdataTypemaker   find_rdatasetrI   )rQ   r3   r   r   r   r   s         r   r   Zone.find_rdataset/  sp    R ""4(((--f5((--f5~~d+!!$,,GGr   c                 R     U R                  XX45      nU$ ! [         a    Sn U$ f = f)a]  Look for an rdataset with the specified name and type in the zone.

This method is like ``find_rdataset()``, except it returns None instead
of raising an exception if the rdataset does not exist and creation
has not been requested.

The rdataset returned is not a copy; changes to it will change
the zone.

*name*: the name of the node to find.
The value may be a ``dns.name.Name`` or a ``str``.  If absolute, the
name must be a subdomain of the zone's origin.  If ``zone.relativize``
is ``True``, then the name will be relativized.

*rdtype*, a ``dns.rdatatype.RdataType`` or ``str``, the rdata type desired.

*covers*, a ``dns.rdatatype.RdataType`` or ``str``, 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, the node will be created if it does
not exist.

Raises ``KeyError`` if the name is not known and create was
not specified, or if the name was not a subdomain of the origin.

Returns a ``dns.rdataset.Rdataset`` or ``None``.
N)r   r8   )rQ   r3   r   r   r   rdatasets         r   get_rdatasetZone.get_rdataset^  s<    T	))$GH   	H	    &&c                 n   U R                  U5      n[        R                  R                  R	                  U5      n[        R                  R                  R	                  U5      nU R                  U5      nUb>  UR                  U R                  X#5        [        U5      S:X  a  U R                  U5        ggg)aG  Delete the rdataset matching *rdtype* and *covers*, if it
exists at the node specified by *name*.

It is not an error if the node does not exist, or if there is no matching
rdataset at the node.

If the node has no rdatasets after the deletion, it will itself be deleted.

*name*: the name of the node to find. The value may be a ``dns.name.Name`` or a
``str``.  If absolute, the name must be a subdomain of the zone's origin.  If
``zone.relativize`` is ``True``, then the name will be relativized.

*rdtype*, a ``dns.rdatatype.RdataType`` or ``str``, the rdata type desired.

*covers*, a ``dns.rdatatype.RdataType`` or ``str`` or ``None``, 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.
Nr   )
r?   r<   r   r   r   r   delete_rdatasetrI   lenr   rQ   r3   r   r   r   s        r   r   Zone.delete_rdataset  s    : ""4(((--f5((--f5}}T"  v>4yA~  &  r   replacementc                     UR                   U R                   :w  a  [        S5      eU R                  US5      nUR                  U5        g)ak  Replace an rdataset at name.

It is not an error if there is no rdataset matching I{replacement}.

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

If the node does not exist, it is created.

*name*: the name of the node to find.
The value may be a ``dns.name.Name`` or a ``str``.  If absolute, the
name must be a subdomain of the zone's origin.  If ``zone.relativize``
is ``True``, then the name will be relativized.

*replacement*, a ``dns.rdataset.Rdataset``, the replacement rdataset.
z#replacement.rdclass != zone.rdclassTN)rI   rP   r   replace_rdataset)rQ   r3   r   r   s       r   r   Zone.replace_rdataset  s@    * $,,.BCC~~dD)k*r   c                    U R                  U5      n[        R                  R                  R	                  U5      n[        R                  R                  R	                  U5      nU R
                  U   R                  U R                  X#5      n[        R                  R                  X@R                  X#5      nUR                  U5        U$ )a  Look for an rdataset with the specified name and type in the zone,
and return an RRset encapsulating it.

This method is less efficient than the similar
``find_rdataset()`` because it creates an RRset instead of
returning the matching rdataset.  It may be more convenient
for some uses since it returns an object which binds the owner
name to the rdataset.

This method may not be used to create new nodes or rdatasets;
use ``find_rdataset`` instead.

*name*: the name of the node to find.
The value may be a ``dns.name.Name`` or a ``str``.  If absolute, the
name must be a subdomain of the zone's origin.  If ``zone.relativize``
is ``True``, then the name will be relativized.

*rdtype*, a ``dns.rdatatype.RdataType`` or ``str``, the rdata type desired.

*covers*, a ``dns.rdatatype.RdataType`` or ``str``, 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, the node will be created if it does
not exist.

Raises ``KeyError`` if the name is not known and create was
not specified, or if the name was not a subdomain of the origin.

Returns a ``dns.rrset.RRset`` or ``None``.
)r?   r<   r   r   r   rJ   r   rI   rrsetRRsetupdate)rQ   r3   r   r   vnamer   r   s          r   
find_rrsetZone.find_rrset  s    X ##D)((--f5((--f5::e$224<<P		||VDXr   c                 R     U R                  XU5      nU$ ! [         a    Sn U$ f = f)af  Look for an rdataset with the specified name and type in the zone,
and return an RRset encapsulating it.

This method is less efficient than the similar ``get_rdataset()``
because it creates an RRset instead of returning the matching
rdataset.  It may be more convenient for some uses since it
returns an object which binds the owner name to the rdataset.

This method may not be used to create new nodes or rdatasets;
use ``get_rdataset()`` instead.

*name*: the name of the node to find.
The value may be a ``dns.name.Name`` or a ``str``.  If absolute, the
name must be a subdomain of the zone's origin.  If ``zone.relativize``
is ``True``, then the name will be relativized.

*rdtype*, a ``dns.rdataset.Rdataset`` or ``str``, the rdata type desired.

*covers*, a ``dns.rdataset.Rdataset`` or ``str``, 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, the node will be created if it does
not exist.

Returns a ``dns.rrset.RRset`` or ``None``.
N)r   r8   )rQ   r3   r   r   r   s        r   	get_rrsetZone.get_rrset  s:    P	OOD&9E   	E	r   c              #     #    [         R                  R                  R                  U5      n[         R                  R                  R                  U5      nU R	                  5        HU  u  p4U HJ  nU[         R                  R
                  :X  d$  UR                  U:X  d  M3  UR                  U:X  d  ME  X54v   ML     MW     g7f)a"  Return a generator which yields (name, rdataset) tuples for
all rdatasets in the zone which have the specified *rdtype*
and *covers*.  If *rdtype* is ``dns.rdatatype.ANY``, the default,
then all rdatasets will be matched.

*rdtype*, a ``dns.rdataset.Rdataset`` or ``str``, the rdata type desired.

*covers*, a ``dns.rdataset.Rdataset`` or ``str``, 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.
N)r<   r   r   r   r{   ANYr   r   )rQ   r   r   r3   r   rdss         r   iterate_rdatasetsZone.iterate_rdatasets0  s     . ((--f5((--f5**,JDS]]...JJ&(SZZ6-A+%	  's   BB?B?1B?c              #     #    [         R                  R                  R                  U5      n[         R                  R                  R                  U5      nU R	                  5        Hi  u  p4U H^  nU[         R                  R
                  :X  d$  UR                  U:X  d  M3  UR                  U:X  d  ME  U H  nX5R                  U4v   M     M`     Mk     g7f)a  Return a generator which yields (name, ttl, rdata) tuples for
all rdatas in the zone which have the specified *rdtype*
and *covers*.  If *rdtype* is ``dns.rdatatype.ANY``, the default,
then all rdatas will be matched.

*rdtype*, a ``dns.rdataset.Rdataset`` or ``str``, the rdata type desired.

*covers*, a ``dns.rdataset.Rdataset`` or ``str``, 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.
N)	r<   r   r   r   r{   r   r   r   ttl)rQ   r   r   r3   r   r   rdatas          r   iterate_rdatasZone.iterate_rdatasP  s     . ((--f5((--f5**,JDS]]...JJ&(SZZ6-A!$#WWe44 "%	  's   BCC1"Cfsortednlwant_commentswant_originc           	      \   [        U[        5      (       a  [        US5      nO[        R                  " U5      nU n[        USS5      nUc  SnUc"  [        R                  R                  U5      n	SnO9[        U[        5      (       a  UR                  U5      n	OUn	UR                  5       nU(       a`  U R                  c   eSU R                  R                  5       -   n
U
R                  U5      n UR                  U5        UR                  U	5        U(       a*  [        U R                  5       5      nUR!                  5         OU R                  5       nU HU  nX   R                  UU R                  UUS9n
U
R                  U5      n UR                  U5        UR                  U	5        MW     SSS5        g! [         a%    UR                  U
5        UR                  U5         Nf = f! [         a&    UR                  U
5        UR                  U5         M  f = f! , (       d  f       g= f)a  Write a zone to a file.

*f*, a file or `str`.  If *f* is a string, it is treated
as the name of a file to open.

*sorted*, a ``bool``.  If True, the default, then the file
will be written with the names sorted in DNSSEC order from
least to greatest.  Otherwise the names will be written in
whatever order they happen to have in the zone's dictionary.

*relativize*, a ``bool``.  If True, the default, then domain
names in the output will be relativized to the zone's origin
if possible.

*nl*, a ``str`` or None.  The end of line string.  If not
``None``, the output will use the platform's native
end-of-line marker (i.e. LF on POSIX, CRLF on Windows).

*want_comments*, a ``bool``.  If ``True``, emit end-of-line comments
as part of writing the file.  If ``False``, the default, do not
emit them.

*want_origin*, a ``bool``.  If ``True``, emit a $ORIGIN line at
the start of the file.  If ``False``, the default, do not emit
one.
wbencodingNzutf-8
z$ORIGIN )r4   r5   r   )rL   rM   open
contextlibnullcontextgetattroslinesepencodedecoder4   to_textwrite	TypeErrorlistrs   sort)rQ   r   r   r5   r   r   r   cmfile_encnl_bll_bnamesns                 r   to_fileZone.to_fileq  s   H a48DMB''*B1 q*d3H"zzz((2B$$yy*YY[{{...!4!4!66hhx( GGCLGGDM
 TYY[)

		GOO;;)"/	 $  hhx( GGCLGGDM C R0 !  GGAJGGBK * !  GGAJGGBK [ RsU   B5H1"F8A5H	"G*+H8,G'$H&G''H*,HHHH
H+c                     [         R                  " 5       nU R                  XaX#XE5        UR                  5       nUR	                  5         U$ )a  Return a zone's text as though it were written to a file.

*sorted*, a ``bool``.  If True, the default, then the file
will be written with the names sorted in DNSSEC order from
least to greatest.  Otherwise the names will be written in
whatever order they happen to have in the zone's dictionary.

*relativize*, a ``bool``.  If True, the default, then domain
names in the output will be relativized to the zone's origin
if possible.

*nl*, a ``str`` or None.  The end of line string.  If not
``None``, the output will use the platform's native
end-of-line marker (i.e. LF on POSIX, CRLF on Windows).

*want_comments*, a ``bool``.  If ``True``, emit end-of-line comments
as part of writing the file.  If ``False``, the default, do not
emit them.

*want_origin*, a ``bool``.  If ``True``, emit a $ORIGIN line at
the start of the output.  If ``False``, the default, do not emit
one.

Returns a ``str``.
)ioStringIOr   getvalueclose)rQ   r   r5   r   r   r   temp_bufferreturn_values           r   r   Zone.to_text  s@    B kkm[*-U"++-r   c                 V   U R                   (       a  [        R                  R                  nOU R                  c   eU R                  nU R                  U[        R                  R                  5      c  [        eU R                  U[        R                  R                  5      c  [        eg)zDo some simple checking of the zone's origin.

Raises ``dns.zone.NoSOA`` if there is no SOA RRset.

Raises ``dns.zone.NoNS`` if there is no NS RRset.

Raises ``KeyError`` if there is no origin node.
N)r5   r<   r3   emptyr4   r   r   SOAr   NSr!   r]   s     r   check_originZone.check_origin  sz     ??88>>D;;***;;DT3==#4#45=KT3==#3#34<J =r   txnc                 l   U R                   (       a  [        R                  R                  nOU R                  c  [
        eU R                  nU(       a+  UR                  U[        R                  R                  5      nO*U R                  U[        R                  R                  5      nUc  [
        eUS   $ )z{Get the zone SOA rdata.

Raises ``dns.zone.NoSOA`` if there is no SOA RRset.

Returns a ``dns.rdtypes.ANY.SOA.SOA`` Rdata.
r   )
r5   r<   r3   r   r4   r   r   r   r   r   )rQ   r   origin_namesoas       r   get_soaZone.get_soa  s~     ??((..K{{" ++K''+s}}'8'89C##K1B1BCC;K1vr   hash_algorithmschemec           	         [         R                  " U5      nU(       d  [        eU[        R                  :w  a  [
        eU R                  (       a  [        R                  R                  nOU R                  c   eU R                  nU" 5       n[        U R                  5       5       GH  u  pgUR                  U R                  5      n[        US S9 H  n	Xd:X  a6  [        R                  R                  U	R                   U	R"                  4;   a  M>  [$        R&                  " SU	R                   U	R(                  U	R*                  5      n
U	 Vs/ s H  oR                  U R                  5      PM     nn[        U5       H<  n[$        R&                  " S[-        U5      5      nUR/                  X-   U-   U-   5        M>     M     GM     UR1                  5       $ s  snf )Nc                 2    U R                   U R                  4$ r`   )r   r   )r   s    r   <lambda>&Zone._compute_digest.<locals>.<lambda>1  s    #**cjj9Qr   )rc   z!HHIz!H)r   r   r+   r   SIMPLEr'   r5   r<   r3   r   r4   r   r{   to_digestabler   ZONEMDr   r   structpackrI   r   r   r   digest)rQ   r   r   hashinfor   hasherr3   r   	rrnamebufr   rrfixedr   rdatasrrlens                 r   _compute_digestZone._compute_digest  sl   
 #&&~600\((())??((..K;;***++K .JD**4;;7I"4-QR&3==+?+?OOOOD ,  ++HOOX-=-=x|| IQQu--dkk:Q#F^E"KKc%j9EMM)"5"="EF , S / }}	 Rs   
$Gc                    U R                  5       R                  nU R                  X5      n[        R                  R
                  R                  R                  U R                  [        R                  R                  X2X5      $ r`   )	r   serialr   r<   rdtypesr   r   rI   r   )rQ   r   r   r  r   s        r   compute_digestZone.compute_digest@  s]    
 &&%%n={{%%,,LL#--..
 	
r   zonemdc                 d   U(       a  U/nONU R                   c   eU R                  U R                   [        R                  R                  5      nUc  [
        eUnU H;  n U R                  UR                  UR                  5      nXTR                  :X  a    g M=     [        e! [         a     MR  f = fr`   )r4   r   r<   r   r   r.   r   r   r   r   	Exceptionr1   )rQ   r  digestsr   r   computeds         r   verify_digestZone.verify_digestK  s     hG;;***##DKK1E1EFC{GF//0E0Ev}}U}}, -  ('  s    5B!!
B/.B/Transactionc           
      \    [        U S[        U SU R                  U R                  5      5      $ )NF   )r  VersionrJ   r4   ro   s    r   readerZone.readerb  s$    4aT[[(QRRr   c                 <    [        X5      nUR                  5         U$ r`   )r  _setup_version)rQ   r   r   s      r   writerZone.writere  s    $,
r   c                     U R                   (       a  [        R                  R                  nOU R                  nU R                  U R                   U4$ r`   )r5   r<   r3   r   r4   )rQ   	effectives     r   origin_informationZone.origin_informationj  s6     ??IIT__i88r   c                     U R                   $ r`   )rI   ro   s    r   	get_classZone.get_classt  s    ||r   c                     g r`   r   rQ   r   s     r   	_end_readZone._end_ready      r   c                     g r`   r   r   s     r   
_end_writeZone._end_write|  r#  r   c                 N    UR                   U l         U R                  c  X0l        g g r`   )rJ   r4   )rQ   _versionr4   s       r   _commit_versionZone._commit_version  s!    ]]
;; K r   c                     g)Nr  r   ro   s    r   _get_next_version_idZone._get_next_version_id  s    r   )rJ   r4   rI   r5   F)TTNFF)r6   Nr`   )r6   r  )Yr   r   r   r   r   r<   r   NoderC   r   __annotations__dictrD   r   r3   rO   rF   r	   rH   	__slots__
rdataclassINr   rM   
RdataClassboolrR   rW   rZ   r?   rd   rh   rk   rn   rs   rw   r{   r   r   r   r   r   r   NONEr   r   Rdatasetr   r   r   r   r   r   r   r   r   r   r   r   intr   Rdatar   r   r   r   r   transactionr  r  r   r   r   r   r   bytesr   r   r  r  r  r  r  r  r!  r%  r*  r-  r   r   r   r   rA   rA   x   s    14L(2sxx}},-=NRK"nSXX]]CHHMM-IJJKRJNhx4E0E'FGNLPx5G1G(HIP<I
 .1^^->->	%sxx}}c123% **% 	%<"&B5);#< B B %!#"#!
 ?D#((--,-7;	: ?D#((--,-7;	#((--	 4!chhmmS&8 9 !d !& 7:mm6H6H-HCHHMM3&'-H cmm--s23-H cmm--s23	-H
 -H 
		-Hf 7:mm6H6H.CHHMM3&'. cmm--s23. cmm--s23	.
 . 
#,,''	(.h 7:mm6H6H	$'CHHMM3&'$' cmm--s23$' cmm--s23	$'
 
$'L+#((--,-+<?LL<Q<Q+	+< 7:mm6H6H	2CHHMM3&'2 cmm--s232 cmm--s23	2
 
2p 7:mm6H6H	,CHHMM3&', cmm--s23, cmm--s23	,
 
#))//	",` 7:mm6G6G69mm6H6H&cmm--s23& cmm--s23& 
%s||'<'<<=	>	&D 7:mm6G6G69mm6H6H5cmm--s235 cmm--s235 
%sCIIOO;<	=	5H  #!W W  W  	W 
 SMW  W  W  
W v  #!%% % SM	%
 % % 
%N( <@COO778				 	 :  ,22 +    
	 J  ,22	
+	
 	
 
			&	&		
 AE(s{{55<<=(	(.S$ = 
9	x&hsxx}}.EE	F9
!
r   rA   c                   .   ^  \ rS rSrS/rU 4S jrSrU =r$ )VersionedNodei  idc                 0   > [         TU ]  5         SU l        g Nr   )superrR   r@  )rQ   	__class__s    r   rR   VersionedNode.__init__  s    r   )r@  )r   r   r   r   r3  rR   r   __classcell__rD  s   @r   r?  r?    s    I r   r?  c                     ^  \ rS rSrU 4S jr\R                  R                  S4S\R                  R                  S\R                  R                  S\R                  R                  S\S\R                  R                  4
U 4S	 jjjr\R                  R                  S4S\R                  R                  S\R                  R                  S\R                  R                  S\S\\R                  R                     4
U 4S
 jjjr\R                  R                  4S\R                  R                  S\R                  R                  S\R                  R                  SS4S jjrS\R                  R                  SS4S jrS\4S jrSrU =r$ )ImmutableVersionedNodei  c                    > [         TU ]  5         UR                  U l        [        UR                   Vs/ s H"  n[
        R                  R                  U5      PM$     sn5      U l        g s  snf r`   )rC  rR   r@  tuple	rdatasetsr<   r   ImmutableRdataset)rQ   r   r   rD  s      r   rR   ImmutableVersionedNode.__init__  sM    ''<@NNKNSS\\++C0NK
Ks   )A*FrI   r   r   r   r6   c                 J   > U(       a  [        S5      e[        TU ]	  XUS5      $ N	immutableF)r   rC  r   rQ   rI   r   r   r   rD  s        r   r   $ImmutableVersionedNode.find_rdataset  s'     K((w$WfeDDr   c                 J   > U(       a  [        S5      e[        TU ]	  XUS5      $ rP  )r   rC  r   rR  s        r   r   #ImmutableVersionedNode.get_rdataset  s'     K((w#GVUCCr   Nc                     [        S5      eNrQ  r   )rQ   rI   r   r   s       r   r   &ImmutableVersionedNode.delete_rdataset  s     $$r   r   c                     [        S5      erW  rX  )rQ   r   s     r   r   'ImmutableVersionedNode.replace_rdataset  s    $$r   c                     gNTr   ro   s    r   is_immutable#ImmutableVersionedNode.is_immutable  s    r   )r@  rL  )r   r   r   r   rR   r<   r   r8  r4  r6  r   r7  r   r9  r   r	   r   r   r   r^  r   rF  rG  s   @r   rI  rI    s   
 +.--*<*<	E**	E ''	E ''		E
 	E 
			E 	E +.--*<*<	D**	D ''	D ''		D
 	D 
#,,''	(	D 	D +.--*<*<	%**% ''% ''	%
 
%%CLL,A,A %d %d  r   rI  c            
       Z   \ rS rSr  SS\S\S\\\R                  R                  \R                  R                  4      S\\R                  R                     4S jjrS\R                  R                  S	\R                  R                  4S
 jrS\R                  R                  S	\\R                  R                     4S jrS\R                  R                  S\R                   R"                  S\R                   R"                  S	\\R$                  R&                     4S jrS rS rSrg)r  i  Nzoner@  rJ   r4   c                 f    Xl         X l        Ub  X0l        OUR                  5       U l        X@l        g r`   )ra  r@  rJ   rD   r4   )rQ   ra  r@  rJ   r4   s        r   rR   Version.__init__  s.     	J))+DJr   r3   r6   c                 V    [        XR                  U R                  R                  5      $ r`   )r?   r4   ra  r5   r]   s     r   r?   Version._validate_name  s    dKK1E1EFFr   c                 Z    U R                  U5      nU R                  R                  U5      $ r`   r   r]   s     r   r   Version.get_node  s%    ""4(zz~~d##r   r   r   c                 x    U R                  U5      nUc  g UR                  U R                  R                  X#5      $ r`   )r   r   ra  rI   r   s        r   r   Version.get_rdataset  s7     }}T"<  !2!2FCCr   c                 6    U R                   R                  5       $ r`   rr   ro   s    r   rs   Version.keys  ru   r   c                 6    U R                   R                  5       $ r`   rz   ro   s    r   r{   Version.items  r}   r   )r@  rJ   r4   ra  )NN)r   r   r   r   rA   r:  r	   r   r<   r3   rO   r   r0  rR   r?   r   r   r   r   r9  r   rs   r{   r   r   r   r   r  r    s   
 IM*.  sxx}}chhmm'CDE	
 'G388== GSXX]] G$SXX]] $x/F $	Dhhmm	D ''	D ''		D
 
#,,''	(	D!"r   r  c                     ^  \ rS rSrSS\S\4U 4S jjjrS\R                  R                  S\R                  R                  4S jrS\R                  R                  SS4S	 jrS\R                  R                  S
\R                  R                  SS4S jrS\R                  R                  S\R"                  R$                  S\R"                  R$                  SS4S jrSrU =r$ )rE   i  ra  r   c                    > UR                  5       n[        TU ]	  X5        U(       d%  U R                  R	                  UR                  5        UR
                  U l        [        5       U l        g r`   )r-  rC  rR   rJ   r   r4   setchanged)rQ   ra  r   r@  rD  s       r   rR   WritableVersion.__init__  sQ     &&("
 JJdjj) kk+.5r   r3   r6   c                    U R                  U5      nU R                  R                  U5      nUb  XR                  ;  a  U R                  R                  5       n[        US5      (       a  U R                  Ul        Ub%  UR                  R                  UR                  5        X0R                  U'   U R                  R                  U5        U$ U$ )Nr@  )r?   rJ   r   rq  ra  rC   hasattrr@  rL  extendadd)rQ   r3   r   new_nodes       r   
_maybe_cowWritableVersion._maybe_cow  s    ""4(zz~~d#<4||3yy--/Hx&& #gg""))$..9'JJtLLT"OKr   Nc                     U R                  U5      nXR                  ;   a)  U R                  U	 U R                  R                  U5        g g r`   )r?   rJ   rq  rv  r]   s     r   r   WritableVersion.delete_node  s?    ""4(::

4 LLT" r   r   c                 H    U R                  U5      nUR                  U5        g r`   )rx  r   )rQ   r3   r   r   s       r   put_rdatasetWritableVersion.put_rdataset  s      t$h'r   r   r   c                     U R                  U5      nUR                  U R                  R                  X#5        [	        U5      S:X  a  U R
                  U	 g g rB  )rx  r   ra  rI   r   rJ   r   s        r   r   WritableVersion.delete_rdataset$  sH     t$TYY..?t9>

4  r   )rq  r4   r/  )r   r   r   r   rA   r7  rR   r<   r3   rO   r   r0  rx  r   r   r9  r}  r   r   r   r   rF  rG  s   @r   rE   rE     s    1T 1 1 1 sxx}}  ,# #$ #(HHMM(-0\\-B-B(	(	!hhmm	! ''	! ''		!
 
	! 	!r   rE   c                   0   ^  \ rS rSrS\4U 4S jjrSrU =r$ )rG   i0  r)  c                   > [         TU ]  UR                  S5        UR                  U l        UR                  U l        UR
                   H?  nUR                  R                  U5      nU(       d  M'  [        U5      UR                  U'   MA     [        R                  R                  UR                  SU R                  R                  5      U l        g r]  )rC  rR   ra  r@  r4   rq  rJ   r   rI  r<   rQ  DictrD   )rQ   r)  r3   r   rD  s       r   rR   ImmutableVersion.__init__2  s     	t,**nnOOD==$$T*Dt&<T&Bd#	 $ ]]''MM4!6!6

r   )r@  rJ   r4   )r   r   r   r   rE   rR   r   rF  rG  s   @r   rG   rG   0  s    
 
 
r   rG   c                      ^  \ rS rSrSU 4S jjr\S 5       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U =r$ )r  iH  c                 F   > US Ln[         TU ]  XU5        X0l        X@l        g r`   )rC  rR   r)  make_immutable)rQ   ra  r   r)  r  	read_onlyrD  s         r   rR   Transaction.__init__I  s'    4'	I6,r   c                     U R                   $ r`   )managerro   s    r   ra  Transaction.zoneO  s    ||r   c                     U R                   b   eU R                  R                  nUc  [        nU" U R                  U R
                  5      U l         g r`   )r)  r  rF   rE   ra  r   )rQ   factorys     r   r  Transaction._setup_versionS  sC    ||###,,77?%Gtyy$*:*:;r   c                 :    U R                   R                  XU5      $ r`   )r)  r   rQ   r3   r   r   s       r   _get_rdatasetTransaction._get_rdatasetZ  s    ||((v>>r   c                 `    U R                   (       a   eU R                  R                  X5        g r`   )r  r)  r}  )rQ   r3   r   s      r   _put_rdatasetTransaction._put_rdataset]  s!    >>!!!!$1r   c                 `    U R                   (       a   eU R                  R                  U5        g r`   )r  r)  r   r]   s     r   _delete_nameTransaction._delete_namea  s!    >>!!  &r   c                 b    U R                   (       a   eU R                  R                  XU5        g r`   )r  r)  r   r  s       r   _delete_rdatasetTransaction._delete_rdatasete  s#    >>!!$$T6:r   c                 <    U R                   R                  U5      S L$ r`   r)  r   r]   s     r   _name_existsTransaction._name_existsi  s    ||$$T*$66r   c                 j    U R                   (       a  g[        U R                  R                  5      S:  $ )NFr   )r  r   r)  rq  ro   s    r   _changedTransaction._changedl  s&    >>t||++,q00r   c                    U R                   (       a  U R                  R                  U 5        g U(       a  [        U R                  R
                  5      S:  a  U R                  (       a2  U R                  R                  nUc  [        nU" U R                  5      nOU R                  nU R                  R                  XU R                  R                  5        g U R                  R                  U 5        g rB  )r  ra  r!  r   r)  rq  r  r  rH   rG   r*  r4   r%  )rQ   commitr  r)  s       r   _end_transactionTransaction._end_transactionr  s    >>II%DLL001A5"",,@@?.G!$,,/,,II%%dT\\5H5HI II  &r   c                 T    U R                   R                  c  XR                   l        g g r`   )r)  r4   )rQ   r4   s     r   _set_originTransaction._set_origin  s!    <<&"(LL 'r   c              #   n   #    U R                   R                  5        H  u  pU H  nX4v   M
     M     g 7fr`   )r)  r{   )rQ   r3   r   r   s       r   _iterate_rdatasetsTransaction._iterate_rdatasets  s1     ,,,,.JD && ! /s   35c                 6    U R                   R                  5       $ r`   )r)  rs   ro   s    r   _iterate_namesTransaction._iterate_names  s    ||  ""r   c                 8    U R                   R                  U5      $ r`   r  r]   s     r   	_get_nodeTransaction._get_node  s    ||$$T**r   c                     U R                   R                  5       u  pnUcQ  U R                  R                  b:  U R                  R                  nU(       a  [        R
                  R                  nOUnXU4$ r`   )r  r  r)  r4   r<   r3   r   )rQ   absoluter5   r  s       r   _origin_informationTransaction._origin_information  s_    ,0LL,K,K,M)y 3 3 ? ||**HHHNN	$	i00r   )r  r)  )NF)r   r   r   r   rR   propertyra  r  r  r  r  r  r  r  r  r  r  r  r  r  r   rF  rG  s   @r   r  r  H  sb    -  <?2';71' )'
#+
1 
1r   r  TFtextrI   zone_factoryfilenameallow_includer   
idna_codecallow_directivesc
           	         Uc  SnU" XUS9n
U
R                  S5       n[        R                  R                  XUS9n[        R                  R                  UUUUU	S9n UR                  5          S S S 5        U(       a  U
R                  5         U
$ ! [        R                  R                   a    [        R                  R                  ef = f! , (       d  f       Nc= f)Nz<string>r5   T)r  )r  r  )
r  r<   	tokenizer	TokenizerzonefileReaderreadr$   ra  r   )r  r4   rI   r5   r  r  r  r   r  r  ra  r   tokr  s                 r   
_from_textr    s    & J?D	T	cmm%%d%L$$'- % 
	)KKM 
 K ||)) 	)(((((	) 
	s   A CB9C

C
Cc
                 *    [        U UUUUUUUUU	5
      $ )a  Build a zone object from a zone file format string.

*text*, a ``str``, the zone file format input.

*origin*, a ``dns.name.Name``, a ``str``, or ``None``.  The origin
of the zone; if not specified, the first ``$ORIGIN`` statement in the
zone file will determine the origin of the zone.

*rdclass*, a ``dns.rdataclass.RdataClass``, the zone's rdata class; the default is
class IN.

*relativize*, a ``bool``, determine's whether domain names are
relativized to the zone's origin.  The default is ``True``.

*zone_factory*, the zone factory to use or ``None``.  If ``None``, then
``dns.zone.Zone`` will be used.  The value may be any class or callable
that returns a subclass of ``dns.zone.Zone``.

*filename*, a ``str`` or ``None``, the filename to emit when
describing where an error occurred; the default is ``'<string>'``.

*allow_include*, a ``bool``.  If ``True``, the default, then ``$INCLUDE``
directives are permitted.  If ``False``, then encoutering a ``$INCLUDE``
will raise a ``SyntaxError`` exception.

*check_origin*, a ``bool``.  If ``True``, the default, then sanity
checks of the origin node will be made by calling the zone's
``check_origin()`` method.

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

*allow_directives*, a ``bool`` or an iterable of `str`.  If ``True``, the default,
then directives are permitted, and the *allow_include* parameter controls whether
``$INCLUDE`` is permitted.  If ``False`` or an empty iterable, then no directive
processing is done and any directive-like text will be treated as a regular owner
name.  If a non-empty iterable, then only the listed directives (including the
``$``) are allowed.

Raises ``dns.zone.NoSOA`` if there is no SOA RRset.

Raises ``dns.zone.NoNS`` if there is no NS RRset.

Raises ``KeyError`` if there is no origin node.

Returns a subclass of ``dns.zone.Zone``.
)r  )
r  r4   rI   r5   r  r  r  r   r  r  s
             r   rN   rN     s0    x  r   r   c
                     [        U [        5      (       a  Uc  U n[        U 5      n
O[        R                  " U 5      n
U
 n [        U UUUUUUUUU	5
      sSSS5        $ ! , (       d  f       O= f e)a  Read a zone file and build a zone object.

*f*, a file or ``str``.  If *f* is a string, it is treated
as the name of a file to open.

*origin*, a ``dns.name.Name``, a ``str``, or ``None``.  The origin
of the zone; if not specified, the first ``$ORIGIN`` statement in the
zone file will determine the origin of the zone.

*rdclass*, an ``int``, the zone's rdata class; the default is class IN.

*relativize*, a ``bool``, determine's whether domain names are
relativized to the zone's origin.  The default is ``True``.

*zone_factory*, the zone factory to use or ``None``.  If ``None``, then
``dns.zone.Zone`` will be used.  The value may be any class or callable
that returns a subclass of ``dns.zone.Zone``.

*filename*, a ``str`` or ``None``, the filename to emit when
describing where an error occurred; the default is ``'<string>'``.

*allow_include*, a ``bool``.  If ``True``, the default, then ``$INCLUDE``
directives are permitted.  If ``False``, then encoutering a ``$INCLUDE``
will raise a ``SyntaxError`` exception.

*check_origin*, a ``bool``.  If ``True``, the default, then sanity
checks of the origin node will be made by calling the zone's
``check_origin()`` method.

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

*allow_directives*, a ``bool`` or an iterable of `str`.  If ``True``, the default,
then directives are permitted, and the *allow_include* parameter controls whether
``$INCLUDE`` is permitted.  If ``False`` or an empty iterable, then no directive
processing is done and any directive-like text will be treated as a regular owner
name.  If a non-empty iterable, then only the listed directives (including the
``$``) are allowed.

Raises ``dns.zone.NoSOA`` if there is no SOA RRset.

Raises ``dns.zone.NoNS`` if there is no NS RRset.

Raises ``KeyError`` if there is no origin node.

Returns a subclass of ``dns.zone.Zone``.
N)rL   rM   r   r   r   r  )r   r4   rI   r5   r  r  r  r   r  r  r   s              r   	from_filer    sr    z !SH04Q##A&	q
 
 5s   A
A+xfrc                    SnU  GH"  nUcM  U(       a  UR                   nOUR                  S   R                  nUR                  S   R                  nU" XgUS9nUR                   H  nUR                  R                  UR                  5      n	U	(       d(  UR                  5       n	XR                  UR                  '   U	R                  UR                  UR                  UR                  S5      n
U
R                  UR                  5        U H  nU
R                  U5        M     M     GM%     Uc  [        S5      eU(       a  UR                  5         U$ )a  Convert the output of a zone transfer generator into a zone object.

*xfr*, a generator of ``dns.message.Message`` objects, typically
``dns.query.xfr()``.

*relativize*, a ``bool``, determine's whether domain names are
relativized to the zone's origin.  The default is ``True``.
It is essential that the relativize setting matches the one specified
to the generator.

*check_origin*, a ``bool``.  If ``True``, the default, then sanity
checks of the origin node will be made by calling the zone's
``check_origin()`` method.

Raises ``dns.zone.NoSOA`` if there is no SOA RRset.

Raises ``dns.zone.NoNS`` if there is no NS RRset.

Raises ``KeyError`` if there is no origin node.

Raises ``ValueError`` if no messages are yielded by the generator.

Returns a subclass of ``dns.zone.Zone``.
Nr   r  Tzempty transfer)r4   answerr3   rI   rJ   r   rC   r   r   r   
update_ttlr   rv  rP   r   )r  r  r5   r   zrr4   rI   r   znodezrdsrds               r   from_xfrr  e  s   > 	A9!))hhqk))GVDAXXEGGKK

+E(&+

#&&u}}ellELLRVWDOOEII&   " 	y)**	Hr   )Hr   r   r   r   r   typingr   r   r   r   r   r   r	   r
   r   r   dns.exceptionr<   
dns.grangedns.immutabledns.namedns.node	dns.rdatadns.rdataclassdns.rdatasetdns.rdatatypedns.rdtypes.ANY.SOAdns.rdtypes.ANY.ZONEMD	dns.rrsetdns.tokenizerdns.transactiondns.ttldns.zonefiledns.zonetypesr   r   r   	exceptionDNSExceptionr   r   r!   r$   r'   r+   r.   r1   r3   rO   r7  r?   r<  TransactionManagerrA   r   r0  r?  rQ  rI  r  rE   rG   r  r4  r5  rM   r6  	IDNACodecr  rN   r  r  r   r   r   <module>r     s  $   	 	                    L L%cmm(( %4G 467 6,G ,3cmm88 33S]]%?%? 3:s}})) :. : : .
((--SXX]]#  	XX]]	@N3??-- NrCHHMM  *] * *Z&" &"R<!g <!~ 
w 
 
.S1#//-- S1p 37),):):"/337'
'U388==#-./' ^^&&' 	'
 ' sm' ' ' ++,' D(3-/0' 
'X 37),):):"/337G
GU388==#-./G ^^&&G 	G
 G smG G G ++,G D(3-/0G 
GX 37),):):"/337P
PU388==#-./P ^^&&P 	P
 P smP P P ++,P D(3-/0P 
Pj 	5	55 5 	5
 
5r   