grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a ´i| ã@sBdZddlmZddlmZddlmZmZGdd„dejƒZdS)a&Fixer for has_key(). Calls to .has_key() methods are expressed in terms of the 'in' operator: d.has_key(k) -> k in d CAVEATS: 1) While the primary target of this fixer is dict.has_key(), the fixer will change any has_key() method call, regardless of its class. 2) Cases like this will not be converted: m = d.has_key if m(k): ... Only *calls* to has_key() are converted. While it is possible to convert the above to something like m = d.__contains__ if m(k): ... this is currently not done. é)Úpytree)Ú fixer_base)ÚNameÚ parenthesizec@seZdZdZdZdd„ZdS)Ú 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 |j¡r&dS| d¡}|d}|j}dd„|dDƒ}|d ¡}| d¡} | rxdd„| Dƒ} |j|j |j|j |j |j |j |jfvr¦t|ƒ}t|ƒd kr¼|d }nt |j|¡}d |_td d d �} |rþtdd d �} t |j| | f¡} t |j || |f¡} | �r8t| ƒ} t |j| ft| ƒ¡} |jj|j |j|j|j|j|j|j|j|jf v�rrt| ƒ} || _| S)NÚnegationÚanchorcSsg|] }| ¡‘qS©©Úclone©Ú.0Únr r ú1/usr/lib64/python3.9/lib2to3/fixes/fix_has_key.pyÚ Róz'FixHasKey.transform..ÚbeforeÚargÚaftercSsg|] }| ¡‘qSr r r r r rrVrééú Úin)ÚprefixÚnot)ÚsymsÚparentÚtypeZnot_testÚpatternÚmatchÚgetrr Z comparisonZand_testZor_testÚtestZlambdefÚargumentrÚlenrZNodeZpowerrZcomp_opÚtupleÚexprZxor_exprZand_exprZ shift_exprZ arith_exprZtermZfactor) ÚselfZnodeÚresultsrrrrrrrZn_opZn_notÚnewr r rÚ transformGsJ ÿ   ÿ    ýzFixHasKey.transformN)Ú__name__Ú __module__Ú __qualname__Z BM_compatibleZPATTERNr)r r r rr&srN) Ú__doc__ÚrrZ fixer_utilrrZBaseFixrr r r rÚs