
    c                     &   d dl Z d dlZd dlZd dlmZ d dlZej        dk    rd dlmZ nd dlmZ d Z	de
dej        fdZej         G d	 d
                      Z G d d          Z G d de          Z G d de          ZdefdZd ZdefdZdS )    N)Any)      )Literalc                 H     G d dt           j                  } ||           S )Nc                       e Zd ZddZdS )(lazy_descriptor.<locals>.DescriptorProxyNc                 8    | j                             | |          S N)	__class____get__)selfinstanceowners      ,lib/python3.11/site-packages/astroid/util.pyr   z0lazy_descriptor.<locals>.DescriptorProxy.__get__   s    >))$999    r   )__name__
__module____qualname__r    r   r   DescriptorProxyr	      s(        	: 	: 	: 	: 	: 	:r   r   lazy_object_proxyProxy)objr   s     r   lazy_descriptorr      sB    : : : : :+1 : : : ?3r   module_namereturnc                 2     t          j         fd          S )Nc                  4    t          j        d z   d          S )N.astroid)	importlibimport_moduler   s   r   <lambda>zlazy_import.<locals>.<lambda>   s    	'k(99EE r   r   r%   s   `r   lazy_importr'      s$    "EEEE  r   c                   Z    e Zd ZdZdefdZeZdedefdZd Z	de
d         fdZeZd	 Zd
S )UninferablezASpecial inference object, which is returned when inference fails.r   c                     dS )Nr)   r   r   s    r   __repr__zUninferable.__repr__$   s    }r   namec                     |dk    rt          d          |                    d          r0|                    d          rt                              | |          S |dk    rt                              | |          S | S )Nnextz next method should not be called__accept)AttributeError
startswithendswithobject__getattribute__)r   r-   s     r   r6   zUninferable.__getattribute__)   s    6> 	E !CDDD??4   	7T]]4%8%8 	7**46668 	7**4666r   c                     | S r   r   )r   argskwargss      r   __call__zUninferable.__call__2   s    r   Fc                     dS )NFr   r+   s    r   __bool__zUninferable.__bool__5   s    ur   c                 ,    |                     |           S r   )visit_uninferable)r   visitors     r   r1   zUninferable.accept:   s    ((...r   N)r   r   r   __doc__strr,   __str__r   r6   r:   r   r<   __nonzero__r1   r   r   r   r)   r)       s        KK#     GS S      '%.     K/ / / / /r   r)   c                       e Zd ZdZdS )BadOperationMessagezObject which describes a TypeError occurred somewhere in the inference chain.

    This is not an exception, but a container object which holds the types and
    the error which occurred.
    N)r   r   r   r@   r   r   r   rE   rE   >   s           r   rE   c                   @    e Zd ZdZd Zed             Zd ZdefdZ	dS )BadUnaryOperationMessagez8Object which describes operational failures on UnaryOps.c                 0    || _         || _        || _        d S r   )operandoperror)r   rI   rJ   rK   s       r   __init__z!BadUnaryOperationMessage.__init__I   s    


r   c                 .    t          d          }|j        S )Nhelpers)r'   object_type)r   rN   s     r   _object_type_helperz,BadUnaryOperationMessage._object_type_helperN   s    i((""r   c                 F    |                      |          }|t          u rd S |S r   )rP   r)   )r   r   objtypes      r   _object_typez%BadUnaryOperationMessage._object_typeS   s,    **3//k! 	4r   r   c                    t          | j        d          r| j        j        }nF|                     | j                  }t          |d          r|j        }n|                                }d}|                    | j        |          S )Nr-   z!bad operand type for unary {}: {})hasattrrI   r-   rS   	as_stringformatrJ   )r   operand_typerO   msgs       r   rB   z BadUnaryOperationMessage.__str__Z   s    4<(( 	7<,LL++DL99K{F++ 7*/  +44661zz$'<000r   N)
r   r   r   r@   rL   propertyrP   rS   rA   rB   r   r   r   rG   rG   F   sn        BB  
 # # X#  1 1 1 1 1 1 1r   rG   c                   $    e Zd ZdZd ZdefdZdS )BadBinaryOperationMessagez.Object which describes type errors for BinOps.c                 0    || _         || _        || _        d S r   )	left_type
right_typerJ   )r   r^   rJ   r_   s       r   rL   z"BadBinaryOperationMessage.__init__l   s    "$r   r   c                 f    d}|                     | j        | j        j        | j        j                  S )Nz1unsupported operand type(s) for {}: {!r} and {!r})rW   rJ   r^   r-   r_   )r   rY   s     r   rB   z!BadBinaryOperationMessage.__str__q   s)    Azz$'4>#68LMMMr   N)r   r   r   r@   rL   rA   rB   r   r   r   r\   r\   i   sK        88  
N N N N N N Nr   r\   c                     | j         }|j        }||u pt          ||          }t          j        | j        j        d|j        dt          d           |S )Nz: is deprecated and slated for removal in astroid 2.0, use z instead   )
stacklevel)__wrapped__r   
issubclasswarningswarnr   PendingDeprecationWarning)clsotherwrapped	other_clsis_instance_ofs        r   _instancecheckrn   v   so    oGI	)KZ	7-K-KNM!$!7!7!79I9I9I	K!	    r   c                     t          | t          j        ft          j        d         t
          d          } |fd          S )z7Get a Proxy from the given name to the given node type.r   )r   __instancecheck__c                       S r   r   )	node_types   r   r&   zproxy_alias.<locals>.<lambda>   s     r   )typer   r   r5   __dict__rn   )
alias_namerr   proxys    ` r   proxy_aliasrw      sQ    		 "5!/	
 	
 E 5""""###r   c                  H    t          d t          j        D                       S )zReturn True if any other than the default DeprecationWarning filter is enabled.

    https://docs.python.org/3/library/warnings.html#default-warning-filter
    c              3   |   K   | ]7}t          t          |d                    o|d         dk    o|d         dk    V  8dS )rb   r   ignorer   __main__N)re   DeprecationWarning).0filters     r   	<genexpr>z(check_warnings_filter.<locals>.<genexpr>   si          	%vay11 	$1I!	$1I#     r   )anyrf   filtersr   r   r   check_warnings_filterr      s7    
    &	     r   )r#   sysrf   typingr   r   version_infor   typing_extensionsr   rA   r   r'   r5   __new__r)   rE   rG   r\   boolrn   rw   r   r   r   r   <module>r      s  
     



           v *))))))     S %6%<     / / / / / / / /:        1  1  1  1  12  1  1  1F
N 
N 
N 
N 
N 3 
N 
N 
N
$ 
 
 
 

$ 
$ 
$
t 
 
 
 
 
 
r   