AlkantarClanX12
Current Path : /opt/alt/python312/lib64/python3.12/lib2to3/__pycache__/ |
Current File : //opt/alt/python312/lib64/python3.12/lib2to3/__pycache__/refactor.cpython-312.opt-1.pyc |
� �Q�fsk � � � 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 <guido@python.org>� 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 �7/opt/alt/python312/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&