
    z                        S r SSKJr  SSKrSSKrSSKrSSKr SSKrSr	SSKrSSKrSSKJrJrJrJrJr   \R(                  rSrSrS
rSrSr " S S\R8                  R:                  5      r " S S\R8                  R:                  5      r " S S\R8                  R@                  5      r! " S S\R8                  R@                  5      r" " S S\R8                  RF                  5      r$ " S S\R8                  R@                  5      r% " S S\R8                  R:                  5      r& " S S\R8                  RF                  5      r' " S S\R8                  RF                  5      r( " S S \R8                  RF                  5      r) " S! S"\R8                  RF                  5      r* " S# S$\+5      r, " S% S&\,5      r- " S' S(\,5      r.\/" S)5      r0\-" S5      r1\-" S5      r2\1r3\." SSSS5      r4\." SSSS5      r5\." SSSS5      r6\." SSSS5      r7\4r8S3S* jr9S+ r:S, r; " S- S.\+5      r<\<" S//5      r=\<" / 5      r>\=S4S0 jr?\=S4S1 jr@S2 rAg! \
 a    Sr	 GN/f = f! \ a"    SS\R,                  " S	5      -  -  S
-  S-
  r GN7f = f)4zDNS Names.
    )BytesIONTF   )longbinary_type	text_typeunichrmaybe_decode   P         c                       \ rS rSrSrSrg)
