ok
Direktori : /opt/alt/python311/lib64/python3.11/lib2to3/__pycache__/ |
Current File : //opt/alt/python311/lib64/python3.11/lib2to3/__pycache__/refactor.cpython-311.opt-1.pyc |
� �fsk � �@ � d Z dZddlZddlZddlZddlZddlZddlZddlZddl m Z ddlmZm Z mZ ddlmZ ddlmZmZ dd lmZ dd�Z G d� d e� � Zd� Zd� Zd� Zd� Zd� Z G d� de� � Z G d� de� � Z G d� de� � Z! G d� de � � Z"dS )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_matcherTc �� � t | g g dg� � }g }t j |j � � D ]<\ }}}|� d� � r!|r |dd� }|� |� � �=|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/python311/lib64/python3.11/lib2to3/refactor.py�get_all_fix_namesr s� � � �Y��B��� .� .�C��I�&�3�C�L�A�A� #� #����e��?�?�6�"�"� #�� ��A�B�B�x�����T�"�"�"���� c � � e Zd ZdS )� _EveryNodeN��__name__� __module__�__qualname__� r r r! r! + � � � � � � ��Dr 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 � � rAt � � }| j D ])}|D ]$}|� t |� � � � �%�*|S t d| z � � �)zf Accepts a pytree Pattern Node and returns a set of the pattern types which will match first. Nz$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������z���#�v�,�-�-� ��;� 0�"�3�;�/�/�/����#�v�-�.�.� ��E�E���� -� -�A�� -� -�������+�+�,�,�,�,� -��� �:�S�A� B� B�Br c �Z � t j t � � }g }| D ]�}|j r[ t |j � � }|D ]}|| � |� � ��?# t $ r |� |� � Y �`w xY w|j �!||j � |� � ��|� |� � ��t t j j � � � t j j � � D ]}|| � |� � �t |� � S )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 sL � � �(��.�.�J��E�� $� $���=� $� 8�'�� �6�6�� "'� 8� 8�I��y�)�0�0��7�7�7�7�8�� � $� $� $����U�#�#�#�#�#� $���� �!�-��5�-�.�5�5�e�<�<�<�<����U�#�#�#�#��6�0�>�E�E�G�G�!�0�7�9� 9� ,� ,� ��9��$�$�U�+�+�+�+�� ���s �A�A?�>A?c �<