
    yIf                       U d dl mZ d dlZd dlmZmZmZmZ d dlm	Z	 erd dl
mZmZ d dlmZ d dlmZ  G d d	          Z e            Zd
ed<    G d d          Z G d de          Z G d de          ZddZddZ	 dddZdS )    )annotationsN)TYPE_CHECKINGAnyFinalLiteral)InferenceError)basesnodes)InferenceContext)InferenceResultc                  @    e Zd ZdZddZeZddZddZddZeZ	d Z
dS )UninferableBasezSpecial inference object, which is returned when inference fails.

    This is meant to be used as a singleton. Use astroid.util.Uninferable to access it.
    returnLiteral['Uninferable']c                    dS )NUninferable selfs    @/var/www/piapp/venv/lib/python3.11/site-packages/astroid/util.py__repr__zUninferableBase.__repr__   s    }    namestrr   c                    |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   r#   z UninferableBase.__getattribute__   s}    6>> !CDDD??4   	7T]]4%8%8 	7**46668**4666r   argskwargsc                    | S Nr   )r   r$   r%   s      r   __call__zUninferableBase.__call__'   s    r   Literal[False]c                    dS )NFr   r   s    r   __bool__zUninferableBase.__bool__*   s    ur   c                ,    |                     |           S r'   )visit_uninferable)r   visitors     r   r   zUninferableBase.accept/   s    ((...r   N)r   r   )r   r   r   r   )r$   r   r%   r   r   r   )r   r)   )__name__
__module____qualname____doc__r   __str__r#   r(   r+   __nonzero__r   r   r   r   r   r      s         
    G          K/ / / / /r   r   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/   r0   r1   r2   r   r   r   r6   r6   6   s           r   r6   c                  <    e Zd ZdZd Zed             Zd Zd	dZdS )
BadUnaryOperationMessagez8Object which describes operational failures on UnaryOps.c                0    || _         || _        || _        d S r'   )operandoperror)r   r:   r;   r<   s       r   __init__z!BadUnaryOperationMessage.__init__A   s    


r   c                    ddl m} |j        S )Nr   )helpers)astroidr?   object_type)r   r?   s     r   _object_type_helperz,BadUnaryOperationMessage._object_type_helperF   s    ######""r   c                ^    |                      |          }t          |t                    rd S |S r'   )rB   
isinstancer   )r   objobjtypes      r   _object_typez%BadUnaryOperationMessage._object_typeL   s1    **3//g// 	4r   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 {}: {})hasattrr:   r   rG   	as_stringformatr;   )r   operand_typerA   msgs       r   r3   z BadUnaryOperationMessage.__str__S   s    4<(( 	7<,LL++DL99K{F++ 7*/  +44661zz$'<000r   Nr   r   )	r/   r0   r1   r2   r=   propertyrB   rG   r3   r   r   r   r8   r8   >   sg        BB  
 # # X#
  1 1 1 1 1 1r   r8   c                       e Zd ZdZd ZddZdS )BadBinaryOperationMessagez.Object which describes type errors for BinOps.c                0    || _         || _        || _        d S r'   )	left_type
right_typer;   )r   rS   r;   rT   s       r   r=   z"BadBinaryOperationMessage.__init__e   s    "$r   r   r   c                f    d}|                     | j        | j        j        | j        j                  S )Nz1unsupported operand type(s) for {}: {!r} and {!r})rK   r;   rS   r   rT   )r   rM   s     r   r3   z!BadBinaryOperationMessage.__str__j   s)    Azz$'4>#68LMMMr   NrN   )r/   r0   r1   r2   r=   r3   r   r   r   rQ   rQ   b   sC        88  
N N N N N Nr   rQ   r   boolc                    | 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__	__class__
issubclasswarningswarnr/   PendingDeprecationWarning)clsotherwrapped	other_clsis_instance_ofs        r   _instancecheckre   o   so    oGI	)KZ	7-K-KNM!$!7!7!79I9I9I	K!	    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 )rX   r   ignore   __main__N)r\   DeprecationWarning).0filters     r   	<genexpr>z(check_warnings_filter.<locals>.<genexpr>   si          	%vay11 	$1I!	$1I#     r   )anyr]   filtersr   r   r   check_warnings_filterrq   |   s7    
    &	     r   node,nodes.NodeNG | bases.Proxy | UninferableBasecontextInferenceContext | NoneInferenceResult | Nonec                   t          | t                    r| S 	 |                     |          }t          |          }n# t          t
          f$ r Y dS w xY w	 t          |           dS # t          $ r Y dS t
          $ r |cY S w xY w)zReturn the inferred value for the given node.

    Return None if inference failed or if there is some ambiguity (more than
    one node has been inferred).
    )rt   N)rD   r   inferr   r   StopIteration)rr   rt   inferitvalues       r   
safe_inferr|      s     $(( **W*--WM*   ttWt   tt   s'   %? AAA) )
B6BB)r   rV   r'   )rr   rs   rt   ru   r   rv   )
__future__r   r]   typingr   r   r   r   astroid.exceptionsr   r@   r	   r
   astroid.contextr   astroid.typingr   r   r   __annotations__r6   r8   rQ   re   rq   r|   r   r   r   <module>r      s   # " " " " " "  5 5 5 5 5 5 5 5 5 5 5 5 - - - - - - /$$$$$$$$000000....../ / / / / / / /@ %_&& & & & &       !1 !1 !1 !1 !12 !1 !1 !1H
N 
N 
N 
N 
N 3 
N 
N 
N
 
 
 

 
 
 
 (,      r   