grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026o ®û|jAeã@sTdZdZdZddlmZddlmZmZddl Z ddl Z ddl m Z ddl ZddlZddlZddlTdd lmZe d ej¡Ze d ej¡ZddlZejgd ¢Z[Gd d„de  dd¡ƒZdd„Zdd„Zdd„ZdZdZeedeƒeeƒZdZ dZ!dZ"dZ#dZ$ee!e"e#e$ƒZ%dZ&edd ƒee&ƒZ'd!e&Z(ee'e(ƒZ)ed"e)d#ƒZ*ee*e)e%ƒZ+d$d%„Z,e j-d&d'„ƒZ.ee,ƒŽZ/d(Z0d)Z1d*Z2d+Z3ee/d,e/d-ƒZ4ee/d.e/d/ƒZ5ee6ej7e8ed0d1�ƒŽZ9ed2e9ƒZ:ee+e:e5e ƒZ;ee;Zeee>e+e:e=e ƒZ?iZ@e,ƒD]ZAe0e@eAd4<e1e@eAd6<e2e@eAd,<e3e@eAd-<�qeBƒZCeBƒZDe,ƒD]%ZEeEd6eEd4fD]ZFeC GeF¡�qIeEd-eEd,fD]ZFeD GeF¡�qZ�q?d8ZHGd9d:„d:eIƒZJGd;d<„d„d>ƒZLd?d@„ZMdAdB„ZNdCdD„ZOdEdF„ZdGdH„ZPdIdJ„ZQdKdL„ZRdMdN„ZSeTdOk�r¨eSƒdSdS)PaoTokenization 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)ÚlookupÚBOM_UTF8N)Ú TextIOWrapper)Ú*)ÚEXACT_TOKEN_TYPESz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$))ÚtokenizeÚgenerate_tokensÚdetect_encodingÚ untokenizeÚ TokenInfoc@s eZdZdd„Zedd„ƒZdS)r cCs$d|jt|jf}d|j|d�S)Nz%d (%s)z8TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r))Útype)r Útok_nameÚ_replace)ÚselfÚannotated_type©rú//opt/alt/python310/lib64/python3.10/tokenize.pyÚ__repr__/s ÿzTokenInfo.__repr__cCs$|jtkr|jtvrt|jS|jS©N)r ÚOPÚstringr©rrrrÚ exact_type4s zTokenInfo.exact_typeN)Ú__name__Ú __module__Ú __qualname__rÚpropertyrrrrrr .sr ztype string start end linecGsdd |¡dS)Nú(ú|ú))Újoin©ÚchoicesrrrÚgroup;sr$cGó t|ŽdS)Nr©r$r"rrrÚany<ó r'cGr%)Nú?r&r"rrrÚmaybe=r(r*z[ \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]cCsVgd¢}dh}|D]}t |¡D]}tjdd„|DƒŽD] }| d |¡¡qqq |S)N)ÚbÚrÚuÚfÚbrÚfrÚcSsg|]}|| ¡f‘qSr)Úupper)Ú.0ÚcrrrÚ _sz(_all_string_prefixes..)Ú _itertoolsÚ permutationsÚproductÚaddr!)Ú_valid_string_prefixesÚresultÚprefixÚtr-rrrÚ_all_string_prefixesTsÿýr>cCst |tj¡Sr)ÚreÚcompileÚUNICODE)ÚexprrrrÚ_compilecsrCz[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'''z"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"T)Úreversez\r?\nz'[^\n'\\]*(?:\\.[^\n'\\]*)*ú'z"[^\n"\\]*(?:\\.[^\n"\\]*)*ú"z \\\r?\n|\Zéc@ó eZdZdS)Ú TokenErrorN©rrrrrrrrIŸr(rIc@rH)ÚStopTokenizingNrJrrrrrK¡r(rKc@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) Ú UntokenizercCsg|_d|_d|_d|_dS)Nér)ÚtokensÚprev_rowÚprev_colÚencodingrrrrÚ__init__¦s zUntokenizer.__init__cCsˆ|\}}||jks||jkr||jkrtd |||j|j¡ƒ‚||j}|r1|j d|¡d|_||j}|rB|j d|¡dSdS)Nz+start ({},{}) precedes previous end ({},{})ú\ rú )rOrPÚ ValueErrorÚformatrNÚappend)rÚstartÚrowÚcolÚ row_offsetÚ col_offsetrrrÚadd_whitespace¬sÿ  ÿzUntokenizer.add_whitespacec Cs,t|ƒ}g}d}|D]…}t|ƒdkr| ||¡nv|\}}}} } |tkr)||_q |tkr/na|tkr9| |¡q |tkrH|  ¡| \|_ |_ q |t t fvrQd}n|rn|rn|d} |dt| ƒkrl|j | ¡t| ƒ|_ d}| |¡|j |¡| \|_ |_ |t t fvr�|j d7_ d|_ q d |j¡S)NFéTéÿÿÿÿrMrr1)ÚiterÚlenÚcompatÚENCODINGrQÚ ENDMARKERÚINDENTrWÚDEDENTÚpoprOrPÚNEWLINEÚNLrNr]r!) rÚiterableÚitÚindentsÚ startliner=Útok_typeÚtokenrXÚendÚlineÚindentrrrr ¹sH           € zUntokenizer.untokenizec Csâg}|jj}|dttfv}d}t |g|¡D]W}|dd…\}} |tkr)| |_q|tt fvr3| d7} |t kr@|r=d| } d}nd}|t krL| | ¡q|t krU|  ¡q|ttfvr^d}n |rj|rj||dƒd}|| ƒqdS)NrFr^rTTr_)rNrWrhrir6ÚchainrcrQÚNAMEÚNUMBERÚSTRINGrerfrg) rrorjrlÚ toks_appendrmÚ prevstringÚtokÚtoknumÚtokvalrrrrbÞs:     äzUntokenizer.compatN)rrrrRr]r rbrrrrrL¤s  %rLcCs*tƒ}| |¡}|jdur| |j¡}|S)aTransform 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. Round-trip invariant for full input: Untokenized source will match input source exactly Round-trip invariant for limited input: # Output bytes will tokenize back to the input t1 = [tok[:2] for tok in tokenize(f.readline)] newcode = untokenize(t1) readline = BytesIO(newcode).readline t2 = [tok[:2] for tok in tokenize(readline)] assert t1 == t2 N)rLr rQÚencode)rjÚutÚoutrrrr s    r cCsH|dd… ¡ dd¡}|dks| d¡rdS|dvs | d¡r"d S|S) z(Imitates get_normal_name in tokenizer.c.Né Ú_ú-úutf-8zutf-8-)zlatin-1ú iso-8859-1z iso-latin-1)zlatin-1-z iso-8859-1-z iso-latin-1-rƒ)ÚlowerÚreplaceÚ startswith)Úorig_encÚencrrrÚ_get_normal_namesÿr‰csÜzˆjj‰Wn tyd‰Ynwd‰d}d}‡fdd„}‡‡fdd„}|ƒ}| t¡r7d‰|d d…}d }|s=|gfS||ƒ}|rH||gfSt |¡sR||gfS|ƒ}|s\||gfS||ƒ}|rh|||gfS|||gfS) 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. NFr‚cszˆƒWStyYdSw)Nó)Ú StopIterationr©ÚreadlinerrÚ read_or_stopAs  ÿz%detect_encoding..read_or_stopcsäz| d¡}Wntyd}ˆdurd |ˆ¡}t|ƒ‚wt |¡}|s(dSt| d¡ƒ}zt|ƒ}Wnt yRˆdurHd|}t|ƒ‚d ˆ|¡}t|ƒ‚wˆrp|dkrlˆdurcd}t|ƒ‚d ˆ¡}t|ƒ‚|d 7}|S) Nr‚z'invalid or missing encoding declarationz {} for {!r}rMzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig) ÚdecodeÚUnicodeDecodeErrorrVÚ SyntaxErrorÚ cookie_reÚmatchr‰r$rÚ LookupError)rqÚ line_stringÚmsgr“rQÚcodec)Ú bom_foundÚfilenamerrÚ find_cookieGs@  ü   þÿù  ÿz$detect_encoding..find_cookieTéú utf-8-sig)Ú__self__ÚnameÚAttributeErrorr†rÚblank_rer“)r�rQÚdefaultrŽršÚfirstÚsecondr)r˜r™r�rr )s:  ÿ &        r cCsNt|dƒ}zt|jƒ\}}| d¡t||dd�}d|_|WS| ¡‚)zXOpen a file in read only mode using the encoding detected by detect_encoding(). ÚrbrT)Úline_bufferingr,)Ú _builtin_openr r�ÚseekrÚmodeÚclose)r™ÚbufferrQÚlinesÚtextrrrr†s  rcCs6t|ƒ\}}t d¡}t |t|dƒ|¡}t|j|ƒS)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. rŠ)r r6Úrepeatrsr`Ú _tokenizeÚ__next__)r�rQÚconsumedÚemptyÚrl_genrrrr–s   rccs~�d}}}d}d\}}d}dg} |dur%|dkrd}tt|dddƒVd} d} z| } |ƒ} Wn ty<d} Ynw|durF|  |¡} |d 7}dt| ƒ} } |r²| sZtd |ƒ‚| | ¡}|rƒ| d¡} }tt|| d|…|||f|| ƒVd\}}d}�n|r©| d d…d kr©| dd…dkr©tt || ||t| ƒf|ƒVd}d}q)|| }|| }q)|dk�r…|�s…| s¾�n2d}| | krð| | dkrÏ|d 7}n| | dkrÞ|t d t }n | | dkrçd}nn| d 7} | | ksÄ| | krö�nú| | dv�r8| | dk�r$| | d…  d¡}tt ||| f|| t|ƒf| ƒV| t|ƒ7} tt | | d…|| f|t| ƒf| ƒVq)|| dk�rU|  |¡tt| d| …|df|| f| ƒV|| dk�r„|| v�rjtdd|| | fƒ‚| dd…} ttd|| f|| f| ƒV|| dk�s\n | �s�td|dfƒ‚d}| | k�rïttƒ | | ¡}|�rÕ| d ¡\}}||f||f|}}} ||k�r»�q‘| ||…| |}}||v�sÚ|dk�rå|dk�rå|dk�rått|||| ƒV�n|dv�r|dk�rùtt |||| ƒVnñtt|||| ƒVnç|dk�r| d¡�rJ‚tt |||| ƒVnÐ|tv�rRtt|ƒ}| | | ¡}|�rE| d¡} | || …}tt|||| f| ƒVn¥||f}| |d…}| }n�|tv�si|dd…tv�si|dd…tv�r¡|ddk�r—||f}tt |¡�p‰t |d ¡�p‰t |d¡ƒ}| |d…d }}| }nXtt|||| ƒVnI| ¡�r°tt|||| ƒVn:|dk�r¸d }n2|d v�rÂ|d 7}n |d!v�rË|d 8}tt|||| ƒVntt | | || f|| d f| ƒV| d 7} | | k�s–q*| �r| ddv�r|  ¡  d¡�sttd|d t| ƒf|d t| ƒd fdƒV| d d…D]}ttd|df|dfdƒV�qtt!d|df|dfdƒVdS)"NrÚ 0123456789)r1rrœr‚)rrr1rŠTrMzEOF in multi-line stringéþÿÿÿrSéýÿÿÿz\ rTú ú z# ú#z r_z3unindent does not match any outer indentation levelz zEOF in multi-line statementÚ.z...Ú r^r›ú\z([{z)]})"r rcr‹r�rarIr“rprvÚ ERRORTOKENÚtabsizeÚrstripÚCOMMENTrirWreÚIndentationErrorrfrCÚ PseudoTokenÚspanrurhÚendswithÚ triple_quotedÚendpatsÚ single_quotedÚgetÚ isidentifierrtrÚstripr†rd)r�rQÚlnumÚparenlevÚ continuedÚnumcharsÚcontstrÚneedcontÚcontlinerlÚ last_linerqÚposÚmaxÚstrstartÚendprogÚendmatchrpÚcolumnÚ comment_tokenÚ pseudomatchrXÚsposÚeposroÚinitialrrrrrr®¯s,€   ÿ   ÿ$ ÿ    ÷ ÿ ÿ "  þ ù€               ÿ þ      ÿ ²¯$#.r®cCs t|dƒS)zÃTokenize a source reading Python code as unicode strings. This has the same API as tokenize(), except that it expects the *readline* callable to return str objects instead of bytes. N)r®rŒrrrr fs r c s2ddl}dd„‰d‡fdd„ }|jdd�}|jdd d d d �|jd ddddd�| ¡}zQ|jrP|j}t|dƒ�}tt|jƒƒ}Wdƒn1sJwYn d}t t j jdƒ}|D]}|j }|j rf|j}d|j|j} td| t||jfƒq[WdSty¦} z| jddd…\} } || jd|| | fƒWYd} ~ dSd} ~ wtyÊ} z| jd\} } || jd|| | fƒWYd} ~ dSd} ~ wtyá} z || |ƒWYd} ~ dSd} ~ wty÷} z || ƒWYd} ~ dSd} ~ wt�ytdƒYdSt�y} zˆd| ƒ‚d} ~ ww)NrcSstj |¡tj d¡dS)Nrº)ÚsysÚstderrÚwrite)ÚmessagerrrÚperrorrs zmain..perrorcsR|r|f||f}ˆd|ƒn|rˆd||fƒnˆd|ƒt d¡dS)Nz%s:%d:%d: error: %sz %s: error: %sz error: %srM)rÝÚexit)ràr™ÚlocationÚargs©rárrÚerrorvs zmain..errorzpython -m tokenize)Úprogr™r)z filename.pyz'the file to tokenize; defaults to stdin)ÚdestÚnargsÚmetavarÚhelpz-ez--exactÚexactÚ store_truez(display token names using the exact type)rèÚactionrër¤zz %d,%d-%d,%d:z%-20s%-15s%-15rrMr›z interrupted zunexpected error: %s)NN)ÚargparseÚArgumentParserÚ add_argumentÚ parse_argsr™r¦Úlistrr�r®rÝÚstdinr rìrrXrpÚprintrrrÀrärIr‘ÚOSErrorÚKeyboardInterruptÚ Exception) rïræÚparserrär™r.rNroÚ token_typeÚ token_rangeÚerrrqr×rrårÚmainnsf þ ÿ ÿ€ÿû$€$€€€ €þrýÚ__main__)UÚ__doc__Ú __author__Ú __credits__Úbuiltinsrr¦ÚcodecsrrÚ collectionsÚ functoolsÚiorÚ itertoolsr6r?rÝrorr@ÚASCIIr’r Ú__all__Ú namedtupler r$r'r*Ú WhitespaceÚCommentÚIgnoreÚNameÚ HexnumberÚ BinnumberÚ OctnumberÚ DecnumberÚ IntnumberÚExponentÚ PointfloatÚExpfloatÚ FloatnumberÚ ImagnumberÚNumberr>Ú lru_cacherCÚ StringPrefixÚSingleÚDoubleÚSingle3ÚDouble3ÚTripleÚStringÚmapÚescapeÚsortedÚSpecialÚFunnyÚ PlainTokenÚTokenÚContStrÚ PseudoExtrasrÁrÅÚ_prefixÚsetrÆrÄr=r-r9r½rørIrKrLr r‰r rr®r rýrrrrrÚsÀ    ÿÿ    ÿ ÿÿþ      ÿ_ ]8 = ÿ