§
    öyIfD  ã                  ó¢   — d dl mZ d dlmZ d dlmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZmZ d dlmZ erd d	lmZ  G d
„ de
¦  «        Zdd„ZdS )é    )Úannotations)ÚTYPE_CHECKING)ÚInstanceÚnodes)ÚUninferableBase)ÚBaseChecker)Ú
safe_infer)ÚDUNDER_METHODSÚ)UNNECESSARY_DUNDER_CALL_LAMBDA_EXCEPTIONS)ÚHIGH)ÚPyLinterc                  ób   — e Zd ZdZdZddiZdZdd„Zedd„¦   «         Z	edd„¦   «         Z
dd„ZdS )ÚDunderCallCheckera–  Check for unnecessary dunder method calls.

    Docs: https://docs.python.org/3/reference/datamodel.html#basic-customization
    We exclude names in list pylint.constants.EXTRA_DUNDER_METHODS such as
    __index__ (see https://github.com/pylint-dev/pylint/issues/6795)
    since these either have no alternative method of being called or
    have a genuine use case for being called manually.

    Additionally, we exclude classes that are not instantiated since these
    might be used to access the dunder methods of a base class of an instance.
    We also exclude dunder method calls on super() since
    these can't be written in an alternative manner.
    úunnecessary-dunder-callÚC2801)z)Unnecessarily calls dunder method %s. %s.r   ziUsed when a dunder method is manually called instead of using the corresponding function/method/operator.© ÚreturnÚNonec                ó¤   — i | _         t          j        ¦   «         D ]4\  }}|| j        j        j        k    r| j                              |¦  «         Œ5d S ©N)Ú_dunder_methodsr
   ÚitemsÚlinterÚconfigÚ
py_versionÚupdate)ÚselfÚ
since_versÚdunder_methodss      úR/var/www/piapp/venv/lib/python3.11/site-packages/pylint/checkers/dunder_methods.pyÚopenzDunderCallChecker.open/   s\   € Ø/1ˆÔÝ*8Ô*>Ñ*@Ô*@ð 	<ð 	<Ñ&ˆJ˜Ø˜Tœ[Ô/Ô:Ò:Ð:ØÔ$×+Ò+¨NÑ;Ô;Ð;øð	<ð 	<ó    Únodeúnodes.NodeNGÚboolc                ó   — | j         }|�tt          |t          j        ¦  «        r4|j                             d¦  «        r|j                             d¦  «        st                               || ¦  «        rdS |j         }|­tdS )zACheck if dunder method call is within a dunder method definition.NÚ__TF)	ÚparentÚ
isinstancer   ÚFunctionDefÚnameÚ
startswithÚendswithr   Úis_lambda_rule_exception)r#   r(   s     r    Úwithin_dunder_or_lambda_defz-DunderCallChecker.within_dunder_or_lambda_def5   s�   € ð ”ˆØÐ å˜6¥5Ô#4Ñ5Ô5ðà”K×*Ò*¨4Ñ0Ô0ðð ”K×(Ò(¨Ñ.Ô.ðõ %×=Ò=¸fÀdÑKÔKð	ð �tØ”]ˆFð Ð ð ˆur"   Úancestorc                ó\   — t          | t          j        ¦  «        o|j        j        t
          v S r   )r)   r   ÚLambdaÚfuncÚattrnamer   )r0   r#   s     r    r.   z*DunderCallChecker.is_lambda_rule_exceptionD   s,   € õ �x¥¤Ñ.Ô.ð PØ”	Ô"Õ&OÐOð	
r"   ú
nodes.Callc                ód  — t          |j        t          j        ¦  «        �r	|j        j        | j        v rø|                      |¦  «        såt          |j        j        t          j        ¦  «        rCt          |j        j        j        t          j	        ¦  «        r|j        j        j        j
        dk    s€t          |j        j        ¦  «        }|�t          |t          t          f¦  «        sdS |                      d||j        j        | j        |j        j                 ft          ¬¦  «         dS dS dS dS dS )z=Check if method being called is an unnecessary dunder method.ÚsuperNr   )r#   ÚargsÚ
confidence)r)   r3   r   Ú	Attributer4   r   r/   ÚexprÚCallÚNamer+   r	   r   r   Úadd_messager   )r   r#   Úinf_exprs      r    Ú
visit_callzDunderCallChecker.visit_callK   s-  € õ �t”y¥%¤/Ñ2Ô2ñ	à”	Ô" dÔ&:Ð:Ð:Ø×4Ò4°TÑ:Ô:ð ;õ ˜4œ9œ>­5¬:Ñ6Ô6ð ;õ ˜tœyœ~Ô2µE´JÑ?Ô?ð	 ;ð
 ”I”NÔ'Ô,°Ò7Ð7õ " $¤)¤.Ñ1Ô1ˆHàÐ ¥J¨x½(ÅOÐ9TÑ$UÔ$UÐ ð �à×ÒØ)ØØ”iÔ(¨$Ô*>¸t¼yÔ?QÔ*RÐSÝð	 ñ ô ð ð ð ð#	ð 	à:Ð:Ð:Ð:ð
 8Ð7r"   N)r   r   )r#   r$   r   r%   )r0   r$   r#   r$   r   r%   )r#   r5   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r+   ÚmsgsÚoptionsr!   Ústaticmethodr/   r.   r@   r   r"   r    r   r      s£   € € € € € ðð ð %€Dàð 
ð€Dð €Gð<ð <ð <ð <ð ðð ð ñ „\ðð ð
ð 
ð 
ñ „\ð
ðð ð ð ð ð r"   r   r   r   r   r   c                óJ   — |                       t          | ¦  «        ¦  «         d S r   )Úregister_checkerr   )r   s    r    ÚregisterrJ   f   s%   € Ø
×ÒÕ-¨fÑ5Ô5Ñ6Ô6Ð6Ð6Ð6r"   N)r   r   r   r   )Ú
__future__r   Útypingr   Úastroidr   r   Úastroid.utilr   Úpylint.checkersr   Úpylint.checkers.utilsr	   Úpylint.constantsr
   r   Úpylint.interfacesr   Úpylint.lintr   r   rJ   r   r"   r    ú<module>rT      s  ðð
 #Ð "Ð "Ð "Ð "Ð "à  Ð  Ð  Ð  Ð  Ð  à #Ð #Ð #Ð #Ð #Ð #Ð #Ð #Ø (Ð (Ð (Ð (Ð (Ð (à 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø VÐ VÐ VÐ VÐ VÐ VÐ VÐ VØ "Ð "Ð "Ð "Ð "Ð "àð %Ø$Ð$Ð$Ð$Ð$Ð$ðNð Nð Nð Nð N˜ñ Nô Nð Nðb7ð 7ð 7ð 7ð 7ð 7r"   