Your IP : 3.133.120.64
o
6��f| � @ s@ d dl mZ d dl mZ d dlmZmZ G dd� dej�ZdS )� )�pytree)�
fixer_base)�Name�parenthesizec @ s e Zd ZdZdZdd� ZdS )� FixHasKeyTa�
anchor=power<
before=any+
trailer< '.' 'has_key' >
trailer<
'('
( not(arglist | argument<any '=' any>) arg=any
| arglist<(not argument<any '=' any>) arg=any ','>
)
')'
>
after=any*
>
|
negation=not_test<
'not'
anchor=power<
before=any+
trailer< '.' 'has_key' >
trailer<
'('
( not(arglist | argument<any '=' any>) arg=any
| arglist<(not argument<any '=' any>) arg=any ','>
)
')'
>
>
>
c
C sx | j }|jj|jkr| j�|j�rd S |�d�}|d }|j}dd� |d D �}|d �� }|�d�} | r<dd� | D �} |j|j |j|j
|j|j|j
|jfv rSt|�}t|�d kr^|d
}nt�|j|�}d|_tddd
�}
|rtddd
�}t�|j||
f�}
t�|j ||
|f�}| r�t|�}t�|j|ft| � �}|jj|j |j|j|j|j|j|j|j|jf v r�t|�}||_|S )N�negation�anchorc S � g | ]}|� � �qS � ��clone��.0�nr
r
�@/opt/alt/python310/lib64/python3.10/lib2to3/fixes/fix_has_key.py�
<listcomp>R � z'FixHasKey.transform.<locals>.<listcomp>�before�arg�afterc S r r
r r
r
r
r r V r � � � �in)�prefix�not)�syms�parent�typeZnot_test�pattern�match�getr r Z
comparisonZand_testZor_test�testZlambdefZargumentr �lenr ZNodeZpowerr Zcomp_op�tuple�exprZxor_exprZand_exprZ
shift_exprZ
arith_exprZtermZfactor)
�selfZnodeZresultsr r r r r r r Zn_opZn_not�newr
r
r � transformG sJ �
�
�zFixHasKey.transformN)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNr( r
r
r
r r &