Viewing File: /opt/hc_python/lib/python3.12/site-packages/tblib/__pycache__/__init__.cpython-312.pyc

�

^��g�����ddlZddlZdZdZejd�ZGd�de�ZGd�de�Z	Gd	�d
e�Z
Gd�d�ZGd
�d�ZGd�d�Z
d�Zy)�Nz3.1.0)�Code�Frame�	Traceback�TracebackParseErrorzO^\s*File "(?P<co_filename>.+)", line (?P<tb_lineno>\d+)(, in (?P<co_name>.+))?$c��eZdZdZd�Zy)�	_AttrDict�c�@�	||S#t$r
t|�d�wxYw�N)�KeyError�AttributeError)�self�names  �=/opt/hc_python/lib/python3.12/site-packages/tblib/__init__.py�__getattr__z_AttrDict.__getattr__
s-��	1���:����	1� ��&�D�0�	1�s��N)�__name__�
__module__�__qualname__�	__slots__rr	�rrr
s���I�1rrc��eZdZy)�__traceback_makerN�rrrr	rrrr���rrc��eZdZy)rNrr	rrrrrrrc��eZdZdZdZd�Zy)rzw
    Class that replicates just enough of the builtin Code object to enable serialization and traceback rendering.
    Nc��|j|_|j|_d|_d|_d|_d|_d|_d|_d|_y)Nrr	�@)	�co_filename�co_name�co_argcount�co_kwonlyargcount�co_varnames�
co_nlocals�co_stacksize�co_flags�co_firstlineno)r�codes  r�__init__z
Code.__init__$sQ���+�+����|�|������!"��������������
���r)rrr�__doc__�co_coder)r	rrrrs����G�	 rrc�"�eZdZdZdd�d�Zd�Zy)ra
    Class that replicates just enough of the builtin Frame object to enable serialization and traceback rendering.

    Args:

        get_locals (callable): A function that take a frame argument and returns a dict.

            See :class:`Traceback` class for example.
    N��
get_localsc��|�in||�|_|jj�D��cic]
\}}|dvs�||��c}}|_t|j�|_|j
|_ycc}}w)N��__file__r)�f_locals�	f_globals�itemsr�f_code�f_lineno)r�framer.�k�vs     rr)zFrame.__init__;sk��(�0��j��6G��
�+0�?�?�+@�+@�+B�d�+B�4�1�a�a�Kc�Fc�!�Q�$�+B�d����5�<�<�(�������
��es
�A6�A6c��y)z�
        For compatibility with PyPy 3.5;
        clear() was added to frame in Python 3.4
        and is called by traceback.clear_frames(), which
        in turn is called by unittest.TestCase.assertRaises
        Nr	)rs r�clearzFrame.clearAs�r)rrrr*r)r;r	rrrr0s���-1�'�rrc�V�eZdZdZdZdd�d�Zd�ZeZd�ZeZ	e
