ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/raven/utils/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/raven/utils/__pycache__/stacks.cpython-311.pyc

�

�܋f4'����dZddlmZmZddlZddlZddlZddlZddlZddl	m
Z
ddlmZej
d��Z	dd�Zdd�Zd	�Zd
�Zdd�Ze
dfd
�Zdd�Zdd�Ze
ddfd�ZdS)z�
raven.utils.stacks
~~~~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
�)�absolute_import�divisionN)�	transform)�	iteritemszcoding[:=]\s*([-\w.]+)c��d}|�Vt|d��rF	|�|��}n#ttf$rd}YnwxYw|�|���}|�.	tj|��}n#ttf$rYdSwxYw|sdStd||z
��}t|dz|zt|����}	d�|||�D��}||�d��}	d�||dz|�D��}
n#t$rYdSwxYwt|��t|	��t|
��fS)	z�
    Returns context_lines before and after lineno from file.
    Returns (pre_context_lineno, pre_context, context_line, post_context).
    N�
get_source�NNNr�c�8�g|]}|�d����S��
��strip��.0�lines  �I/opt/cloudlinux/venv/lib64/python3.11/site-packages/raven/utils/stacks.py�
<listcomp>z'get_lines_from_file.<locals>.<listcomp>As4��
�
�
��
�J�J�v���
�
�
�r
c�8�g|]}|�d����Srrrs  rrz'get_lines_from_file.<locals>.<listcomp>Fs4��
�
�
��
�J�J�v���
�
�
r)�hasattrr�ImportError�IOError�
splitlines�	linecache�getlines�OSError�max�min�lenr�
IndexError�slim_string)�filename�lineno�
context_lines�loader�module_name�source�lower_bound�upper_bound�pre_context�context_line�post_contexts           r�get_lines_from_filer.s����F�
��g�f�l�;�;��	��&�&�{�3�3�F�F���W�%�	�	�	��F�F�F�	���� ���&�&�(�(�F�
�~�	$��'��1�1�F�F����!�	$�	$�	$�#�#�#�	$����� ����a��-�/�0�0�K��f�q�j�=�0�#�f�+�+�>�>�K� �
�
��{�6�1�2�
�
�
���f�~�+�+�F�3�3��
�
����
�K�7�8�
�
�
����� � � ���� ����
	�K� � ��L�!�!��L�!�!��s4�,�A�A�A3�3B�B�AD
�
D�Dc�8�	||S#t$r|cYSwxYw)z�
    f_locals is not guaranteed to have .get(), but it will always
    support __getitem__. Even if it doesn't, we return ``default``.
    )�	Exception)�f_locals�key�defaults   r�_getitem_from_framer4Us5��
���}��������������s�
��c����t�d��r�j}n't�d��r�j}nt����t	�fd�|��D����S)zu
    Given something that closely resembles a dictionary, we attempt
    to coerce it into a propery dictionary.
    �iterkeys�keysc3�,�K�|]}|�|fV��dS�N�)r�k�dictishs  �r�	<genexpr>zto_dict.<locals>.<genexpr>ls+�����-�-�A��G�A�J��-�-�-�-�-�-r)rr6r7�
ValueError�dict)r<�ms` r�to_dictrA`ss���
�w�
�#�#�"�����	��&�	!�	!�"��L�����!�!�!��-�-�-�-�����-�-�-�-�-�-rc#��K�|rkt|d��r]t|jdi��}t|d��s|jt|dd��fV�|j}|rt|d���YdSdSdSdS)z�
    Given a traceback object, it will iterate over all
    frames that do not contain the ``__traceback_hide__``
    local variable.
    �tb_framer1�__traceback_hide__�	tb_linenoN)r�getattrrCr4�tb_next)�tbr1s  r�iter_traceback_framesrIos�����
����Z�(�(���2�;�
�B�7�7��"�8�-A�B�B�	>��+�w�r�;��=�=�=�=�=�=�
�Z��

����Z�(�(���������rc#��K�|stj��dd�}d�t|��D��D],\}}t|di��}t	|d��s||fV��-dS)z�
    Given an optional list of frames (defaults to current stack),
    iterates over all frames that do not contain the ``__traceback_hide__``
    local variable.
    r
Nc3�6K�|]}|d|dfV��dS)r�Nr:)r�fs  rr=z$iter_stack_frames.<locals>.<genexpr>�s.����A�A�1�1�Q�4��1��,�A�A�A�A�A�Arr1rD)�inspect�stack�reversedrFr4)�frames�framer$r1s    r�iter_stack_framesrS�s������%��������$��A�A���0@�0@�A�A�A� � �
��v��5�*�b�1�1��"�8�-A�B�B�	 ���-����� � ric�D�t|dd��}|sdSt|t��s"	t|��}n#t$rYdSwxYwi}d}t|��D]?\}}||��}t
t|����}||z|kr
|||<||z
}�@|S)Nr1r)rF�
isinstancer?rAr0rr �repr)	rR�transformer�max_var_sizer1�f_vars�f_sizer;�v�v_sizes	         r�get_frame_localsr]�s����u�j�$�/�/�H����t��h��%�%��	��x�(�(�H�H���	�	�	��4�4�	�����F�
�F��(�#�#�����1��K��N�N���T�!�W�W�����F�?�\�)�)��F�1�I��f��F���Ms�<�
A
�	A
�c�B�d}g}g}|D]G}|dz
}|�d��r|�|���2|�|���H||kr|S||z
}t|��}t||z
d��}|rht	|dz��}	||	|	�D]I}|�dd��|�dd��|�dd��|dz}�JnL|D]I}|�dd��|�dd��|�dd��|dz}�J|rg||z
}
t	|
dz��}	||	|	�D]D}|�dd��|�dd��|�dd���E|S)	z~
    Removes various excess metadata from middle frames which go beyond
    ``frame_allowance``.

    Returns ``frames``.
    rr
