
    ZQd.                     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 )	zFixer for generator.throw(E, V, T).

g.throw(E)       -> g.throw(E)
g.throw(E, V)    -> g.throw(E(V))
g.throw(E, V, T) -> g.throw(E(V).with_traceback(T))

g.throw("foo"[, V[, T]]) will warn about string exceptions.   )pytree)token)
fixer_base)NameCallArgListAttris_tuplec                       e Zd ZdZdZd ZdS )FixThrowTz
    power< any trailer< '.' 'throw' >
           trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' >
    >
    |
    power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > >
    c                    | j         }|d                                         }|j        t          j        u r|                     |d           d S |                    d          }|d S |                                }t          |          rd |j        dd         D             }n
d|_	        |g}|d         }d	|v r|d	                                         }d|_	        t          ||          }	t          |	t          d
                    t          |g          gz   }
|                    t          j        |j        |
                     d S |                    t          ||                     d S )Nexcz+Python 3 does not support string exceptionsvalc                 6    g | ]}|                                 S  )clone).0cs     ./usr/lib/python3.11/lib2to3/fixes/fix_throw.py
<listcomp>z&FixThrow.transform.<locals>.<listcomp>)   s     :::!AGGII:::        argstbwith_traceback)symsr   typer   STRINGcannot_convertgetr
   childrenprefixr   r	   r   r   replacer   Nodepower)selfnoderesultsr   r   r   r   
throw_argsr   ewith_tbs              r   	transformzFixThrow.transform   s[   yen""$$8u|##&STTTF kk%  ;FiikkC== 	::s|AbD'9:::DDCJ5DV_
7??$$&&BBIS$A1d#34455"GGv{4:w??@@@@@tC/////r   N)__name__
__module____qualname__BM_compatiblePATTERNr.   r   r   r   r   r      s/        MG0 0 0 0 0r   r   N)__doc__r   r   pgen2r   r   
fixer_utilr   r   r   r	   r
   BaseFixr   r   r   r   <module>r8      s   ? ?                   < < < < < < < < < < < < < <(0 (0 (0 (0 (0z! (0 (0 (0 (0 (0r   