File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/raven/utils/__pycache__/stacks.cpython-311.pyc
�
:!]U��� �� � d Z ddlmZmZ ddlZddlZddlZddlZddlZddl m
Z
ddlmZ ej
d� � Z dd�Zdd�Zd � Zd
� Zdd�Ze
dfd
�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# t t f$ r d}Y nw xY w|�|� � � }|�. t j | � � }n# t t f$ r Y dS w xY w|sdS t d||z
� � }t |dz |z t |� � � � } d� |||� D � � }|| � d� � } d� ||dz |� D � � }
n# t $ r Y dS w xY wt |� � 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 �c/builddir/build/BUILD/cloudlinux-venv-1.0.8/venv/lib/python3.11/site-packages/raven/utils/stacks.py�
<listcomp>z'get_lines_from_file.<locals>.<listcomp>A s4 � �
�
�
��
�J�J�v���
�
�
� r
c �8 � g | ]}|� d � � ��S r r r s r r z'get_lines_from_file.<locals>.<listcomp>F s4 � �
�
�
��
�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 |cY S w xY w)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_framer4 U s5 � �
���}���� � � ��������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�keysc 3 �, �K � | ]}|�| fV � �d S �N� )r �k�dictishs �r � <genexpr>zto_dict.<locals>.<genexpr>l s+ �� � � �-�-�A��G�A�J��-�-�-�-�-�-r )r r6 r7 �
ValueError�dict)r<