o bc @sJdZddlmZmZddlmZmZmZmZm Z m Z Gdddej Z dS)z7 Convert use of sys.exitfunc to use the atexit module. )pytree fixer_base)NameAttrCallCommaNewlinesymscs<eZdZdZdZdZfddZfddZddZZ S) FixExitfuncTa ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) cstt|j|dSN)superr __init__)selfargs __class__1/usr/lib/python3.10/lib2to3/fixes/fix_exitfunc.pyr szFixExitfunc.__init__cstt|||d|_dSr )r r start_tree sys_import)rtreefilenamerrrr!s zFixExitfunc.start_treec Cs(d|vr|jdur|d|_dS|d}d|_ttjttdtd}t ||g|j}| ||jdurA| |ddS|jj d}|j tjkr]|t|tdddS|jj}|j |j}|j} ttjtd tddg} ttj| g} ||dt||d | dS) NrfuncatexitregisterzKCan't find sys import; Please add an atexit import at the top of your file. import)rcloneprefixrNoder powerrrrreplacewarningchildrentypedotted_as_names append_childrparentindex import_name simple_stmt insert_childr) rnoderesultsrrcallnamescontaining_stmtpositionstmt_container new_importnewrrr transform%s6         zFixExitfunc.transform) __name__ __module__ __qualname__keep_line_order BM_compatiblePATTERNr rr8 __classcell__rrrrr s  r N) __doc__lib2to3rrlib2to3.fixer_utilrrrrrr BaseFixr rrrrs