
    7gj                       d Z ddlmZ ddlZddlZddlmZmZ ddlmZm	Z	m
Z
 ddlmZmZ ddlmZ ddlmZmZmZmZ dd	lmZmZmZmZ dd
lmZ ddlmZmZmZ ddl m!Z!m"Z"m#Z# erddl$m%Z% ddhZ&ere&jO                  d       h dZ(	 d%	 	 	 	 	 d&dZ) G d d      Z*	 d%	 	 	 	 	 	 	 d'dZ+	 	 	 	 	 	 	 	 d(dZ, G d de*      Z- G d de-      Z. G d de*      Z/ G d de/      Z0 G d d e-      Z1 G d! d"e1      Z2 G d# d$e-      Z3y))zXThis module contains base classes and functions for the nodes and some
inference utils.
    )annotationsN)IterableIterator)TYPE_CHECKINGAnyLiteral)
decoratorsnodes)
PY310_PLUS)CallContextInferenceContextbind_context_to_nodecopy_context)AstroidTypeErrorAttributeInferenceErrorInferenceErrorNameInferenceError)objectmodel)InferenceErrorInfoInferenceResultSuccessfulInferenceResult)UninferableUninferableBase
safe_infer)
Constraintzbuiltins.propertyzabc.abstractpropertyzenum.property>   lazyreifyLazyPropertylazypropertylazy_propertylazyattributecache_readonlycachedpropertylazy_attributecached_propertyDynamicClassAttributec                  	 | j                  |      }t        j                  |      ry|D ch c]&  }t        |t              s|j                  d      d   ( c}	t        	fdt        D              ry| j                  sy| j                  j                  xs dD ]  }t        ||      }|t        |t              r#t        |t        j                        s>|j                  D ]x  }t        |t        j                        s|j                  |j                        \  }}t        |t        j                         sW|j                  dk(  sg|j                  d	k(  sw  y  yc c}w )
NcontextT.c              3  &   K   | ]  }|v  
 y wN ).0namestrippeds     -lib/python3.12/site-packages/astroid/bases.py	<genexpr>z_is_property.<locals>.<genexpr>O   s     
<(;48(;s   Fr.   builtinsproperty)decoratornames
PROPERTIESintersection
isinstancer   splitanyPOSSIBLE_PROPERTIESr	   r
   r   ClassDefbasesNamelookupr0   Module)
methr)   r6   r0   	decoratorinferred
base_classmodule_r1   s
            @r2   _is_propertyrH   D   s1    (((9N~. #"D$0 	

3"H
 
<(;
<< ??__**0b0	i9z(ODh/&nn
!*ejj9&--joo>	vu||4z1":5 - 1  7s   +E$c                  L    e Zd ZU dZded<   	 d	 	 	 d	dZd
dZ	 d	 	 	 	 	 ddZy)ProxyzA simple proxy object.

    Note:

    Subclasses of this object will need a custom __getattr__
    if new instance attributes are created. See the Const class
    zAnodes.ClassDef | nodes.FunctionDef | nodes.Lambda | UnboundMethod_proxiedNc                f    |(t        | t        j                  t        t        f      sJ y || _        y r-   )r9   r
   Const	Generator	UnionTyperK   )selfproxieds     r2   __init__zProxy.__init__s   s-     ? dU[[)Y$GHHH#DM    c                    |dk(  r| j                   j                  S || j                  v r| j                  |   S t        | j                  |      S )NrK   )	__class__rK   __dict__getattr)rP   r0   s     r2   __getattr__zProxy.__getattr__   sF    :>>***4== ==&&t}}d++rS   c              +     K   |  y wr-   r.   )rP   r)   kwargss      r2   inferzProxy.infer   s      
s   r-   )rQ   zHnodes.ClassDef | nodes.FunctionDef | nodes.Lambda | UnboundMethod | NonereturnNone)r0   strr\   r   )r)   InferenceContext | NonerZ   r   r\   zKcollections.abc.Generator[InferenceResult, None, InferenceErrorInfo | None])__name__
__module____qualname____doc____annotations__rR   rX   r[   r.   rS   r2   rJ   rJ   h   sV     PO 	$ U$
 
$$, 26.AD	TrS   rJ   c              #    K   d}d}|>|j                   }|j                         }||j                  j                  |i       }ni }nd}i }t	               }| D ]  }t        |t              r| d}|j                  ||      |_         	 t               }|j                         D ](  \  }	}
|	j                  |      r|j                  |
       * |j                  |      D ]  t        fd|D              r d}d}!  |s|r	t          y|st        d| ||      y# t        $ r Y t        $ r t          d}Y w xY ww)zGReturn an iterator on statements inferred by each statement in *stmts*.FNTr(   c              3  @   K   | ]  }|j                          y wr-   )satisfied_by)r/   
