관리-도구
편집 파일: fix_raise.cpython-311.pyc
� �܋f@ � �x � d Z ddlmZmZ ddlmZ ddlmZmZm Z m Z mZmZ ddl mZ G d� dej � � ZdS ) a� Fixer for 'raise E, V' From Armin Ronacher's ``python-modernize``. raise -> raise raise E -> raise E raise E, 5 -> raise E(5) raise E, 5, T -> raise E(5).with_traceback(T) raise E, None, T -> raise E.with_traceback(T) raise (((E, E'), E''), E'''), 5 -> raise E(5) raise "foo", V, T -> warns about string exceptions raise E, (V1, V2) -> raise E(V1, V2) raise E, (V1, V2), T -> raise E(V1, V2).with_traceback(T) CAVEATS: 1) "raise E, V, T" cannot be translated safely in general. If V is not a tuple or a (number, string, None) literal, then: raise E, V, T -> from future.utils import raise_ raise_(E, V, T) � )�pytree� fixer_base)�token)�Name�Call�is_tuple�Comma�Attr�ArgList)�touch_import_topc � � e Zd ZdZdZd� ZdS )�FixRaiseTzB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > c � � | j }|d � � � }|j t j k rd}| � ||� � d S t |� � rOt |� � r9|j d j d � � � }t |� � �9d|_ d|v r|d � � � }nd }d|v �r|d � � � }t |� � r*d� |j dd � D � � }t ||� � }n�|j t j t j fv rd |_ t ||g� � }n�|j t j k r|j dk rnbt dd |� � d |_ |t � � |g}|�|t � � |gz }t t d � � ||j �� � S |�7d |_ t! |t d� � � � t# |g� � gz } n|g} t% j |j t d� � g| z |j �� � S )N�excz+Python 3 does not support string exceptions� r � �tb�valc �6 � g | ]}|� � � ��S � )�clone)�.0�cs �l/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/libfuturize/fixes/fix_raise.py� <listcomp>z&FixRaise.transform.<locals>.<listcomp>I s � �>�>�>�a���� � �>�>�>� ���� �Nonezfuture.utils�raise_)�prefix�with_traceback�raise)�symsr �typer �STRING�cannot_convertr �childrenr! r �NUMBER�NAME�valuer r r r r r �Node� raise_stmt) �self�node�resultsr$ r �msgr r �args�exc_lists r � transformzFixRaise.transform* sF � ��y���e�n�"�"�$�$���8�u�|�#�#�?�C�����c�*�*�*��F� �C�=�=� ��3�-�-� :� �l�1�o�.�q�1�7�7�9�9�� �3�-�-� :� �C�J��7�?�?����$�$�&�&�B�B��B��G����%�.�&�&�(�(�C���}�}� G�>�>�3�<��"��+=�>�>�>���3��o�o�����e�l�E�L�9�9�9� !�� ��3���&�&�����U�Z�'�'�C�I��,@�,@� � !��)�T�B�B�B� �� ��U�W�W�c�*���>��U�W�W�b�M�)�D��D��O�O�T�$�+�F�F�F�F� �>��B�I��C��&6�!7�!7�8�8�G�R�D�M�M�?�J�H�H��u�H��{�4�?� ��N�N�+�h�6�"&�+�/� /� /� /r N)�__name__� __module__�__qualname__� BM_compatible�PATTERNr4 r r r r r # s4 � � � � � ��M��G�A/� A/� A/� A/� A/r r N)�__doc__�lib2to3r r � lib2to3.pgen2r �lib2to3.fixer_utilr r r r r r �libfuturize.fixer_utilr �BaseFixr r r r �<module>r@ s� ��� �6 '� &� &� &� &� &� &� &� � � � � � � I� I� I� I� I� I� I� I� I� I� I� I� I� I� I� I� 3� 3� 3� 3� 3� 3�H/� H/� H/� H/� H/�z�!� H/� H/� H/� H/� H/r