AlkantarClanX12

Your IP : 3.142.40.195


Current Path : /opt/alt/python311/lib64/python3.11/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/lib2to3/fixes/__pycache__/fix_raise.cpython-311.pyc

�

c��fn��p�dZddlmZddlmZddlmZddlmZmZm	Z	m
Z
mZGd�dej��Z
dS)	a[Fixer for 'raise E, V, T'

raise         -> raise
raise E       -> raise E
raise E, V    -> raise E(V)
raise E, V, T -> raise E(V).with_traceback(T)
raise E, None, T -> raise E.with_traceback(T)

raise (((E, E'), E''), E'''), V -> raise E(V)
raise "foo", V, T               -> warns about string exceptions


CAVEATS:
1) "raise E, V" will be incorrectly translated if V is an exception
   instance. The correct Python 3 idiom is

        raise E from V

   but since we can't detect instance-hood by syntax alone and since
   any client code would have to be changed as well, we don't automate
   this.
�)�pytree)�token)�
fixer_base)�Name�Call�Attr�ArgList�is_tuplec��eZdZdZdZd�ZdS)�FixRaiseTzB
    raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] >
    c�h�|j}|d���}|jtjkrd}|�||��dSt
|��rOt
|��r9|jdjd���}t
|���9d|_d|vr7tj
|jtd��|g��}|j|_|S|d���}t
|��rd�|jdd	�D��}n
d
|_|g}d|vr�|d���}	d
|	_|}
|jtj
ks|jdkrt||��}
t!|
td
����t#|	g��gz}tj
|jtd��g|z��}|j|_|Stj
|jtd��t||��g|j���S)N�excz+Python 3 does not support string exceptions��� �val�raisec�6�g|]}|�����S�)�clone)�.0�cs  �>/opt/alt/python311/lib64/python3.11/lib2to3/fixes/fix_raise.py�
<listcomp>z&FixRaise.transform.<locals>.<listcomp>Ds ��:�:�:�!�A�G�G�I�I�:�:�:������tb�None�with_traceback)�prefix)�symsr�typer�STRING�cannot_convertr
�childrenr!r�Node�
raise_stmtr�NAME�valuerrr	�simple_stmt)�self�node�resultsr"r�msg�newr�argsr�e�with_tbs            r�	transformzFixRaise.transform&s���y���e�n�"�"�$�$���8�u�|�#�#�?�C�����c�*�*�*��F��C�=�=�	��3�-�-�
:��l�1�o�.�q�1�7�7�9�9���3�-�-�
:��C�J������+�d�o��W�
�
�s�/C�D�D�C���C�J��J��e�n�"�"�$�$���C�=�=�	�:�:�s�|�A�b�D�'9�:�:�:�D�D��C�J��5�D��7�?�?����$�$�&�&�B��B�I��A��x�5�:�%�%���f�)<�)<���d�O�O���1�d�#3�4�4�5�5��"�����G�G��+�d�.��g����'�0I�J�J�C���C�J��J��;�t�� $�W�
�
�t�C����?�&*�k�3�3�3�
3rN)�__name__�
__module__�__qualname__�
BM_compatible�PATTERNr4rrrrrs/�������M��G�43�43�43�43�43rrN)�__doc__rr�pgen2rr�
fixer_utilrrrr	r
�BaseFixrrrr�<module>r>s�����2������������������<�<�<�<�<�<�<�<�<�<�<�<�<�<�;3�;3�;3�;3�;3�z�!�;3�;3�;3�;3�;3r