constraintinfs     r2   r3   z_infer_stmts.<locals>.<genexpr>   s     WFV
z..s3FVs   z.Inference failed for all members of {stmts!r}.)stmtsframer)   )
lookupnamecloneconstraintsgetr   r9   r   _infer_namesetitems	parent_ofupdater[   allr   r   r   )rj   r)   rk   rD   constraint_failedr0   rn   stmtstmt_constraintsconstraint_stmtpotential_constraintsri   s              @r2   _infer_stmtsr{      sj     H!!--/!--11$;KK"$dO,JH!--eT:	03:E:K:K:M6!6&006$++,AB ;N zz'z2WFVWWI#H(,% 3 . )<	
 	
  " 	 	H	s=   BE
1D$<AD$!E$	E-E/EEEEInstancec                   t        | j                  ||      d       }|rt        |d      r|j                         st        S 	 t        g |      |_        |j                  | |      D ]C  }t        |t              r|c S 	 t        |j                  |            }|j                         c S  	 t        S t        S # t        $ r}t        |      |d }~ww xY w# t        $ r Y t        S w xY w)Nr(   infer_call_resultargscallee)nextigetattrhasattrcallabler   r   callcontextr~   r9   r   r[   StopIterationr   
bool_value)instancemethod_namer)   rB   valuerD   es          r2   _infer_method_result_truthr      s    
 !!+w!?FD12}}	"-2d"CG//'/Je_5 LA#EKKK$@AH  **,, K ; % A(9q@A  		s<   ;C  B;C -C ;	CCCC 	C*)C*c                      e Zd ZU dZded<   ded<   ddZ	 	 d	 	 	 	 	 	 	 ddZ	 d	 	 	 	 	 dd	Z	 d	 	 	 	 	 dd
Z	 d	 	 	 	 	 ddZ	y)BaseInstancezWAn instance base class, which provides lookup methods for potential
    instances.
    znodes.ClassDefrK   zobjectmodel.ObjectModelspecial_attributesc                     yNzInstance ofr.   rP   s    r2   display_typezBaseInstance.display_type       rS   Nc                   	 | j                   j                  ||      }|r"	 || j                   j                  ||d      z   S |S # t        $ rt}| j                  r/|| j                  v r!| j                  j	                  |      gcY d }~S |r#| j                   j                  ||d      cY d }~S t        | ||      |d }~ww xY w# t        $ r Y |S w xY w)NFclass_context)target	attributer)   )rK   instance_attrr   r   r@   rW   )rP   r0   r)   lookupclassvaluesexcs         r2   rW   zBaseInstance.getattr   s    	]]00w?F  5 5' !6 !  
 + ' 	&&443J3J+J//66t<== }},,T7%,PP)tW	& + s@   A  C 	C5B<CB<'C-B<<C	CCc           	   #    K   |s
