Your IP : 3.139.86.53


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/tokenize.cpython-312.pyc

�

�Q�f�R�	�T�dZdZdZddlmZddlmZmZddl	Z	ddl
Z
ddlmZddl
ZddlZddlZddl�dd	lmZddlZej(d
ej*�Zej(dej*�ZddlZej0gd�zZ[Gd
�de	j2dd��Zd�Zd�Zd�ZdZdZeedez�zee�zZ dZ!dZ"dZ#dZ$dZ%ee"e#e$e%�Z&dZ'edd�ee'�zZ(de'zZ)ee(e)�Z*ede*d z�Z+ee+e*e&�Z,d!�Z-e
j\d"��Z/ee-��Z0d#Z1d$Z2d%Z3d&Z4ee0d'ze0d(z�Z5ee0d)ze0d*z�Z6ee7ejpe9ed+�,���Z:ed-e:�Z;ee,e;e6e!�Z<e e<zZ=ee0d.zed/d�ze0d0zed1d�z�Z>ed2ee5�Z?eee?e,e;e>e!�zZ@iZAe-�D]"ZBe1eAeBd/z<e2eAeBd1z<e3eAeBd'z<e4eAeBd(z<�$[BeC�ZDeC�ZEe-�D]BZFeFd1zeFd/zfD]ZGeDj�eG��eFd(zeFd'zfD]ZGeEj�eG���D[F[Gd3ZIGd4�d5eJ�ZKGd6�d7eJ�ZLGd8�d9�ZMd:�ZNd;�ZOd<�ZPd=�Zd>�ZQd?�ZRd@�ZSdA�ZTdDdB�ZUeVdCk(reS�yy)EaoTokenization 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 <ping@lfw.org>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�"�eZdZd�Zed��Zy)r
c�p�d|jt|jfz}d|j|��zS)Nz%d (%s)z8TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r))�type)r�tok_name�_replace)�self�annotated_types  �//opt/alt/python312/lib64/python3.12/tokenize.py�__repr__zTokenInfo.__repr__0s9��"�d�i�i��$�)�)�1D�%E�E��J��
�
�>�
�2�3�	4�c��|jtk(r%|jtvrt|jS|jS�N)r�OP�stringr�rs r�
exact_typezTokenInfo.exact_type5s2���9�9��?�t�{�{�.?�?�$�T�[�[�1�1��9�9�rN)�__name__�
__module__�__qualname__r�propertyr�rrr
r
/s��4�
���rr
ztype string start end linec�0�ddj|�zdzS)N�(�|�))�join��choicess r�groupr*<s��C�#�(�(�7�"3�3�c�9�9rc��t|�dzS)Nr�r*r(s r�anyr-=s��%��/�C�/�/rc��t|�dzS)N�?r,r(s r�mayber0>s��E�7�O�c�1�1rz[ \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
�
�gd�}dh}|D]q}tj|�D]W}tj|D�cgc]}||j�f��c}�D]"}|j	dj|���$�Y�s|Scc}w)N)�b�r�u�f�br�fr�)�
_itertools�permutations�product�upper�addr')�_valid_string_prefixes�result�prefix�t�cr4s      r�_all_string_prefixesrCUs���>���T�F�(���(�(��0�A� �'�'�!�)D�!�Q�1�a�g�g�i�.�!�)D�E���
�
�2�7�7�1�:�&�F�1�)��M��*Es�Bc�J�tj|tj�Sr)�re�compile�UNICODE)�exprs r�_compilerIds��
�:�:�d�B�J�J�'�'rz[^'\\]*(?:\\.[^'\\]*)*'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��eZdZy)�
TokenErrorN�rrr r"rrrOrO���rrOc��eZdZy)�StopTokenizingNrPr"rrrSrS�rQrrSc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�Untokenizerc�J�g|_d|_d|_d|_d|_y)N�r)�tokens�prev_row�prev_col�	prev_type�encodingrs r�__init__zUntokenizer.__init__�s%�������
���
������
rc��|\}}||jks||jk(r@||jkr1tdj|||j|j���||jz
}|r%|jjd|z�d|_||jz
}|r|jjd|z�yy)Nz+start ({},{}) precedes previous end ({},{})z\
r� )rYrZ�
ValueError�formatrX�append)r�start�row�col�
row_offset�
col_offsets      r�add_whitespacezUntokenizer.add_whitespace�s������S������#����"6�3����;N��J�$�f�S�#�t�}�}�d�m�m�L�N�
N��4�=�=�(�
���K�K���v�
�2�3��D�M��4�=�=�(�
���K�K���s�Z�/�0�rc�@�g}d}|D]�}|dk(r|rd}n|j|�|dk(rRtd�tjdj|ddd��D��}|dzd	k(r|j|�nd
}|j|���dj|�S)NF�}�{c3� K�|]}d���y�w)rWNr")�.0�chars  r�	<genexpr>z.Untokenizer.escape_brackets.<locals>.<genexpr>�s����$�#�$�A�#�s��\�������rTr8)rb�sumr9�	takewhile�__eq__r')r�token�
characters�consume_until_next_bracket�	character�
n_backslashess      r�escape_bracketszUntokenizer.escape_brackets�s����
�%*�"��I��C��-�16�.��%�%�i�0��C�� #�$�",�"6�"6����"�2�6�r�6�*�#�$�!�
�!�1�$��)��%�%�i�0�15�.����i�(�#�$�w�w�z�"�"rc�X�t|�}g}d}|D�]�}t|�dk(r|j||��n�|\}}}}	}
|tk(r||_�@|t
k(r�n�|tk(r|j|��g|tk(r |j�|	\|_
|_��|ttfvrd}n�|rF|rD|d}|dt|�k\r+|jj|�t|�|_d}n�|tk(r]d|vsd|vr�|j!|�}|j"�d}|	\}
}|j%d�|j%d	�z}|
||zf}	nA|t&t(fvr3|j*t&t,fvr|jjd
�|j/|�|jj|�|	\|_
|_|ttfvr|xjdz
c_
d|_||_���dj1|j�S)
NFrsTrrrWrkrjz{{z}}r_rr8)�iter�len�compat�ENCODINGr\�	ENDMARKER�INDENTrb�DEDENT�poprYrZ�NEWLINE�NLrX�FSTRING_MIDDLEr|�
splitlines�count�STRING�
FSTRING_STARTr[�FSTRING_ENDrhr')r�iterable�it�indents�	startlinerA�tok_typerwrc�end�line�indent�	last_line�end_line�end_col�extra_charss                rrzUntokenizer.untokenize�s���
�(�^�����	��A��1�v��{����A�r�"��01�-�H�e�U�C���8�#� %��
���9�$���6�!����u�%���V�#����
�/2�,��
�t�}���g�r�]�*� �	��w� ������8�s�6�{�*��K�K�&�&�v�.�$'��K�D�M�!�	��^�+��%�<�3�%�<� �0�0��7�E� 0�� 0� 0� 2�2� 6�I�(+�%�H�g�"+�/�/�$�"7�)�/�/�$�:O�"O�K�#�W�{�%:�;�C��f�m�4�4����F�T_�K`�9`����"�"�3�'�����&��K�K���u�%�+.�(�D�M�4�=��G�R�=�(��
�
��"�
� !��
�%�D�N�S�T�w�w�t�{�{�#�#rc�,�g}|jj}|dttfv}d}d}t	j
|g|�D�]L}|dd\}	}
|	tk(r|
|_�|	ttfvr|
dz
}
|	tk(r
|rd|
z}
d}nd}|	tk(r|dz
}n|	tk(r|dz}|	tk(r|j|
��}|	tk(r|j���|	ttfvrd}n,|r|r||d�d}n|	t k(r|j#|
�}
|
dvr%|jr|jd|
k(r|rd|
z}
|	ttfvr3|j$ttfvr|jjd�||
�|	|_��Oy)	NrFrsr_TrWrr>rkrj)rXrbr�r�r9�chainr�r\�NAME�NUMBERr�r�r�r�r�r�r�r|r[)rrwr�r��toks_appendr��
prevstring�
in_fstring�tok�toknum�tokvals           rr�zUntokenizer.compats������k�k�(�(���!�H��"�
�-�	��
��
��#�#�U�G�X�6�C� ��!�W�N�F�F���!� &��
���$���'��#�
������ �6�\�F�!�
�"�
���&��a��
��;�&��a��
�������v�&���6�!����
���G�R�=�(� �	��w��G�B�K�(�!�	��>�)��-�-�f�5����#�������B��6�8Q�V`��v����&�-�0�0�T�^�^��P[�G\�5\����"�"�3�'����#�D�N�Y7rN)rrr r]rhr|rr�r"rrrUrU�s���1�#�..$�`3$rrUc��t�}|j|�}|j�|j|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
    )rUrr\�encode)r��ut�outs   rrr:s:��(
��B�
�-�-��
!�C�	�{�{���j�j����%���Jrc��|ddj�jdd�}|dk(s|jd�ry|dvs|jd�ry	|S)
z(Imitates get_normal_name in tokenizer.c.N��_�-�utf-8zutf-8-)zlatin-1�
iso-8859-1ziso-latin-1)zlatin-1-ziso-8859-1-ziso-latin-1-r�)�lower�replace�
startswith)�orig_enc�encs  r�_get_normal_namer�UsX���3�B�-�
�
�
�
'�
'��S�
1�C�
�g�~�����1��
�6�6�
�~�~�A�B���Orc�j����	�jj�d�d}d}�fd�}��fd�}|�}|jt�r	d�|dd}d}|s|gfS||�}|r||gfSt
j
|�s||gfS|�}|s||gfS||�}|r|||gfS|||gfS#t$rd�Y��wxYw)	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�c�2��	��S#t$rYywxYw)Nr)�
StopIteration��readlines�r�read_or_stopz%detect_encoding.<locals>.read_or_stopxs"���	��:����	��	�s�
�	�c����	|jd�}tj|�}|syt
|jd��}	t|�}�r5|dk7r+��
d}t|��dj��}t|��|d	z
}|S#t$r"d}��dj|��}t|��wxYw#t$r0��d|z}t|��dj�|�}t|��wxYw)
Nr�z'invalid or missing encoding declarationz{} for {!r}rWzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig)
�decode�UnicodeDecodeErrorra�SyntaxError�	cookie_re�matchr�r*r�LookupError)r��line_string�msgr�r\�codec�	bom_found�filenames      ��r�find_cookiez$detect_encoding.<locals>.find_cookie~s(���		#��+�+�g�.�K�����,����#�E�K�K��N�3��		#��8�$�E���7�"��#�3�C�"�#�&�&�=�C�C�H�M�C�!�#�&�&����H����="�	#�;�C��#�#�*�*�3��9���c�"�"�		#���	#���*�X�5���c�"�"�6�<�<�X� �"���c�"�"�	#�s�B�B9�+B6�99C2T��	utf-8-sig)�__self__�name�AttributeErrorr�r�blank_rer�)	r�r\�defaultr�r��first�secondr�r�s	`      @@rrr`s����"��$�$�)�)���I��H��G��$�L
�N�E�����!��	��a�b�	�������{���5�!�H���%�� � ��>�>�%� ������
�^�F��������6�"�H���%���(�(��U�F�O�#�#��O�����s�B$�$B2�1B2c���t|d�}	t|j�\}}|jd�t	||d��}d|_|S#|j
��xYw)zXOpen a file in read only mode using the encoding detected by
    detect_encoding().
    �rbrT)�line_bufferingr3)�
_builtin_openrr��seekr�mode�close)r��bufferr\�lines�texts     rrr�s_���8�T�
*�F��)�&�/�/�:���%����A���V�X�d�C����	���������
�s�?A�A!c#��K�t|�\}}tj|t|d��}|�|dk(rd}t	t
|ddd���t
|j|d��Ed{���y7��w)	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.
    rNr�r�)rrr8T��extra_tokens)rr9r�r~r
r��!_generate_tokens_from_c_tokenizer�__next__)r�r\�consumed�rl_gens    rr	r	�sm����&)��2��H�h�
�
�
�h��X�s�(;�
<�F����{�"��H���(�F�F�B�?�?�0����(�Y]�^�^�^�s�A(A2�*A0�+A2c��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.
    Tr�)r�r�s rr
r
�s��-�X�D�I�Irc�R�
�ddl}d��
d�
fd�	}|jd��}|jdddd	�
�|jddd
dd��|j�}	|jr@|j}t|d�5}t
t|j��}ddd�n'd}ttjjd��}D]g}|j}|jr|j}d|j|j zz}	t#|	d�t$|d�|j&d����iy#1swY�vxYw#t($r8}
|
j*ddd\}}||
j*d||f�Yd}
~
yd}
~
wt,$r5}
|
j*d\}}||
j*d||f�Yd}
~
yd}
~
wt.$r}
||
�Yd}
~
yd}
~
wt0$r}
||
�Yd}
~
yd}
~
wt2$rt#d�Yyt4$r}
�
d|
z��d}
~
wwxYw)Nrc��tjj|�tjjd�y)N�
)�sys�stderr�write)�messages r�perrorzmain.<locals>.perror�s&���
�
����!��
�
����rc���|r|f|z|fz}�d|z�n|r�|�d|���n�d|z�tjd�y)Nz%s:%d:%d: error: %sz	: error: z	error: %srW)r��exit)r�r��location�argsr�s    �r�errorzmain.<locals>.error�sO�����;��)�W�J�6�D��(�4�/�0�
��h��8�9��;��(�)�����rzpython -m tokenize)�progr�r/zfilename.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�z<stdin>Tr�z%d,%d-%d,%d:�20�15rWr�zinterrupted
zunexpected error: %s)NN)�argparse�ArgumentParser�add_argument�
parse_argsr�r��listr	r�r�r��stdinrr�rrcr��printrr�IndentationErrorr�rOr��OSError�KeyboardInterrupt�	Exception)r�r��parserr�r�r5rXrw�
token_type�token_range�errr��columnr�s             @r�mainr	�s�������
$�
$�*>�
$�
?�F�
���Z�s� -�F��H�����i�g�l�G��I�����D�"��=�=��}�}�H��x��.�!��h�q�z�z�2�3��/�.�!�H�6��	�	�"�"��7�F�
�E����J��z�z�"�-�-�
�(�E�K�K�%�)�)�,C�D�K����� 4�e�l�l�D�
E��/�.�� �5��x�x��{�1�Q�'���f�
�c�h�h�q�k�8�d�F�^�4�4���5��x�x��{���f�
�c�h�h�q�k�8�d�F�^�4�4����
�c�8������
�c�
�
����
�o�����%��+�,�
���sg�$E	�D=� BE	�=E�E	�		H&�.F�H&�+G�H&�
	G�H&�'G4�4H&�
H&�H!�!H&c��d|vry|S)z�Transform 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")r�s r�_transform_msgr/s��3�c�9�)��Jrc#�jK�|�tj||��}ntj|||��}	|D]}tj|����y#t$rR}t|�tk7r|d�t
|j�}t||j|jf�d�d}~wwxYw�w)zWTokenize a source reading Python code as unicode strings using the internal C tokenizerNr�)r\r�)�	_tokenize�
TokenizerIterr
�_maker�rrr�rO�lineno�offset)�sourcer\r�r��info�er�s       rr�r�9s�������
�
$�
$�V�,�
G��
�
$�
$�V�h�\�
Z��>��D��/�/�$�'�'����>���7�k�!�����Q�U�U�#����q�x�x����2�3��=��	>�s)�3B3�A�B3�	B0�A
B+�+B0�0B3�__main__)NF)W�__doc__�
__author__�__credits__�builtinsrr��codecsrr�collections�	functools�ior�	itertoolsr9rEr�rwrr
rF�ASCIIr�r��__all__�
namedtupler
r*r-r0�
Whitespace�Comment�Ignore�Name�	Hexnumber�	Binnumber�	Octnumber�	Decnumber�	Intnumber�Exponent�
Pointfloat�Expfloat�Floatnumber�
Imagnumber�NumberrC�	lru_cacherI�StringPrefix�Single�Double�Single3�Double3�Triple�String�map�escape�sorted�Special�Funny�
PlainToken�Token�ContStr�PseudoExtras�PseudoToken�endpats�_prefix�set�
single_quoted�
triple_quotedrAr4r=�tabsizerrOrSrUrr�rr	r
r	rr�rr"rr�<module>rIs����,*�
���+�#�����	�
��#���B�J�J�@�"�(�(�K�	��2�:�:�0�"�(�(�;���
�-�-�6�6��	��&��&�&�{�4P�Q��:�/�1��
�
��	�c�*�z�1�2�	2�U�7�^�	C��
��&�	��	� �	�.�	��)�Y�	�9�=�	�(��
�?�)�+�-2�8�_�=�
��(�*���J��)��
�+�[�7�-B�
C�
�	�z�;�	�	2��
����(��(�
�*�,�-��
$��	#��
2��
2��	�|�e�#�\�E�%9�	:��	�|�=�=��=�=�
?����R�Y�Y��'8�$� G�H�
I��
�h�� ��
�6�5�&�$�
/�
�������=�=��c�:�&�'��=�=��c�:�&�'�(���]�G�V�4���5��v�u�g�t�L�L��

��#�%�G�#�G�G�c�M��#�G�G�c�M��&�G�G�e�O��&�G�G�e�O��	&�
���
���
�	�	�A��#�g�q�3�w�
�����!�� ��%�i��U��
#�����!��$�
 �
�q�
��!��!�&�Y�%�P$�P$�f�6	�Z$�z
�_�8J�=�~�
>� �z���F�r

?>