Your IP : 18.117.72.244
���]� � @ sc d d l m Z d d l m Z d d l m Z d d l m Z m Z Gd d � d e j � Z d S)� )�pytree)�token)�
fixer_base)�Name�parenthesizec @ s( e Z d Z d Z d Z d d � Z d S)� 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 s" | j } | j j | j k r7 | j j | j � r7 d S| j d � } | d } | j } d d � | d D� } | d j � } | j d � } | r� d d � | D� } | j | j | j | j
| j | j | j
| j f k r� t | � } t | � d k r| d
} n t j | j | � } d | _ t d d
d �}
| rot d d
d �} t j | j | |
f � }
t j | j | |
| f � } | r�t | � } t j | j | f t | � � } | j j | j | j | j | j | j | j | j | j | j f k rt | � } | | _ | S)N�negation�anchorc S s g | ] } | j � � q S� )�clone)�.0�nr
r
�0/opt/alt/python35/lib64/python3.5/fix_has_key.py�
<listcomp>S s z'FixHasKey.transform.<locals>.<listcomp>�before�arg�afterc S s g | ] } | j � � q Sr
)r )r r
r
r
r r W s � � � �in�prefix�not)�syms�parent�typeZnot_test�pattern�match�getr r Z
comparisonZand_testZor_testZtestZlambdef�argumentr �lenr ZNodeZpowerr Zcomp_op�tuple�exprZxor_exprZand_exprZ
shift_exprZ
arith_exprZtermZfactor)
�selfZnode�resultsr r r r r r r Zn_opZn_not�newr
r
r � transformH sD
!
" zFixHasKey.transformN)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNr&