§
    ZQd|  ã                   óX   — d Z ddlmZ ddlmZ ddlmZmZ  G d„ dej        ¦  «        ZdS )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                   ó   — e Zd ZdZdZ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           
      óR  — |sJ ‚| j         }|j        j        |j        k    r!| j                             |j        ¦  «        rd S |                     d¦  «        }|d         }|j        }d„ |d         D ¦   «         }|d                              ¦   «         }|                     d¦  «        }	|	rd„ |	D ¦   «         }	|j        |j	        |j        |j
        |j        |j        |j        |j        fv rt          |¦  «        }t!          |¦  «        dk    r	|d	         }nt#          j        |j        |¦  «        }d
|_        t)          dd
¬¦  «        }
|r-t)          dd
¬¦  «        }t#          j        |j        ||
f¦  «        }
t#          j        |j	        ||
|f¦  «        }|	r:t          |¦  «        }t#          j        |j        |ft-          |	¦  «        z   ¦  «        }|j        j        |j	        |j        |j        |j        |j        |j        |j        |j        |j        f	v rt          |¦  «        }||_        |S )NÚnegationÚanchorc                 ó6   — g | ]}|                      ¦   «         ‘ŒS © ©Úclone©Ú.0Úns     ú0/usr/lib/python3.11/lib2to3/fixes/fix_has_key.pyú
<listcomp>z'FixHasKey.transform.<locals>.<listcomp>R   s    € Ð7Ð7Ð7 �!—'’'‘)”)Ð7Ð7Ð7ó    ÚbeforeÚargÚafterc                 ó6   — g | ]}|                      ¦   «         ‘ŒS r   r   r   s     r   r   z'FixHasKey.transform.<locals>.<listcomp>V   s    € Ð.Ð.Ð. 1�Q—W’W‘Y”YÐ.Ð.Ð.r   é   é    ú Úin)ÚprefixÚnot)ÚsymsÚparentÚtypeÚnot_testÚpatternÚmatchÚgetr   r   Ú
comparisonÚand_testÚor_testÚtestÚlambdefÚargumentr   Úlenr   ÚNodeÚpowerr   Úcomp_opÚtupleÚexprÚxor_exprÚand_exprÚ
shift_exprÚ
arith_exprÚtermÚfactor)ÚselfÚnodeÚresultsr    r
   r   r   r   r   r   Ún_opÚn_notÚnews                r   Ú	transformzFixHasKey.transformG   s#  € ØˆˆˆØŒyˆØŒKÔ ¤Ò-Ð-ØŒL×Ò˜tœ{Ñ+Ô+ð .ð �4Ø—;’;˜zÑ*Ô*ˆØ˜Ô"ˆØ”ˆØ7Ð7 W¨XÔ%6Ð7Ñ7Ô7ˆØ�eŒn×"Ò"Ñ$Ô$ˆØ—’˜GÑ$Ô$ˆØð 	/Ø.Ð.¨Ð.Ñ.Ô.ˆEØŒ8˜œ¨¬¸¼Øœ d¤i°´¸t¼}ðNð Nð Nå˜sÑ#Ô#ˆCÝˆv‰;Œ;˜!ÒÐØ˜A”YˆFˆFå”[ ¤¨VÑ4Ô4ˆFØˆŒÝ�D Ð%Ñ%Ô%ˆØð 	<Ý˜ sÐ+Ñ+Ô+ˆEÝ”;˜tœ|¨e°T¨]Ñ;Ô;ˆDÝŒk˜$œ/¨C°°vÐ+>Ñ?Ô?ˆØð 	AÝ˜sÑ#Ô#ˆCÝ”+˜dœj¨3¨&µ5¸±<´<Ñ*?Ñ@Ô@ˆCØŒ;Ô ¤°´¸D¼MØ $¤¨t¬Ø $¤°´Ø $¤¨T¬Zð 9ð 9ð 9õ ˜sÑ#Ô#ˆCØˆŒ
Øˆ
r   N)Ú__name__Ú
__module__Ú__qualname__ÚBM_compatibleÚPATTERNr?   r   r   r   r   r   &   s/   € € € € € Ø€Mð€Gð<&ð &ð &ð &ð &r   r   N)	Ú__doc__Ú r   r   Ú
fixer_utilr   r   ÚBaseFixr   r   r   r   ú<module>rI      sŽ   ððð ð: Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø +Ð +Ð +Ð +Ð +Ð +Ð +Ð +ðGð Gð Gð Gð G�
Ô"ñ Gô Gð Gð Gð Gr   