
    daf|                     Z    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y)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y)	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           
      h   |sJ | j                   }|j                  j                  |j                  k(  r&| j                  j                  |j                        ry |j                  d      }|d   }|j                  }|d   D cg c]  }|j                          }}|d   j                         }	|j                  d      }
|
r|
D cg c]  }|j                          }
}|	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      }|
r8t        |      }t#        j$                  |j&                  |ft-        |
      z         }|j                  j                  |j                  |j.                  |j0                  |j2                  |j4                  |j6                  |j8                  |j:                  |j&                  f	v rt        |      }||_        |S c c}w c c}w )Nnegationanchorbeforeargafter        in)prefixnot)symsparenttypenot_testpatternmatchgetr   clone
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   nr   r   r   n_opn_notnews                 4/root/Python-3.12.4/Lib/lib2to3/fixes/fix_has_key.py	transformzFixHasKey.transformG   s"   wyyKK-LLt{{+ ;;z*"%,X%67!'')77en""$G$(-.1QWWY.E.88diit}}N Ns#Cv;!AYF[[V4FD%s+E;;t||eT];Dkk$//Cv+>?s#C++djj3&5<*?@C;;DMM $t $ $TZZ 9 9 s#C

7 8 /s   J*J/N)__name__
__module____qualname__BM_compatiblePATTERNr7        r6   r   r   &   s    MG<&r>   r   N)	__doc__ r   r   
fixer_utilr   r   BaseFixr   r=   r>   r6   <module>rC      s)   :   +G
"" Gr>   