§
    ZQdn  ã                   óp   — d Z ddlmZ ddlmZ ddlmZ ddlmZmZm	Z	m
Z
mZ  G d„ dej        ¦  «        ZdS )	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                   ó   — e Zd ZdZdZd„ ZdS )ÚFixRaiseTzB
    raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] >
    c                 óh  — | j         }|d                              ¦   «         }|j        t          j        k    rd}|                      ||¦  «         d S t          |¦  «        rOt          |¦  «        r9|j        d         j        d                              ¦   «         }t          |¦  «        °9d|_        d|vr7t          j
        |j        t          d¦  «        |g¦  «        }|j        |_        |S |d                              ¦   «         }t          |¦  «        rd„ |j        dd	…         D ¦   «         }n
d
|_        |g}d|v r»|d                              ¦   «         }	d
|	_        |}
|j        t          j        k    s|j        dk    rt          ||¦  «        }
t!          |
t          d¦  «        ¦  «        t#          |	g¦  «        gz   }t          j
        |j        t          d¦  «        g|z   ¦  «        }|j        |_        |S t          j
        |j        t          d¦  «        t          ||¦  «        g|j        ¬¦  «        S )NÚexcz+Python 3 does not support string exceptionsé   é    ú ÚvalÚraisec                 ó6   — g | ]}|                      ¦   «         ‘ŒS © )Úclone)Ú.0Úcs     ú./usr/lib/python3.11/lib2to3/fixes/fix_raise.pyú
<listcomp>z&FixRaise.transform.<locals>.<listcomp>D   s    € Ð:Ð:Ð: !�A—G’G‘I”IÐ:Ð:Ð:ó    éÿÿÿÿÚ ÚtbÚNoneÚwith_traceback)Úprefix)Úsymsr   Útyper   ÚSTRINGÚcannot_convertr
   Úchildrenr!   r   ÚNodeÚ
raise_stmtr   ÚNAMEÚvaluer   r   r	   Úsimple_stmt)ÚselfÚnodeÚresultsr"   r   ÚmsgÚnewr   Úargsr   ÚeÚwith_tbs               r   Ú	transformzFixRaise.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ð 3r   N)Ú__name__Ú
__module__Ú__qualname__ÚBM_compatibleÚPATTERNr4   r   r   r   r   r      s/   € € € € € à€Mð€Gð43ð 43ð 43ð 43ð 43r   r   N)Ú__doc__r   r   Úpgen2r   r   Ú
fixer_utilr   r   r   r	   r
   ÚBaseFixr   r   r   r   ú<module>r>      s¨   ððð ð2 Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <ð;3ð ;3ð ;3ð ;3ð ;3ˆzÔ!ñ ;3ô ;3ð ;3ð ;3ð ;3r   