Ë
c‡½jsk ã ó — d Z dZddlZddlZddlZddlZddlZddlZddlZddl m
Z
ddlmZm
Z
mZ ddlmZ ddlmZmZ dd lmZ dd
„Z G d„ de« Zd
„ Zd„ Zd„ Zd„ Zd„ Z G d„ de« Z G d„ de« Z G d„ de« Z! G d„ de « Z"y)zÛRefactoring framework.
Used as a main program, this can refactor any number of files and/or
recursively descend down directories. Imported as a module, this
provides infrastructure to write your own refactoring tool.
z#Guido van Rossum é N)Úchainé )ÚdriverÚtokenizeÚtoken)Ú find_root)ÚpytreeÚpygram)Úbtm_matcherc óÌ — t | g g dg« }g }t j |j « D ]0 \ }}}|j d« sŒ|r|dd }|j |« Œ2 |S )zEReturn a sorted list of all available fix names in the given package.Ú*Úfix_é N)Ú
__import__ÚpkgutilÚiter_modulesÚ__path__Ú
startswithÚappend)Ú fixer_pkgÚ
remove_prefixÚpkgÚ fix_namesÚfinderÚnameÚispkgs ú)/usr/lib64/python3.12/lib2to3/refactor.pyÚget_all_fix_namesr sj € ä
�Y B¨¨Ó
.€CØ€IÜ&×3Ñ3°C·L±LÖAш��eØ�?‰?˜6Õ"ÙØ˜A˜B�x�Ø×јTÕ"ð Bð
Ðó c ó — e Zd Zy)Ú
_EveryNodeN©Ú__name__Ú
__module__Ú__qualname__© r r r! r! + ó „ Ør r! c óâ — t | t j t j f« r| j €t
‚| j hS t | t j « r'| j rt | j « S t
‚t | t j « r>t « }| j D ]# }|D ] }|j t |« « Œ Œ% |S t d| z « ‚)zf Accepts a pytree Pattern Node and returns a set
of the pattern types which will match first. z$Oh no! I don't understand pattern %s)
Ú
isinstancer ÚNodePatternÚLeafPatternÚtyper! ÚNegatedPatternÚcontentÚ_get_head_typesÚWildcardPatternÚsetÚupdateÚ Exception)ÚpatÚrÚpÚxs r r/ r/ / sÁ € ô �#œ×*Ñ*¬F×,>Ñ,>Ð?Ô@ð �8‰8ÐÜÐØ—‘ˆzÐä�#”v×,Ñ,Ô-Ø�;Š;Ü" 3§;¡;Ó/Ð/ÜÐä�#”v×-Ñ-Ô.ä‹EˆØ—”ˆAÛ�Ø—‘œ¨Ó+Õ,ñ ð ð ˆä
Ð:¸SÑAÓ
BÐBr c óX — t j t « }g }| D ]| }|j r2 t |j « }|D ] }|| j |« Œ ŒA|j �||j j |« Œl|j |« Œ~ t t j j j « t j j « D ] }|| j |« Œ t |« S # t $ r |j |« Y �Œ
w xY w)z^ Accepts a list of fixers and returns a dictionary
of head node type --> fixer list. )ÚcollectionsÚdefaultdictÚlistÚpatternr/ r r! Ú_accept_typer r
Úpython_grammarÚ
symbol2numberÚvaluesÚtokensÚextendÚdict)Ú
fixer_listÚ
head_nodesÚeveryÚfixerÚheadsÚ node_types r Ú_get_headnode_dictrJ K s € ô ×(Ñ(¬Ó.€JØ€EÛˆØ�=Š=ð
8Ü'¨¯
©
Ó6�ó "'�IؘyÑ)×0Ñ0°Õ7ñ "'ð ×!Ñ!Ð-ؘ5×-Ñ-Ñ.×5Ñ5°eÕ<à—‘˜UÕ#ð ô œ6×0Ñ0×>Ñ>×EÑEÓGÜ!×0Ñ0×7Ñ7ö9ˆ à�9Ñ×$Ñ$ UÕ+ð9ô �
ÓÐøô ò
$Ø—‘˜U×#ð
$ús ®DÄD)Ä(D)c óL — t | d« D �cg c]
}| dz |z ‘Œ c}S c c}w )zN
Return the fully qualified names for fixers in the package pkg_name.
FÚ.)r )Úpkg_nameÚfix_names r Úget_fixers_from_packagerO d s= € ô
.¨h¸Ô>ó@Ù>�ð
�s‰N˜XÓ%Ø>ñ@ð @ùò @s �!c ó — | S ©Nr&