d��Ze
d	d��Zy)
ra'
    Class that wraps builtin Traceback objects.

    Args:
        get_locals (callable): A function that take a frame argument and returns a dict.

            Ideally you will only return exactly what you need, and only with simple types that can be json serializable.

            Example:

            .. code:: python

                def get_locals(frame):
                    if frame.f_locals.get("__tracebackhide__"):
                        return {"__tracebackhide__": True}
                    else:
                        return {}
    Nr-c�n�t|j|��|_t|j�|_|j}|}t|�}|�dtj|�}t|j|��|_t|j�|_||_|}|j}|��cyy)Nr-)r�tb_frame�int�	tb_lineno�tb_next�type�object�__new__)r�tbr.�prev_traceback�cls�	tracebacks      rr)zTraceback.__init__`s����b�k�k�j�A��
��R�\�\�*����Z�Z�����4�j���n����s�+�I�!&�r�{�{�z�!J�I��"%�b�l�l�"3�I��%.�N�"�&�N����B�
�nrc��|}d}d}tddd�}|r�|jj}|j|jd|j
|jdd��}	t|t|jj�t|jj��|j}|r��	|~~S#t$r4tj�dj}|�|}|�||_|}~Y�PwxYw#~~wxYw)	zm
        Convert to a builtin Traceback object that is usable for raising or rendering a stacktrace.
        Nzraise __traceback_makerz<string>�execrr	)r'r!rr �co_freevars�co_cellvars�)�compiler>r5�replacer@rr rJ�dictr3r2�	Exception�sys�exc_inforA)r�current�top_tbrE�stubr5r(�next_tbs        r�as_tracebackzTraceback.as_tracebackps������
���%���
��
��%�%�,�,�F��<�<�&�0�0��"�.�.������
 ��D�	
��T�4�� 0� 0� :� :�;�T�'�BR�BR�B[�B[�=\�]��o�o�G�/�0	������
��,�,�.��+�3�3���>�$�F��>�!(�B�J����
����s�"AB=�9C=�=:C:�9C:�=Dc�|�|j�d}n|jj�}|jjj|jjj
d�}|jj|jj||jjd�}||j|d�S)z�
        Converts to a dictionary representation. You can serialize the result to JSON as it only has
        builtin objects like dicts, lists, ints or strings.
        N�rr �r3r2r5r6�r>r@rA)
rA�as_dictr>r5rr r3r2r6r@)rrAr(r7s    rr]zTraceback.as_dict�s���
�<�<���G��l�l�*�*�,�G� �=�=�/�/�;�;��}�}�+�+�3�3�
��
���0�0��
�
�.�.���
�
�.�.�	
�������
�	
rc��|dr|j|d�}nd}t|ddd|ddd��}t|dd|djd	i�||dd
��}t||d|�
�}||t��S)zj
        Creates an instance from a dictionary with the same structure as ``.as_dict()`` returns.
        rANr>r5rr rZr3r2r6r[r@r\r-)�	from_dictr�get�get_all_locals)rG�dctrAr(r7rEs      rr_zTraceback.from_dict�s���
�y�>��m�m�C�	�N�3�G��G���J���1�-�@��
�O�H�-�i�8�
����*�o�k�2���_�(�(��R�8����_�Z�0�	
�����+�&��
��
�2�.�1�1rc���g}|}|j�D]i}|j�}|r|dk(rd}�tj|�}|r |j	|j���T|j
d�r�f|s�in|rYd}t|�D]A}t|t|t|dd��it|�t|d��	�|�
�}�C||�Std|�d���)
z�
        Creates an instance by parsing a stacktrace. Strict means that parsing stops when lines are not indented by at least two spaces
        anymore.
        z"Traceback (most recent call last):Fz  Nr�?r0r@r[)r>rAzCould not find any frames in �.)�
splitlines�rstrip�FRAME_RE�match�append�	groupdict�
startswith�reversedrr?r)	rG�string�strict�frames�header�line�frame_match�previousr7s	         r�from_stringzTraceback.from_string�s��������%�%�'�D��;�;�=�D���?�?�"�F��"�.�.��.�K���
�
�k�3�3�5�6�����&����(���H�!�&�)��$��&��"+�%*�=�%9�%(�#�"$�(��/�!$�U�;�%7�!8�	�%�
��*��x�=� �%�(E�f�Z�q�&Q�R�Rr)T)
rrrr*rAr)rX�to_tracebackr]�to_dict�classmethodr_rur	rrrrJsW���&�G�)-�� (�T �L�
�4�G��2��2�4�)S��)Srrc�,�t|j�Sr)rPr2)r7s rraras�������r)�rerR�__version__�__all__rNrhrPrrQrrrrrrar	rr�<module>r}sr��	�
���
=���2�:�:�h�i��1��1�	�	�	�	�)�	� � �&��4sS�sS�l r
Back to Directory File Manager