EmptyLabel9   zA DNS label is empty. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       lib/third_party/dns/name.pyr   r   9   s    r   r   c                       \ rS rSrSrSrg)	BadEscape=   z8An escaped code in a text format of DNS name is invalid.r   Nr   r   r   r   r   r   =   s    Br   r   c                       \ rS rSrSrSrg)
BadPointerA   z=A DNS compression pointer points forward instead of backward.r   Nr   r   r   r   r    r    A   s    Gr   r    c                       \ rS rSrSrSrg)BadLabelTypeE   z2The label type in DNS name wire format is unknown.r   Nr   r   r   r   r#   r#   E   s    <r   r#   c                       \ rS rSrSrSrg)NeedAbsoluteNameOrOriginI   zrAn attempt was made to convert a non-absolute name to
wire when there was also a non-absolute (or missing) origin.r   Nr   r   r   r   r&   r&   I   s    Dr   r&   c                       \ rS rSrSrSrg)NameTooLongN   z A DNS name is > 255 octets long.r   Nr   r   r   r   r)   r)   N       *r   r)   c                       \ rS rSrSrSrg)LabelTooLongR   z A DNS label is > 63 octets long.r   Nr   r   r   r   r-   r-   R   r+   r   r-   c                       \ rS rSrSrSrg)AbsoluteConcatenationV   zYAn attempt was made to append anything other than the
empty name to an absolute DNS name.r   Nr   r   r   r   r0   r0   V   s    +r   r0   c                       \ rS rSrSrSrg)NoParent[   zIAn attempt was made to get the parent of the root name
or the empty name.r   Nr   r   r   r   r3   r3   [   s    r   r3   c                       \ rS rSrSrSrg)
NoIDNA2008_   zHIDNA 2008 processing was requested but the idna module is not
available.r   Nr   r   r   r   r6   r6   _   s    r   r6   c                   "    \ rS rSrSrS1rSrSrg)IDNAExceptiond   z$IDNA processing raised an exception.idna_exceptionz+IDNA processing exception: {idna_exception}r   N)r   r   r   r   r   supp_kwargsfmtr   r   r   r   r9   r9   d   s    .#$K
7Cr   r9   c                   *    \ rS rSrSrS rS rS rSrg)	IDNACodeck   z.Abstract base class for IDNA encoder/decoders.c                     g Nr   selfs    r   __init__IDNACodec.__init__n   s    r   c                     [         erB   )NotImplementedErrorrD   labels     r   encodeIDNACodec.encodeq   s    !!r   c                     UR                  5       nUR                  S5      (       a   USS  R                  S5      nO[        U5      n[        US5      $ ! [         a  n[	        US9eS nAff = f)Ns   xn--r   punycoder;   T)lower
startswithdecode	Exceptionr9   r	   	_escapify)rD   rJ   	downcasedes       r   rR   IDNACodec.decodet   so    KKM	((6!!",,Z8 !'E%%	  6#1556s   A 
A,	A''A,r   N)	r   r   r   r   r   rE   rK   rR   r   r   r   r   r?   r?   k   s    8"
&r   r?   c                   B   ^  \ rS rSrSrSU 4S jjrS rU 4S jrSrU =r	$ )IDNA2003Codec   zIDNA 2003 encoder/decoder.c                 6   > [         [        U ]  5         Xl        g)zInitialize the IDNA 2003 encoder/decoder.

*strict_decode* is a ``bool``. If `True`, then IDNA2003 checking
is done when decoding.  This can cause failures if the name
was encoded with IDNA2008.  The default is `False`.
N)superrY   rE   strict_decode)rD   r]   	__class__s     r   rE   IDNA2003Codec.__init__   s     	mT+-*r   c                 x    US:X  a  g [         R                  R                  U5      $ ! [         a    [        ef = f)zEncode *label*. r   )	encodingsidnaToASCIIUnicodeErrorr-   rI   s     r   rK   IDNA2003Codec.encode   s=     B;	>>))%00 		s   ( 9c                    > U R                   (       d  [        [        U ]  U5      $ US:X  a  g [	        [
        R                  R                  U5      S5      $ ! [         a  n[        US9eSnAff = f)zDecode *label*.r   ra   TrO   N)
r]   r\   rY   rR   rT   rb   rc   	ToUnicoderS   r9   rD   rJ   rV   r^   s      r   rR   IDNA2003Codec.decode   sd    !!4U;;C<	2Y^^55e<dCC 	2q11	2s   (A 
A/!	A**A/)r]   F)
r   r   r   r   r   rE   rK   rR   r   __classcell__r^   s   @r   rY   rY      s    $	+	2 	2r   rY   c                   L   ^  \ rS rSrSr  SU 4S jjrS rS rU 4S jrSr	U =r
$ )	IDNA2008Codec   at  IDNA 2008 encoder/decoder.

*uts_46* is a ``bool``.  If True, apply Unicode IDNA
compatibility processing as described in Unicode Technical
Standard #46 (http://unicode.org/reports/tr46/).
If False, do not apply the mapping.  The default is False.

*transitional* is a ``bool``: If True, use the
"transitional" mode described in Unicode Technical Standard
#46.  The default is False.

*allow_pure_ascii* is a ``bool``.  If True, then a label which
consists of only ASCII characters is allowed.  This is less
strict than regular IDNA 2008, but is also necessary for mixed
names, e.g. a name with starting with "_sip._tcp." and ending
in an IDN suffix which would otherwise be disallowed.  The
default is False.

*strict_decode* is a ``bool``: If True, then IDNA2008 checking
is done when decoding.  This can cause failures if the name
was encoded with IDNA2003.  The default is False.
c                 Z   > [         [        U ]  5         Xl        X l        X0l        X@l        g)z)Initialize the IDNA 2008 encoder/decoder.N)r\   ro   rE   uts_46transitionalallow_pure_asciir]   )rD   rr   rs   rt   r]   r^   s        r   rE   IDNA2008Codec.__init__   s)     	mT+-( 0*r   c                 8    U H  n[        U5      S:  d  M    g   g)N   FT)ord)rD   rJ   cs      r   is_all_asciiIDNA2008Codec.is_all_ascii   s    A1v}  r   c                    US:X  a  gU R                   (       a'  U R                  U5      (       a  UR                  S5      $ [        (       d  [        e U R
                  (       a"  [        R                  " USU R                  5      n[        R                  " U5      $ ! [        R                   a  n[        US9eS nAff = f)Nra   r   asciiFrO   )rt   rz   rK   have_idna_2008r6   rr   rc   uts46_remaprs   alabel	IDNAErrorr9   )rD   rJ   rV   s      r   rK   IDNA2008Codec.encode   s    B;  T%6%6u%=%=<<((~	2{{((t7H7HI;;u%%~~ 	2q11	2s   AB B=/	B88B=c                 Z  > U R                   (       d  [        [        U ]  U5      $ US:X  a  g[        (       d  [
        e U R                  (       a  [        R                  " USS5      n[        [        R                  " U5      S5      $ ! [        R                   a  n[        US9eS nAff = f)Nr   ra   FTrO   )r]   r\   ro   rR   r~   r6   rr   rc   r   rT   ulabelr   r9   ri   s      r   rR   IDNA2008Codec.decode   s    !!4U;;C<~	2{{((u=T[[/66~~ 	2q11	2s   AB B*	B%%B*)rt   r]   rs   rr   )FFFF)r   r   r   r   r   rE   rz   rK   rR   r   rl   rm   s   @r   ro   ro      s)    . 387<+22 2r   ro   s   "().;\@$c                    U(       d  Sn[        U [        5      (       a  U R                  5       n [        U 5       HD  nU[        ;   a  US[        U5      -   -  nM   US:  a  US:  a  U[        U5      -  nM<  USU-  -  nMF     UR                  5       $ Sn[        U [        5      (       a  U R                  5       n U  H2  nUS:  a  US:  a  X#-  nM  US:  a  X#-  nM!  US[        U5      -  -  nM4     U$ )zEscape the characters in label which need it.
@param unicode_mode: escapify only special and whitespace (<= 0x20)
characters
@returns: the escaped string
@rtype: stringra   \    rw   z\%03d )	
isinstancer   rK   	bytearray_escapedchrr   rR   rx   )rJ   unicode_modetextry   s       r   rT   rT      s     eY''LLNE5!AH}s1v%Ta$hA1$ " {{}D%%%w;1w;IDG|		CF**  Kr   c                     [        U 5      nSnSnSnU  H4  n[        U5      nX&S-   -  nUS:  a  [        eUS:  a  US:X  a  UnUS-  nM6     US:  a  [        eUS:  a  X1S-
  :w  a  [        egg)a@  Check for empty labels in the middle of a label sequence,
labels that are too long, and for too many labels.

Raises ``dns.name.NameTooLong`` if the name as a whole is too long.

Raises ``dns.name.EmptyLabel`` if a label is empty (i.e. the root
label) and appears in a position other than the end of the label
sequence

r   r   ?   r      N)lenr-   r)   r   )labelsltotalijrJ   lls          r   _validate_labelsr     s     	FAE
A	AZa7q5Uc\A	Q  s{Av!1u* vr   c                     [        U [        5      (       a  U $ [        U [        5      (       a  U R                  5       $ [        e)z^If label is ``text``, convert it to ``binary``.  If it is already
``binary`` just return it.

)r   r   r   rK   
ValueError)rJ   s    r   _maybe_convert_to_binaryr   1  s5     %%%%##||~
r   c                     ^  \ rS rSrSrS/rU 4S jrS rS rS r	S r
U 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(S jrS)S jrS*S jrS+S jrS rS r S r!S  r"S! r#S" r$S# r%S$ r&S,S% jr'S& r(S'r)U =r*$ )-Namei>  zA DNS name.

The dns.name.Name class represents a DNS name as a tuple of
labels.  Each label is a `binary` in DNS wire format.  Instances
of the class are immutable.
r   c                    > U Vs/ s H  n[        U5      PM     nn[        [        U ]  S[	        U5      5        [        U R                  5        gs  snf )zJ*labels* is any iterable whose values are ``text`` or ``binary``.
        r   N)r   r\   r   __setattr__tupler   r   )rD   r   xr^   s      r   rE   Name.__init__I  sE     8>>v!*1-v>dD%hf>% ?s   Ac                     [        S5      e)Nz+object doesn't support attribute assignment)	TypeError)rD   namevalues      r   r   Name.__setattr__Q  s    EFFr   c                 ,    [        U R                  5      $ rB   )r   r   rC   s    r   __copy__Name.__copy__U  s    DKK  r   c                 V    [        [        R                  " U R                  U5      5      $ rB   )r   copydeepcopyr   )rD   memos     r   __deepcopy__Name.__deepcopy__X  s    DMM$++t455r   c                     SU R                   0$ Nr   r   rC   s    r   __getstate__Name.__getstate__[  s    $++&&r   c                 ^   > [         [        U ]  SUS   5        [        U R                  5        g r   )r\   r   r   r   r   )rD   stater^   s     r   __setstate__Name.__setstate___  s$    dD%hh@%r   c                 d    [        U R                  5      S:  =(       a    U R                  S   S:H  $ )zPIs the most significant label of this name the root label?

Returns a ``bool``.
r   r   r   r   r   rC   s    r   is_absoluteName.is_absolutec  s*     4;;!#>B3(>>r   c                 d    [        U R                  5      S:  =(       a    U R                  S   S:H  $ )zTIs this name wild?  (I.e. Is the least significant label '*'?)

Returns a ``bool``.
r      *r   rC   s    r   is_wildName.is_wildk  s*     4;;!#>A$(>>r   c                     [        S5      nU R                   H-  n[        UR                  5       5       H  nXS-  U-   -  nM     M/     [	        U[
        -  5      $ )zAReturn a case-insensitive hash of the name.

Returns an ``int``.
r   r   )r   r   r   rP   intmaxint)rD   hrJ   ry   s       r   __hash__Name.__hash__s  sP     G[[Eu{{}-1f\! . ! 1v:r   c                 d   U R                  5       nUR                  5       nX#:w  a  U(       a	  [        SS4$ [        SS4$ [        U R                  5      n[        UR                  5      nXE-
  nUS:  a  UnOUnSnSn	[        n
US:  a  US-  nUS-  nUS-  nU R                  U   R	                  5       nUR                  U   R	                  5       nX:  a  SnU	S:  a  [
        n
XU	4$ X:  a  SnU	S:  a  [
        n
XU	4$ U	S-  n	US:  a  M  UnUS:  a  [        n
OUS:  a  [        n
O[        n
XU	4$ )a  Compare two names, returning a 3-tuple
``(relation, order, nlabels)``.

*relation* describes the relation ship between the names,
and is one of: ``dns.name.NAMERELN_NONE``,
``dns.name.NAMERELN_SUPERDOMAIN``, ``dns.name.NAMERELN_SUBDOMAIN``,
``dns.name.NAMERELN_EQUAL``, or ``dns.name.NAMERELN_COMMONANCESTOR``.

*order* is < 0 if *self* < *other*, > 0 if *self* > *other*, and ==
0 if *self* == *other*.  A relative name is always less than an
absolute name.  If both names have the same relativity, then
the DNSSEC order relation is used to order them.

*nlabels* is the number of significant labels that the two names
have in common.

Here are some examples.  Names ending in "." are absolute names,
those not ending in "." are relative names.

=============  =============  ===========  =====  =======
self           other          relation     order  nlabels
=============  =============  ===========  =====  =======
www.example.   www.example.   equal        0      3
www.example.   example.       subdomain    > 0    2
example.       www.example.   superdomain  < 0    2
example1.com.  example2.com.  common anc.  < 0    2
example1       example2.      none         < 0    0
example1.      example2       none         > 0    0
=============  =============  ===========  =====  =======
r   r   r   )	r   NAMERELN_NONEr   r   rP   NAMERELN_COMMONANCESTORNAMERELN_SUPERDOMAINNAMERELN_SUBDOMAINNAMERELN_EQUAL)rD   othersabsoabsl1l2ldiffr   ordernlabelsnamerelnlabel1label2s                r   fullcompareName.fullcompare  sX   @ !  "<%q!,,%r1--19AA !eFA!GB!GB[[_**,F\\"%++-FQ;6H 11Q;6H 11qLG! !e" 19+HQY)H%H))r   c                 V    U R                  U5      u  p#nU[        :X  d
  U[        :X  a  gg)zIs self a subdomain of other?

Note that the notion of subdomain includes equality, e.g.
"dnpython.org" is a subdomain of itself.

Returns a ``bool``.
TF)r   r   r   rD   r   nronls        r   is_subdomainName.is_subdomain  s.     &&u-##r^';r   c                 V    U R                  U5      u  p#nU[        :X  d
  U[        :X  a  gg)zIs self a superdomain of other?

Note that the notion of superdomain includes equality, e.g.
"dnpython.org" is a superdomain of itself.

Returns a ``bool``.
TF)r   r   r   r   s        r   is_superdomainName.is_superdomain  s.     &&u-%%~)=r   c                 r    [        U R                   Vs/ s H  oR                  5       PM     sn5      $ s  snf )zSReturn a name which is equal to the current name, but is in
DNSSEC canonical form.
)r   r   rP   )rD   r   s     r   canonicalizeName.canonicalize  s)    
 41WWY4554s   4c                 \    [        U[        5      (       a  U R                  U5      S   S:H  $ g)Nr   r   Fr   r   r   rD   r   s     r   __eq__Name.__eq__  s-    eT""##E*1-22r   c                 \    [        U[        5      (       a  U R                  U5      S   S:g  $ g)Nr   r   Tr   r   s     r   __ne__Name.__ne__  s-    eT""##E*1-22r   c                 f    [        U[        5      (       a  U R                  U5      S   S:  $ [        $ Nr   r   r   r   r   NotImplementedr   s     r   __lt__Name.__lt__  0    eT""##E*1-11!!r   c                 f    [        U[        5      (       a  U R                  U5      S   S:*  $ [        $ r   r   r   s     r   __le__Name.__le__   0    eT""##E*1-22!!r   c                 f    [        U[        5      (       a  U R                  U5      S   S:  $ [        $ r   r   r   s     r   __ge__Name.__ge__  r   r   c                 f    [        U[        5      (       a  U R                  U5      S   S:  $ [        $ r   r   r   s     r   __gt__Name.__gt__  r   r   c                 .    SU R                  5       -   S-   $ )Nz
<DNS name >)__str__rC   s    r   __repr__Name.__repr__  s    dlln,s22r   c                 $    U R                  S5      $ )NF)to_textrC   s    r   r  Name.__str__  s    ||E""r   c                 |   [        U R                  5      S:X  a  [        S5      $ [        U R                  5      S:X  a  U R                  S   S:X  a  [        S5      $ U(       a%  U R                  5       (       a  U R                  SS nOU R                  nSR	                  [        [        U5      5      n[        U5      $ )zConvert name to DNS text format.

*omit_final_dot* is a ``bool``.  If True, don't emit the final
dot (denoting the root label) for absolute names.  The default
is False.

Returns a ``text``.
r      @r   r      .Nr   )r   r   r	   r   joinmaprT   )rD   omit_final_dotr   ss       r   r  Name.to_text  s     t{{q %%t{{q T[[^s%:%%d..00CR AAIIc)Q'(Ar   c                 |   [        U R                  5      S:X  a  g[        U R                  5      S:X  a  U R                  S   S:X  a  gU(       a%  U R                  5       (       a  U R                  SS nOU R                  nUc  [        nSR	                  U Vs/ s H  oBR                  U5      PM     sn5      $ s  snf )a  Convert name to Unicode text format.

IDN ACE labels are converted to Unicode.

*omit_final_dot* is a ``bool``.  If True, don't emit the final
dot (denoting the root label) for absolute names.  The default
is False.
*idna_codec* specifies the IDNA encoder/decoder.  If None, the
dns.name.IDNA_2003_Practical encoder/decoder is used.
The IDNA_2003_Practical decoder does
not impose any policy, it just decodes punycode, so if you
don't want checking for compliance, you can use this decoder
for IDNA2008 as well.

Returns a ``text``.
r   @r   r   .Nr   )r   r   r   IDNA_2003_Practicalr  rR   )rD   r  
idna_codecr   r   s        r   
to_unicodeName.to_unicode-  s    $ t{{q t{{q T[[^s%:d..00CR AA,Jyy:1++A.:;;:s   B9c           	         U R                  5       (       dX  Ub  UR                  5       (       d  [        e[        U R                  5      nUR	                  [        UR                  5      5        OU R                  nU Vs/ s H>  n[
        R                  " S[        U5      -  [        U5      UR                  5       5      PM@     nnSR                  U5      $ s  snf )a  Convert name to a format suitable for digesting in hashes.

The name is canonicalized and converted to uncompressed wire
format.  All names in wire format are absolute.  If the name
is a relative name, then an origin must be supplied.

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

Raises ``dns.name.NeedAbsoluteNameOrOrigin`` if the name is
relative and no origin was provided.

Returns a ``binary``.
z!B%dsr   )
r   r&   listr   extendstructpackr   rP   r  )rD   originr   r   dlabelss        r   to_digestableName.to_digestableK  s    " !!~V%7%7%9%9..$++&FMM$v}}-.[[F"$"q ;;wQ/QC" 	 $xx  $s   >ACc                     Uc  [        5       nSnOSnU R                  5       (       dX  Ub  UR                  5       (       d  [        e[        U R                  5      nUR                  [        UR                  5      5        OU R                  nSnU H  n[        XVS 5      nUS-  nUb  UR                  U5      n	OSn	U	b/  SU	-   n
[        R                  " SU
5      nUR                  U5          OzUb)  [        U5      S:  a  UR                  5       n	U	S::  a  XU'   [        U5      nUR                  [        R                  " S	U5      5        US:  d  M  UR                  U5        M     U(       a  UR                  5       $ g)
aV  Convert name to wire format, possibly compressing it.

*file* is the file where the name is emitted (typically a
BytesIO file).  If ``None`` (the default), a ``binary``
containing the wire name will be returned.

*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.

Raises ``dns.name.NeedAbsoluteNameOrOrigin`` if the name is
relative and no origin was provided.

Returns a ``binary`` or ``None``.
NTFr   r   i   z!Hi?  !B)r   r   r&   r  r   r  r   getr  r   writer   tellgetvalue)rD   filecompressr!  want_returnr   r   rJ   nposr   r  r   s                r   to_wireName.to_wireg  sJ   ( <9DKK!!~V%7%7%9%9..$++&FMM$v}}-.[[FEVBZ AFA#ll1oKKe,

1'CFQJ))+Cf}&)J

6;;tQ/0q5JJu%) * ==?" r   c                 ,    [        U R                  5      $ )z9The length of the name (in labels).

Returns an ``int``.
r   rC   s    r   __len__Name.__len__  s     4;;r   c                      U R                   U   $ rB   r   )rD   indexs     r   __getitem__Name.__getitem__  s    {{5!!r   c                 $    U R                  U5      $ rB   )concatenater   s     r   __add__Name.__add__  s    &&r   c                 $    U R                  U5      $ rB   )
relativizer   s     r   __sub__Name.__sub__  s    u%%r   c                    [        U R                  5      nUS:X  a  U [        R                  R                  4$ X:X  a  [        R                  R                  U 4$ US:  d  X:  a  [        S5      e[        U SU*  5      [        X* S 5      4$ )a   Split a name into a prefix and suffix names at the specified depth.

*depth* is an ``int`` specifying the number of labels in the suffix

Raises ``ValueError`` if *depth* was not >= 0 and <= the length of the
name.

Returns the tuple ``(prefix, suffix)``.
r   z0depth must be >= 0 and <= the length of the nameN)r   r   dnsr   emptyr   r   )rD   depthr   s      r   split
Name.split  s     A:#((..))ZHHNND))QY%)BD DT(UF^$d4=&9::r   c                     U R                  5       (       a  [        U5      S:  a  [        e[        U R                  5      nUR                  [        UR                  5      5        [        U5      $ )zReturn a new name which is the concatenation of self and other.

Raises ``dns.name.AbsoluteConcatenation`` if the name is
absolute and *other* is not the empty name.

Returns a ``dns.name.Name``.
r   )r   r   r0   r  r   r  r   )rD   r   r   s      r   r:  Name.concatenate  sP     #e*q.''dkk"d5<<()F|r   c                 h    Ub.  U R                  U5      (       a  [        U S[        U5      *  5      $ U $ )aQ  If the name is a subdomain of *origin*, return a new name which is
the name relative to origin.  Otherwise return the name.

For example, relativizing ``www.dnspython.org.`` to origin
``dnspython.org.`` returns the name ``www``.  Relativizing ``example.``
to origin ``dnspython.org.`` returns ``example.``.

Returns a ``dns.name.Name``.
N)r   r   r   rD   r!  s     r   r>  Name.relativize  s7     $"3"3F";";^F|,--Kr   c                 R    U R                  5       (       d  U R                  U5      $ U $ )aZ  If the name is a relative name, return a new name which is the
concatenation of the name and origin.  Otherwise return the name.

For example, derelativizing ``www`` to origin ``dnspython.org.``
returns the name ``www.dnspython.org.``.  Derelativizing ``example.``
to origin ``dnspython.org.`` returns ``example.``.

Returns a ``dns.name.Name``.
)r   r:  rJ  s     r   derelativizeName.derelativize  s)     !!##F++Kr   c                 f    U(       a)  U(       a  U R                  U5      $ U R                  U5      $ U $ )a  Return a name with the relativity desired by the caller.

If *origin* is ``None``, then the name is returned.
Otherwise, if *relativize* is ``True`` the name is
relativized, and if *relativize* is ``False`` the name is
derelativized.

Returns a ``dns.name.Name``.
)r>  rM  )rD   r!  r>  s      r   choose_relativityName.choose_relativity  s/     v..((00Kr   c                 f    U [         :X  d
  U [        :X  a  [        e[        U R                  SS 5      $ )zReturn the parent of the name.

For example, the parent of ``www.dnspython.org.`` is ``dnspython.org``.

Raises ``dns.name.NoParent`` if the name is either the root name or the
empty name, and thus has no parent.

Returns a ``dns.name.Name``.
r   N)rootrC  r3   r   r   rC   s    r   parentName.parent	  s+     4<45=NDKKO$$r   r   rk   )FNrB   )NNN)NT)+r   r   r   r   r   	__slots__rE   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r#  r0  r3  r7  r;  r?  rE  r:  r>  rM  rP  rT  r   rl   rm   s   @r   r   r   >  s     
I&G!6'&??
J*X6""""3#*<<!88#t "'&;*  &% %r   r   r   c                    [        U [        5      (       d  [        S5      eUb   [        U[        5      (       d  [        S5      e/ nSnSnSnSnUc  [        nU S:X  a  Sn U (       GaC  U S:X  a  [        S/5      $ U  H  nU(       a  US:X  a/  UR                  5       (       a  [        U5      nUS	-  nM7  XH-  nSnM?  UR                  5       (       d  [        eUS
-  nU[        U5      -  nUS	-  nUS:X  a  SnU[        U5      -  nM  M  US;   a9  [        U5      S:X  a  [        eUR                  UR                  U5      5        SnM  US:X  a  SnSnSnM  XH-  nM     U(       a  [        e[        U5      S:  a!  UR                  UR                  U5      5        OUR                  S5        [        U5      S:X  d	  US   S:w  a'  Ub$  UR                  [        UR                  5      5        [        U5      $ )a  Convert unicode text into a Name object.

Labels are encoded in IDN ACE form according to rules specified by
the IDNA codec.

*text*, a ``text``, is the text to convert into a name.

*origin*, a ``dns.name.Name``, specifies the origin to
append to non-absolute names.  The default is the root name.

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

Returns a ``dns.name.Name``.
z0input to from_unicode() must be a unicode stringorigin must be a Name or Nonera   Fr   r  r  r   r   
   r   )r  u   。u   ．u   ｡r   Tr   )r   r   r   r   	IDNA_2003isdigitr   r   r   r   r   appendrK   r  r  r   )	r   r!  r  r   rJ   escapingedigitsr   ry   s	            r   from_unicoder_    s   $ dI&&KLLNj66899FEHGE
t|4<;Aa<yy{{ #A1
#(99;;'RKESVOEqLG!|#(. $ ==u:?$$j//67e
9 : Ou:>MM*++E23MM#FqF2J#-63Ed6==)*<r   c                 4   [        U [        5      (       a  [        XU5      $ [        U [        5      (       d  [	        S5      eUb   [        U[
        5      (       d  [	        S5      e/ nSnSnSnSnU S:X  a  Sn U (       GaQ  U S:X  a  [        S/5      $ [        U 5       H  n[        R                  " SU5      n	U(       a  US:X  a/  U	R                  5       (       a  [        U	5      nUS	-  nMN  XI-  nSnMV  U	R                  5       (       d  [        eUS
-  nU[        U	5      -  nUS	-  nUS:X  a  SnU[        R                  " SU5      -  nM  M  U	S:X  a*  [        U5      S:X  a  [        eUR                  U5        SnM  U	S:X  a  SnSnSnM  XI-  nM     U(       a  [        e[        U5      S:  a  UR                  U5        OUR                  S5        [        U5      S:X  d	  US   S:w  a'  Ub$  UR                  [!        UR"                  5      5        [        U5      $ )aw  Convert text into a Name object.

*text*, a ``text``, is the text to convert into a name.

*origin*, a ``dns.name.Name``, specifies the origin to
append to non-absolute names.  The default is the root name.

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

Returns a ``dns.name.Name``.
z%input to from_text() must be a stringrX  r   Fr   r  r  r&  r   rY  r      \Tr   )r   r   r_  r   r   r   r   r  r   r[  r   r   r   r   r\  r  r  r   )
r   r!  r  r   rJ   r]  r^  r   ry   byte_s
             r   	from_textrc  i  s    $	""D*55dK((@AANj66899FEHGEt|4<;4AKKa(Ea<}} #E
1#( ==??'RKESZ'EqLG!|#(T5!99 $ $u:?$$e$%; !< Ou:>MM% MM#FqF2J#-63Ed6==)*<r   c                     [        U [        5      (       d  [        S5      e[        R                  R                  U 5      n / nUnSnX   nUS-  nSnUS:w  a  US:  a2  UR                  XX-    R                  5       5        X-  nUS:X  a  Xe-  nO7US:  a+  US-  S-  X   -   nUS:X  a  US-  nX:  a  [        eUnUS-  nO[        eX   nUS-  nUS:X  a  US-  nUS:w  a  M  UR                  S5        [        U5      U4$ )	a3  Convert possibly compressed wire format into a Name.

*message* is a ``binary`` containing an entire DNS message in DNS
wire form.

*current*, an ``int``, is the offset of the beginning of the name
from the start of the message

Raises ``dns.name.BadPointer`` if a compression pointer did not
point backwards in the message.

Raises ``dns.name.BadLabelType`` if an invalid label type was encountered.

Returns a ``(dns.name.Name, int)`` tuple consisting of the name
that was read and the number of bytes of the wire format message
which were consumed reading it.
z*input to from_wire() must be a byte stringr   r   @      r      ra   )r   r   r   rB  wiredata
maybe_wrapr\  unwrapr    r#   r   )messagecurrentr   biggest_pointerhopscountcuseds          r   	from_wirerq    s+   & g{++EFFll%%g.GFODEqLGE
1*2:MM'7?;BBDEGqyc\t|s*W-==Gqy
)  %OAID 119QJE' 1*( MM"L%  r   rk   )Br   ior   r  sysr   encodings.idnarb   rc   r~   ImportErrordns.exceptionrB  dns.wiredata_compatr   r   r   r   r	   r   AttributeErrorcalcsizer   r   r   r   r   	exceptionSyntaxErrorr   r   	FormErrorr    r#   DNSExceptionr&   r)   r-   r0   r3   r6   r9   objectr?   rY   ro   r   r   r  IDNA_2003_StrictrZ  IDNA_2008_PracticalIDNA_2008_UTS_46IDNA_2008_StrictIDNA_2008_Transitional	IDNA_2008rT   r   r   r   rS  rC  r_  rc  rq  r   r   r   <module>r     s  $   
  N   G G8ZZF     **  C)) CH(( H=3==** =Ds}}99 D
+#--)) ++3==,, ++CMM66 +
s}})) ++ 
8CMM.. 8& &,!2I !2HA2I A2F \"#E*  & 	#D%u=  ueU;  ud; &tT5%@ 	@<
X%6 X%v SE{ 	R"t HV  D EP1!i  N  8A,,-!3a7F8s"   I I II$I;:I;