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 :  /lib/python3/dist-packages/executing/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

"(�cL����dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZm
Z
ddlmZddlmZddlmZddlmZddlmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&erdd	l'm(Z(m)Z)dd
l*m+Z+ej,fZ-e	j.ddkre-ej/fz
Z-e	j.ddkr'ddlm0Z0dd
l1m2Z2ddlm3Z3ddl4m5Z5e0d���Z6e7Z8n!ddl9m2Z2m:Z;ddlm<Z3Gd�de=��Z5d�Z6e>Z8Gd�dej?��Z@e	j.dkrejAZBddlmCZDGd�deD��ZCn+Gd�de
dd����ZCddlmEZEmFZFmGZGmHZHmIZImJZJd�ZBGd �d!eC��ZKdJd#�ZLd$�ZAdZMGd%�d&eN��ZOe$d'��ZPd(�ZQGd)�d*e=��ZRGd+�d,e=��ZSGd-�d.ejT��ZUeVd/�ejWD����ZXd0�ZYd1ZZd2�Z[Gd3�d4e=��Z\d5�Z]d6�Z^d7�Z_d8�Z`d9�Zad:�Zbd;�Zcd<�Zdd=�Zee��Zfe6d>���Zgd?�Zhd@�ZidA�ZjdB�ZkdC�ZldD�ZmdE�ZndF�Zoe	j.dGkrdHdIlpmqZrdSe\ZrdS)Ka+
MIT License

Copyright (c) 2021 Alex Hall

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
�N)�defaultdict�
namedtuple)�deepcopy)�islice)�
attrgetter)�RLock)�
TYPE_CHECKING�Any�Callable�Dict�Iterable�Iterator�List�Optional�Sequence�Set�Sized�Tuple�Type�TypeVar�Union�cast)�	ASTTokens�ASTText)�ASTTextBase�)�	lru_cache)�detect_encoding)�zip_longest)�Path)�maxsize)r�	cookie_re)�izip_longestc��eZdZdS)r N)�__name__�
__module__�__qualname__���5/usr/lib/python3/dist-packages/executing/executing.pyr r Bs�������r)r c�N���i�tj�����fd���}|S)Nc�4��|�vr�|S�|�x}�|<|S�Nr()�args�result�d�funcs  ��r*�wrapperzcache.<locals>.wrapperJs0����q�y�y���w��#�t�T�{�*�F�Q�t�W��Mr))�	functools�wraps)r1r2r0s` @r*�cacher5FsC������	���	�	�	�	�	�	�	�
�	�	��r)c��eZdZdZdS)�EnhancedASTN)r%r&r'�parentr(r)r*r7r7Zs������
�F�F�Fr)r7)r�)�Instructionc��eZdZdZdS�r:N�r%r&r'�linenor(r)r*r:r:b����������r)r:c��eZdZdZdSr<r=r(r)r*r:r:er?r)z offset argval opname starts_line)�
HAVE_ARGUMENT�EXTENDED_ARG�hasconst�opname�findlinestarts�hasnamec#�~K�|j}tt|����}t|��}d}d}||kr�|}||}t	|��}|�|��}	d}
|dz}|tkr�t	||��t	||dz��dzz|z}d}|dz}|tkr|dz}|tvr|j	|}
n5|tvr|j|}
nt|dkr
|j
|}
t||
t||	��V�||k��dSdS)Nr���i�	LOAD_FAST)�co_code�dictrE�len�ord�getrArBrC�	co_constsrF�co_namesrD�co_varnamesr:)�co�code�
linestarts�n�i�extended_arg�offset�c�opr>�argval�opargs            r*�_get_instructionsr_msM�����z���.��,�,�-�-�
���I�I��
�����!�e�e��F��Q��A��Q���B��^�^�A�&�&�F��F��A��A��]�"�"��D��G���s�4��A��;�'7�'7�#�'=�=��L�� ����E����%�%�#(�5�=�L���>�>��\�%�0�F�F��7�]�]��[��/�F�F��B�Z�;�.�.��^�E�2�F��f�f�f�R�j�&�A�A�A�A�A�)�!�e�e�e�e�e�er)c��eZdZdZdS)�EnhancedInstructionN)r%r&r'�_copiedr(r)r*rara�s�������G�G�Gr)ra�c�B�|stt|�����dS)z�
    Like an assert statement, but unaffected by -O
    :param condition: value that is expected to be truthy
    :type message: Any
    N)�AssertionError�str)�	condition�messages  r*�assert_ri�s*���+��S��\�\�*�*�*�+�+r)c#�K�|j}t|��D]:}tt|��}|jp|}t|��||_|V��;dSr-)�co_firstlinenor_rra�starts_linerir>)rTr>�insts   r*�get_instructionsrn�si����
�
�F�!�"�%�%�����'��.�.���!�+�V�����������
�
�
�
��r)c�"��eZdZgf�fd�	Z�xZS)�NotOneValueFoundc�f��||_tt|���|��dSr-)�values�superrp�__init__)�self�msgrr�	__class__s   �r*rtzNotOneValueFound.__init__�s/������
��t�$�$�-�-�c�2�2�2�2�2r))r%r&r'rt�
__classcell__�rws@r*rprp�s@�������!#�3�3�3�3�3�3�3�3�3�3r)rp�Tc��t|t��rGt|��dkrtdt|��z���t	|��dStt
|d����}t|��dkrtd���t|��dkrtd|���|dS)NrHzExpected one value, found %srrJzExpected one value, found 0z!Expected one value, found several)�
isinstancerrNrp�list�tupler)�it�lsts  r*�onlyr��s����"�e�����r�7�7�a�<�<�"�#A�C��G�G�#K�L�L�L��B�x�x��{��
��r�1�
�
�
�
�C�
�3�x�x�1�}�}��<�=�=�=�
�3�x�x�!�|�|��B�3�G�G�G��q�6�Mr)c��eZdZdZd�Zedd���Ze		dd���Zed���Zed���Z	ed	���Z
ed
���Zed���Z
d�Zd
�Zd�Zed���Zed���Zd�ZdS)�Sourcea�
    The source code of a single file and associated metadata.

    The main method of interest is the classmethod `executing(frame)`.

    If you want an instance of this class, don't construct it.
    Ideally use the classmethod `for_frame(frame)`.
    If you don't have a frame, use `for_filename(filename [, module_globals])`.
    These methods cache instances by filename, so at most one instance exists per filename.

    Attributes:
        - filename
        - text
        - lines
        - tree: AST parsed from text, or None if text is not valid Python
            All nodes in the tree have an extra `parent` attribute

    Other methods of interest:
        - statements_at_line
        - asttokens
        - code_qualname
    c���	�||_d�|��}t|t��s8|�|���	|��	��}�	fd�|D��}||_d�|D��|_tj	ddkr|}n,d�d�t|��D����}tt��|_
d|_i|_d|_d|_	t%j||���|_t%j|j��D]x}t%j|��D]/}t-t.|��t-t.|��_�0t3|��D]"}|j
|�|���#�yt7��}|�|j��|j|_dS#t<t>f$rYdSwxYw)	zG
        Don't call this constructor, see the class docstring.
        rcc�:��g|]}|������Sr()�decode)�.0�line�encodings  �r*�
<listcomp>z#Source.__init__.<locals>.<listcomp>�s%���=�=�=�t�T�[�[��*�*�=�=�=r)c�8�g|]}|�d����S)z
)�rstrip)r�r�s  r*r�z#Source.__init__.<locals>.<listcomp>�s$��<�<�<�d�d�k�k�&�)�)�<�<�<r)rrc�P�g|]#\}}|dkrtj|��rdn|��$S)rJ�
)�encoding_pattern�match)r�rXr�s   r*r�z#Source.__init__.<locals>.<listcomp>�sK�� � � ��A�t��A���"2�"8��">�">����� � � r)N��filename) r��joinr|�	text_typerr��text�lines�sys�version_info�	enumeraterr}�_nodes_by_line�tree�
_qualnames�
_asttokens�_asttext�ast�parse�walk�iter_child_nodesrr7r8�node_linenos�append�QualnameVisitor�visit�	qualnames�SyntaxError�
ValueError)
rur�r�r��ast_text�node�childr>�visitorr�s
         @r*rtzSource.__init__�s���!��
��w�w�u�~�~���$�	�*�*�	>��+�+�D�1�1�H��;�;�x�(�(�D�=�=�=�=�u�=�=�=�E���	�<�<�e�<�<�<��
���A��!�#�#��H�H�
�w�w� � � )��/�/� � � ���H�*�$�/�/�����	���������
�
	0��	�(�X�>�>�>�D�I�����+�+�
=�
=�� �1�$�7�7�N�N�E�6:�;��6M�6M�D��e�,�,�3�3�*�4�0�0�=�=�F��'��/�6�6�t�<�<�<�<�=�&�'�'�G��M�M�$�)�$�$�$�%�/�D�O�O�O���Z�(�	�	�	��D�D�	���s�>G!�!G6�5G6Tc�R�|�|jj|jpi|��S)zb
        Returns the `Source` object corresponding to the file the frame is executing in.
        )�for_filename�f_code�co_filename�	f_globals)�cls�frame�	use_caches   r*�	for_framezSource.for_frames)������� 8�%�/�:O�R�QZ�[�[�[r)Nc�T���t�t��rt������fd�}tj����}tj���|��}|�|s|tj�<|��}|��t|����S)Nc�T��tjtt������Sr-)�	linecache�getlinesrr�)r��module_globalss��r*�	get_linesz&Source.for_filename.<locals>.get_lines"s ����%�d�9�h�&?�&?��P�P�Pr))	r|r rfr�r5rP�
checkcache�_for_filename_and_linesr~)r�r�r�r�r��entryr�s ``    r*r�zSource.for_filenames������h��%�%�	%��8�}�}�H�	Q�	Q�	Q�	Q�	Q�	Q�
��#�#�H�-�-����X�&�&�&��	������U��
).�I�O�H�%��I�K�K�E��*�*�8�U�5�\�\�B�B�Br)c��|�di��}	|||fS#t$rYnwxYw|||��x}|||f<|S)N�__source_cache_with_lines)�_class_local�KeyError)r�r�r��source_cacher/s     r*r�zSource._for_filename_and_lines4sv���'�'�(C�R�H�H��	���5� 1�2�2���	�	�	��D�	����47�3�x��3G�3G�G���x��/�0��
s�	"�
/�/c�r�tjdkr&tj|jj|j��dSdS)N)r�)r�r�r��	lazycacher�r�r�)r�r�s  r*r�zSource.lazycache@s:����v�%�%����� 8�%�/�J�J�J�J�J�&�%r)c���t|tj��r|}|j}|j}|j}n|}|j}|j}|j}|t|��|f}|�
di��}|�|��}	|	s�dx}
x}}|�|��}
|
j
}|r�	|
�|��}|rFt|��rt!||||
��\}}
n!t#|||||
��}|j}
|j}n#t($rt*r�YnwxYw|�J�|
r%t-|
��h}t/||k��|}|
|
||fx||<}	t1|g|	�R�S)z�
        Returns an `Executing` object representing the operation
        currently executing in the given frame or traceback object.
        �__executing_cacheN)r|�types�
TracebackType�tb_frame�	tb_lineno�tb_lasti�f_lineno�f_lastir��idr�rPr�r��statements_at_line�is_ipython_cell_code�find_node_ipython�
NodeFinderr/�	decorator�	Exception�TESTING�statement_containing_noderi�	Executing)r��frame_or_tb�tbr�r>�lastirU�key�executing_cacher.r��stmtsr��sourcer��node_finder�	new_stmtss                 r*�	executingzSource.executingFs����k�5�#6�7�7�	"��B��K�E��\�F��K�E�E��E��^�F��M�E��|���R��X�X�u�%���*�*�+>��C�C���"�"�3�'�'���	I�'+�+�D�+�5�9��]�]�5�)�)�F��;�D��
&��"�5�5�f�=�=�E��>�/��5�5�>�.?��u�e�U[�.\�.\�O�I�t�t�*4�U�E�4��PV�*W�*W�K�#.�#5�D�(3�(=�I��� ��������������(�(�(��&�!:�4�!@�!@� A�I��I��.�/�/�/�%�E�*0�$��y�*H�H�O�C� �4���&��&�&�&�&s�.AD�D!� D!c�^�|j�||��}t|||��|S)z�
        Returns an attribute directly associated with this class
        (as opposed to subclasses), setting default if necessary
        )�__dict__rP�setattr)r��name�defaultr/s    r*r�zSource._class_local�s2����!�!�$��0�0����T�6�"�"�"��
r)c�0�d�|j|D��S)az
        Returns the statement nodes overlapping the given line.

        Returns at most one statement unless semicolons are present.

        If the `text` attribute is not valid python, meaning
        `tree` is None, returns an empty set.

        Otherwise, `Source.for_frame(frame).statements_at_line(frame.f_lineno)`
        should return at least one statement.
        c�,�h|]}t|����Sr()r�)r�r�s  r*�	<setcomp>z,Source.statements_at_line.<locals>.<setcomp>�s0��
�
�
��
&�d�+�+�
�
�
r))r�)rur>s  r*r�zSource.statements_at_line�s-��
�
�
���'�
�
�
�	
r)c�n�ddlm}|j�"||j|j|j���|_|jS)z�
        Returns an ASTText object for getting the source of specific AST nodes.

        See http://asttokens.readthedocs.io/en/latest/api-index.html
        r)rN�r�r�)�	asttokensrr�r�r�r�)rurs  r*�asttextzSource.asttext�sD��	&�%�%�%�%�%��=� �#�G�D�I�D�I��
�V�V�V�D�M��}�r)c���ddl}|j�[t|d��r|���j|_n,|�|j|j|j���|_|jS)z�
        Returns an ASTTokens object for getting the source of specific AST nodes.

        See http://asttokens.readthedocs.io/en/latest/api-index.html
        rNrr�)r�r��hasattrr�rr�r�r��rur�s  r*r�zSource.asttokens�sk��	�����?�"��y�)�,�,�
i�"&�,�,�.�.�":����"+�"5�"5�d�i�d�i�Z^�Zg�"5�"h�"h�����r)c�z�ddl}t|d��r|���S|���S)Nrr)r�r�r�r�s  r*�
_asttext_basezSource._asttext_base�s>�������9�i�(�(�	$��<�<�>�>�!��>�>�#�#�#r)c��t|t��r/t�|��}|�|��S|Sr-)r|�bytesr�rr�)r�r�s  r*�
decode_sourcezSource.decode_source�s@���f�e�$�$�	��-�-�f�5�5�H��=�=��*�*�*��Mr)c�Z�ttj|��j��dS)Nr)r�io�BytesIO�readline)r�s r*rzSource.detect_encoding�s$���r�z�&�1�1�:�;�;�A�>�>r)c��t|j|jk��|j�|j|jf|j��S)a
        Imitates the __qualname__ attribute of functions for code objects.
        Given:

            - A function `func`
            - A frame `frame` for an execution of `func`, meaning:
                `frame.f_code is func.__code__`

        `Source.for_frame(frame).code_qualname(frame.f_code)`
        will be equal to `func.__qualname__`*. Works for Python 2 as well,
        where of course no `__qualname__` attribute exists.

        Falls back to `code.co_name` if there is no appropriate qualname.

        Based on https://github.com/wbolster/qualname

        (* unless `func` is a lambda
        nested inside another lambda on the same line, in which case
        the outer lambda's qualname will be returned for the codes
        of both lambdas)
        )rir�r�r�rP�co_namerk�rurUs  r*�
code_qualnamezSource.code_qualname�s@��.	�� �D�M�1�2�2�2���"�"�D�L�$�2E�#F���U�U�Ur))T�NT)r%r&r'�__doc__rt�classmethodr�r�r�r�r�r�r5r�r�r�r��staticmethodr�rrr(r)r*r�r��s���������.10�10�10�f�\�\�\��[�\����	C�C�C��[�C�8�	�	��[�	��K�K��[�K�
�8'�8'��[�8'�t�	�	��[�	��
�
��U�
�(������ $�$�$�����\���?�?��\�?�V�V�V�V�Vr)r�c�*�eZdZdZd�Zd�Zd�Zd�ZdS)r�a�
    Information about the operation a frame is currently executing.

    Generally you will just want `node`, which is the AST node being executed,
    or None if it's unknown.

    If a decorator is currently being called, then:
        - `node` is a function or class definition
        - `decorator` is the expression in `node.decorator_list` being called
        - `statements == {node}`
    c�L�||_||_||_||_||_dSr-)r�r�r��
