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__/util.cpython-311.pyc
�

�ȍc�D����ddlZddlZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
ddlmZm
Z
mZmZmZmZmZmZmZmZmZddlmZerTddlmZGd�d	e
��ZeeefZejdd
kreeeeeefeeefefZ nej Z d�Z!Gd�d
ej"d
d����Z#ejdkrej$Z%n
Gd�d��Z%d6d�Z&d6d�Z'ejdkrd�Z(nd�Z(d�Z)d�Z*d�Z+d�eej,��D��Z-d�Z.d�eej,��D��Z/d�eej,��D��hd�zZ0d�Z1d �Z2d!�Z3d"�Z4d#�Z5d$�Z6d%�Z7e8��Z9d&�Z:d'�Z;d(�Z<Gd)�d*e8��Z=ejdd
krd+�Z>nd,�Z>d-�Z?d.�Z@ejdd
�d/kr dd0lAmBZBeBd�1��d2���ZCd3�ZDdSd4�ZCd5�ZDdS)7�N)�ABCMeta)�Module�expr�AST)�Callable�Dict�Iterable�Iterator�List�Optional�Tuple�Union�cast�Any�
TYPE_CHECKING)�	iteritems�)�NodeNGc��eZdZdZdZdZdS)�EnhancedASTNr)�__name__�
__module__�__qualname__�first_token�
last_token�lineno���0/usr/lib/python3/dist-packages/asttokens/util.pyrr!s�������K��J�
�F�F�Frr�c�p�tj|�dt|���d����S)zRReturns a human-friendly representation of a token with the given type and string.�:�u)�token�tok_name�repr�lstrip)�tok_type�strings  r�
token_reprr*/s3���N�8�,�,�,�d�6�l�l�.A�.A�#�.F�.F�.F�	G�Grc��eZdZdZd�ZdS)�Tokena�
  TokenInfo is an 8-tuple containing the same 5 fields as the tokens produced by the tokenize
  module, and 3 additional ones useful for this module:

  - [0] .type     Token type (see token.py)
  - [1] .string   Token (a string)
  - [2] .start    Starting (row, column) indices of the token (a 2-tuple of ints)
  - [3] .end      Ending (row, column) indices of the token (a 2-tuple of ints)
  - [4] .line     Original line (string)
  - [5] .index    Index of the token in the list of tokens that it belongs to.
  - [6] .startpos Starting character offset into the input text.
  - [7] .endpos   Ending character offset into the input text.
  c�6�t|j|j��S�N)r*�typer)��selfs r�__str__z
Token.__str__Ds���d�i���-�-�-rN)rrr�__doc__r2rrrr,r,6s-��������.�.�.�.�.rr,z0type string start end line index startpos endpos)��c�"�eZdZe��ZdS)�AstConstantN)rrr�object�valuerrrr7r7Ls�������F�H�H�E�E�Err7c�6�|j|ko|dup
|j|kS)zVReturns true if token is of the given type and, if a string is given, has that string.N)r/r)�r$r(�tok_strs   r�match_tokenr=Ps&��
��x�	�	P�W��_�%O����8O�Prc���t|||��sOtdt||���dt|���d|jd�d|jddz�����dS)z�
  Verifies that the given token is of the expected type. If tok_str is given, the token string
  is verified too. If the token doesn't match, raises an informative ValueError.
  zExpected token z, got z	 on line rz col rN)r=�
ValueErrorr*�str�startr;s   r�expect_tokenrBVsw��
�U�H�g�	.�	.�+�
�*���7�#�#�#�#�S��Z�Z�Z�Z��k�!�n�n�n�e�k�!�n�q�(�(�*�+�+�+�+�+r)r4�c�L�|tjtjtjfvS�zW
    These are considered non-coding tokens, as they don't affect the syntax tree.
    )r$�NL�COMMENT�ENCODING��
token_types r�is_non_coding_tokenrKds��
�%�(�E�M�5�>�B�B�Brc�"�|tjkSrE)r$�N_TOKENSrIs rrKrKks��
���'�'rc��tjttgtftj|��j����S)z;
  Generates standard library tokens for the given code.
  )�tokenize�generate_tokensrrr@�io�StringIO�readline)�texts rrPrPss5��
�	!�$�x��C��'8�"�+�d�:K�:K�:T�"U�"U�	V�	V�Vrc�>�t|d��rtntS)z�
  Returns a function which yields all direct children of a AST node,
  skipping children that are singleton nodes.
  The function depends on whether ``node`` is from ``ast`` or from the ``astroid`` module.
  �get_children)�hasattr�iter_children_astroid�iter_children_ast��nodes r�iter_children_funcr\~s ��#*�$��"?�"?�	V�	�	�EV�Vrc�L�t|��rgS|���Sr.)�
is_joined_strrVrZs rrXrX�s+���4����
�I�	
�	�	�	�	�rc
���h|]c\}}t|t���t|tjtjtjtjtjf���a|��dSr)	�
isinstancer/�
issubclass�ast�expr_context�boolop�operator�unaryop�cmpop��.0�n�cs   r�	<setcomp>rl�sk��c�c�c�D�A�q�z�!�T�7J�7J�c���S�-�s�z�3�<���VY�V_�`�a�a�c�a�c�c�crc#�
K�t|��rdSt|tj��r,t	|j|j��D]\}}|�|V�|V��dStj|��D]}|jtvr|V��dSr.)
r^r`rbr�zip�keys�values�iter_child_nodes�	__class__�
SINGLETONS)r[�keyr9�childs    rrYrY�s������4����
�F���c�h�����D�I�t�{�3�3�����e�	���	�	�	��k�k�k�k�
�F��#�D�)�)���e�
��j�(�(��k�k�k���rc�v�h|]6\}}t|t���t|tj���4|��7Sr)r`r/rarb�stmtrhs   rrlrl�sV��H�H�H�$�!�Q�!�!�T�*�*�H�/9�!�S�X�/F�/F�H�A�H�H�Hrc�v�h|]6\}}t|t���t|tj���4|��7Sr)r`r/rarbrrhs   rrlrl�sV��H�H�H�4�1�a�!�!�T�*�*�H�/9�!�S�X�/F�/F�H�Q�H�H�Hr>�Const�DelAttr�DelName�
AssignAttr�
AssignNamec�(�|jjtvS)z+Returns whether node is an expression node.)rrr�expr_class_namesrZs r�is_exprr�����
��	 �$4�	4�4rc�(�|jjtvS)z)Returns whether node is a statement node.)rrr�stmt_class_namesrZs r�is_stmtr��r�rc�"�|jjdkS)z&Returns whether node is a module node.r�rrrrZs r�	is_moduler��s��
��	 �H�	,�,rc�"�|jjdkS)zFReturns whether node is a JoinedStr node, used to represent f-strings.�	JoinedStrr�rZs rr^r^�s��

��	 �K�	/�/rc�"�|jjdkS)z2Returns whether node is a starred expression node.�Starredr�rZs r�
is_starredr��s��
��	 �I�	-�-rc	��|jjdvpN|jjdko>tttttj|��j����S)z?Returns whether node represents a slice, e.g. `1:2` in `x[1:2]`)�Slice�ExtSlicer
)	rrr�any�map�is_slicerrbr
�eltsrZs rr�r��sR���n��!6�6��
�.�
!�W�
,�=��#�h��S�Y�� 5� 5� :�;�;�<�<�	rc��|jjdko:t|tj��o|j|jcxuo
|jcxuoduncS)Nr�)rrrr`rbr�lower�upper�steprZs r�is_empty_astroid_slicer��se���n���(�8���s�w�'�'�
'�8�
�*��
�
7�
7�
7�
7�d�i�
7�
7�
7�
7�4�
7�
7�
7�
7�rc��|sd�}t|��}t��}d}|dtfg}|r�|���\}}}	|	tur~||vsJ�|�|��|||��\}
}|�|||f��t
|��}||��D] }
|�||
|
tf���!n+|||ttt|	����}|��|S)a5
  Scans the tree under the node depth-first using an explicit stack. It avoids implicit recursion
  via the function call stack to avoid hitting 'maximum recursion depth exceeded' error.

  It calls ``previsit()`` and ``postvisit()`` as follows:

  * ``previsit(node, par_value)`` - should return ``(par_value, value)``
        ``par_value`` is as returned from ``previsit()`` of the parent.

  * ``postvisit(node, par_value, value)`` - should return ``value``
        ``par_value`` is as returned from ``previsit()`` of the parent, and ``value`` is as
        returned from ``previsit()`` of this node itself. The return ``value`` is ignored except
        the one for the root node, which is returned from the overall ``visit_tree()`` call.

  For the initial node, ``par_value`` is None. ``postvisit`` may be None.
  c��dSr.r)r[�pvaluer9s   r�<lambda>zvisit_tree.<locals>.<lambda>�s��D�rN)r\�set�	_PREVISIT�pop�add�append�len�insertrrr,)r[�previsit�	postvisit�
iter_children�done�ret�stack�current�	par_valuer9r��
post_value�insrjs              r�
visit_treer��s6��$
�1�0�0�I�$�T�*�*�-�	���$��#��$�	�"�
#�%�
�H� %�	�	����G�Y���	���
�D�
 �
 �
 �
 �
�h�h�w����#�8�G�Y�7�7��f�j��l�l�G�Y�
�3�4�4�4�
��J�J�c��}�W�%�%�2�2�!�
���S�1�f�i�0�1�1�1�1�2�
�I�g�y�$�x����*F�*F�G�G�c�	�H�

�*rc#�"K�t|��}t��}|g}|rj|���}||vsJ�|�|��|V�t	|��}||��D]}|�||���|�hdSdS)a�
  Recursively yield all descendant nodes in the tree starting at ``node`` (including ``node``
  itself), using depth-first pre-order traversal (yieling parents before their children).

  This is similar to ``ast.walk()``, but with a different order, and it works for both ``ast`` and
  ``astroid`` trees. Also, as ``iter_children()``, it skips singleton nodes generated by ``ast``.
  N)r\r�r�r�r�r�)r[r�r�r�r�r�rks       r�walkr�s�����%�T�*�*�-�	���$��&�%�
���i�i�k�k�G��$������H�H�W����
�M�M�M��e�*�*�C�
�]�7�
#�
#�����l�l�3������	�����rc��d}g}t|��D]:\}}}|�|||���|�|��|}�;|�||d���d�|��S)ah
  Replaces multiple slices of text with new values. This is a convenience method for making code
  modifications of ranges e.g. as identified by ``ASTTokens.get_text_range(node)``. Replacements is
  an iterable of ``(start, end, new_text)`` tuples.

  For example, ``replace("this is a test", [(0, 4, "X"), (8, 9, "THE")])`` produces
  ``"X is THE test"``.
  rN�)�sortedr��join)rT�replacements�p�partsrA�end�new_texts       r�replacer�0s����!�
�%� &�|� 4� 4����u�c�8�	�L�L��a��g�����	�L�L������A�A��,�,�t�A�B�B�x����	������rc��eZdZdZd�Zd�ZdS)�NodeMethodsz[
  Helper to get `visit_{node_type}` methods given a node's class and cache the results.
  c��i|_dSr.)�_cacher0s r�__init__zNodeMethods.__init__Hs
���D�K�K�Krc��|j�|��}|s<d|j���z}t	|||j��}||j|<|S)z�
    Using the lowercase name of the class as node_type, returns `obj.visit_{node_type}`,
    or `obj.visit_default` if the type-specific method is not found.
    �visit_)r��getrr��getattr�
visit_default)r1�obj�cls�method�names     rr�zNodeMethods.getLs\���[�_�_�S�
!�
!�F�� �
���*�*�,�,�
,�d��s�D�#�"3�4�4�f��d�k�#���MrN)rrrr3r�r�rrrr�r�Ds<���������������rr�c� �t|��Sr.)�iter)�original_tokenss r�patched_generate_tokensr�]s���� � � rc#�,K�g}|D]v}|jtjtjtjfvr.|r|dj|jkr|�|���Zt|��D]}|V��g}|V��wt|��D]}|V��dS)a�
    Fixes tokens yielded by `tokenize.generate_tokens` to handle more non-ASCII characters in identifiers.
    Workaround for https://github.com/python/cpython/issues/68382.
    Should only be used when tokenizing a string that is known to be valid syntax,
    because it assumes that error tokens are not actually errors.
    Combines groups of consecutive NAME, NUMBER, and/or ERRORTOKEN tokens into a single NAME token.
    ���N)	r/rO�NAME�
ERRORTOKEN�NUMBERr�rAr��combine_tokens)r��group�tok�combined_tokens    rr�r�as�����
�E�����

�(�x�}�h�&9�8�?�K�
K�
K��L�!�"�I�M�S�Y�6�6�
���S�����,�U�3�3�	�	�N��
�
�
�
����	�	�	�	�(��/�/����������rc�6�td�|D����rtd�|D����dkr|Stjtjd�d�|D����|dj|dj|dj���gS)	Nc3�@K�|]}|jtjkV��dSr.)r/rOr��rir�s  r�	<genexpr>z!combine_tokens.<locals>.<genexpr>|s,����@�@�3�s�x�8�.�.�@�@�@�@�@�@rc��h|]	}|j��
Sr)�liner�s  rrlz!combine_tokens.<locals>.<setcomp>|s��Hc�Hc�Hc�VY���Hc�Hc�Hcrrr�c3�$K�|]}|jV��dSr.)r))ri�ts  rr�z!combine_tokens.<locals>.<genexpr>�s$����/�/�A�q�x�/�/�/�/�/�/rrr�)r/r)rAr�r�)	r�r�rO�	TokenInfor�r�rAr�r�)r�s rr�r�zs����@�@�%�@�@�@�@�@��C�Hc�Hc�]b�Hc�Hc�Hc�Dd�Dd�hi�Di�Di�
�l���
�]��w�w�/�/��/�/�/�/�/��A�h�n��"�I�M�
�1�X�]�����rc�p�d�tj|��D��}|rt|d��S|S)zq
  If the given AST node contains multiple statements, return the last one.
  Otherwise, just return the node.
  c��g|]?}t|tjtjt	tdd��f���=|��@S)�
match_caser)r`rbrw�
excepthandlerr�)rirus  r�
<listcomp>zlast_stmt.<locals>.<listcomp>�sQ�������%�#�(�C�$5�w�s�L�RT�7U�7U�V�W�W��	���rr�)rbrq�	last_stmt)r[�child_stmtss  rr�r��sL�����+�D�1�1����+��&��[��_�%�%�%�	
�+r)r4�)�	lru_cache)�maxsizec���d�tj���}d�tj|��D��}d�|D��}tt	|����t|��k}t�fd�|D����}|o|S)a�
    The positions attached to nodes inside f-string FormattedValues have some bugs
    that were fixed in Python 3.9.7 in https://github.com/python/cpython/pull/27729.
    This checks for those bugs more concretely without relying on the Python version.
    Specifically this checks:
     - Values with a format spec or conversion
     - Repeated (i.e. identical-looking) expressions
     - Multiline f-strings implicitly concatenated.
    z�(
      f"a {b}{b} c {d!r} e {f:g} h {i:{j}} k {l:{m:n}}"
      f"a {b}{b} c {d!r} e {f:g} h {i:{j}} k {l:{m:n}}"
      f"{x + y + z} {x} {y} {z} {z} {z!a} {z:z}"
    )c�F�g|]}t|tj���|��Sr)r`rb�Name�rir[s  rr�z*fstring_positions_work.<locals>.<listcomp>�s)��P�P�P�4�Z��c�h�5O�5O�P�$�P�P�Prc�*�g|]}|j|jf��Sr)r�
col_offsetr�s  rr�z*fstring_positions_work.<locals>.<listcomp>�s!��L�L�L��t�{�D�O�4�L�L�Lrc3�T�K�|]"}tj�|��|jkV��#dSr.)rb�get_source_segment�id)rir[�sources  �rr�z)fstring_positions_work.<locals>.<genexpr>�sK�����"�"�
�
��V�T�*�*�d�g�5�"�"�"�"�"�"r)rb�parser�r�r��all)�tree�
name_nodes�name_positions�positions_are_unique�correct_source_segmentsr�s     @r�fstring_positions_workr��s����	�F�
�9�V���D�P�P�3�8�D�>�>�P�P�P�J�L�L��L�L�L�N��s�>�2�2�3�3�s�>�7J�7J�J��!�"�"�"�"��"�"�"���� �;�$;�;rc��t|��D]�}t|tj��s�|jD]�}t|dd��t|tj��rgt��s(t|j��D]}t|dd���|j	r*t|j	dd��t|j	������dS)z
    Add a special attribute `_broken_positions` to nodes inside f-strings
    if the lineno/col_offset cannot be trusted.
    �_broken_positionsTN)r�r`rbr�rp�setattr�FormattedValuer�r9�format_spec�annotate_fstring_nodes)r��	joinedstr�partrus    rrr�s����$�Z�Z�5�5�	�
�	�3�=�
1�
1����"�5�5�$���)�4�0�0�0��d�C�.�/�/�	5�'�)�)�8��d�j�)�)�
8�
8���e�0�$�7�7�7�7�
�
�5��D�$�&9�4�@�@�@�
#�4�#3�4�4�4��5�5�5rc��dS)NFrrrrr�r��s���5rc��dSr.r)�_trees rrr�s���Drr.)Erb�collectionsrQ�sysr$rO�abcrrrr�typingrrr	r
rrr
rrrr�sixr�astroid_compatrr�AstNode�version_info�intr@r�r*�
namedtupler,�Constantr7r=rBrKrPr\rX�__dict__rsrYr�rr�r�r�r^r�r�r�r8r�r�r�r�r�r�r�r��	functoolsr�r�rrrr�<module>rs����
�
�
�����	�	�	�	�
�
�
�
���������������!�!�!�!�!�!�!�!�!�!�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m��������#�$�$�$�$�$�$������C����
�+�v�%�&�'���a��A����c�3��c�3�h���s�C�x��#�E�F�I�I��"�I�H�H�H�.�.�.�.�.�"�K�"�7�,^�_�_�.�.�.�&��v�����+�+���������Q�Q�Q�Q�	+�	+�	+�	+���v���C�C�C�C�(�(�(�W�W�W�W�W�W����c�c�I�I�c�l�3�3�c�c�c�
����.H�H�)�)�C�L�"9�"9�H�H�H��H�H�9�9�S�\�#:�#:�H�H�H�O�O�O�P��5�5�5�
5�5�5�
-�-�-�
0�0�0�.�.�.�������
�F�H�H�	�(
�(
�(
�X���4���(�����&����,��A��!���!�!�!�!����2��������B�Q�B��6�!�!�!�!�!�!�!�!��9�T����<�<���<�45�5�5�5�5�4���	�	�	�	�	r

Youez - 2016 - github.com/yon3zu
LinuXploit