
    6h:v                    F   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 SKrS SKJ	r	J
r
Jr  SSKJr  SSKJr  \R                   (       a  S SKrSSKJrJrJr  \R*                  " S5      r\ V s0 s H  n \" U 5      S	U -   R1                  S
5      _M      sn r\ V s0 s H  o S	U -   _M
     sn r\S0S j5       r\S1S j5       rS rS2S3S jjr S2       S4S jjrS5S jrS5S jrS6S jr S7S jr!S8S9S jjr"S:S;S jjr#S<S jr$S<S jr%S=S jr&S=S jr'\RP                  " SS9 " S S5      5       r)S r*S  r+S=S! jr,\RZ                  " S"5      r.S>S# jr/S?S$ jr0S@SAS% jjr1SBS& jr2SBS' jr3S( r4SBS) jr5S* q6 SC         SDS+ jjr7SSSSSSSSSSS,.
r8SES- jr9SFS. jr:SGS/ jr;gs  sn f s  sn f )H    )annotationsN)IteratorOptionaloverload   )_)attr)encodingerrorpycompats   ()[]{}?*+-|^$\.&~# 	
   \latin1c                    g N pats    </usr/lib/python3/dist-packages/mercurial/utils/stringutil.pyreescaper   .           c                    g r   r   r   s    r   r   r   3   r   r   c                    Sn[        U [        5      (       a  SnU R                  S5      n U R                  [        5      n U(       a  U $ U R                  S5      $ )z"Drop-in replacement for re.escape.TFr   )
isinstancebytesdecode	translate_regexescapemapencode)r   wantunis     r   r   r   8   sN    
 G#ujj"
--
(C
::hr   Fc           	     4    SR                  [        XX#S95      $ )zPretty print an object.r   bprefixindentlevel)join	pprintgen)or#   r$   r%   s       r   pprintr)   G   s    88IaMNNr   c              #    #    [        U [        5      (       a)  U(       a  S[        U 5      -  v   gS[        U 5      -  v   g[        U [        5      (       a  S[        [        U 5      5      -  v   g[        U [        5      (       a  U (       d  Sv   gSv   U(       a  US-  nSv   S	X2-  -  v   [        U 5       HE  u  pE[        XQX#S
9 Sh  vN   US-   [        U 5      :  d  M+  U(       a  Sv   S	X2-  -  v   MA  Sv   MG     U(       a  US-  nSv   S	X2-  -  v   Sv   g[        U [        5      (       a  U (       d  Sv   gSv   U(       a  US-  nSv   S	X2-  -  v   [        [        U R                  5       5      5       H^  u  nu  pg[        XaX#S
9 Sh  vN   Sv   [        XqX#S
9 Sh  vN   US-   [        U 5      :  d  MD  U(       a  Sv   S	X2-  -  v   MZ  Sv   M`     U(       a  US-  nSv   S	X2-  -  v   Sv   g[        U [        5      (       a  U (       d  Sv   gSv   U(       a  US-  nSv   S	X2-  -  v   [        [        U 5      5       HE  u  pF[        XaX#S
9 Sh  vN   US-   [        U 5      :  d  M+  U(       a  Sv   S	X2-  -  v   MA  Sv   MG     U(       a  US-  nSv   S	X2-  -  v   Sv   g[        U [        5      (       a  U (       d  Sv   gSv   U(       a  US-  nSv   S	X2-  -  v   [        U 5       HE  u  pE[        XQX#S
9 Sh  vN   US-   [        U 5      :  d  M+  U(       a  Sv   S	X2-  -  v   MA  Sv   MG     U(       a  US-  nSv   S	X2-  -  v   Sv   g[        U [        R                  5      (       a   [        U 5      nSv   U(       a  US-  nSv   S	X2-  -  v   Sn	U	(       dI  Un
 [        U 5      n[        XX#S
9 Sh  vN   U	(       d  U(       a  Sv   S	X2-  -  v   OSv   U	(       d  MI  U(       a  US-  nSv   S	X2-  -  v   Sv   g["        R$                  " U 5      v   g GNo GN GN GN GN2! [          a    Sv    gf = f! [          a    Sn	 Nf = f N7f)av  Pretty print an object to a generator of atoms.

``bprefix`` is a flag influencing whether bytestrings are preferred with
a ``b''`` prefix.

``indent`` controls whether collections and nested data structures
span multiple lines via the indentation amount in spaces. By default,
no newlines are emitted.

``level`` specifies the initial indent level. Used if ``indent > 0``.
s   b'%s's   '%s's   bytearray['%s']s   []N   [      
    r"   s   ,
s   ,    ]s   {}   {s   :    }s   set([])s   set([s   ])s   ()   (   )s   gen[]s   gen[FT)r   r   	escapestr	bytearraylist	enumerater'   lendictsorteditemssettupletypesGeneratorTypenextStopIterationr   byterepr)r(   r#   r$   r%   iakvnextitemlastcurrents              r   r'   r'   L   sO     !UYq\))IaL((	Ay	!	! !9U1X#666	At		K
QJEK%.))aLDA FPPP1us1v~ L%.11K ! QJEK%.))
	At		K
QJEK%.))"6!'')#45IAv FPPPK FPPP1us1v~ L%.11K 6 QJEK%.))
	As		QJEK%.))fQi(DA FPPP1us1v~ L%.11K ) QJEK%.))	Au		K
QJEK%.))aLDA FPPP1us1v~ L%.11K ! QJEK%.))
	Au**	+	+	AwH
 QJEK%.))G7 !    L%.11K# $& QJEK%.))
""e Q8 Q Q8 Q8 Q&  	N	$ ! s   C	Q1P:Q1$B1Q1P=Q1+Q ,Q1B Q1$Q%Q1=BQ1QQ1-AQ1	Q	 (Q1=Q Q1Q/+Q18Q1=Q1 Q1Q1Q1	QQ1QQ1Q,)Q1+Q,,Q1c                2   / n[         R                  " U 5      nS=p4U[        U5      :  a  SnUR                  SUS-   5      nUS:  a  [        U5      nO;XdS-   :  a3  UR	                  SUS-
  5      (       a  UR                  SUS-   US-
  5      nUS:  a  UnOUS-  nUR                  SSU5      UR                  SSU5      -
  nUS:  d   eUR                  XrX5 R                  5       45        XVpCU[        U5      :  a  M  SR                  S	 U 5       5      $ )
z9Pretty print a representation of a possibly-nested objectr      <r,      =r.      >r-   c              3  6   #    U  H  u  pS U-  U-   v   M     g7f)s     Nr   ).0lss      r   	<genexpr>prettyrepr.<locals>.<genexpr>"  s     6eai!ms   )
r   rB   r8   find
startswithrfindcountappendrstripr&   )r(   linesrsp0p1q0q1rQ   s           r   
prettyreprra     s   E			1	BKB
s2w, WWT26"6RB q&[R]]4a88 $QQ/B6B!GBHHT1b!BHHT1b$99AvvaB))+,-B- s2w,. ::6666r   c                   U c  g[        U [        5      (       a.  U S   [        R                  " [        R                  U SS 5      -  $ [        U [
        5      (       a  U $ [        U 5      (       a  U " 5       $ [        U 5      $ )aN  Format an optional printable representation from unexpanded bits

========  =================================
type(r)   example
========  =================================
tuple     ('<not %r>', other)
bytes     '<branch closed>'
callable  lambda: '<branch %r>' % sorted(b)
object    other
========  =================================
Nr   r   r,   )r   r=   r   rapplymaybebytestrr   callabler)   )rs    r   	buildreprrg   %  sk     	y	Au		thooh&;&;QqrUCCC	Au			!s
ayr   c                0    [        U =(       a    SU ;   5      $ )z&return true if a string is binary data    )boolrR   s    r   binaryrl   =  s     eqj!!r   c                ~    U R                  S5      (       a  SU SS  4$ U R                  S5      (       a  SU SS  4$ SU 4$ )Ns   re:   re   s   literal:   literal   )rV   )patterns    r   _splitpatternrs   B  sQ    &!!gabk!!			K	(	(712;&&wr   Tc                  ^ [        U 5      u  p US:X  a>   SnU(       d  [        R                  n[        R                  " X5      nX UR                  4$ US:X  a4  U(       a  U R                  nO[        R                  " U 5      mU4S jnX U4$ [        R                  " SU-  5      e! [        R                   a0  n[        R
                  " [        S5      [        U5      -  5      eSnAff = f)a1  
accepts a string, possibly starting with 're:' or 'literal:' prefix.
returns the matcher name, pattern, and matcher function.
missing or unknown prefixes are treated as literal matches.

helper for tests:
>>> def test(pattern, *tests):
...     kind, pattern, matcher = stringmatcher(pattern)
...     return (kind, pattern, [bool(matcher(t)) for t in tests])
>>> def itest(pattern, *tests):
...     kind, pattern, matcher = stringmatcher(pattern, casesensitive=False)
...     return (kind, pattern, [bool(matcher(t)) for t in tests])

exact matching (no prefix):
>>> test(b'abcdefg', b'abc', b'def', b'abcdefg')
('literal', 'abcdefg', [False, False, True])

regex matching ('re:' prefix)
>>> test(b're:a.+b', b'nomatch', b'fooadef', b'fooadefbar')
('re', 'a.+b', [False, False, True])

force exact matches ('literal:' prefix)
>>> test(b'literal:re:foobar', b'foobar', b're:foobar')
('literal', 're:foobar', [False, True])

unknown prefixes are ignored and treated as literals
>>> test(b'foo:bar', b'foo', b'bar', b'foo:bar')
('literal', 'foo:bar', [False, False, True])

case insensitive regex matches
>>> itest(b're:A.+b', b'nomatch', b'fooadef', b'fooadefBar')
('re', 'A.+b', [False, False, True])

case insensitive literal matches
>>> itest(b'ABCDEFG', b'abc', b'def', b'abcdefg')
('literal', 'ABCDEFG', [False, False, True])
rn   r      invalid regular expression: %sNrp   c                6   > T[         R                  " U 5      :H  $ r   )r
   lower)rR   ipats    r   <lambda>stringmatcher.<locals>.<lambda>  s    dhnnQ&77r      unhandled pattern kind: %s)rs   remodIcompiler   
ParseErrorr   forcebytestrsearch__eq__r
   rw   ProgrammingError)rr   casesensitivekindflagsregexematchrx   s          @r   stringmatcherr   J  s    L "'*MDu}	E MM'1E
 ell**		NNE>>'*D7Ee##

 
 !>!E
FF {{ 	""34|AF 	s   /B& &C*:+C%%C*c                x   [        U 5      u  p US:X  a   [        R                  " X5      $ US:X  a+  [        R                  " [        R                  " U 5      U5      $ [        R                  " SU-  5      e! [        R                   a0  n[        R                  " [        S5      [        U5      -  5      eSnAff = f)a0  Build a regexp object from a string pattern possibly starting with
're:' or 'literal:' prefix.

helper for tests:
>>> def test(pattern, *tests):
...     regexp = substringregexp(pattern)
...     return [bool(regexp.search(t)) for t in tests]
>>> def itest(pattern, *tests):
...     regexp = substringregexp(pattern, remod.I)
...     return [bool(regexp.search(t)) for t in tests]

substring matching (no prefix):
>>> test(b'bcde', b'abc', b'def', b'abcdefg')
[False, False, True]

substring pattern should be escaped:
>>> substringregexp(b'.bc').pattern
'\\.bc'
>>> test(b'.bc', b'abc', b'def', b'abcdefg')
[False, False, False]

regex matching ('re:' prefix)
>>> test(b're:a.+b', b'nomatch', b'fooadef', b'fooadefbar')
[False, False, True]

force substring matches ('literal:' prefix)
>>> test(b'literal:re:foobar', b'foobar', b're:foobar')
[False, True]

case insensitive literal matches
>>> itest(b'BCDE', b'abc', b'def', b'abcdefg')
[False, False, True]

case insensitive regex matches
>>> itest(b're:A.+b', b'nomatch', b'fooadef', b'fooadefBar')
[False, False, True]
rn   ru   Nrp   r{   )	rs   r|   r~   r   r   r   r   escaper   )rr   r   r   r   s       r   substringregexpr     s    L "'*MDu}	==00
 
	}}U\\'2E::

 
 !>!E
FF {{ 	""34|AF 	s   A5 5B9	+B44B9c                    U R                  S5      nUS:  a  U SU n U R                  S5      nUS:  a  XS-   S n U R                  S5      nUS:  a  U SU n U R                  S5      nUS:  a  U SU n U $ )z>Return a short representation of a user name or email address.   @r   NrL   r,   r.      .rU   userfs     r   	shortuserr     s    		$AAvBQx		$AAvEG}		$AAvBQx		$AAvBQxKr   c                z    U R                  S5      nUS:  a  U SU n U R                  S5      nUS:  a  XS-   S n U $ )z,Return the user portion of an email address.r   r   NrL   r,   r   r   s     r   	emailuserr     sG    		$AAvBQx		$AAvEG}Kr   c                `    U R                  S5      nUS:X  a  SnX R                  S5      S-   U $ )zget email of author.rN   rK   NrL   r,   r   )authorrf   s     r   emailr     s5    DABw++d#a'!,,r   c                    SU ;  a  U $ U R                  S5      nUS:w  a$  U SU R                  S5      R                  SS5      $ U R                  S5      nU SU R                  SS	5      $ )
a  Returns the name before an email address,
interpreting it as per RFC 5322

>>> person(b'foo@bar')
'foo'
>>> person(b'Foo Bar <foo@bar>')
'Foo Bar'
>>> person(b'"Foo Bar" <foo@bar>')
'Foo Bar'
>>> person(b'"Foo "buz" Bar" <foo@bar>')
'Foo "buz" Bar'
>>> # The following are invalid, but do exist in real-life
...
>>> person(b'Foo "buz" Bar <foo@bar>')
'Foo "buz" Bar'
>>> person(b'"Foo Bar <foo@bar>')
'Foo Bar'
r   rL   rK   Ns    "s   \"   "r   r.   )rU   stripreplace)r   r   s     r   personr     sq    & 6DABwbqz&..vt<<DA"1:dD))r   )hashc                  Z    \ rS rSrSr\R                  " 5       r\R                  " SS9rSr	g)mailmappingi  z:Represents a username/email key or value in
a mailmap fileN)defaultr   )
__name__
__module____qualname____firstlineno____doc__r	   ibr   name__static_attributes__r   r   r   r   r     s"     GGIE774 Dr   r   c                V    U(       + =(       d    U (       + =(       a    [        U5      S:  $ )a)  Returns True if the parsed names and emails
in a mailmap entry are invalid.

>>> # No names or emails fails
>>> names, emails = [], []
>>> _ismailmaplineinvalid(names, emails)
True
>>> # Only one email fails
>>> emails = [b'email@email.com']
>>> _ismailmaplineinvalid(names, emails)
True
>>> # One email and one name passes
>>> names = [b'Test Name']
>>> _ismailmaplineinvalid(names, emails)
False
>>> # No names but two emails passes
>>> names = []
>>> emails = [b'proper@email.com', b'commit@email.com']
>>> _ismailmaplineinvalid(names, emails)
False
r   )r8   )namesemailss     r   _ismailmaplineinvalidr     s     , :6U6s6{Q6r   c                   0 nU c  U$ U R                  5        GH9  nUR                  5       R                  S5      (       a  M*  / / pC/ nUR                  5        H  nUR                  S5      (       a    OUR                  S5      (       af  UR	                  S5      (       aP  UR                  USS 5        U(       a"  UR                  SR                  U5      5        / n[        U5      S:  a    OM  UR                  U5        M     [        X45      (       a  M  [        US   [        U5      S:X  a  US   OSS	9n[        US
   U(       a  US
   OSS	9X'   GM<     U$ )a$  Parses data in the .mailmap format

>>> mmdata = b"\n".join([
... b'# Comment',
... b'Name <commit1@email.xx>',
... b'<name@email.xx> <commit2@email.xx>',
... b'Name <proper@email.xx> <commit3@email.xx>',
... b'Name <proper@email.xx> Commit <commit4@email.xx>',
... ])
>>> mm = parsemailmap(mmdata)
>>> for key in sorted(mm.keys()):
...     print(key)
mailmapping(email='commit1@email.xx', name=None)
mailmapping(email='commit2@email.xx', name=None)
mailmapping(email='commit3@email.xx', name=None)
mailmapping(email='commit4@email.xx', name='Commit')
>>> for val in sorted(mm.values()):
...     print(val)
mailmapping(email='commit1@email.xx', name='Name')
mailmapping(email='name@email.xx', name=None)
mailmapping(email='proper@email.xx', name='Name')
mailmapping(email='proper@email.xx', name='Name')
N   #rL   rN   r,   rK   r.   r   )r   r   r   )

splitlineslstriprV   splitendswithrY   r&   r8   r   r   )mailmapcontentmailmapliner   r   namebuilderelement
mailmapkeys           r   parsemailmapr     sJ   0 G))+ ;;=##D)) Bvzz|G!!$''##D))g.>.>t.D.D gam,LL;!78"$K v;? #
 ""7++ $4 !// *!%jAor4


 *)"q
[ ,d Nr   c                   [        U5      (       a  U (       d  U$ [        [        U5      [        U5      S9n X   nSUR                  (       a  UR                  OUR                  UR                  (       a  UR                  4-  $ UR                  4-  $ ! [         a2    [        UR                  S9nU R                  U[        SS5      5      n Nf = f)a  Returns the author field according to the mailmap cache, or
the original author field.

>>> mmdata = b"\n".join([
...     b'# Comment',
...     b'Name <commit1@email.xx>',
...     b'<name@email.xx> <commit2@email.xx>',
...     b'Name <proper@email.xx> <commit3@email.xx>',
...     b'Name <proper@email.xx> Commit <commit4@email.xx>',
... ])
>>> m = parsemailmap(mmdata)
>>> mapname(m, b'Commit <commit1@email.xx>')
'Name <commit1@email.xx>'
>>> mapname(m, b'Name <commit2@email.xx>')
'Name <name@email.xx>'
>>> mapname(m, b'Commit <commit3@email.xx>')
'Name <proper@email.xx>'
>>> mapname(m, b'Commit <commit4@email.xx>')
'Name <proper@email.xx>'
>>> mapname(m, b'Unknown Name <unknown@email.com>')
'Unknown Name <unknown@email.com>'
)r   r   )r   Ns   %s <%s>)isauthorwellformedr   r   r   KeyErrorgetr   )r   r   commitpropercommit2s        r   mapnamer   o  s    2 f%%W fVnE&MBF? {{  *0,,    ? FLL1Wk$&=>	?s   B 9CCs   ^[^<]+\s<[^<>]+@[^<>]+>$c                0    [         R                  U 5      SL$ )a  Return True if the author field is well formed
(ie "Contributor Name <contrib@email.dom>")

>>> isauthorwellformed(b'Good Author <good@author.com>')
True
>>> isauthorwellformed(b'Author <good@author.com>')
True
>>> isauthorwellformed(b'Bad Author')
False
>>> isauthorwellformed(b'Bad Author <author@author.com')
False
>>> isauthorwellformed(b'Bad Author author@author.com')
False
>>> isauthorwellformed(b'<author@author.com>')
False
>>> isauthorwellformed(b'Bad Author <author>')
False
N)_correctauthorformatr   )r   s    r   r   r     s    &  %%f-T99r   c                    U R                  S5      nUS:w  a  U SU n  U R                  5       S   $ ! [         a     gf = f)z"Return the first line of the inputr-   rK   Nr   r   )rU   r   
IndexError)textrC   s     r   	firstliner     sM     			%ABwBQx ## s   1 
>>c                ,    [         R                  " XSS9$ )zCTrim string to at most maxlength (default: 400) columns in display.s   ...)ellipsis)r
   trim)r   	maxlengths     r   r   r     s    ==6::r   c                    [        U [        [        45      (       a  [        U 5      n [        R
                  " U 5      S   $ Nr   )r   
memoryviewr5   r   codecsescape_encoderk   s    r   r4   r4     s5    !j),--!H "1%%r   c                4    [         R                  " U 5      S   $ r   )r   escape_decoderk   s    r   unescapestrr     s    "1%%r   c                     [         R                  " U 5      $ ! [         a6    [         R                  " [        R                  " [        U 5      5      5      s $ f = f)zHPortably format an arbitrary object (e.g. exception) into a byte
string.)r   bytestrUnicodeEncodeErrorr
   
strtolocalstr)objs    r   r   r     sG    ?$$ ? 3 3CH =>>?s    =AAc                v    [         R                  " [         R                  " U 5      5      R                  SS5      $ )Ns   \\r   )r   rB   r   r   rk   s    r   uireprr     s+    X--a0199'5IIr   c                 H     " S S[         R                  5      nUqU" S0 U D6$ )Nc                  *    \ rS rSrSrS rS rS rSrg)_MBTextWrapper.<locals>.twi  a  
Extend TextWrapper for width-awareness.

Neither number of 'bytes' in any encoding nor 'characters' is
appropriate to calculate terminal columns for specified string.

Original TextWrapper implementation uses built-in 'len()' directly,
so overriding is needed to use width information of each characters.

In addition, characters classified into 'ambiguous' width are
treated as wide in East Asian area, but as narrow in other.

This requires use decision to determine width of such characters.
c                    Sn[         R                  n[        [        U5      5       H  nX4" X   5      -  nX#:  d  M  US U XS  4s  $    US4$ )Nr   r   )r
   	ucolwidthranger8   )selfucstr
space_leftrQ   colwidthrC   s         r   _cutdown#_MBTextWrapper.<locals>.tw._cutdown  s\    A))H3u:&Xeh''>!"1IuRy11 ' #:r   c                    [        XC-
  S5      nU R                  (       a-  U R                  US   U5      u  pgUR                  U5        XqS'   g U(       d   UR                  UR	                  5       5        g g )Nr,   rK   )maxbreak_long_wordsr   rY   pop)r   reversed_chunkscur_linecur_lenwidthr   cutress           r   _handle_long_word,_MBTextWrapper.<locals>.tw._handle_long_word  sa    U_a0J$$==)<jI$&)# 3 3 56 r   c                2   [         R                  n/ nU R                  S::  a  [        SU R                  -  5      eUR	                  5         U(       GaD  / nSnU(       a  U R
                  nOU R                  nU R                  [        U5      -
  nU R                  (       a!  US   R                  5       S:X  a
  U(       a  US	 U(       aA  U" US   5      nXX-   U::  a$  UR                  UR                  5       5        XX-  nOO	U(       a  MA  U(       a!  U" US   5      U:  a  U R                  XXW5        U R                  (       a!  U(       a  US   R                  5       S:X  a  US	 U(       a#  UR                  USR                  U5      -   5        U(       a  GMD  U$ )Nr   s   invalid width %r (must be > 0)rK    )r
   r   r   
ValueErrorreversesubsequent_indentinitial_indentr8   drop_whitespacer   rY   r   r   r&   )	r   chunksr   r[   r   r   r$   r   rQ   s	            r   _wrap_chunks'_MBTextWrapper.<locals>.tw._wrap_chunks  sd   ))HEzzQ !BTZZ!OPP NN  !33F!00F 

S[0 ''F2J,<,<,>",Dr
 ,A {e+ 

5  f hvbz2U:**6WL ((  **,3  LL"''(*;!;<a &d Lr   r   N)	r   r   r   r   r   r   r   r   r   r   r   r   twr     s    			7=	r   r  r   )textwrapTextWrapper_MBTextWrapper)kwargsr  s     r   r  r    s*    cX!! cL N<<r   c                   [        [        U5      [        U5      5      nX::  a  [        SUS-   5      nU R                  [        R                  " [
        R
                  5      [        R                  " [
        R                  5      5      n UR                  [        R                  " [
        R
                  5      [        R                  " [
        R                  5      5      nUR                  [        R                  " [
        R
                  5      [        R                  " [
        R                  5      5      n[        XUS9nUR                  U 5      R                  [        R                  " [
        R
                  5      5      $ )NN   r,   )r   r   r   )
r   r8   r   r   sysstrr
   encodingmoder  fillr   )r   r   
initindent
hangindent	maxindentwrappers         r   wrapr  U  s    C
OS_5IB	A&;;))*--.D ""))*--.J ""))*--.J *G <<$$X__X5F5F%GHHr   )
   1s   yess   trues   ons   always   0s   nos   falses   offs   neverc                J    [         R                  U R                  5       S5      $ )zDParse s into a boolean.

If s is not a valid boolean, returns None.
N)	_booleansr   rw   rk   s    r   	parseboolr  |  s    
 ==D))r   c                   ^^^ UU4S jmUU4S jmU4S jmU b-  [        U [        5      (       a  T" U R                  S5      5      nOU nU=(       d    / $ )zparse a configuration value as a list of comma/space separated strings

>>> parselist(b'this,is "a small" ,test')
['this', 'is', 'a small', 'test']
c                  > SnU[        U5      :  ad  XUS-    R                  5       (       d  XUS-    S:X  a?  SnUS-  nU[        U5      :  a)  XUS-    R                  5       (       a  M2  XUS-    S:X  a  M?  U[        U5      :  a  S X4$ U(       a  U R                  S5        XUS-    S:X  a  U S   (       d  TXS-   4$ XUS-    S:X  a&  U S   SS  S:X  a  U S   S S XUS-    -   U S'   TXS-   4$ U S==   XUS-    -  ss'   TXS-   4$ )	NFr,      ,Tr   r   rK   r   )r8   isspacerY   )partsrR   offset
whitespace_parse_plain_parse_quotes       r   r  parselist.<locals>._parse_plain  sD   
s1vovz"**,,6A:0F$0NJaKF	 s1vovz"**,,6A:0F$0N SV&&LLfqj!T)%)
22
#t+b	"#%0Gb	#2FQJ)??E"I
22b	Q
++	UQJ..r   c                .  > U[        U5      :  a  XUS-    S:X  a  U R                  S5        US-  nU[        U5      :  ab  XUS-    R                  5       (       d  XUS-    S:X  a=  US-  nU[        U5      :  a)  XUS-    R                  5       (       a  M0  XUS-    S:X  a  M=  TX4$ U[        U5      :  a|  XUS-    S:w  aq  XUS-    S:X  a3  US-   [        U5      :  a!  XS-   US-    S:X  a  US-  nU S==   S-  ss'   OU S==   XUS-    -  ss'   US-  nU[        U5      :  a  XUS-    S:w  a  Mq  U[        U5      :  a=  T" U S   5      nU(       d  SU S'   O!SUS   -   US'   U S S n U R                  U5        S X4$ US-  nU[        U5      :  a,  XUS-    S	;   a!  US-  nU[        U5      :  a  XUS-    S	;   a  M!  U[        U5      :  aB  US-   [        U5      :X  a  XUS-    S:X  a  U S==   S-  ss'   US-  nOU R                  S5        OS X4$ TX4$ )
Nr,   r   r   r  r   r   rK   r   )r.   r  )r8   rY   r  extend)r  rR   r  
real_parts_configlistr  s       r   r  parselist.<locals>._parse_quote  sd   CF?q&1*5=LLaKF3q6/6A:&..00fqj)T1!	 3q6/6A:&..00fqj)T1  ..s1vo!VaZ"8D"@6A:&%/QJQ'qj6A:.$6!b	T!	b	Q
33	aKF s1vo!VaZ"8D"@ SV$U2Y/J b	 $z!} 4
1cr
Z(&&!s1vo!VaZ"8L"HaKF s1vo!VaZ"8L"H CF?zSV#6A:(>$(Fb	T!	!S!&&U**r   c                   > U R                  S5      n U (       d  / $ TS/Sp2nU(       a  U" X U5      u  pnU(       a  M  U$ )Ns    ,r   r   )rZ   )rR   parserr  r  r  s       r   r"  parselist.<locals>._configlist  sE    HHUOI ,seQv$*5V$<!F6 fr   s    ,
)r   r   r   )valueresultr"  r  r  s     @@@r   	parselistr)    sI    /&.+` Zu55U\\'23<Rr   c                L    [         R                  " U R                  S5      5      $ )z8Evaluate a string containing a Python literal expressionr   )astliteral_evalr   rk   s    r   evalpythonliteralr-    s     AHHX.//r   )r   r   returnr   )r   r   r.  r   )Fr   r   )r#   rj   r$   intr%   r/  r.  r   )r#   rj   r$   r/  r%   r/  r.  zIterator[bytes])r.  r   )rR   r   r.  rj   )rr   r   )T)rr   r   r   rj   )r   )rr   r   r   r/  )r   r   r.  r   )r   r   r.  r   )r   r   r.  rj   )r   r   r.  r   )i  )r   r   r   r/  r.  r   )rR   r   r.  r   )r   r   )
r   r   r   r/  r  r   r  r   r.  r   )rR   r   r.  zOptional[bool])r'  zOptional[bytes])rR   r   )<
__future__r   r+  r   rer|   r  r>   typingr   r   r   i18nr   
thirdpartyr	   TYPE_CHECKINGr   r
   r   r   r   
_respecialordr   r   regexbytesescapemapr   r)   r'   ra   rg   rl   rs   r   r   r   r   r   r   rR   r   r   r   r   r~   r   r   r   r   r4   r   r   r   r  r  r  r  r)  r-  )rC   s   0r   <module>r9     s&   # 
         
  ?@
AKLA3q6EAI--h77L/9:z!519}z:  
 
 
 
 O =>w#w#&)w#69w#w#t7>0"
:Gz1Gh"-*8 T! ! !72Od-` }}%AB :,	;
&&?JhX KNI
II).IBGI
I4 
	*Wt0k M:s   *%FF