Hacked By AnonymousFox
3
\=m � @ s8 d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl m
Z
mZmZ ddl
mZ ddlmZmZ ddlmZ d%d
d�ZG dd
� d
e�Zdd� Zdd� Zdd� Zdd� Zejd&k r�ddlZejZdd� Zdd� Z neZeZeZ dd� Z!G dd� de�Z"G dd � d e#�Z$G d!d"� d"e�Z%G d#d$� d$e$�Z&dS )'z#Guido van Rossum <guido@python.org>� N)�chain� )�driver�tokenize�token)� find_root)�pytree�pygram)�btm_matcherTc C st t | g g dg�}tjj|j�}g }xLttj|��D ]:}|jd�r2|jd�r2|rZ|dd � }|j |d d� � q2W |S )N�*�fix_z.py� � ���)
�
__import__�os�path�dirname�__file__�sorted�listdir�
startswith�endswith�append)Z fixer_pkgZ
remove_prefixZpkgZ fixer_dirZ fix_names�name� r �(/usr/lib64/python3.6/lib2to3/refactor.py�get_all_fix_names s r c @ s e Zd ZdS )�
_EveryNodeN)�__name__�
__module__�__qualname__r r r r r + s r c C s� t | tjtjf�r(| jd kr t�| jhS t | tj�rH| jrDt| j�S t�t | tj �r�t
� }x*| jD ] }x|D ]}|jt|�� qlW qbW |S td| ��d S )Nz$Oh no! I don't understand pattern %s)
�
isinstancer ZNodePatternZLeafPattern�typer ZNegatedPatternZcontent�_get_head_typesZWildcardPattern�set�update� Exception)Zpat�r�p�xr r r r$ / s
r$ c C s� t jt�}g }x�| D ]|}|jrjyt|j�}W n tk
rJ |j|� Y q�X xB|D ]}|| j|� qRW q|jd k r�||j j|� q|j|� qW x,tt j
jj� t j
j
�D ]}|| j|� q�W t|�S )N)�collections�defaultdict�list�patternr$ r r Z_accept_typer r �python_grammarZ
symbol2number�values�tokens�extend�dict)Z
fixer_listZ
head_nodesZevery�fixerZheadsZ node_typer r r �_get_headnode_dictK s"