403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/asttokens/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/asttokens/__pycache__/asttokens.cpython-311.pyc
�

�\c$E��
�ddlZddlZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZmZm
Z
mZmZddlZddlmZddlmZddlmZmZmZmZmZmZmZerddlmZmZGd	�d
ejej e!����Z"Gd�de"e!��Z#Gd
�de"e!��Z$dZ%ej&dd�dkrMe%ej'ej(fz
Z%ej&dd�dkr)e%ej)ej*ej+ej,ej-ej.fz
Z%dd�Z/dS)�N)�Module)	�Iterable�Iterator�List�Optional�Tuple�Any�cast�
TYPE_CHECKING�Type)�xrange�)�LineNumbers)�Token�match_token�is_non_coding_token�patched_generate_tokens�	last_stmt�annotate_fstring_nodes�generate_tokens)�AstNode�	TokenInfoc�D�eZdZd�Zejd���Zdd�Zdd�ZdS)�ASTTextBasec�r�||_tj|��}||_t	|��|_dS�N)�	_filename�six�ensure_text�_textr�
_line_numbers)�self�source_text�filenames   �5/usr/lib/python3/dist-packages/asttokens/asttokens.py�__init__zASTTextBase.__init__"s9��
�D�N�
�/�+�.�.�K��D�J�$�[�1�1�D����c��t�)��
    Returns two ``(lineno, col_offset)`` tuples for the start and end of the given node.
    If the positions can't be determined, or the nodes don't correspond to any particular text,
    returns ``(1, 0)`` for both.

    ``padded`` corresponds to the ``padded`` argument to ``ast.get_source_segment()``.
    This means that if ``padded`` is True, the start position will be adjusted to include
    leading whitespace if ``node`` is a multiline statement.
    )�NotImplementedError�r"�node�paddeds   r%�get_text_positionszASTTextBase.get_text_positions1s
���r'Tc�p�|�||��\}}|jj|�|jj|�fS)a
    Returns the (startpos, endpos) positions in source text corresponding to the given node.
    Returns (0, 0) for nodes (like `Load`) that don't correspond to any particular text.

    See ``get_text_positions()`` for details on the ``padded`` argument.
    )r.r!�line_to_offset�r"r,r-�start�ends     r%�get_text_rangezASTTextBase.get_text_range?sG���(�(��v�6�6�J�E�3�'�d��'��/�'�d��'��-��r'c�R�|�||��\}}|j||�S)z�
    Returns the text corresponding to the given node.
    Returns '' for nodes (like `Load`) that don't correspond to any particular text.

    See ``get_text_positions()`` for details on the ``padded`` argument.
    )r4r r1s     r%�get_textzASTTextBase.get_textMs.���$�$�T�6�2�2�J�E�3��:�e�S�j�!�!r'N)T)	�__name__�
__module__�__qualname__r&�abc�abstractmethodr.r4r6�r'r%rr!sj������
2�
2�
2������������	"�	"�	"�	"�	"�	"r'rc����eZdZdZd�fd�	Zd�Zd�Zed���Zed	���Z	ed
���Z
ed���Zd�Zd
�Z
d�Zdd�Zdd�Zdd�Z	dd�Zdd�Zd�Z�xZS)�	ASTTokensa�
  ASTTokens maintains the text of Python code in several forms: as a string, as line numbers, and
  as tokens, and is used to mark and access token and position information.

  ``source_text`` must be a unicode or UTF8-encoded string. If you pass in UTF8 bytes, remember
  that all offsets you'll get are to the unicode text, which is available as the ``.text``
  property.

  If ``parse`` is set, the ``source_text`` will be parsed with ``ast.parse()``, and the resulting
  tree marked with token info and made available as the ``.tree`` property.

  If ``tree`` is given, it will be marked and made available as the ``.tree`` property. In
  addition to the trees produced by the ``ast`` module, ASTTokens will also mark trees produced
  using ``astroid`` library <https://www.astroid.org>.

  If only ``source_text`` is given, you may use ``.mark_tokens(tree)`` to mark the nodes of an AST
  tree created separately.
  FN�	<unknown>c���tt|���||��|rtj||��n||_|�t
