B /g^ @sddlTdZdZedZedZedZedZedZee e hZ ee e eeeehZeed feed feed feed feed feedfeedfeedfdZeefeefeefeeefgfeeefgfeeefgfeeefgfeeefgfeeefgfeefd Z e!e"e#e$e%e&e'e(dZ)e&e"Be(BZ*e+e'BZ,Gddde-Z.GdddZ/GdddZ0GdddZ1ddZ2ddZ3d d!Z4d"d#Z5d2d%d&Z6d'd(Z7d)d*Z8d3d,d-Z9d.d/Z:d0d1Z;d+S)4)*z .\[{()*+?^$|z*+?{ 0123456789Z01234567Z0123456789abcdefABCDEFZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz      \)z\az\bz\fz\nz\rz\tz\vz\\) z\Az\bz\Bz\dz\Dz\sz\Sz\wz\Wz\Z)iLmsxatuc@s eZdZdS)VerboseN)__name__ __module__ __qualname__rr!/usr/lib64/python3.7/sre_parse.pyrGsrc@sBeZdZddZeddZdddZdd Zd d Zd d Z dS)PatterncCsd|_i|_dg|_d|_dS)Nr)flags groupdict groupwidthslookbehindgroups)selfrrr__init__LszPattern.__init__cCs t|jS)N)lenr)rrrrgroupsQszPattern.groupsNcCsb|j}|jd|jtkr$td|dk r^|j|d}|dk rTtd|||f||j|<|S)Nztoo many groupsz7redefinition of group name %r as group %d; was group %d)r"rappend MAXGROUPSerrorrget)rnamegidogidrrr opengroupTs   zPattern.opengroupcCs||j|<dS)N)getwidthr)rr(prrr closegroup`szPattern.closegroupcCs||jko|j|dk S)N)r"r)rr(rrr checkgroupbszPattern.checkgroupcCs6|jdk r2||s|d||jkr2|ddS)Nzcannot refer to an open groupz?cannot refer to group defined in the same lookbehind subpattern)rr.r%)rr(sourcerrrchecklookbehindgroupes     zPattern.checklookbehindgroup)N) rrrr propertyr"r*r-r.r0rrrrrJs   rc@s`eZdZdddZdddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ dS) SubPatternNcCs"||_|dkrg}||_d|_dS)N)patterndatawidth)rr3r4rrrr os zSubPattern.__init__rc Csd}ttf}x|jD]\}}t|dt|dd|tkrttx*|D]"\}}t|ddt||qLWq|tkrtx:t|dD]*\}}|rt|dd||dqWq|t kr|\}} } td|| |d| rt|dd| |dqt ||rd}x\|D]T}t |t rX|sDt||dd}n"|sjtd ddt|ddd}q(W|stqtd|qWdS) NTz )endORELSEF ) tuplelistr4printstrINBRANCH enumeratedumpGROUPREF_EXISTS isinstancer2) rlevelnlseqtypesopavrr condgroupitem_yesitem_norrrrCvsH          zSubPattern.dumpcCs t|jS)N)reprr4)rrrr__repr__szSubPattern.__repr__cCs t|jS)N)r!r4)rrrr__len__szSubPattern.__len__cCs |j|=dS)N)r4)rindexrrr __delitem__szSubPattern.__delitem__cCs&t|trt|j|j|S|j|S)N)rEslicer2r3r4)rrQrrr __getitem__s zSubPattern.__getitem__cCs||j|<dS)N)r4)rrQcoderrr __setitem__szSubPattern.__setitem__cCs|j||dS)N)r4insert)rrQrUrrrrWszSubPattern.insertcCs|j|dS)N)r4r#)rrUrrrr#szSubPattern.appendc Cs|jdk r|jSd}}x|jD]\}}|tkrtd}d}x0|dD]$}|\}}t||}t||}qJW||}||}q"|tkr|\}}||}||}q"|tkr|d\}}||}||}q"|t kr|d\}}|||d}|||d}q"|t kr,|d}|d}q"|t krX|j j |\}}||}||}q"|tkr|d\}}|ddk r|d\}}t||}t||}nd}||}||}q"|tkr"Pq"Wt|tdt|tf|_|jS)Nrr8)r5r4rA MAXREPEATr+minmaxCALL SUBPATTERN _REPEATCODES _UNITCODESGROUPREFr3rrDSUCCESS) rlohirIrJr jlhrrrr+sZ                zSubPattern.getwidth)N)r) rrrr rCrOrPrRrTrVrWr#r+rrrrr2ms  (r2c@sbeZdZddZddZddZddZd d Zd d Ze d dZ ddZ ddZ dddZ dS) TokenizercCs@t|t|_||_|js"t|d}||_d|_d|_|dS)Nlatin1r)rEr?istextstringdecoded_stringrQnext_Tokenizer__next)rrkrrrr s  zTokenizer.__init__cCs|j}y|j|}Wntk r.d|_dSX|dkr|d7}y||j|7}Wn.tk rtd|jt|jddYnX|d|_||_dS)Nr r8zbad escape (end of pattern))rQrl IndexErrorrmr%rkr!)rrQcharrrr__nexts zTokenizer.__nextcCs||jkr|dSdS)NTF)rmrn)rrprrrmatchs zTokenizer.matchcCs|j}||S)N)rmrn)rthisrrrr&sz Tokenizer.getcCs:d}x0t|D]$}|j}||kr"P||7}|qW|S)Nr6)rangermrn)rncharsetresult_crrrgetwhiles zTokenizer.getwhilecCshd}x^|j}||dkr>|s*|d|d|t|||krX|sV|ddP||7}qW|S)Nr6zmissing group namezmissing %s, unterminated namer8)rmrnr%r!)r terminatorrwryrrrgetuntil s     zTokenizer.getuntilcCs|jt|jpdS)Nr6)rQr!rm)rrrrpossz Tokenizer.poscCs|jt|jpdS)Nr6)rQr!rm)rrrrtellszTokenizer.tellcCs||_|dS)N)rQrn)rrQrrrseek szTokenizer.seekrcCst||j||S)N)r%rkr~)rmsgoffsetrrrr%$szTokenizer.errorN)r)rrrr rnrrr&rzr|r1r}r~rr%rrrrrhs   rhcCst|}|r|St|}|r0|dtkr0|Sy|dd}|dkr||dt7}t|dkrx|d|t|tt |dddfS|dkr|j r||dt7}t|d kr|d|t|tt |dddfS|d krH|j rH||d t7}t|d kr&|d|t|t |ddd}t |t|fS|t kr||dt 7}t |ddd }|d kr|d|t|t|fS|t krtt|dkr|tkr|d|t|tt|dfSWntk rYnX|d|t|dS)Nrr8rYrzincomplete escape %srU z.octal escape value %s outside of range 0-0o377z bad escape %s)ESCAPESr& CATEGORIESr@rz HEXDIGITSr!r%LITERALintrjchr OCTDIGITSDIGITS ValueError ASCIILETTERSord)r/escaperUryrrr _class_escape'sR         rcCst|}|r|St|}|r$|Syv|dd}|dkr||dt7}t|dkrl|d|t|tt|dddfS|dkr|j r||dt7}t|dkr|d|t|tt|dddfS|d kr<|j r<||d t7}t|d kr|d|t|t|ddd}t |t|fS|d krl||dt 7}tt|ddd fS|t kr^|j t kr||7}|dt kr|dt kr|j t kr||7}t|ddd }|d kr|d|t|t|fSt|dd}||jkrF||s2|dt||||t|fS|d|t|dt|dkr|tkr|d|t|tt|dfSWntk rYnX|d|t|dS)Nr8rYrrzincomplete escape %srrrrrr0rz.octal escape value %s outside of range 0-0o377zcannot refer to an open groupzinvalid group reference %dz bad escape %s)rr&rrzrr!r%rrrjrrrrmr"r.r0rarrr)r/rstaterUrygrouprrr_escapeWsn                  rcCstt|S)N)r=dictfromkeys)itemsrrr_uniqsrcCs`g}|j}|j}|}x.|t||||d| o4| |dsPqWt|dkr\|dSt|}x^d} xR|D]*} | szP| dkr| d} qp| d| krpPqpWx|D] } | d=qW|| qfPqfWg} x|D]b} t| dkrP| d\} } | tkr| | | fq| tkr.| ddtk r.| | qPqW|tt | f|S|t d|ff|S)Nr8|r) r#rrr~_parser!r2rr@NEGATEextendrrA)r/rverbosenestedr itemsappend sourcematchstart subpatternprefixitemsetrIrJrrr _parse_subsP            rFc/ Cs t|}|j}|j}|j}t} t} x|j} | dkr6P| dkr@P||r|| tkrTq&| dkr|x|} | dkst| dkr^Pq^Wq&| ddkrt|| |} || q&| t kr|t | | fq&| dkr| d} g}|j}|jdkrddl }|j d| t|d d |d }xT|} | dkr8|d | | | d krL|rLPn| ddkrft|| }n~|r| dkr|j| krddl }|j d| dkrdn| dkrdn| dkrdnd| dft|d d t | | f}|dr@|}|dkr|d | | |d krP|dtkr6|dd}|||t | dfP|ddkrjt||}n>|dkrddl }|j d| dt|d d t | |f}|dt ks|dt krd| |f}||t| dt||d}|d}||kr.d| |f}||t| dt||t||ffn"|dtkrZ|dd}||qWt|}| |dkr|ddt kr|r|t|ddfn ||dn"|r|dtdf|t|fq&| tkr<| } | dkrd\}}nJ| dkrdt}}n2| dkr6dt}}n| dkrB|jdkr^|t | | fq&dt}}d }}x|jtkr||7}qrW|d!rx"|jtkr||7}qWn|}|ds|t | | f|| q&|rt|}|tkrtd"|rPt|}|tkr"td"||krP|d#| | ntd$|f|rd|d%d}nd}|r|ddtkr|d&| | t| |ddtkr|d'| | t| |ddt kr |dd\}}}}|dkr |s |s |}|dr(t!|||ff|d%<nt"|||ff|d%<q&| d(krT|t#dfq&| d)k r| d} d*}d}!d}d}|d r(|}|dkr|d+|d,kr|d-r|$d.}!|!%sd/|!}||t|!dn|d0r|$d1}!|!%sd/|!}||t|!d|j&|!}"|"dkrPd2|!}||t|!d|'|"sp|d3t|!d|(|"||t)|"fq&n2|}|dkr|d+|d4|t|dnf|d5krd}nT|dkrx4|jdkr|d6| | |d1krPqWq&n|d7k rd}#|d-kr|}|dkrL|d+|d8krn|d9|t|dd%}#|j*}$|$dkr|j+|_*t,||||d}|#dkr|$dkrd|_*|d1s|d:| | |d0kr|t-|#|ffq&|t.|#|ffq&n"|d)k rv|$d1}%|%% rX|j&|%}&|&dk rd2|%}||t|%dnyt|%}&|&dk rpt/Wn4t/k rd/|%}||t|%ddYnX|& s|d;t|%d|&t0k rd<|&}||t|%d|(|&|t1||||d}'|d= rnd}(|d1 s`|d:| | |t2|&|'|(ffq&n|t3k s|dk rt4|||})|)dk r| r| rddl }|j d?|j5dd@t|j5d@k rdAnd ft6|d d |j7t8@r&|s&t9q&|)\}}d}n|dB|t|d|dk r~y|:|!}Wn<tk r|}*z||*j;t|!ddWdd}*~*XYnX| s|t8@ o|t8@ }+t,|||+|d}|d1 s|d:| | |dk r|<|||t ||||ffq&| d k r|tt=fq&| dCk r&|tt>fq&tdD|fq&Wxht?t|ddd%D]N},||,\}-}.|-t k rP|.\}}}}|dk rP| sP| sP|||,|,d< qPW|S)ENz|)#rrr [r8z"Possible nested set at position %dr) stacklevel^zunterminated character set]z-&~|zPossible set %s at position %d- difference& intersection~zsymmetric differenceunionz&Possible set difference at position %drYzbad character range %s-%s?)rr8r+{}r6,z"the repetition number is too largez"min repeat greater than max repeatzunsupported quantifier %rrXznothing to repeatzmultiple repeat.(Tzunexpected end of patternP<>zbad character in group name %r=)zunknown group name %rzcannot refer to an open groupzunknown extension ?P:zmissing ), unterminated commentz=!|dkrTd}||n|dkrTd}||||O}|t@r~|t@|kr~d}|||}|dkr|d|d krP|tkr|rd nd}||t|qW|d kr|j|O_dS|t@r|d d |dkr|}|dkr|d|tkrJ|r6d nd}||t|xt|}|t@rld}||||O}|}|dkr|d|dkrP|tkrL|rd nd}||t|qLW|t@r|dd ||@r|dd ||fS)Nrrr z8bad inline flags: cannot use 'L' flag with a str patternrz:bad inline flags: cannot use 'u' flag with a bytes patternz9bad inline flags: flags 'a', 'u' and 'L' are incompatiblezmissing -, : or )z)-:z unknown flagrz,bad inline flags: cannot turn on global flagr8z missing flagz8bad inline flags: cannot turn off flags 'a', 'u' and 'L'z missing :rz-bad inline flags: cannot turn off global flagz(bad inline flags: flag turned on and off) r&rrjr% TYPE_FLAGSisalphar!r GLOBAL_FLAGS)r/rrprrrflagrrrrrEsp                   rcCsjt|tr>|t@rtd|t@s,|tO}qf|t@rftdn(|t@rNtd|t@rf|t@rftd|S)Nz)cannot use LOCALE flag with a str patternz(ASCII and UNICODE flags are incompatiblez,cannot use UNICODE flag with a bytes patternz'ASCII and LOCALE flags are incompatible)rEr?SRE_FLAG_LOCALErSRE_FLAG_ASCIISRE_FLAG_UNICODE)srcrrrr fix_flagss   rNcCst|}|dkrt}||_||_yt|||t@d}WnBtk rzt}|tB|_||_|dt||dd}YnXt||j j|j _|j dk r| d|t @r| |S)NrTzunbalanced parenthesis)rhrrr?rrrrrr3rmr%SRE_FLAG_DEBUGrC)r?rr3r/r,rrrparses&    rc st|j}gggj}fdd}j}x||}|dkrNP|ddkr|d}|dkrJd}dsd d }|ry ||} Wn tk rt d |YnXnlyt |} | dkrt Wn0t k rd |t |ddYnX| t kr4d | t |d|| t |dq|dkrjtkr||7}jtkr||7}|tt |dddd@q|tkrZd} jtkr4||7}|tkr4|dtkr4jtkr4||7}d} t |ddd}|dkr(d|t ||t|| s|t |ddt |dnRytt|d}Wn4tk r|tkrd|t |YnX||q>||q>WrЈdt|tsddDfS)NcsX|jkrd||r8ddd=t|fddS)Nzinvalid group reference %dr6)r"r%r#joinr!)rQr})r"literalliteralsr3rrraddgroups  z parse_template..addgrouprr r8gr6rz missing sz"parse_template..)rhr&r# groupindexrrr%r|rKeyErrorrorrr!r$rmrrrrrrrEr?) r/r3sgetlappendrrrsryr'rQisoctalr)r"rrr3rrparse_templates             "            rcCsz|j}|jdd}|\}}|dd}y&x |D]\}}||pB|||<q0WWn tk rntd|YnX||S)Nrzinvalid group reference %d)rrkror%r)templaterrremptyr"rrQrrrrexpand_templates r )F)rN)< sre_constantsrr frozensetrrrrrrrr_rrr@rrCATEGORYr`rrrZAT_BEGINNING_STRINGZ AT_BOUNDARYZAT_NON_BOUNDARYZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ CATEGORY_WORDZCATEGORY_NOT_WORDZ AT_END_STRINGrSRE_FLAG_IGNORECASErSRE_FLAG_MULTILINESRE_FLAG_DOTALLrrSRE_FLAG_TEMPLATErrrrr Exceptionrrr2rhrrrrrrrrrr rrrrsj                #rH0A: r< U