t               }	 ||_        | j                  ||d      }t        | j	                  ||      ||       E d{    y7 # t
        $ r 	 | j                  j                  j                  dk7  r | j                  j                  ||d      }| j	                  ||      E d{  7   Y y# t
        $ r}t        di t        |      |d}~ww xY ww xY ww)zInferred getattr.F)r   )rk   Nr=   r   r.   )r   rl   rW   r{   
_wrap_attrr   rK   rU   r`   r   r   vars)rP   r0   r)   get_attrattrserrors         r2   r   zBaseInstance.igetattr  s      &(G	?!%G||D'u|EH#'2G4   ' 
	?	? ==**33zA..tWE.R??5':::* ?$3tE{3>?
	?s_   C'<A AA C'A 	C$AB=5B86B=;C'=	C CC  C$$C'c              #    K   |D ]  }t        |t              r5t        |      r|j                  | |      E d{    9t	        ||        Ht        |t
        j                        rP|j                  j                  r5|j                  j                  d   j                  dk(  rt	        ||        | |  y7 w)z8Wrap bound methods of attrs in a InstanceMethod proxies.Nr   rP   )
r9   UnboundMethodrH   r~   BoundMethodr
   Lambdar   	argumentsr0   )rP   r   r)   attrs       r2   r   zBaseInstance._wrap_attr$  s      D$.%#55dGDDD%dD11D%,,/99&&499+>+>q+A+F+F&+P%dD11

  Es   6C B>BC c              #  B  K   t        ||       }d}t        |t        j                        rUt        |j                  t        j
                        r1| j                  |j                  j                  |      D ]  }d}| 
 | j                  j                  d|      D ]o  }t        |t              s|j                         s$t        |t              r|j                  | j                  u rd}| S|j                  ||      D ]  }d}| 
 q |st        | ||      yw)z5Infer what a class instance is returning when called.FT__call__)nodecallerr)   N)r   r9   r
   Callfunc	Attributer   attrnamerK   r   r   r   r~   r   )rP   r   r)   rD   resr   s         r2   r~   zBaseInstance.infer_call_result6  s      'w5 fejj)jeoo.V}}V[[%9%97C	 D
 MM**:w?D$0$-$--4==2P
--fg>	 ? @  d67KK s   DDr\   r^   NT)r0   r^   r)   r_   r   boolr\   zlist[InferenceResult]r-   r0   r^   r)   r_   r\   Iterator[InferenceResult])r   Iterable[InferenceResult]r)   r_   r\   r   r    SuccessfulInferenceResult | Noner)   r_   r\   r   )
r`   ra   rb   rc   rd   r   rW   r   r   r~   r.   rS   r2   r   r      s     // ,0 	 ) 	
 
@ =A??"9?	"?4 TX.9P	"* ,0L0L )L 
#	LrS   r   c                       e Zd ZdZ ej
                         Zd fdZej                  	 	 	 	 	 	 	 	 	 	 	 	 dd       Z
ddZddZddZddZddZ	 d	 	 	 dd	Z	 d	 	 	 	 	 dd
Z xZS )r|   z-A special node representing a class instance.c                $    t         |   |       y r-   )superrR   )rP   rQ   rU   s     r2   rR   zInstance.__init__Z  s    !rS   c                &    |j                  | |      S r-   )r~   )rP   opnodeoperatorotherr)   methods         r2   infer_binary_opzInstance.infer_binary_op]  s     ''g66rS   c                    dj                  | j                  j                         j                  | j                  j                  t	        |             S )Nz<Instance of {}.{} at 0x{}>)formatrK   rootr0   idr   s    r2   __repr__zInstance.__repr__h  s=    ,33MM %%t}}'9'92d8
 	