statementsr�)rur�r�r�r�r�s      r*rtzExecuting.__init__�s)����
������	����"����r)c�J�|j�|jj��Sr-)r�rr�r��rus r*rzExecuting.code_qualnames���{�(�(���):�;�;�;r)c�d�|j����|j��Sr-)r�r��get_textr�r	s r*r�zExecuting.texts&���{�(�(�*�*�3�3�D�I�>�>�>r)c�d�|j����|j��Sr-)r�r��get_text_ranger�r	s r*�
text_rangezExecuting.text_ranges&���{�(�(�*�*�9�9�$�)�D�D�Dr)N)r%r&r'rrtrr�rr(r)r*r�r��s_������
�
�#�#�#�<�<�<�?�?�?�E�E�E�E�Er)r�c�>��eZdZ�fd�Zdd�Zdd�ZeZd�Zd�Z�xZ	S)r�c�r��tt|�����g|_i|_dSr-)rsr�rt�stackr�)rurws �r*rtzQualnameVisitor.__init__s1���
�o�t�$�$�-�-�/�/�/���
�����r)Nc��|p|j}|j�|��t|dd��r|jdj}n|j}|j�||fd�|j����dS)N�decorator_listr(r�.)	r�rr��getattrrr>r��
setdefaultr�)rur�r�r>s    r*�add_qualnamezQualnameVisitor.add_qualnames���� �t�y���
���$�����4�)�2�.�.�	!��(��+�2�F�F��[�F���!�!�4��.�#�(�(�4�:�2F�2F�G�G�G�G�Gr)c��tjddkr<t|tjtjtjf��s
J|���n0t|tjtjf��s
J|���|�||��|j�	d��g}t|tj��r	|j
g}n|j
}|D]}|�|���|j���|j���tj
|��D]�\}}|dkr�t|tj��r|�|���<t|t��r4|D]1}t|tj��r|�|���2��dS)Nrrz<locals>�body)r�r�r|r��FunctionDef�AsyncFunctionDef�Lambdarrr�rr��pop�iter_fields�ASTr})rur�r��childrenr��field�
grandchilds       r*�visit_FunctionDefz!QualnameVisitor.visit_FunctionDef%s�����A��!�#�#��d�S�_�c�6J�C�J�$W�X�X�^�^�Z^�^�^�^�^��d�S�_�c�j�$A�B�B�H�H�D�H�H�H����$��%�%�%��
���*�%�%�%����d�C�J�'�'�	!��	�{�H�H��y�H��	�	�E��J�J�u������
�������
������
 �O�D�1�1�	/�	/�L�E�5�������%���)�)�
/��
�
�5�!�!�!�!��E�4�(�(�
/�"'�/�/�J�!�*�c�g�6�6�/��
�
�:�.�.�.���	/�	/r)c�j�t|tj��sJ�|�|d��dS)Nz<lambda>)r|r�rr#�rur�s  r*�visit_LambdazQualnameVisitor.visit_LambdaFs6���$��
�+�+�+�+�+����t�Z�0�0�0�0�0r)c���t|tj��sJ�|�|��|�|��|j���dSr-)r|r��ClassDefr�
generic_visitrrr%s  r*�visit_ClassDefzQualnameVisitor.visit_ClassDefKsZ���$���-�-�-�-�-����$�������4� � � ��
�������r)r-)
r%r&r'rtrr#�visit_AsyncFunctionDefr&r*rxrys@r*r�r�s�������������H�H�H�H�/�/�/�/�>/��1�1�1�
������r)r�c#�JK�|]}tt|��jV��dSr-)r�
__future__�
compiler_flag)r��fnames  r*�	<genexpr>r0Vs@������16�G�J����,������r)c�N�t||jdt|jzd���S)N�execT)�flags�dont_inherit)�compiler��future_flags�co_flags)r��
matching_codes  r*�compile_similar_tor9[s3�����!���]�3�3�����r)�8io8urthglkjdghvljusketgIYRFYUVGHFRTBGVHKGF78678957647698c�N�td�t|��D����S)Nc3�K�|]C}|jdko3t|jt��o|j�d��V��DdS)�
LOAD_CONSTz@pyN)rDr|r]rf�
startswith)r��bcs  r*r0z)is_rewritten_by_pytest.<locals>.<genexpr>jsd�������	�	�\�!�_�j���3�&?�&?�_�B�I�DX�DX�Y^�D_�D_������r))�anyrn�rUs r*�is_rewritten_by_pytestrBhs8�����"�4�(�(������r)c�B�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZdS)
�SentinelNodeFinderNc��
���
��t|��||_||_|jx|_}t|��|_|jr"tt|����|_	nt��|_	d|_
|�|��x|_��j
}d��td���
td���|�d��rt j��nR|�d��rt j�t j�
�n#|�d��r�t j�t+t jt jt1t dd��t jt jt jt jt jt jt jt j t j!t j"��
�
|�
�
fd���nM|�d	��rSt j#�t+t j$t j%t j&t j'�
��|�
�
fd��n�|dvrt j(�t j�
�fd
��n�|dvr;t j)�t j�
tTj+ddks�j,r�fd��n�|dvrt j-�d��np|�d��rt j.�
t j�nB|�d��rt j.�
t j(��fd��nt_|���t`5�
��fd�|D��}�
t j.kr"tc|��|_2	ddd��dStg|�4|����}	|	s&�t jkr|�5|��ntc|	��|_2ddd��dS#1swxYwYdS)Nc��dSrr(��es r*�<lambda>z-SentinelNodeFinder.__init__.<locals>.<lambda>�s���r)�CALL_)�
BINARY_SUBSCRzSLICE+�BINARY_�MatMultr()
�BINARY_POWER�BINARY_MULTIPLY�BINARY_MATRIX_MULTIPLY�BINARY_FLOOR_DIVIDE�BINARY_TRUE_DIVIDE�
BINARY_MODULO�
BINARY_ADD�BINARY_SUBTRACT�
BINARY_LSHIFT�
BINARY_RSHIFT�
BINARY_AND�
BINARY_XOR�	BINARY_ORc�.��t|j���Sr-�r|r\�rH�op_types �r*rIz-SentinelNodeFinder.__init__.<locals>.<lambda>�����Z���g�%>�%>�r)�UNARY_)�UNARY_POSITIVE�UNARY_NEGATIVE�	UNARY_NOT�UNARY_INVERTc�.��t|j���Sr-r\r]s �r*rIz-SentinelNodeFinder.__init__.<locals>.<lambda>�r_r))�	LOAD_ATTR�LOAD_METHOD�
LOOKUP_METHODc�8��t|j�j��Sr-��attr_names_match�attrr]�rH�instructions �r*rIz-SentinelNodeFinder.__init__.<locals>.<lambda>�����%5�a�f�k�>P�%Q�%Q�r))�	LOAD_NAME�LOAD_GLOBALrK�
LOAD_DEREF�LOAD_CLASSDEREFrrc�$��|j�jkSr-)r�r]rms �r*rIz-SentinelNodeFinder.__init__.<locals>.<lambda>�s������1C�)C�r))�
COMPARE_OP�IS_OP�CONTAINS_OPc�2�t|j��dkS)NrH)rN�opsrGs r*rIz-SentinelNodeFinder.__init__.<locals>.<lambda>�s��S���Z�Z�1�_�r))�STORE_SLICE�STORE_SUBSCR�
STORE_ATTRc�8��t|j�j��Sr-rjrms �r*rIz-SentinelNodeFinder.__init__.<locals>.<lambda>�ror)c
���h|]{}tj|��D]d}t|���rRtt|dd�����r3�|��r(t	|��|k�Ott|����e�|S)�ctxN)r�r�r|rr�rr7)r��stmtr�r�extra_filter�typs   ���r*r�z.SentinelNodeFinder.__init__.<locals>.<setcomp>�s���������H�T�N�N�����d�C�(�(�	�
�g�d�E�4�8�8�#�>�>�� �<��%�%�
�-�T�2�2�d�:�:�
�[�$�'�'�;�:�:�:r))6rir�r�r�rUrB�	is_pytest�	frozenset�assert_linenos�ignore_linenosr��get_actual_current_instructionrnrD�typer>r��Call�	Subscript�Load�BinOprM�Pow�Multr�FloorDiv�Div�Mod�Add�Sub�LShift�RShift�BitAnd�BitXor�BitOr�UnaryOp�UAdd�USub�Not�Invert�	Attribute�Namer�r�r]�Compare�Store�RuntimeError�lockr�r/r}�matching_nodes�find_decorator)rur�r�r�r�r�rU�op_name�exprs�matchingrr�rnr^r�s          @@@@@r*rtzSentinelNodeFinder.__init__ss ��������������
���	� �<�'��	�D�/��5�5����>�	.�"+�N�4�,@�,@�"A�"A�D���"+�+�+�D�����)-�)L�)L�U�)S�)S�S���;��$��%�~���4�j�j���4�j�j�����g�&�&�4	(��(�C�C�
�
�
� ;�
<�
<�2	(��-�C��(�C�C�
�
�
�	�
*�
*�/	(��)�C�� �W� #��'.�s�I�r�'B�'B�$'�L�#&�7�!�g��7� #��!�j�!�j��:��:��)������G�?�>�>�>�L�L�
�
�
��
)�
)�	(��+�C��"�x�"�x��'� �Z�	���
��G�?�>�>�>�L�L�
�E�
E�
E��-�C��(�C�Q�Q�Q�Q�L�L�
�b�
b�
b��(�C��(�C����"�a�'�'�;�+=�'�C�C�C�C���
�>�
>�
>��+�C�4�4�L�L�
�
�
� ?�
@�
@�	(��)�C��-�C�C�
�
�
��
-�
-�	(��)�C��-�C�Q�Q�Q�Q�L�L��w�'�'�'�
�	-�	-�������!����E��c�i���#�5�k�k����!	-�	-�	-�	-�	-�	-�	-�	-�$�D�/�/��6�6�7�7�H��
-��s�x����#�#�E�*�*�*�*�"�8�n�n���-	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	-�	-s�6O6�AO6�6O:�=O:c���t|��}tt|tjt
f����|j}t|���fd����j��D��}d�t|��D��d}t||dzj
�d����||t|��z
dz|dz�}td�|D��dhk��|�
�j��}|ddd�|}|�_|�_dS)Nc�>��g|]}|j�jjk�|��Sr()r>r�r��r�rmrus  �r*r�z5SentinelNodeFinder.find_decorator.<locals>.<listcomp>�s5���
�
�
���{�d�j�1�1�1�
�1�1�1r)c�.�g|]\}}|jdk�|��S)�
CALL_FUNCTION�rD)r�rXrms   r*r�z5SentinelNodeFinder.find_decorator.<locals>.<listcomp>�s3��,
�,
�,
���4��{�o�-�-�
�-�-�-r)���rH�STORE_c��h|]	}|j��
Sr(r��r�rms  r*r�z4SentinelNodeFinder.find_decorator.<locals>.<setcomp>�s��@�@�@����@�@�@r)r�)r�rir|r�r(�function_node_typesr�clean_instructionsrUr�rDr>rN�indexrnr�r/)	rur�r��
decorators�line_instructions� last_decorator_instruction_index�decorator_instructions�decorator_indexr�s	`        r*r�z!SentinelNodeFinder.find_decorator�s�����E�{�{���
�4�#�,�0C�!D�E�E�F�F�F��(�
��
����
�
�
�
��/�/��	�:�:�
�
�
��
,
�,
�$�%6�7�7�,
�,
�,
�
�	,�(�
	��>��B�C�J�U�U��
�
�	
�	
�	
�
"3�,��*�o�o�
��
�2���
�"
��	�@�@�)?�@�@�@�_�DU�U�V�V�V�0�6�6�t�7G�H�H���t�t��t�$�_�5�	�"�������r)c�:���fd�t|��D��S)Nc�B��g|]}|jdvr|j�jv�|��S))rB�NOP)rDr>r�r�s  �r*r�z9SentinelNodeFinder.clean_instructions.<locals>.<listcomp>�sC���
�
�
���{�"9�9�9��{�$�"5�5�5�
�6�5�5r))rnr�s` r*r�z%SentinelNodeFinder.clean_instructions�s6���
�
�
�
�(��.�.�
�
�
�	
r)c��|�|j��}td�|���D����sd�|D��}|S)Nc3�,K�|]}|jdkV��dS)�JUMP_IF_NOT_DEBUGNr�r�s  r*r0zESentinelNodeFinder.get_original_clean_instructions.<locals>.<genexpr>s>����
�
����2�2�
�
�
�
�
�
r)c�(�g|]}|jdk�
|��S)r�r�r�s  r*r�zFSentinelNodeFinder.get_original_clean_instructions.<locals>.<listcomp>s0�������;�"5�5�5��5�5�5r))r�rUr@�compile_instructions)rur/s  r*�get_original_clean_instructionsz2SentinelNodeFinder.get_original_clean_instructionssx���(�(���3�3���
�
� �5�5�7�7�
�
�
�
�
�	���!'����F�
�
r)c	#��K�����}t�fd�t|��D����}t|��D�]u\}}t|��}|�J�t	j|t	j��t	jt������}t	j	|��||��	��
��}||��n#||��wxYwtjdkr@	t||��n.#t$r!ts|t!|��dz
krY��wxYwd�t|��D��}	t|	��D]c\}
}||
dzz}t#|�|��jdk��t#|�|��jd	k���dt|	��D]�\}
}||
dzz}|dz
}||kr�||}
||}|
j|jcxkrd
vrWnnT|
j|jkrD||dzj||dzjcxkrdkrnn|�|dz��tjdkr7t+||��D]&\}}t#|o|ot-||�����'|V����wdS)Nc3�8�K�|]\}}|�jk�|V��dSr-)rn)r�rXrmrus   �r*r0z4SentinelNodeFinder.matching_nodes.<locals>.<genexpr>sA�����
�
���4��t�'�'�'�
�'�'�'�'�
�
r))�s)�leftr\�right)r�
rHc�8�g|]\}}|jtk�|��Sr()r]�sentinel)r�rXrns   r*r�z5SentinelNodeFinder.matching_nodes.<locals>.<listcomp>4s4�����"�A�{��%��1�1��1�1�1r)rJr=rN�rwrvrc)r�r�r��
get_setterr�r�r��Strr��fix_missing_locationsr�r�r��handle_jumpsr�r�rNrirrD�argr�
opnames_match)rur��original_instructions�original_index�
expr_index�expr�setter�replacement�instructions�indices�	index_num�sentinel_index�	new_index�
original_inst�new_inst�inst1�inst2s`                r*r�z!SentinelNodeFinder.matching_nodess������ $� D� D� F� F���
�
�
�
�$�%:�;�;�
�
�
�
�
��
!*�%� 0� 0�I	�I	��J����%�%�F��%�%�%��)���7�9�9��g��)�)�)����K�

�%�k�2�2�2��F�;����
�#�8�8�:�:����t��������t����������7�*�*�� ��/D�E�E�E�E�� �����!�*�s�5�z�z�A�~�"=�"=� ���	������&/��&=�&=����G�.7�w�-?�-?�
S�
S�)�	�>��)�a�-�/����(�(��8�8�?�<�O�P�P�P���(�(��8�8�?�>�Q�R�R�R�R�.7�w�-?�-?�
�
�)�	�>��)�a�-�/��*�Q�.�	���.�.�� 5�n� E�
�'�	�2��
&�,���[�[�[�[�C[�[�[�[�[�[�)�-���=�=�-�n�q�.@�A�H�'�	�A�
�6�=�M�M�M�M�AL�M�M�M�M�M�!�$�$�Y��]�3�3�3��#�g�-�-�(3�-�|�)�)�Q�Q���u� �� O�%� O�M�%��4O�4O�P�P�P�P��
�
�
�
�=
�WI	�I	s�C(�(
C5�	D�'E�Ec��t|j|j��}t|�|����}|�|��Sr-)r9r�rUr��
find_codesr�)ru�module_coderUs   r*r�z'SentinelNodeFinder.compile_instructionsfsB��(���D�I�>�>���D�O�O�K�0�0�1�1���&�&�t�,�,�,r)c�0������td��td��td��d�g��js!�td��td��gz
���fd��g��|��r��|�����fd���|���S)	Nrk�co_freevars�co_cellvarsc�8�t|j��p|jSr-)�is_ipython_cell_code_namer�)r[s r*rIz/SentinelNodeFinder.find_codes.<locals>.<lambda>rs��/��	�:�:�G�a�i�r)rRrSc�>���t��fd��D����S)Nc3�R�K�|]!}|���|�j��kV��"dSr-rA)r��fr[rus  ��r*r0zASentinelNodeFinder.find_codes.<locals>.matches.<locals>.<genexpr>|sN����������!�����$�)���$������r))�all)r[�checksrus`��r*�matchesz.SentinelNodeFinder.find_codes.<locals>.matcheszsA����������������
r)c���|jD]B}tj|��s��|��r��|���|���CdSr-)rQ�inspect�iscoder�)rU�const�code_options�finderr�s  ���r*r�z-SentinelNodeFinder.find_codes.<locals>.finder�sf�����
�
���~�e�,�,����7�5�>�>�/� �'�'��.�.�.���u�
�
�
�
�

�
r))rr�r�)ru�	root_coder�r�r�r�s` @@@@r*r�zSentinelNodeFinder.find_codesls��������
�'�(�(��}�%�%��}�%�%�G�G�	
���~�	���:�&�&��=�)�)��
�F�
	�	�	�	�	�	����7�9���	+����	�*�*�*�	�	�	�	�	�	�	�	��y�����r)c����tt|j����}t�fd�t	|��D����}	||}|jdkr|S|dz
}�)z{
        Get the instruction corresponding to the current
        frame offset, skipping EXTENDED_ARG instructions
        c3�8�K�|]\}}|j�k�|V��dSr-)rZ)r�rXrmr�s   �r*r0zDSentinelNodeFinder.get_actual_current_instruction.<locals>.<genexpr>�s@�����
�
���4��{�e�#�#�
�#�#�#�#�
�
r)TrBrH)r}rnrUr�r�rD)rur�r�r�rns `   r*r�z1SentinelNodeFinder.get_actual_current_instruction�s�����,�T�Y�7�7�8�8���
�
�
�
�$�\�2�2�
�
�
�
�
��	�&�u�-�K��!�^�3�3�"�"��Q�J�E�		r))r%r&r'r/rtr�r�r�r�r�r�r�r(r)r*rDrDps�������
�F�a-�a-�a-�F���B
�
�
����&Q�Q�Q�f-�-�-�$�$�$�L����r)rDc#��K�d}tt|��|d��D]S\}}|jtkrt	|jdk��d}�0|rt	|jdk��d}�M||fV��TdS)zz
    Yields (index, instruction) pairs excluding the basic
    instructions introduced by the sentinel transformation
    FNr=TrN)rr�r]r�rirD)r��start�
skip_powerrXrms     r*�non_sentinel_instructionsr��s������J��)�L�1�1�5�$�?�?�	�	���4��;�(�"�"��D�K�<�/�0�0�0��J��
�	��D�K�>�1�2�2�2��J����g�
�
�
�
�	�	r)c#�K�tt|��|d��}t||��}d}		t|��\}}t|��\}	}
n#t$rYdSwxYw|r,|j|
jcxkrdkrnnt|��\}	}
|j|
jcxkodvnco|j|
jk}|||	|
fV���)z�
    Yields matching indices and instructions from the new and original instructions,
    leaving out changes made by the sentinel transformation.
    NFTrcr�)rr�r��next�
StopIterationrDr�)r��original_startr�r��
original_iter�new_iter�inverted_comparison�
original_ir��new_ir�s           r*�walk_both_instructionsr�s�����9�%:�;�;�^�T�R�R�M�(��u�=�=�H���9�	�(,�]�(;�(;�%�J�
�"�8�n�n�O�E�8�8���	�	�	��F�F�	����
 �	-��$���F�F�F�F�;�F�F�F�F�F�"�8�n�n�O�E�8�� �H�O�O�O�O�O�7O�O�O�O�O�
2��!�X�\�1�	��-���8�8�8�8�9s�$A�
A(�'A(c���	�	t|d|d��D]�\}}}�	t|�	��r�d�	jvrRd|jvrIt�	fd�t	|��D����}t||||��}|�J�||||dz�<nXg}||d�D]"}|�|��|jdvrn�#t�tt||����|||�<ndS��)a�
    Transforms instructions in place until it looks more like original_instructions.
    This is only needed in 3.10+ where optimisations lead to more drastic changes
    after the sentinel transformation.
    Replaces JUMP instructions that aren't also present in original_instructions
    with the sections that they jump to until a raise or return.
    In some other cases duplication found in `original_instructions`
    is replicated in `instructions`.
    Tr�JUMPc3�d�K�|]*\}}|j�jk�t|dd���&|V��+dS)rbFN)rZr]r)r�rXrmr�s   �r*r0zhandle_jumps.<locals>.<genexpr>�sV���������4��{�h�o�5�5�#�D�)�U�;�;�6��5�5�5�5��r)NrH��RETURN_VALUE�
RAISE_VARARGS)	rr�rDr�r��handle_jumpr�re�find_new_matching)
r�r�rr�rr��new_instructions�orig_section�section_instr�s
         @r*r�r��sm���*�:P�!�1�l�A�;
�;
�)	�)	�6�J�
�u�h��]�H�5�5�
�����(�(�V�=�;O�-O�-O������#,�\�#:�#:�������$/�)�:�|�U�$�$� �(�3�3�3�2B��U�U�Q�Y�.�/�/� "��$9�*�+�+�$F�)�)�L� �'�'��5�5�5�#�*�.O�O�O���P�)�(�,0�1B�<�Q]�1^�1^�,_�,_��U�5�[�)�
�E�
�F�U*r)c	#�bK�tt|��t|��z
��D]}ttt	||��t|�����\}}t|��t|��krdSt||��r|||ddz�V���dS)z�
    Yields sections of `instructions` which match `orig_section`.
    The yielded sections include sentinel instructions, but these
    are ignored when checking for matches.
    Nr�rH)�rangerN�ziprr��sections_match)rr�r�r��dup_sections     r*rrs������s�<�(�(�3�|�+<�+<�<�=�=�
6�
6��"�
�)�,��>�>��L�!�!��� 
�����{���c�,�/�/�/�/��F�F��,��4�4�	6��u�W�R�[�1�_�4�5�5�5�5��
6�
6r)c�*�t||||��D]\}}}}tt||����|jdvrRt	|||dz���}|D]	}	d|	_�
|||dz�}
t
||
|��s
g|||dz�<|cS��dS)a`
    Returns the section of instructions starting at `start` and ending
    with a RETURN_VALUE or RAISE_VARARGS instruction.
    There should be a matching section in original_instructions starting at original_start.
    If that section doesn't appear elsewhere in original_instructions,
    then also delete the returned section of instructions.
    r
rHTN)rrir�rDrrb�check_duplicates)r�rr�r��
original_jr��new_jr��inlined�inlrs           r*r
r
$s���7M��~�|�U�7�7�
�
�2�
�M�5�(�	�
�m�X�6�6�7�7�7���#D�D�D��|�E�E�A�I�,=�>�?�?�G��
#�
#��"����0��*�q�.�1P�Q�L�#���.C���
5�35��U�U�Q�Y�.�/��N�N�N�E��4r)c���tt|����D]Y}||kr�	|||t|��z�}t|��t|��krdSt||��rdS�ZdS)z�
    Returns True if a section of original_instructions starting somewhere other
    than original_i and matching orig_section is found, i.e. orig_section is duplicated.
    FT)rrNr)rrr��	dup_startrs     r*rr?s����3�4�5�5�6�6���	��
�"�"��+�I�	�C��DU�DU�8U�,U�V���{���c�,�/�/�/�/��5�5��,��4�4�	��4�4�	��5r)c�P�td�t||��D����S)z\
    Returns True if the given lists of instructions have matching linenos and opnames.
    c3�K�|]A\}}|j|jkpd|jcxko
|jkncot||��V��BdS)�	POP_BLOCKN)r>rDr�)r��	orig_inst�dup_insts   r*r0z!sections_match.<locals>.<genexpr>Us�������
 �I�x�
����/�
B��i�.�A�A�A�A�(�/�A�A�A�A�	/�

�)�X�.�.�
�����r))r�r)rrs  r*rrPs>��
���$'�|�[�#A�#A������r)c���|j|jkpQd|jvod|jvp?|jdko
|jdkp)|jdvo
|jdkp|jdko
|jdkS)Nr�
PRINT_EXPR�POP_TOP)rgrhrf�CALL_METHODr�r�)r�r�s  r*r�r�`s���	����$�	O��U�\�!�#��e�l�"�	O�
�L�L�(�F�U�\�Y�-F�	O�

�L�<�<�
,����+�
	O�
�L�M�)�M�e�l�o�.M�
r)c�������|j�tj���D]M\���|ur
��fd�}|cSt�t��r%t���D]\�}||ur��fd�}|ccS��NdS)Nc�&��t��|��Sr-)r�)�new_noder�r8s ��r*r�zget_setter.<locals>.setterts����v�t�X�6�6�6r)c���|��<dSr-r()r*r!rXs ��r*r�zget_setter.<locals>.setter{s���#+��a���r))r8r�rr|r}r�)r�r��itemr!rXr�r8s   @@@@r*r�r�os�������
�[�F���v�.�.�
"�
"���e��D�=�=�
7�
7�
7�
7�
7�
7��M�M�M�
��t�
$�
$�	"�$�U�+�+�
"�
"���4��4�<�<�,�,�,�,�,�,�"�M�M�M�M�M� ���4r)c���t|tj��s4tt|��j}t|tj���4tt|��Sr-)r|r�r�rr7r8)r�s r*r�r��sP����s�x�(�(�.��K��&�&�-����s�x�(�(�.���T�"�"�"r)c#��K�tj|��D]O}t|d��r=tt	|��tj��rt
|��D]}|V���PdS)Nr8)r�r�r�r|r��Assertr�)r�r�r>s   r*r�r��s{��������������h�'�'�	��4�T�:�:�C�J�G�G�	�'�t�,�,�
�
��������
�r)c�"�t|jtj��s&|j}t|jtj���&tjd��}ttj|��g|_tj||��|S)Nrc)	r|r8r��Moduler�rr�r�
copy_location)r�r�s  r*�_extract_ipython_statementr3�sv��
���c�j�1�1���{�����c�j�1�1��
�9�R�=�=�D��c�h��%�%�&�D�I���d�D�!�!�!��Kr)c�F�ttjd|����S)Nz(<module>|<cell line: \d+>)$)�bool�rer�)�	code_names r*r�r��s�����8�)�D�D�E�E�Er)c�F�ttjd|����S)Nz'<ipython-input-|[/\\]ipykernel_\d+[/\\])r5r6�searchr�s r*�is_ipython_cell_filenamer:�s����	�D�h�O�O�P�P�Pr)c�R�t|j��ot|j��Sr-)r:r�r�r�)�code_objs r*r�r��s*��	!��!5�6�6�	4�!�(�"2�3�3�r)c���dx}}|D]X}t|��}	t|||||��}|s|r|js|jrdS|j}|j}�I#t$rY�UwxYw||fS)N)NN)r3r�r/r�r�)	r�r�r�r�r�r�r�r�r�s	         r*r�r��s�����D�9�����)�$�/�/��
	�$�U�E�4���G�G�K��
"�	�
"��(:�
"�k�>S�
"�"�z�z��%�D�#�-�I�I���	�	�	��D�	�����d�?�s�%A�A�
A�Ac��||krdS|�d��sdSttjd|z|����S)z�
    Checks that the user-visible attr (from ast) can correspond to
    the argval in the bytecode, i.e. the real attribute fetched internally,
    which may be mangled for private attributes.
    T�__Fz^_\w+%s$)r>r5r6r�)rlr]s  r*rkrk�sJ���v�~�~��t��?�?�4� � ���u�����t�+�V�4�4�5�5�5r)c#�K�t|d��rdg}t|d��rAt|tj��r'|j�J�t|j|jdz��}n|jg}|D]}|V��dSdS)Nr>�
end_linenorH)r�r|r�r�rArr>)r��linenosr>s   r*r�r��s������t�X�������4��&�&�	$�:�d�C�H�+E�+E�	$��?�.�.�.��D�K���1�)<�=�=�G�G��{�m�G��	�	�F��L�L�L�L���	�	r))r�rH)�PositionNodeFinder)rc)srr-r��disr3r�r�r�r6r�r��collectionsrr�copyr�	itertoolsr�operatorr�	threadingr�typingr	r
rrr
rrrrrrrrrrrr�rr�asttokens.asttokensrrr�r�rr�tokenizerr�pathlibr r5rfr��lib2to3.pgen2.tokenizer"r�r#�object�unicoderr7rnr_r:�_InstructionrArBrCrDrErFrarir�r�rprzr�r�r��NodeVisitorr��sum�all_feature_namesr6r9r�rBrDr�rr�rr
rrr�r�r�r�r�r3r�r:r�r�rkr��_position_node_finderrDr�r(r)r*�<module>rWs����0����
�
�
�
�
�
�
�
���������	�	�	�	�����	�	�	�	�
�
�
�
�����/�/�/�/�/�/�/�/�������������������������S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S��0�,�,�,�,�,�,�,�,�/�/�/�/�/�/���(����A��!����C�0�2�2����A��!���#�#�#�#�#�#�(�(�(�(�(�(�%�%�%�%�%�%��������I�d�#�#�#�E��I�I�U�U�U�U�U�U�U�U�5�5�5�5�5�5�
�
�
�
�
�v�
�
�
���� �I������#�'������v����,��/�/�/�/�/�/������l����������j�j��0R�S�S����[�Z�Z�Z�Z�Z�Z�Z�Z�Z�Z�Z�Z�Z�Z�Z�
B�B�B�@�����+����
+�+�+�+������3�3�3�3�3�y�3�3�3��G�C�L�L��
�
�
� kV�kV�kV�kV�kV�V�kV�kV�kV�\	E�E�E�E�E��E�E�E�D<�<�<�<�<�c�o�<�<�<�D�s���:D�:V�������
���F�����v�v�v�v�v��v�v�v�t	���&9�9�9�65�5�5�p6�6�6�(���6���"
�
�
� ������&
�u�w�w���#�#���#����
�
�
� F�F�F�
Q�Q�Q�
������&6�6�6�
�
�
���w���G�G�G�G�G�G�G�G�#�J�J�Jr)

Youez - 2016 - github.com/yon3zu
LinuXploit