|j��}t|�	|����|_
d�|j
D��|_|jr|�|j��dSdS)Nc��g|]	}|j��
Sr<)�startpos)�.0�toks  r%�
<listcomp>z&ASTTokens.__init__.<locals>.<listcomp>|s��@�@�@�C�3�<�@�@�@r')
�superr>r&�ast�parse�_treerr �list�_translate_tokens�_tokens�_token_offsets�mark_tokens)r"r#rH�treer$�tokens�	__class__s      �r%r&zASTTokens.__init__ms����

�)�T���#�#�K��:�:�:�5:�D���;��1�1�1��D�J��~��t�z�*�*�f���.�.�v�6�6�7�7�D�L�A�@�4�<�@�@�@�D���z�#�
���t�z�"�"�"�"�"�#�#r'c�N�ddlm}||���|��dS)ap
    Given the root of the AST or Astroid tree produced from source_text, visits all nodes marking
    them with token and position information by adding ``.first_token`` and
    ``.last_token``attributes. This is done automatically in the constructor when ``parse`` or
    ``tree`` arguments are set, but may be used manually with a separate AST or Astroid tree.
    r)�
MarkTokensN)rNrS�
visit_tree)r"�	root_noderSs   r%rNzASTTokens.mark_tokens�s:��(�'�'�'�'�'��J�t�����	�*�*�*�*�*r'c#�"K�tt|����D]o\}}|\}}}}}t|||||||j�|d|d��|j�|d|d����V��pdS)zS
    Translates the given standard library tokens into our own representation.
    rrN)�	enumeraterrr!r0)	r"�original_tokens�indexrD�tok_type�tok_strr2r3�lines	         r%rKzASTTokens._translate_tokens�s�����
 � 7�� H� H�I�I�E�E�
��s�,/�)�h����T��(�G�U�C��u��$�3�3�E�!�H�e�A�h�G�G��$�3�3�C��F�C��F�C�C�
E�
E�E�E�E�E�E�Er'c��|jS)z,The source code passed into the constructor.)r �r"s r%�textzASTTokens.text�����:�r'c��|jS)zIThe list of tokens corresponding to the source code from the constructor.)rLr^s r%rPzASTTokens.tokens�s���<�r'c��|jS)zTThe root of the AST tree passed into the constructor or parsed from the source code.)rIr^s r%rOzASTTokens.tree�r`r'c��|jS)zThe filename that was parsed)rr^s r%r$zASTTokens.filename�s���>�r'c�R�|jtj|j|��dz
S)z�
    Returns the token containing the given character offset (0-based position in source text),
    or the preceeding token if the position is between tokens.
    r)rL�bisectrM)r"�offsets  r%�get_token_from_offsetzASTTokens.get_token_from_offset�s%���<��
�d�&9�6�B�B�Q�F�G�Gr'c�^�|�|j�||����S)z�
    Returns the token containing the given (lineno, col_offset) position, or the preceeding token
    if the position is between tokens.
    )rgr!r0�r"�lineno�
col_offsets   r%�	get_tokenzASTTokens.get_token�s,���%�%�d�&8�&G�&G��PZ�&[�&[�\�\�\r'c�`�|�||j�||����S)zd
    Same as get_token(), but interprets col_offset as a UTF8 offset, which is what `ast` uses.
    )rlr!�
from_utf8_colris   r%�get_token_from_utf8zASTTokens.get_token_from_utf8�s+��
�>�>�&�$�"4�"B�"B�6�:�"V�"V�W�W�Wr'c��|jdz}|sCt|j|j��r$|dz
}t|j|j���$|j|S)z�
    Returns the next token after the given one. If include_extra is True, includes non-coding
    tokens from the tokenize module, such as NL and COMMENT.
    r�rYrrL�type�r"rD�
include_extra�is    r%�
next_tokenzASTTokens.next_token��`��	�	�A�
�A������Q�� 4�5�5��	�Q���
 ���Q�� 4�5�5���<��?�r'c��|jdz
}|sCt|j|j��r$|dz}t|j|j���$|j|S)z�
    Returns the previous token before the given one. If include_extra is True, includes non-coding
    tokens from the tokenize module, such as NL and COMMENT.
    rrqrss    r%�
prev_tokenzASTTokens.prev_token�rwr'c���|}|r|jn|j}t|||��sPtj|j��s7||d���}t|||��stj|j���7|S)z�
    Looks for the first token, starting at start_token, that matches tok_type and, if given, the
    token string. Searches backwards if reverse is True. Returns ENDMARKER token if not found (you
    can check it with `token.ISEOF(t.type)`.
    T�rt)ryrvr�token�ISEOFrr)r"�start_tokenrZr[�reverse�t�advances       r%�
find_tokenzASTTokens.find_token�s���	�A�!(�=�d�o�o�d�o�G��!�X�w�/�/�)���A�F�8K�8K�)�
�'�!�4�
(�
(�
(�a��!�X�w�/�/�)���A�F�8K�8K�)��Hr'c#�K�t|j|jdz��D]2}|st|j|j��s|j|V��3dS)z�
    Yields all tokens in order from first_token through and including last_token. If
    include_extra is True, includes non-coding tokens such as tokenize.NL and .COMMENT.
    rN)r
rYrrLrr)r"�first_token�
last_tokenrtrus     r%�token_rangezASTTokens.token_range�sj�����K�%�z�'7�!�';�
<�
<����	��1�$�,�q�/�2F�G�G���l�1�o������r'c�F�|�|j|j|���S)z�
    Yields all tokens making up the given node. If include_extra is True, includes non-coding
    tokens such as tokenize.NL and .COMMENT.
    r{)r�r�r�)r"r,rts   r%�
get_tokenszASTTokens.get_tokens�s$�����D�,�d�o�]��[�[�[r'c���t|d��sdS|jj}|jj}|r6td�|�|��D����r
|ddf}||fS)r)r���rrr�c3�JK�|]}t|tj��V��dSr)rr|�NEWLINE)rCr�s  r%�	<genexpr>z/ASTTokens.get_text_positions.<locals>.<genexpr>s.����S�S��k�!�U�]�3�3�S�S�S�S�S�Sr'r)�hasattrr�r2r�r3�anyr�r1s     r%r.zASTTokens.get_text_positionssy���4��'�'��
�^���"�E�
�/�
�C�
��#�S�S�T�_�_�T�=R�=R�S�S�S�S�S���Q�x��m�e��#�:�r')FNr?N)F)NF)r7r8r9�__doc__r&rNrK�propertyr_rPrOr$rgrlrorvryr�r�r�r.�
__classcell__�rQs@r%r>r>Ys����������&#�#�#�#�#�#�(
+�
+�
+�	E�	E�	E�����8��
����8��
����8��
����8��
H�H�H�	]�	]�	]�X�X�X�
�
�
�
�
�
�
�
�
�
�
�
� !&�����\�\�\�\�������r'r>c�\��eZdZdZd	�fd�	Zed���Zed���Zd�Zd�Z	�xZ
S)
�ASTTexta�
  Supports the same ``get_text*`` methods as ``ASTTokens``,
  but uses the AST to determine the text positions instead of tokens.
  This is faster than ``ASTTokens`` as it requires less setup work.

  It also (sometimes) supports nodes inside f-strings, which ``ASTTokens`` doesn't.

  Astroid trees are not supported at all and will raise an error.

  Some node types and/or Python versions are not supported.
  In these cases the ``get_text*`` methods will fall back to using ``ASTTokens``
  which incurs the usual setup cost the first time.
  If you want to avoid this, check ``supports_tokenless(node)`` before calling ``get_text*`` methods.
  Nr?c���t|tjtd��f��st	d���tt|���||��||_|j�t|j��d|_
dS)NzASTText only supports AST trees)�
isinstancerG�ASTrrr*rFr�r&rIr�
_asttokens)r"r#rOr$rQs    �r%r&zASTText.__init__+s~���
�d�S�W�d�4�j�j�1�2�2�C�� A�B�B�B�	�'�4���!�!�+�x�8�8�8��D�J��z���T�Z�(�(�(��D�O�O�Or'c��|j�8tj|j|j��|_t|j��|jSr)rIrGrHr rrr^s r%rOzASTText.tree;s;���z���9�T�Z���8�8�d�j��T�Z�(�(�(��:�r'c�j�|j�&t|j|j|j���|_|jS)N)rOr$)r�r>r rOrr^s r%�	asttokenszASTText.asttokensCs;�����!�
�*��y��>����d�o�
�?�r'c��tjdd�dkrtd���t|tj��r.d|j�t|j	����fSt|d��sdS|sJ�t|dg��}|r	|d	}n|}|r t|��j
|j
krd	}n%|j�|j
|j��}|j
|f}t|��}t!t"|j��}t!t"|j��}	|j�||	��}	||	f}
||
fS)
zF
    Version of ``get_text_positions()`` that doesn't use tokens.
    N����zPThis method should only be called internally after checking supports_tokenless()r�rjr��decorator_listr)�sys�version_info�AssertionErrorr�rGrr!�offset_to_line�lenr r��getattrrrjrnrkr
�int�
end_lineno�end_col_offset)r"r,r-�
decorators�
start_node�start_col_offsetr2�end_noder�r�r3s           r%�_get_text_positions_tokenlessz%ASTText._get_text_positions_tokenlessNsb��
������f�$�$��m�n�n�n��$��
�#�#�H�
�T�'�6�6�s�4�:���G�G�
G�G��4��"�"��
�^��K�K�K���/��4�4�J����a�=�j�j��j�
�d�)�D�/�/�(�D�K�7�7�����+�9�9�*�:K�Z�Mb�c�c��
�
� 0�1�E�
����H��c�8�.�/�/�J��#�x�6�7�7�N��'�5�5�j�.�Q�Q�N��~�
&�C��#�:�r'c��t|dd��rdSt|��r|�||��S|j�||��S)r)�_broken_positionsNr�)r��supports_tokenlessr�r�r.r+s   r%r.zASTText.get_text_positions~s\���t�(�$�/�/��
�^��$���>�
�
/�
/��f�
=�
=�=��>�,�,�T�6�:�:�:r')Nr?)r7r8r9r�r&r�rOr�r�r.r�r�s@r%r�r�s��������
�
������� ����8������8��.�.�.�`;�;�;�;�;�;�;r'r�r<r�r�c���t|tjtd��f��oMt|t��o7t
jdd�dkodt
j���vS)aQ
  Returns True if the Python version and the node (if given) are supported by
  the ``get_text*`` methods of ``ASTText`` without falling back to ``ASTTokens``.
  See ``ASTText`` for why this matters.

  The following cases are not supported:

    - Python 3.7 and earlier
    - PyPy
    - Astroid nodes (``get_text*`` methods of ``ASTText`` will raise an error)
    - ``ast.arguments`` and ``ast.withitem``
    - The following nodes in Python 3.8 only:
      - ``ast.arg``
      - ``ast.Starred``
      - ``ast.Slice``
      - ``ast.ExtSlice``
      - ``ast.Index``
      - ``ast.keyword``
  Nr�r��pypy)	r�rGr�rr�_unsupported_tokenless_typesr�r��version�lower)r,s r%r�r��so��,�����d���,�-�-�,���;�<�<�
<�,�

�
�2�A�2�
�&�
(�,����)�)�+�+�
+�	r'r)0r:rGrer�r|r�typingrrrrrr	r
rrr�	six.movesr
�line_numbersr�utilrrrrrrrrr�with_metaclass�ABCMeta�objectrr>r�r�r��	arguments�withitem�arg�Starred�Slice�ExtSlice�Index�keywordr�r<r'r%�<module>r�s����
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�����������\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�
�
�
�
�������%�%�%�%�%�%�G�G�G�G�G�G�G�G�G�G�G�G�G�G�G�G�G�G��'�&�&�&�&�&�&�&�&�5"�5"�5"�5"�5"�$�#�$�S�[�&�9�9�5"�5"�5"�p@�@�@�@�@��V�@�@�@�Ft;�t;�t;�t;�t;�k�6�t;�t;�t;�p "����B�Q�B��6�!�!���M�3�<�#���	��b�q�b��V�#�#� �	�g�s�{�	�i���s�y�#�+�	%�� ������r'

Youez - 2016 - github.com/yon3zu
LinuXploit