�in_apprL�varsNr+r-)�get�appendr r�int�pop)rQ�frame_allowance�
frames_len�
app_frames�
system_framesrR�	remaining�	app_count�system_allowance�half_max�
app_allowances           r�slim_frame_dataro�s���J��J��M��(�(���a��
��9�9�X���	(����e�$�$�$�$�� � ��'�'�'�'��_�$�$��
��_�,�I��J���I��?�Y�6��:�:�����'�!�+�,�,��"�8�X�I�#5�6�	�	�E��I�I�f�d�#�#�#��I�I�m�T�*�*�*��I�I�n�d�+�+�+���N�I�I�		�#�	�	�E��I�I�f�d�#�#�#��I�I�m�T�*�*�*��I�I�n�d�+�+�+���N�I�I��,�!�I�-�
��}�q�(�)�)����(�� 2�3�	,�	,�E��I�I�f�d�#�#�#��I�I�m�T�*�*�*��I�I�n�d�+�+�+�+��Mr�c�d�|s|St|��|kr|d|dz
�dzS|d|�S)N�z...)r )�value�lengths  rr"r"�sF������
�5�z�z�F����[�f�q�j�[�!�E�)�)���&��>�rTc���d}g}|D�]�}t|ttf��r|\}}n	|}|j}t	|di��}	t|	d��r�Pt	|di��}
t	|dd��}|r|jj}|jj}
nd}d}
t|
d��}t|
d��}|r|d	z}|�|rt||d
||��\}}}nd\}}}	tj|�dd	��d
j
}|�|�tjd��d
d	��d�tj��}n#t$$r|}YnwxYw|s|}|||pd|
pd|d	zd�}|rt'||���}|r||d<|�|�|||d���|�|�����dt-||���i}|S)a
    Given a list of frames, returns a list of stack information
    dictionary objects that are JSON-ready.

    We have to be careful here as certain implementations of the
    _Frame class do not contain the necessary data to lookup all
    of the information we want.
    Tr1rD�	f_globals�f_codeN�
__loader__�__name__r
�r	�.rrL���z	<unknown>)�abs_pathr#�module�functionr$)rWra)r+r,r-rQ)rf)rU�list�tuple�f_linenorFr4rw�co_filename�co_namer.�sys�modules�split�__file__�rsplit�os�sep�lstripr0r]�updatercro)rQrW�capture_localsrfrD�result�
frame_inforRr$r1rvrwr}rr&r'r+r,r-�
base_filenamer#�frame_resultrY�	stackinfos                        r�get_stack_infor��s�����
�F��B$�B$�
��j�4��-�0�0�	)�&�M�E�6�6��E��(�F��5�*�b�1�1���x�)=�>�>�	���E�;��3�3�	����$�/�/���	��|�/�H��|�+�H�H��H��H�$�Y��=�=��)�)�Z�@�@���	��a�K�F���(��#�H�f�a���M�M�
4�K��|�|�7G�3�K��|�	 ��K��(9�(9�#�q�(A�(A�!�(D�E�N�M��~�~��$�$�R�V�Q�/�/��2�A�7�7�79�;�;A�6�"�&�>�>�
�H���	 �	 �	 ��H�H�H�	 �����	 ��H�!� �!�)�T� �/�K��q�j�
�
���	.�%�e��E�E�E�F��
.�'-��V�$��#����*� ,� ,�!�!�
�
�
�
	�
�
�l�#�#�#�#�	�/�&�/�J�J�J��I��s�"BE1�1F�?F)NNr9)r^)rp)�__doc__�
__future__rrrNr�rer�r��raven.utils.serializerr�raven.utils.compatr�compile�
_coding_rer.r4rArIrSr]ror"r�r:rr�<module>r�sc����1�0�0�0�0�0�0�0���������	�	�	�	�	�	�	�	�
�
�
�
�,�,�,�,�,�,�(�(�(�(�(�(��R�Z�1�
2�
2�
�26�;�;�;�;�|����.�.�.����" � � � �)2������00�0�0�0�f����(1��#%�U�U�U�U�U�Ur

Zerion Mini Shell 1.0