rS   c                ~    d| j                   j                         j                   d| j                   j                   S )NzInstance of r*   )rK   r   r0   r   s    r2   __str__zInstance.__str__m  s4    dmm002778$--:L:L9MNNrS   c                ^    	 | j                   j                  dd       y# t        $ r Y yw xY w)Nr   Fr   T)rK   rW   r   r   s    r2   r   zInstance.callablep  s3    	MM!!*E!B& 		s     	,,c                6    | j                   j                         S r-   )rK   qnamer   s    r2   pytypezInstance.pytypew  s    }}""$$rS   c                     yr   r.   r   s    r2   r   zInstance.display_typez  r   rS   c                    |xs
 t               }| |_        	 t        | d|      }|S # t        t        f$ r( 	 t        | d|      }Y |S # t        t        f$ r Y Y yw xY ww xY w)aW  Infer the truth value for an Instance.

        The truth value of an instance is determined by these conditions:

           * if it implements __bool__ on Python 3 or __nonzero__
             on Python 2, then its bool value will be determined by
             calling this special method and checking its result.
           * when this method is not defined, __len__() is called, if it
             is defined, and the object is considered true if its result is
             nonzero. If a class defines neither __len__() nor __bool__(),
             all its instances are considered true.
        __bool____len__T)r   	boundnoder   r   r   )rP   r)   results      r2   r   zInstance.bool_value}  s~     /-/ 	/j'JF   78 	3D)WM  ,^< 		s&   & AAAAAAc                V   t        ||       }|s|}t        | j                  d|      d       }t        |g|      |_        t        |t              st        d| |      t        |j                  j                        dk7  rt        d| |      t        |j                  | |      d       S )N__getitem__r(   r   z(Could not find __getitem__ for {node!r}.)r   r)      z8__getitem__ for {node!r} does not have correct signature)r   r   r   r   r   r9   r   r   lenr   r   r   r~   )rP   indexr)   new_contextr   s        r2   getitemzInstance.getitem  s     +7D9!GdmmM7mCTJ"-E76"J&+. :w  v{{$$%*"J 
 F,,T;?FFrS   )rQ   nodes.ClassDef | Noner\   r]   )r   znodes.AugAssign | nodes.BinOpr   r^   r   r   r)   r   r   r   r\   zGenerator[InferenceResult]r   r\   r   r-   )r)   r_   r\   bool | UninferableBase)r   znodes.Constr)   r_   r\   zInferenceResult | None)r`   ra   rb   rc   r   InstanceModelr   rR   r	   yes_if_nothing_inferredr   r   r   r   r   r   r   r   __classcell__rU   s   @r2   r|   r|   U  s    72224" ''7-7 7 	7
 "7 *7 
$7 (7

O% 26.	: FJG G+BG	GrS   c                      e Zd ZU dZded<    ej                         Zded<   ddZddZ	ddZ
ddd
Z	 d	 	 	 	 	 ddZ	 d	 	 	 	 	 ddZ	 	 	 	 	 	 ddZdddZy	)r   z>A special node representing a method not bound to an instance.!nodes.FunctionDef | UnboundMethodrK   z=objectmodel.BoundMethodModel | objectmodel.UnboundMethodModelr   c                *   | j                   j                  sJ d       | j                   j                  j                         }dj                  | j                  j
                  | j                   j                  |j                         t        |             S )NExpected a parent nodez<{} {} of {} at 0x{})	rK   parentrk   r   rU   r`   r0   r   r   )rP   rk   s     r2   r   zUnboundMethod.__repr__  sm    }}##=%==#$$**,%,,NN##T]]%7%74
 	
rS   c                     y)Nr   r.   r   s    r2   implicit_parametersz!UnboundMethod.implicit_parameters  s    rS   c                     yNFr.   r   s    r2   is_boundzUnboundMethod.is_bound      rS   Nc                    || j                   v r| j                   j                  |      gS | j                  j                  ||      S r-   )r   r@   rK   rW   rP   r0   r)   s      r2   rW   zUnboundMethod.getattr  sA    4***++224899}}$$T733rS   c                    || j                   v r%t        | j                   j                  |      f      S | j                  j	                  ||      S r-   )r   iterr@   rK   r   r   s      r2   r   zUnboundMethod.igetattr  sH     4***0077=?@@}}%%dG44rS   c                r   | j                   j                  dk(  r| j                   j                  sJ d       | j                   j                  j                         j	                         }|j                  d      r#|dk7  r| j                  ||xs
 t                     S | j                   j                  ||      S )a  
        The boundnode of the regular context with a function called
        on ``object.__new__`` will be of type ``object``,
        which is incorrect for the argument in general.
        If no context is given the ``object.__new__`` call argument will
        be correctly inferred except when inside a call that requires
        the additional context (such as a classmethod) of the boundnode
        to determine which class the method was called from
        __new__r   z	builtins.builtins.type)	rK   r0   r   rk   r   
