
    yIf	                        d Z ddlmZ ddlZddlmZ ddlZddlmZ erddlm	Z	 ddl
mZ dd
Z	 dddZ	 dddZddZdS )a  Contains logic for retrieving special methods.

This implementation does not rely on the dot attribute access
logic, found in ``.getattr()``. The difference between these two
is that the dunder methods are looked with the type slots
(you can find more about these here
http://lucumr.pocoo.org/2014/8/16/the-python-i-would-like-to-see/)
As such, the lookup for the special methods is actually simpler than
the dot attribute access.
    )annotationsN)TYPE_CHECKING)AttributeInferenceError)nodes)InferenceContextreturnlistc                &   | j                             g           }t          j                            fd|                     d          D                       }t          t          j        ||                    }|st          |           |S )Nc              3  N   K   | ]}|j                             g           V   d S N)localsget).0ancestornames     U/var/www/piapp/venv/lib/python3.11/site-packages/astroid/interpreter/dunder_lookup.py	<genexpr>z!_lookup_in_mro.<locals>.<genexpr>   sF       * **2D"%%* * * * * *    T)recurs	attributetarget)r   r   	itertoolschainfrom_iterable	ancestorsr	   r   )noder   attrsr   valuess    `   r   _lookup_in_mror       s    KOOD"%%EO)) * * * *6:nnDn6Q6Q* * *  E )/%//00F C%TBBBBMr   r   nodes.NodeNGr   strcontextInferenceContext | Nonec                ~   t          | t          j        t          j        t          j        t          j        t          j        f          rt          | |          S t          | t          j                  rt          | |          S t          | t          j
                  rt          | ||          S t          ||           )zLookup the given special method name in the given *node*.

    If the special method was found, then a list of attributes
    will be returned. Otherwise, `astroid.AttributeInferenceError`
    is going to be raised.
    r#   r   )
isinstanceastroidListTupleConstDictSet_builtin_lookupInstancer    ClassDef_class_lookupr   )r   r   r#   s      r   lookupr2   )   s     w|W]GM7<U  + tT***$()) *dD)))$()) :T49999
!D
>
>
>>r   nodes.ClassDefc                t    |                      |          }|t          ||           t          ||          S )Nr&   r   )	metaclassr   r    )r   r   r#   r5   s       r   r1   r1   >   s@     w//I%TBBBB)T***r   c                b    | j                             |g           }|st          ||           |S )Nr   )r   r   r   )r   r   r   s      r   r.   r.   H   s8    [__T2&&F C%TBBBBMr   )r   r	   r   )r   r!   r   r"   r#   r$   r   r	   )r   r3   r   r"   r#   r$   r   r	   )__doc__
__future__r   r   typingr   r(   astroid.exceptionsr   r   astroid.contextr   r    r2   r1   r.    r   r   <module>r=      s   
	 	 # " " " " "                  6 6 6 6 6 6 1000000
 
 
 
 GK? ? ? ? ?, IM+ + + + +     r   