U if| @s>ddlmZddlmZddlmZmZGdddejZdS))pytree) fixer_base)Name parenthesizec@seZdZdZdZddZdS) FixHasKeyTa anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > after=any* > | negation=not_test< 'not' anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > > > c Cs||j}|jj|jkr&|j|jr&dS|d}|d}|j}dd|dD}|d}|d} | rxdd| D} |j|j |j|j |j |j |j |jfkrt|}t|d kr|d }nt|j|}d |_td d d } |rtdd d } t|j| | f} t|j || |f} | r8t| } t|j| ft| } |jj|j |j|j|j|j|j|j|j|jf krrt| } || _| S)NnegationanchorcSsg|] }|qSclone.0nr r >/opt/alt/python38/lib64/python3.8/lib2to3/fixes/fix_has_key.py Rsz'FixHasKey.transform..beforeargaftercSsg|] }|qSr r r r r rrVs in)prefixnot)symsparenttypeZnot_testpatternmatchgetrr Z comparisonZand_testZor_testZtestZlambdefZargumentrlenrZNodeZpowerrZcomp_optupleexprZxor_exprZand_exprZ shift_exprZ arith_exprZtermZfactor) selfZnodeZresultsrrrrrrrZn_opZn_notnewr r r transformGsV        zFixHasKey.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr%r r r rr&srN)rrZ fixer_utilrrZBaseFixrr r r r!s