AlkantarClanX12

Your IP : 3.138.121.79


Current Path : /opt/alt/python312/lib64/python3.12/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/lib2to3/fixes/__pycache__/fix_has_key.cpython-312.pyc

�

�Q�f|��Z�dZddlmZddlmZddlmZmZGd�dej�Zy)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��eZdZdZdZd�Zy)�	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�|sJ�|j}|jj|jk(r&|jj|j�ry|j
d�}|d}|j}|dD�cgc]}|j���}}|dj�}	|j
d�}
|
r|
D�cgc]}|j���}
}|	j|j|j|j|j|j|j|jfvrt|	�}	t!|�dk(r|d}n t#j$|j&|�}d|_t)d	d�
�}|r/t)dd�
�}t#j$|j*||f�}t#j$|j|	||f�}
|
r8t|
�}
t#j$|j&|
ft-|
�z�}
|jj|j|j.|j0|j2|j4|j6|j8|j:|j&f	vrt|
�}
||
_|
Scc}wcc}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�resultsrr
rr�nrr
r�n_op�n_not�news              �@/opt/alt/python312/lib64/python3.12/lib2to3/fixes/fix_has_key.py�	transformzFixHasKey.transformGs&����w��y�y���K�K����
�
�-��L�L���t�{�{�+���;�;�z�*����"������%,�X�%6�7�%6��!�'�'�)�%6��7��e�n�"�"�$�����G�$���(-�.��1�Q�W�W�Y��E�.��8�8��������
�
����d�i�i����t�}�}�N�N��s�#�C��v�;�!���A�Y�F��[�[����V�4�F���
��D��%�����s�+�E��;�;�t�|�|�e�T�]�;�D��k�k�$�/�/�C��v�+>�?����s�#�C��+�+�d�j�j�3�&�5��<�*?�@�C��;�;���������D�M�M� $�
�
�t��� $������ $���T�Z�Z� 9�9��s�#�C���
��
��78��/s�J*�J/N)�__name__�
__module__�__qualname__�
BM_compatible�PATTERNr7��r6rr&s���M��G�<&r>rN)	�__doc__�rr�
fixer_utilrr�BaseFixrr=r>r6�<module>rCs)���:��+�G�
�"�"�Gr>