Sindbad~EG File Manager
�
�f|��X�dZddlmZddlmZddlmZmZGd�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��eZdZdZdZd�ZdS)� 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
�J�|j}|jj|jkr!|j�|j��rdS|�d��}|d}|j}d�|dD��}|d���}|�d��} | rd�| D��} |j|j |j|j
|j|j|j
|jfvrt|��}t!|��dkr |d }nt#j|j|��}d
|_t)dd
���}
|r-t)d
d
���}t#j|j||
f��}
t#j|j ||
|f��}| r:t|��}t#j|j|ft-| ��z��}|jj|j |j|j|j|j|j|j|j|jf vrt|��}||_|S)N�negation�anchorc�6�g|]}|�����S���clone��.0�ns �@/opt/alt/python311/lib64/python3.11/lib2to3/fixes/fix_has_key.py�
<listcomp>z'FixHasKey.transform.<locals>.<listcomp>Rs ��7�7�7��!�'�'�)�)�7�7�7��before�arg�afterc�6�g|]}|�����Sr
rrs rrz'FixHasKey.transform.<locals>.<listcomp>Vs ��.�.�.�1�Q�W�W�Y�Y�.�.�.r��� �in)�prefix�not)�syms�parent�type�not_test�pattern�match�getrr�
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
rrrrr�n_op�n_not�news
r� transformzFixHasKey.transformGs���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���
��
rN)�__name__�
__module__�__qualname__�
BM_compatible�PATTERNr?r
rrrr&s/�������M��G�<&�&�&�&�&rrN) �__doc__�rr�
fixer_utilrr�BaseFixrr
rr�<module>rIs�����:������������+�+�+�+�+�+�+�+�G�G�G�G�G�
�"�G�G�G�G�Gr
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists