e@T LSrSrSrSSKJr SSKJrJr SSK r SSK r SSK J r SSK rSSKrSSKrSSK7 SS KJr SSKr\R("S \R*5r\R("S \R*5rSSKr\R0/S Q-rC"S S\ R2"SS55rSrSrSrSrSr\\"S\-5-\"\5-r Sr!Sr"Sr#Sr$Sr%\"\"\#\$\%5r&Sr'\"SS5\"\'5-r(S\'-r)\"\(\)5r*\"S\*S -5r+\"\+\*\&5r,S!r-\ R\S"5r/\"\-"56r0S#r1S$r2S%r3S&r4\"\0S'-\0S(-5r5\"\0S)-\0S*-5r6\"\7"\Rp\9"\S+S,956r:\"S-\:5r;\"\,\;\6\!5r<\ \<-r=\"\0S.-\"S/S5-\0S0-\"S1S5-5r>\"S2\\55r?\\"\?\,\;\>\!5-r@0rA\-"5H#rB\1\A\BS/-'\2\A\BS1-'\3\A\BS'-'\4\A\BS(-'M% CB\C"5rD\C"5rE\-"5HGrF\FS1-\FS/-4HrG\DR\G5 M \FS(-\FS'-4HrG\ER\G5 M MI CFCGS3rI"S4S5\J5rK"S6S75rLS8rMS9rNS:rOS;rS<rPS=rQS>rRS?rSSBS@jrT\USA:Xa\R"5 gg)CaoTokenization help for Python programs. tokenize(readline) is a generator that breaks a stream of bytes into Python tokens. It decodes the bytes according to PEP-0263 for determining source file encoding. It accepts a readline-like method which is called repeatedly to get the next line of input (or b"" for EOF). It generates 5-tuples with these members: the token type (see token.py) the token (a string) the starting (row, column) indices of the token (a 2-tuple of ints) the ending (row, column) indices of the token (a 2-tuple of ints) the original line (string) It is designed to match the working of the Python tokenizer exactly, except that it produces COMMENT tokens for comments and gives type OP for all operators. Additionally, all token lists start with an ENCODING token which tells you which encoding was used to decode the bytes stream. zKa-Ping Yee zpGvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro, Raymond Hettinger, Trent Nelson, Michael Foord)open)lookupBOM_UTF8N) TextIOWrapper)*)EXACT_TOKEN_TYPESz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$))tokenizegenerate_tokensdetect_encoding untokenize TokenInfor TokenErrorc*\rSrSrSr\S5rSrg)r /cjSUR[UR4-nSURUS9-$)Nz%d (%s)z8TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r))type)rtok_name_replace)selfannotated_types ./opt/imh/python3.13/lib/python3.13/tokenize.py__repr__TokenInfo.__repr__0s9"dii$))1D%EEJ > 23 4cUR[:Xa'UR[;a[UR$UR$N)rOPstringrrs r exact_typeTokenInfo.exact_type5s2 99?t{{.??$T[[1 199 rN)__name__ __module__ __qualname____firstlineno__rpropertyr __static_attributes__r"rrr r /s4 rr ztype string start end linec0SSRU5-S-$)N(|))joinchoicess rgroupr0<sC#((7"33c99rc[U6S-$)Nrr0r.s ranyr3=s%/C//rc[U6S-$)N?r2r.s rmayber6>sE7Oc11rz[ \f\t]*z #[^\r\n]*z\\\r?\nz\w+z0[xX](?:_?[0-9a-fA-F])+z0[bB](?:_?[01])+z0[oO](?:_?[0-7])+z(?:0(?:_?0)*|[1-9](?:_?[0-9])*)z[eE][-+]?[0-9](?:_?[0-9])*z)[0-9](?:_?[0-9])*\.(?:[0-9](?:_?[0-9])*)?z\.[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*[jJ]z[jJ]c /SQnS1nUHzn[R"U5H]n[R"UVs/sHoDUR54PM sn6H#nUR SR U55 M% M_ M| U$s snf)N)brufbrfr) _itertools permutationsproductupperaddr-)_valid_string_prefixesresultprefixtcr:s r_all_string_prefixesrIUs>TF(((0A ''!)D!Qaggi.!)DE 2771:&F1) M*EsB cL[R"U[R5$r)recompileUNICODE)exprs r_compilerOds ::dBJJ ''rz[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'''z"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"T)reversez\r?\nz'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z \\\r?\n|\Zc\rSrSrSrg)rr"N)r#r$r%r&r(r"rrrrsTrrc8\rSrSrSrSrSrSrSrSr Sr g ) UntokenizercX/UlSUlSUlSUlSUlSUlg)Nrr>)tokensprev_rowprev_col prev_type prev_lineencodingrs r__init__Untokenizer.__init__s,    rcPUup#X R:dX R:Xa?X0R:a0[SRX#URUR55eUR U5 X0R- nU(aUR R SU-5 gg)Nz+start ({},{}) precedes previous end ({},{}) )r\r] ValueErrorformatadd_backslash_continuationr[append)rstartrowcol col_offsets radd_whitespaceUntokenizer.add_whitespaces  #"63;NJ$fSt}}dmmLN N ''.==(  KK  sZ/ 0 rcUSnX R- nUS:XagURRS5(aSOSnURRS5nSR [ R "[R[U555nURRUSU3U--5 SUl g)zAdd backslash continuation characters if the row has increased without encountering a newline token. This also inserts the correct amount of whitespace before the backslash. rNz  z\ r>\) r\r_endswithrstripr-r? takewhilestrisspacereversedr[rhr])rrirj row_offsetnewlinelinewss rrg&Untokenizer.add_backslash_continuations Ah==( ?  NN33F;;&~~$$X. WWZ))#++x~F G 2"WI ;;< rc h/nSnUHnUS:XaU(aSnOURU5 US:Xa][S[R"SRUSSS2555nUS-S :Xd USS :waURU5 OS nURU5 M S R U5$) NF}{c3&# UHnSv M g7f)rZNr").0chars r .Untokenizer.escape_brackets..s$#$A#srqrNTr>)rhsumr?rt__eq__r-)rtoken charactersconsume_until_next_bracket character n_backslashess rescape_bracketsUntokenizer.escape_bracketss %*"IC-16.%%i0C #$","6"6 "26r6*#$! !1$)Z^s-B%%i015.   i (#$wwz""rc[U5n/nSnUGHn[U5S:XaURXR5 GOUupgpn U[:XaXplM?U[ :Xa GOU[ :XaURU5 MiU[:Xa!UR5 U uUl Ul MU[[4;aSnOU(aLU(aEUSn US[U 5:a+URRU 5 [U 5Ul SnOhU[:Xa^SU;dSU;aRUR!U5nUR""5Sn U upU R%S5U R%S 5-nXU-4n UR'U5 URRU5 U uUl Ul U[[4;aU=RS- sl S Ul X`lXlGM S R-UR5$) NFrTrrZrr~z{{z}}rr>)iterlencompatENCODINGr` ENDMARKERINDENTrhDEDENTpopr\r]NEWLINENLr[FSTRING_MIDDLEr splitlinescountrmr^r_r-)riterableitindents startlinerGtok_typerriendrzindent last_lineend_lineend_col extra_charss rr Untokenizer.untokenizes (^ A1v{ A"01 -HU8# % 9$6!u%V# /2, t}gr]* w 8s6{*KK&&v.$'KDM! ^+%<3%< 007E % 0 0 22 6I(+%H"+//$"7)//$:O"OK#{%:;C    & KK  u %+. (DM4=GR=( " ! %N!NQRwwt{{##rc/nURRnUS[[4;nSnSn[R "U/U5GHxnUSSupU [ :XaXlMU [[4;aU S- n U [:XaU(aSU -n SnOSnU [:XaUS- nOU [:XaUS-nU [:XaURU 5 MU [:XaUR5 MU [[4;aSnO7U(aU(aU"US5 SnOU [ :XaUR#U 5n U S;a0UR(aURSU :Xa U(aSU -n U [[4;a5UR$[[4;aURRS5 U"U 5 XlGM{ g) NrFrrdTrZr>rr~)r[rhrrr?chainrr`NAMENUMBERSTRING FSTRING_START FSTRING_ENDrrrrrr^) rrrr toks_appendr prevstring in_fstringtoktoknumtokvals rrUntokenizer.compatskk(( !H" -   ##UGX6C !WNF! & $'#  6\F! " &a ;&a v&6! GR=( wGBK(! >)--f5#  B68QV`v&-00T^^P[G\5\ ""3'  #NY7r)r`r]r_r\r^r[N) r#r$r%r&rarmrgrr rr(r"rrrWrWs!1"#.-$^3$rrWc[5nURU5nURbURUR5nU$)aUTransform tokens back into Python source code. It returns a bytes object, encoded using the ENCODING token, which is the first token sequence output by tokenize. Each element returned by the iterable must be a token sequence with at least two elements, a token number and token value. If only two tokens are passed, the resulting output is poor. The result is guaranteed to tokenize back to match the input so that the conversion is lossless and round-trips are assured. The guarantee applies only to the token type and token string as the spacing between tokens (column positions) may change. )rWr r`encode)rutouts rr r Fs: B -- !C {{jj% JrcUSSR5RSS5nUS:XdURS5(agUS;dURS5(ag U$) z7Imitates get_normal_name in Parser/tokenizer/helpers.c.N _-utf-8zutf-8-)zlatin-1 iso-8859-1z iso-latin-1)zlatin-1-z iso-8859-1-z iso-latin-1-r)lowerreplace startswith)orig_encencs r_get_normal_namer[s^ 3B-    ' 'S 1C g~11 66 ~~ABB Orc^^^TRRmSmSnSnU4SjnUU4SjnU"5nUR[5(a SmUSSnSnU(dU/4$U"U5nU(aX/4$[ R U5(dX%/4$U"5nU(dX%/4$U"U5nU(aXU/4$X%U/4$![a SmNf=f) a The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. NFrc4>T"5$![a gf=f)Nr) StopIterationreadlinesr read_or_stop%detect_encoding..read_or_stop~s" :   s  c>URS5n[R U5nU(dg[ URS55n[U5nT(a-US:wa"TcSnOSRT5n[U5eUS - nU$![a# SnTbSRUT5n[U5ef=f![a' TcSU-nOSRTU5n[U5ef=f) Nrz'invalid or missing encoding declarationz {} for {!r}rZzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig) decodeUnicodeDecodeErrorrf SyntaxError cookie_rematchrr0r LookupError)rz line_stringmsgrr`codec bom_foundfilenames r find_cookie$detect_encoding..find_cookies  #++g.K ,#EKKN3 #8$E 7"#3C<CCHMC!#&&  H=" #;C##**39c" "  # #*X55<>%  ^F 6"H(( FO ##O sB?? C Cc[US5n[UR5up#URS5 [ XSS9nSUlU$! UR 5 e=f)zPOpen a file in read only mode using the encoding detected by detect_encoding(). rbrT)line_bufferingr9) _builtin_openr rseekrmodeclose)rbufferr`linestexts rrrs[8T *F)&//: AVdC    s :A Ac## [U5up[R"U[US55nUbUS:XaSn[ [ USSS5v [ URUSS9ShvN gN7f) a The tokenize() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as bytes. Alternatively, readline can be a callable function terminating with StopIteration: readline = open(myfile, 'rb').__next__ # Example of alternate readline The generator produces 5-tuples with these members: the token type; the token string; a 2-tuple (srow, scol) of ints specifying the row and column where the token begins in the source; a 2-tuple (erow, ecol) of ints specifying the row and column where the token ends in the source; and the line on which the token was found. The line passed is the physical line. The first token sequence will always be an ENCODING token which tells you which encoding was used to decode the bytes stream. rNrr)rrr>T extra_tokens)r r?rrr r!_generate_tokens_from_c_tokenizer__next__)rr`consumedrl_gens rr r sj&)2H   hXs(; .perrors& ! rc>U(aU4U-U4-nT"SU-5 O"U(aT"U<SU<35 O T"SU-5 [R"S5 g)Nz%s:%d:%d: error: %sz : error: z error: %srZ)rexit)rrlocationargsrs rerrormain..errorsO ;)WJ6D (4/ 0  h8 9 ;( )  rzpython -m tokenize)progrr5z filename.pyz'the file to tokenize; defaults to stdin)destnargsmetavarhelpz-ez--exactexact store_truez(display token names using the exact type)r actionr rzTrz %d,%d-%d,%d:2015rZrz interrupted zunexpected error: %s)NN)argparseArgumentParser add_argument parse_argsrrlistr rrrstdinrr r rirprintrrIndentationErrorrrrOSErrorKeyboardInterrupt Exception)rrparserrrr;r[r token_type token_rangeerrrzcolumnrs @rmainr"s $ $*> $ ?F Zs -FH iglGI    D" ==}}Hx.!hqzz23/.!H6 ""7F EJzz"-- (EKK%)),CDK  4ellD E /. 5xx{1Q'  chhqk8d^44 5xx{  chhqk8d^44  c8  c  o %+, sg)E?EB#E E E H2,F H2)G  H2 G$$ H21G>>H2 H2! H--H2cSU;agU$)zTransform error messages from the C tokenizer into the Python tokenize The C tokenizer is more picky than the Python one, so we need to massage the error messages a bit for backwards compatibility. z)unterminated triple-quoted string literalzEOF in multi-line stringr")rs r_transform_msgr$5s 3c9) Jrc#f# Uc[R"XS9nO[R"XUS9nUHn[RU5v M g![aRn[ U5[:waUSe[ UR5n[XeRUR45SeSnAff=f7f)zWTokenize a source reading Python code as unicode strings using the internal C tokenizerNr)r`r) _tokenize TokenizerIterr _makerrr$rrlinenooffset)sourcer`rrinfoers rrr?s  $ $V G  $ $V\ Z>D//$' ' > 7k ! QUU#xx23= >s).B1 AB1 B.A B))B..B1__main__)NF)V__doc__ __author__ __credits__builtinsrrcodecsrr collections functoolsior itertoolsr?rKrrrr&rLASCIIrr__all__ namedtupler r0r3r6 WhitespaceCommentIgnoreName Hexnumber Binnumber Octnumber Decnumber IntnumberExponent PointfloatExpfloat Floatnumber ImagnumberNumberrI lru_cacherO StringPrefixSingleDoubleSingle3Double3TripleStringmapescapesortedSpecialFunny PlainTokenTokenContStr PseudoExtras PseudoTokenendpats_prefixset single_quoted triple_quotedrGr:rCtabsizerrrWr rr r r r"r$rr#r"rrrbs,*  +# # JJ@"(( K ::0"(( ; --L L   &&{4PQ :/1  c*z12 2U7^ C  &  . )Y 9 = ( ?)+-28_= ( *J) +[7-B C z; 2  (( *,-  $ # 2 2 |e#\E%9 : |==== ? RYY'8$ GH I h  65&$ /   ==c:&'==c:&' (]GV4 5vugtLL #%G#GGcM#GGcM&GGeO&GGeO &     A#gq3w ! %iU #!$ q !!^$^$B* Z$z _8J=~ >  zFr