startswith_infer_builtin_newr   r~   )rP   r   r)   r   s       r2   r~   zUnboundMethod.infer_call_result  s    " ==*==''A)AA'MM((..0668E,/1I..vw7TBRBTUU}}..vw??rS   c              #  4  K   t        |t        j                        sy |j                  sy t	        |j                        dkD  rd }t        |j                  d   t        j
                        r|j                  d   j                  }nMt        |j                  d   j                         d       }t        |t        j
                        r|j                  }|6t        j                  |      }t        |t        j                        rJ | y |j                  j                  |j                  d         }|j                  d   j                  |      D ]B  }t        |t              r| t        |t        j                        rt        |       t          y w)N   r   r(   )r9   r
   r   r   r   rM   r   r   r[   const_factory	EmptyNodeextra_contextro   r   r=   r|   r   )rP   r   r)   r   inferred_argconstnode_contextrD   s           r2   r   z UnboundMethod._infer_builtin_new  s7    
 &%**-{{v{{aE&++a.%++6A,,#FKKN$8$8$:DAlEKK8(..E ++E2%eU__===,,00Q@A,,\,BH(O4(ENN3x((   Cs   FFc                     yr   r.   rP   r)   s     r2   r   zUnboundMethod.bool_value
      rS   r   r\   zLiteral[0, 1]r   r-   )r0   r^   r)   r_   r   r   )r   r   r)   r   r\   zCcollections.abc.Generator[nodes.Const | Instance | UninferableBase]r)   r_   r\   Literal[True])r`   ra   rb   rc   rd   r   UnboundMethodModelr   r   r   r   rW   r   r~   r   r   r.   rS   r2   r   r     s    H// 	'&&( E)
4 =A55"95	"5 ,0@0@ )@ 
#	@2!0! "! 
M	!@rS   r   c                       e Zd ZdZ ej
                         Z	 	 	 	 	 	 d fdZd	dZd
dZ		 	 	 	 	 	 ddZ
	 d	 	 	 	 	 d fdZdddZ xZS )r   z:A special node representing a method bound to an instance.c                2    t         |   |       || _        y r-   )r   rR   bound)rP   proxyr	  rU   s      r2   rR   zBoundMethod.__init__  s    
 	
rS   c                $    | j                   dk(  ryy)Nr   r   r   )r0   r   s    r2   r   zBoundMethod.implicit_parameters  s    99	!rS   c                     yr   r.   r   s    r2   r   zBoundMethod.is_bound!  r  rS   c                   ddl m} 	 t        |j                  d   j	                  |            }t        |t        j                        sy|j                  d      sy	 t        |j                  d   j	                  |            }t        |t        j                        syt        |j                  t              sy	 t        |j                  d   j	                  |            }t        |t        j                        sy	 |j                  D cg c]  }t        |j	                  |             }	}t!        d |	D              ry	 t        |j                  d	   j	                  |            }
t        |
t        j"                        syt%        j&                  t(              }|
j*                  D ]  \  }}	 t        |j	                  |            }	 t        |j	                  |            }t        |t        j                        sYt        |j                  t              st||j                     j-                  |        |j/                  |j                  |j0                  xs d|j2                  xs d||j4                  |j6                  
      } |||j0                  |j2                  |j4                  |j6                        }|j9                  |j                  |gdd|g        ||_        |S # t
        $ r}t        |      |d}~ww xY w# t
        $ r}t        |      |d}~ww xY w# t
        $ r}t        |      |d}~ww xY wc c}w # t
        $ r}t        |      |d}~ww xY w# t
        $ r}t        |      |d}~ww xY w# t
        $ r}t        |      |d}~ww xY w# t
        $ r}t        |      |d}~ww xY w)zTry to infer what type.__new__(mcs, name, bases, attrs) returns.

        In order for such call to be valid, the metaclass needs to be
        a subtype of ``type``, the name needs to be a string, the bases
        needs to be a tuple of classes
        r   )Passr(   Nr   r   r   c              3  R   K   | ]  }t        |t        j                          ! y wr-   )r9   r
   r=   )r/   bases     r2   r3   z3BoundMethod._infer_type_new_call.<locals>.<genexpr>T  s     O:dENN33s   %'   )r0   lineno
col_offsetr   
end_linenoend_col_offset)r   r  r  r  r  T)r>   bodyr	   newstyle	metaclasskeywords)astroid.nodesr  r   r   r[   r   r   r9   r
   r=   is_subtype_ofrM   r   r^   Tupleeltsr;   Dictcollectionsdefaultdictlistrr   appendrU   r  r  r  r  postinitlocals)rP   r   r)   r  mcsr   r0   r>   eltinferred_basesr   
cls_localskeyr   clsemptys                   r2   _infer_type_new_callz BoundMethod._infer_type_new_call$  s`    	'	9v{{1~++G+<=C #u~~.  1	9A,,W,=>D $,$**c*	9Q--g->?E %-	9JO**U*3d399W9#=>*NU OOO	9Q--g->?E %,7B7N7Nt7T
++JC=399W956=U[[[9: #u{{+
399c0J399%,,U3 & mm==%A((-A((!00  
 ==((((!00
 	** 	 	
  

i  	9 1q8	9  	9 1q8	9  	9 1q8	9 V 	9 1q8	9  	9 1q8	9 ! =$W51<= ! =$W51<=s   (K4 (L =(L0 M "M1M (M1 6NN-4	L=L

L	L-L((L-0	M9MMM 	M.M))M.1	N:NN	N*N%%N*-	O6OOc                   t        || j                        }t        | j                  t        j                        rz| j                  j
                  dk(  ra| j
                  dk(  rRt        |t        j                        r8t        |j                        dk(  r | j                  ||      }|rt        |f      S t        | 1  ||      S )Ntyper      )r   r	  r9   r
   r=   r0   r   r   r   r,  r   r   r~   )rP   r   r)   new_clsrU   s       r2   r~   zBoundMethod.infer_call_result  s    
 'w

;tzz5>>2

6)		Y&65::.FKK A% //@GWJ''w(99rS   c                     yr   r.   r  s     r2   r   zBoundMethod.bool_value  r  rS   )r
  z0nodes.FunctionDef | nodes.Lambda | UnboundMethodr	  r   r\   r]   r  )r\   r  )r   z
nodes.Callr)   r   r\   r   r-   r   r  )r`   ra   rb   rc   r   BoundMethodModelr   rR   r   r   r,  r~   r   r   r   s   @r2   r   r     s    D5557? ) 
	c c+;c	cP ,0:0: ): 
#	:( rS   r   c                  x     e Zd ZU dZded<   	 d	 	 	 	 	 d fdZddZddZddZddZ	ddd	Z
dd
ZddZ xZS )rN   zeA special node representing a generator.

    Proxied class is set once for all in raw_building.
    zobjectmodel.GeneratorModelr   c                    t         |           || _        t        |      | _        t        j                         t        _        y r-   )	r   rR   r   r   _call_contextr   GeneratorModelrN   r   )rP   r   generator_initial_contextrU   s      r2   rR   zGenerator.__init__  s8    
 	)*CD (3'A'A'C	$rS   c              #  j   K   | j                   j                  | j                        E d {    y 7 wr-   )r   infer_yield_resultr5  r   s    r2   infer_yield_typeszGenerator.infer_yield_types  s$     ;;11$2D2DEEEs   )313c                     yr   r.   r   s    r2   r   zGenerator.callable  r   rS   c                     y)Nzbuiltins.generatorr.   r   s    r2   r   zGenerator.pytype  s    #rS   c                     y)NrN   r.   r   s    r2   r   zGenerator.display_type      rS   c                     yr   r.   r  s     r2   r   zGenerator.bool_value  r  rS   c                h    d| j                   j                   d| j                   dt        |        dS )Nz<Generator() l. at 0x>rK   r0   r  r   r   s    r2   r   zGenerator.__repr__  1    T]]//0T[[M4zQRSSrS   c                6    d| j                   j                   dS )Nz
Generator()rK   r0   r   s    r2   r   zGenerator.__str__      DMM../q11rS   r-   )r   znodes.FunctionDefr7  r_   r\   r]   )r\   r   r\   zLiteral[False]r   r  )r`   ra   rb   rc   rd   rR   r:  r   r   r   r   r   r   r   r   s   @r2   rN   rN     s`     32
 >B
D!
D $;
D 
	
DF$T2rS   rN   c                  0    e Zd ZdZddZddZddZddZy)	AsyncGeneratorz-Special node representing an async generator.c                     y)Nzbuiltins.async_generatorr.   r   s    r2   r   zAsyncGenerator.pytype  s    )rS   c                     y)NrL  r.   r   s    r2   r   zAsyncGenerator.display_type  s    rS   c                h    d| j                   j                   d| j                   dt        |        dS )Nz<AsyncGenerator(rA  rB  rC  rD  r   s    r2   r   zAsyncGenerator.__repr__  s2    !$--"4"4!5T$++fRPTXJVWXXrS   c                6    d| j                   j                   dS )NzAsyncGenerator(rG  rH  r   s    r2   r   zAsyncGenerator.__str__  s     !3!3 4A66rS   N)r\   z#Literal['builtins.async_generator']r   )r`   ra   rb   rc   r   r   r   r   r.   rS   r2   rL  rL    s    7* Y7rS   rL  c                  h     e Zd ZdZ	 d		 	 	 	 	 	 	 d
 fdZddZd	ddZddZddZddZ	ddZ
 xZS )rO   zoSpecial node representing new style typing unions.

    Proxied class is set once for all in raw_building.
    c                L    t         |           || _        || _        || _        y r-   )r   rR   r   leftright)rP   rS  rT  r   rU   s       r2   rR   zUnionType.__init__  s%     		
rS   c                     yr   r.   r   s    r2   r   zUnionType.callable  r   rS   c                     yr   r.   r  s     r2   r   zUnionType.bool_value  r  rS   c                     y)Nztypes.UnionTyper.   r   s    r2   r   zUnionType.pytype  s     rS   c                     y)NrO   r.   r   s    r2   r   zUnionType.display_type  r>  rS   c                h    d| j                   j                   d| j                   dt        |        dS )Nz<UnionType(rA  rB  rC  rD  r   s    r2   r   zUnionType.__repr__  rE  rS   c                6    d| j                   j                   dS )Nz
UnionType(rG  rH  r   s    r2   r   zUnionType.__str__  rI  rS   r-   )rS  (UnionType | nodes.ClassDef | nodes.ConstrT  r[  r   znodes.NodeNG | Noner\   r]   rJ  r  )r\   zLiteral['types.UnionType']r   )r`   ra   rb   rc   rR   r   r   r   r   r   r   r   r   s   @r2   rO   rO     sW     '+		6	 8	 $		
 
	!T2rS   rO   r-   )rB   r   r)   r_   r\   r   )rj   r   r)   r_   rk   z"nodes.NodeNG | BaseInstance | Noner\   z*collections.abc.Generator[InferenceResult])r   r|   r   r^   r)   r   r\   r   )4rc   
__future__r   r  collections.abcr   r   typingr   r   r   astroidr	   r
   astroid.constr   astroid.contextr   r   r   r   astroid.exceptionsr   r   r   r   astroid.interpreterr   astroid.typingr   r   r   astroid.utilr   r   r   astroid.constraintr   r7   addr<   rH   rJ   r{   r   r   r|   r   r   rN   rL  rO   r.   rS   r2   <module>rh     sc  
 #   . . . % $   , 
 B A- "#9:
NN?#   QU!
+!6M!	!H' 'Z 153
$3
$3
 .3
 0	3
l%(3C0rL5 rLjWG| WGt\E \~P- Pf*2 *2Z7Y 7 !2 !2rS   