0x1949 Team - FAZEMRX - MANAGER
Edit File: refactor.cpython-310.pyc
o ��bcsk � @ s d Z dZddlZddlZddlZddlZddlZddlZddlZddl m Z ddlmZm Z mZ ddlmZ ddlmZmZ dd lmZ d!dd�ZG d d� de�Zdd� Zdd� Zdd� Zdd� Zdd� ZG dd� de�ZG dd� de�Z G dd� de�Z!G dd � d e �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 C sT t | g g dg�}g }t�|j�D ]\}}}|�d�r'|r"|dd� }|�|� q|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�ispkg� r �'/usr/lib/python3.10/lib2to3/refactor.py�get_all_fix_names s �r c @ � e Zd ZdS )� _EveryNodeN��__name__� __module__�__qualname__r r r r r + � r c C s� t | tjtjf�r| jdu rt�| jhS t | tj�r$| jr"t| j�S t�t | tj �rAt � }| jD ]}|D ] }|�t|�� q4q0|S td| ��)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�xr r r r+ / s �r+ c C s� t �t�}g }| D ];}|jr1zt|j�}W n ty# |�|� Y q w |D ] }|| �|� q&q |jdur?||j �|� q |�|� q tt j j�� t j j �D ] }|| �|� qPt|�S )z^ Accepts a list of fixers and returns a dictionary of head node type --> fixer list. N)�collections�defaultdict�list�patternr+ r r �_accept_typer r �python_grammar� symbol2number�values�tokens�extend�dict)� fixer_list� head_nodes�every�fixer�heads� node_typer r r �_get_headnode_dictK s( �� �rE c s � fdd�t � d�D �S )zN Return the fully qualified names for fixers in the package pkg_name. c s g | ]}� d | �qS ��.r )�.0�fix_name��pkg_namer r � <listcomp>h s �z+get_fixers_from_package.<locals>.<listcomp>F)r rJ r rJ r �get_fixers_from_packaged s �rM c C s | S �Nr )�objr r r � _identityk s rP c sj d}t �t�| �j�� � fdd�}ttjt jtj h�}t � }z� |� \}}||v r*q|tjkr5|r2ncd}n_|tjkr�|dkr�|� \}}|tjksL|dkrMnR|� \}}|tjks[|dkr\nH|� \}}|tj kro|dkro|� \}}|tjkr�|�|� |� \}}|tj ks�|d kr�n |� \}}|tjkstnnq W t|�S W t|�S W t|�S W t|�S ty� Y t|�S w ) NFc s t � �} | d | d fS )Nr r )�next)�tok��genr r �advancer s z(_detect_future_features.<locals>.advanceT�from� __future__�import�(�,)r �generate_tokens�io�StringIO�readline� frozensetr �NEWLINE�NL�COMMENTr- �STRING�NAME�OP�add� StopIteration)�source�have_docstringrU �ignore�features�tp�valuer rS r �_detect_future_featureso s\ ��������rn c @ s e Zd ZdZdS )� FixerErrorzA fixer could not be loaded.N)r! r"