
    Mh+G                        d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ  e            Z G d de          Z G d d          Z G d de          Zd#dZ G d de          Z G d de          Z G d de          Z G d de          Z G d d          Z d Z! G d  d!          Z" e"g           Z#d" Z$dS )$a4  
Values are the "values" that Python would return. However Values are at the
same time also the "values" that a user is currently sitting in.

A ValueSet is typically used to specify the return of a function or any other
static analysis operation. In jedi there are always multiple returns and not
just one.
    )reduce)add)zip_longest)Name)debug)clean_scope_docstringSimpleGetItemNotFound)safe_property)%inference_state_as_method_param_cache)memoize_methodc                       e Zd ZdS )HasNoContextN)__name__
__module____qualname__     Y/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/jedi/inference/base_value.pyr   r      s        Dr   r   c                       e Zd Zd Zd Zd Zd Zd ZddZd	 Z	ddZ
	 	 ddZd Zd ZddZd Zd Zed             ZdS )HelperValueMixinc                 `    | }|j         |                                S 	 |j         |S |j         }N)parent_context
as_context)selfvalues     r   get_root_contextz!HelperValueMixin.get_root_context   sB    '##%%%	)#+(E	)r   c                 :    | j                             | |          S )N)	argumentsinference_stateexecuter   r    s     r   r#   zHelperValueMixin.execute(   s    #++DI+FFFr   c                 n    ddl m}  |d |D                       }| j                            | |          S )Nr   )ValuesArgumentsc                 .    g | ]}t          |g          S r   ValueSet).0r   s     r   
<listcomp>z8HelperValueMixin.execute_with_values.<locals>.<listcomp>-   s"    $O$O$O5Xug%6%6$O$O$Or   )jedi.inference.argumentsr&   r"   r#   )r   
value_listr&   r    s       r   execute_with_valuesz$HelperValueMixin.execute_with_values+   sK    <<<<<<#O$O$OJ$O$O$OPP	#++D)<<<r   c                 *    |                                  S r   r.   r   s    r   execute_annotationz#HelperValueMixin.execute_annotation0   s    '')))r   c                 "    t          | g          S r   r(   r1   s    r   gather_annotation_classesz*HelperValueMixin.gather_annotation_classes3   s    r   NFc                 r    t                               d |                     ||          D                       S )Nc              3   >   K   | ]}|                                 V  d S r   inferr*   
lazy_values     r   	<genexpr>z:HelperValueMixin.merge_types_of_iterate.<locals>.<genexpr>7   sB       "
 "
 "
 "
 "
 "
 "
 "
r   r)   	from_setsiterate)r   contextualized_nodeis_asyncs      r   merge_types_of_iteratez'HelperValueMixin.merge_types_of_iterate6   sE    !! "
 "
"ll+>II"
 "
 "
 
 
 	
r   c              #     K   t          |t                    r|nd }|                     |          E d {V  |                                 r<ddlm}  |t          | h                    D ]}|                                E d {V  d S d S )N)origin_scoper   )convert_values)
isinstancer   get_filtersis_stub!jedi.inference.gradual.conversionrD   r)   )r   name_or_strrC   rD   cs        r   _get_value_filtersz#HelperValueMixin._get_value_filters<   s      &0d&C&CM{{###>>>>>>>>><<>> 	+HHHHHH#^HdV$4$455 + +==??********	+ 	++ +r   Tc                     ddl m} |                     |          }|                    ||          }t	          j        d|| |           |S )Nr   )finderzcontext.goto %s in (%s): %s)jedi.inferencerM   rK   filter_namer   dbg)r   rI   name_contextanalysis_errorsrM   filtersnamess          r   gotozHelperValueMixin.gotoE   sX    ))))))))+66""7K88	/dEJJJr   c                    || }|                      |||          }t                              d |D                       }|s3t          |t                    r|j        n|}|                     |          }|s6|s4|r2t          |t                    rddlm} |	                    || |           t          j        d||           |S )zZ
        :param position: Position of the last statement -> tuple of line, column
        Nc              3   >   K   | ]}|                                 V  d S r   r7   )r*   names     r   r;   z6HelperValueMixin.py__getattribute__.<locals>.<genexpr>T   s*      #C#CTDJJLL#C#C#C#C#C#Cr   r   analysisz context.names_to_types: %s -> %s)rU   r)   r=   rE   r   r   py__getattribute__alternativesrN   rZ   add_attribute_errorr   rP   )	r   rI   rQ   positionrR   rT   valuesnrZ   s	            r   py__getattribute__z#HelperValueMixin.py__getattribute__L   s    
 L		+|_EE###C#CU#C#C#CCC 	<%/T%B%BS!!A88;;F 	5V 	5 	5+t,, 5333333,, $5 5 5	4eVDDDr   c                     |                      d          }|st          j        d|            |                                S )N	__await__z"Tried to run __await__ on value %s)r`   r   warningr.   )r   await_value_sets     r   py__await__zHelperValueMixin.py__await__a   sC    11+>> 	FM>EEE22444r   c                     | j         j        S r   )rX   string_namer1   s    r   
py__name__zHelperValueMixin.py__name__g   s    y$$r   c                    t          j        d|            |rddlm} t	           ||                     d                                                              d                                                              d                                                                                    g          S |                     |          S )Nz
iterate %sr   )LazyKnownValues	__aiter__	__anext__rb   )	r   rP   jedi.inference.lazy_valuerj   iterr`   r.   py__stop_iteration_returns
py__iter__)r   r?   r@   rj   s       r   r>   zHelperValueMixin.iteratej   s    	,%%% 	AAAAAA ++K88LLNN++K889L9L9N9N++K889L9L9N9N3355	     2333r   c                 >   t          j        d| d|d          5  |                                 D ];}|                    |          r$t          j        dd            d d d            dS <t          j        dd           	 d d d            dS # 1 swxY w Y   d S )	Nzsubclass matching of z <=> BLUE)colorzmatched subclass TrueTzmatched subclass FalseF)r   increase_indent_cm	py__mro__is_same_classrP   )r   class_valueclss      r   is_sub_class_ofz HelperValueMixin.is_sub_class_ofz   s#   %%$$$P[P[&\,24 4 4 	 	~~''    $$[11  I5VDDDD	 	 	 	 	 	 	 	  I.f====	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AB-BBBc                 |    t          |          j        t          j        k    r|                    |           S | |k    S r   )typerv   r   )r   class2s     r   rv   zHelperValueMixin.is_same_class   s8    <<%)9)GGG''---v~r   c                      | j         |i |S r   )_as_contextr   argskwargss      r   r   zHelperValueMixin.as_context   s    t0000r   NF)NT)NNT)r   r   r   r   r#   r.   r2   r4   rA   rK   rU   r`   re   rh   r>   ry   rv   r   r   r   r   r   r   r      s"       ) ) )G G G= = =
* * *     
 
 
 
+ + +    KO+/   *5 5 5% % %4 4 4 4      1 1 ^1 1 1r   r   c                       e Zd ZdZdZdZdZd#dZd Zd Z	d#dZ
d#dZd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZefdZd Zd Zd Zd Zd Zd Zd Z d Z!d Z"e#d             Z$d$d!Z%d" Z&dS )%Valuez*
    To be implemented by subclasses.
    Nnot_defined_please_report_bugc                 "    || _         || _        d S r   )r"   r   )r   r"   r   s      r   __init__zValue.__init__   s    .,r   c                 h    ddl m} |                    |j        d|j        d| z             t
          S )Nr   rY   ztype-error-not-subscriptablez+TypeError: '%s' object is not subscriptablemessage)rN   rZ   r   contextnode	NO_VALUES)r   index_value_setr?   rZ   s       r   py__getitem__zValue.py__getitem__   sN    ++++++'*$ADH	 	 	
 	
 	
 r   c                     t           r   r	   )r   indexs     r   py__simple_getitem__zValue.py__simple_getitem__   s    ##r   c                 |    |,ddl m} |                    |j        d|j        d| z             t          g           S )Nr   rY   ztype-error-not-iterablez&TypeError: '%s' object is not iterabler   )rN   rZ   r   r   r   rn   )r   r?   rZ   s      r   rp   zValue.py__iter__   s\    *//////LL#+)#(@4G	  I I I
 Bxxr   c                 ,    |                      |          S r   )rp   )r   r?   s     r   
py__next__zValue.py__next__   s    2333r   c                     g S r   r   r1   s    r   get_signatureszValue.get_signatures   s    	r   c                     dS r   r   r1   s    r   is_classzValue.is_class       ur   c                     dS r   r   r1   s    r   is_class_mixinzValue.is_class_mixin   r   r   c                     dS r   r   r1   s    r   is_instancezValue.is_instance   r   r   c                     dS r   r   r1   s    r   is_functionzValue.is_function   r   r   c                     dS r   r   r1   s    r   	is_modulezValue.is_module   r   r   c                     dS r   r   r1   s    r   is_namespacezValue.is_namespace   r   r   c                     dS r   r   r1   s    r   is_compiledzValue.is_compiled   r   r   c                     dS r   r   r1   s    r   is_bound_methodzValue.is_bound_method   r   r   c                     dS r   r   r1   s    r   is_builtins_modulezValue.is_builtins_module   r   r   c                     dS )z
        Since Wrapper is a super class for classes, functions and modules,
        the return value will always be true.
        Tr   r1   s    r   
py__bool__zValue.py__bool__   s	    
 tr   c                 f    	 | j         j         t          | j                   S # t          $ r Y dS w xY w)N )	tree_nodeget_doc_noder   AttributeErrorr1   s    r   	py__doc__zValue.py__doc__   sH    	9N'' )888  	 	 	22	s   " 
00c                 <    |t           u rt          d| z            |S )Nz'There exists no safe value for value %s)sentinel
ValueError)r   defaults     r   get_safe_valuezValue.get_safe_value   s&    hFMNNNr   c                 >    t          j        d|| |           t          S )Nz!%s not possible between %s and %sr   rc   r   )r   otheroperators      r   execute_operationzValue.execute_operation   s    98T5QQQr   c                 :    t          j        d|            t          S )Nzno execution possible %sr   r$   s     r   
py__call__zValue.py__call__   s    0$777r   c                 :    t          j        d|            t          S )Nz0Not possible to return the stop iterations of %sr   r1   s    r   ro   z Value.py__stop_iteration_returns   s    H$OOOr   c                     t           S )zH
        For now a way to add values in cases like __getattr__.
        )r   )r   rI   s     r   r[   z$Value.py__getattribute__alternatives   s
     r   c                 L    t          j        d|            t          | g          S )NzNo __get__ defined on %s)r   rc   r)   )r   instancerw   s      r   	py__get__zValue.py__get__   s%    0$777r   c                     t           S r   )NotImplemented)r   calling_instancer   rw   s       r   py__get__on_classzValue.py__get__on_class   s    r   c                     d S r   r   r1   s    r   get_qualified_nameszValue.get_qualified_names  s    tr   c                 4    | j                                         S r   )r   rG   r1   s    r   rG   zValue.is_stub  s    "**,,,r   c                     t           r   )r   r1   s    r   r~   zValue._as_context  s    r   c                     t           r   NotImplementedErrorr1   s    r   rX   z
Value.name  s    !!r   Tc                     d S r   r   )r   add_class_infos     r   get_type_hintzValue.get_type_hint  s    tr   c                     i S )an  
        When the current instance represents a type annotation, this method
        tries to find information about undefined type vars and returns a dict
        from type var name to value set.

        This is for example important to understand what `iter([1])` returns.
        According to typeshed, `iter` returns an `Iterator[_T]`:

            def iter(iterable: Iterable[_T]) -> Iterator[_T]: ...

        This functions would generate `int` for `_T` in this case, because it
        unpacks the `Iterable`.

        Parameters
        ----------

        `self`: represents the annotation of the current parameter to infer the
            value for. In the above example, this would initially be the
            `Iterable[_T]` of the `iterable` parameter and then, when recursing,
            just the `_T` generic parameter.

        `value_set`: represents the actual argument passed to the parameter
            we're inferred for, or (for recursive calls) their types. In the
            above example this would first be the representation of the list
            `[1]` and then, when recursing, just of `1`.
        r   )r   	value_sets     r   infer_type_varszValue.infer_type_vars  s	    6 	r   r   T)'r   r   r   __doc__r   
array_typeapi_typer   r   r   rp   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ro   r[   r   r   r   rG   r~   propertyrX   r   r   r   r   r   r   r      s         I J.H- - - -	 	 	$ $ $   4 4 4 4                      9 9 9 &.    
                 - - -   " " X"       r   r   NFc                 t    t                               d |                     ||          D                       S )z
    Calls `iterate`, on all values but ignores the ordering and just returns
    all values that the iterate functions yield.
    c              3   >   K   | ]}|                                 V  d S r   r7   r9   s     r   r;   z!iterate_values.<locals>.<genexpr>8  sB         	     r   r@   r<   )r^   r?   r@   s      r   iterate_valuesr   3  sI    
    ..)<x.PP     r   c                   `    e Zd Zed             Ze e            d                         Zd ZdS )_ValueWrapperBasec                     ddl m} | j        j        }|j         || |j                  S ddlm}  || |j                  S )Nr   )	ValueName)CompiledValueName)jedi.inference.namesr   _wrapped_valuerX   	tree_namejedi.inference.compiledr   rg   )r   r   wrapped_namer   s       r   rX   z_ValueWrapperBase.name?  se    222222*/!-9T<#9:::AAAAAA$$T<+CDDDr   c                      | |i |S r   r   )rx   r"   r   r   s       r   create_cachedz_ValueWrapperBase.create_cachedI  s     sD#F###r   c                 L    |dk    s
J d            t          | j        |          S )Nr   zProblem with _get_wrapped_value)getattrr   )r   rX   s     r   __getattr__z_ValueWrapperBase.__getattr__N  s0    '''')J'''t*D111r   N)	r   r   r   r   rX   classmethodr   r   r   r   r   r   r   r   >  sn        E E ]E **,,$ $ -, [$2 2 2 2 2r   r   c                   @    e Zd Zeed                         Zd Zd ZdS )LazyValueWrapperc                     t          j        d          5  |                                 cd d d            S # 1 swxY w Y   d S )NzResolve lazy value wrapper)r   rt   _get_wrapped_valuer1   s    r   r   zLazyValueWrapper._wrapped_valueT  s     %&BCC 	- 	-**,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-s   6::c                      d| j         j        z  S )Nz<%s>)	__class__r   r1   s    r   __repr__zLazyValueWrapper.__repr__Z  s    011r   c                     t           r   r   r1   s    r   r   z#LazyValueWrapper._get_wrapped_value]  s    !!r   N)r   r   r   r   r   r   r   r   r   r   r   r   r   S  sU        - - ^ ]-2 2 2" " " " "r   r   c                       e Zd Zd Zd ZdS )ValueWrapperc                     || _         d S r   )r   )r   wrapped_values     r   r   zValueWrapper.__init__b  s    +r   c                 0    | j         j        d| j        dS )N())r   r   r   r1   s    r   r   zValueWrapper.__repr__e  s!    >222D4G4G4GHHr   N)r   r   r   r   r   r   r   r   r   r   a  s7        , , ,I I I I Ir   r   c                   $     e Zd Z fdZd Z xZS )	TreeValuec                 Z    t                                          ||           || _        d S r   )superr   r   )r   r"   r   r   r   s       r   r   zTreeValue.__init__j  s(    .999"r   c                 2    d| j         j        d| j        dS )N<: >)r   r   r   r1   s    r   r   zTreeValue.__repr__n  s      !^444dnnnEEr   )r   r   r   r   r   __classcell__)r   s   @r   r   r   i  sN        # # # # #F F F F F F Fr   r   c                   &    e Zd Zd Zd Zd Zd ZdS )ContextualizedNodec                 "    || _         || _        d S r   )r   r   )r   r   r   s      r   r   zContextualizedNode.__init__s  s    			r   c                 4    | j                                         S r   )r   r   r1   s    r   r   z#ContextualizedNode.get_root_contextw  s    |,,...r   c                 @    | j                             | j                  S r   )r   
infer_noder   r1   s    r   r8   zContextualizedNode.inferz  s    |&&ty111r   c                 B    d| j         j        d| j        d| j        dS )Nr  r  z in r  )r   r   r   r   r1   s    r   r   zContextualizedNode.__repr__}  s(     #'>#:#:#:DIIIt|||TTr   N)r   r   r   r   r   r8   r   r   r   r   r  r  r  sU          / / /2 2 2U U U U Ur   r  c                    t           }t                      }|D ]}|                    d           }t          |          t          t
          t          t          t          fv r*	 || 	                    |          z  }a# t          $ r Y nw xY w|                    |           |s|s&||                     t          |          |          z  }t          j        d|           |S )N)r   zpy__getitem__ result: %s)r   setr   r{   floatintstrslicebytesr   r
   r   r   r)   r   rP   )r   index_valuesr?   resultunused_valuesindex_valuer   s          r   _getitemr    s    FEEM# 	' 	'**4*88;;5#sE5999%44U;;;(    	+&&&&
  
L 
%%%]##
 
 	
 
I(&111Ms    A99
BBc                       e Zd Zd Zed             Zed             Zd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zd Zd Zd Zd ZddZd Zd Zd Zd Zd Zd Zd Zd ZddZd ZdS ) r)   c                 f    t          |          | _        |D ]}t          |t                    rJ d S r   )	frozenset_setrE   r)   )r   iterabler   s      r   r   zValueSet.__init__  sC    h''	 	3 	3E!%222222	3 	3r   c                 >    |                      |           }||_        |S r   )__new__r  )rx   
frozenset_r   s      r   _from_frozen_setzValueSet._from_frozen_set  s    {{3	r   c                     t                      }|D ]4}t          |t                    r||j        z  }"|t	          |          z  }5|                     t	          |                    S )z7
        Used to work with an iterable of set.
        )r  rE   r)   r  r  r!  )rx   sets
aggregatedset_s       r   r=   zValueSet.from_sets  sj    
 UU
 	. 	.D$)) .di'

ioo-

##Ij$9$9:::r   c                 F    |                      | j        |j        z            S r   r!  r  r   r   s     r   __or__zValueSet.__or__      $$TY%;<<<r   c                 F    |                      | j        |j        z            S r   r'  r(  s     r   __and__zValueSet.__and__  r*  r   c                 *    t          | j                  S r   )rn   r  r1   s    r   __iter__zValueSet.__iter__      DIr   c                 *    t          | j                  S r   )boolr  r1   s    r   __bool__zValueSet.__bool__  r/  r   c                 *    t          | j                  S r   )lenr  r1   s    r   __len__zValueSet.__len__  s    49~~r   c                 P    dd                     d | j        D                       z  S )NzS{%s}, c              3   4   K   | ]}t          |          V  d S r   )r  )r*   ss     r   r;   z$ValueSet.__repr__.<locals>.<genexpr>  s(      #>#>qCFF#>#>#>#>#>#>r   )joinr  r1   s    r   r   zValueSet.__repr__  s*    $))#>#>DI#>#>#>>>??r   c                 R    |                      t          || j                            S r   )r   filterr  )r   filter_funcs     r   r<  zValueSet.filter  s     ~~f[$)<<===r   c                       fd}|S )Nc                  X                           fdj        D                       S )Nc              3   D   K   | ]} t          |          i V  d S r   )r   )r*   r   r   r   rX   s     r   r;   z7ValueSet.__getattr__.<locals>.mapper.<locals>.<genexpr>  sP       " " %t$$d5f55" " " " " "r   )r=   r  )r   r   rX   r   s   ``r   mapperz$ValueSet.__getattr__.<locals>.mapper  sM    >> " " " " " "!Y" " "   r   r   )r   rX   rA  s   `` r   r   zValueSet.__getattr__  s)    	 	 	 	 	 	
 r   c                 "    | j         |j         k    S r   r  r(  s     r   __eq__zValueSet.__eq__  s    yEJ&&r   c                 .    |                      |           S r   )rD  r(  s     r   __ne__zValueSet.__ne__  s    ;;u%%%%r   c                 *    t          | j                  S r   )hashr  r1   s    r   __hash__zValueSet.__hash__  r/  r   c                 >    t          d | j        D                       S )Nc              3   >   K   | ]}|                                 V  d S r   )py__class__r*   rJ   s     r   r;   z'ValueSet.py__class__.<locals>.<genexpr>  s*      ;;A;;;;;;r   )r)   r  r1   s    r   rL  zValueSet.py__class__  s!    ;;;;;;;;r   NFc              #      K   ddl m} fd| j        D             }t          | D ]} |d |D                       V  d S )Nr   )get_merged_lazy_valuec                 >    g | ]}|                                S )r   )r>   )r*   rJ   r?   r@   s     r   r+   z$ValueSet.iterate.<locals>.<listcomp>  s*    [[[Aaii 3hiGG[[[r   c                     g | ]}||S r   r   )r*   ls     r   r+   z$ValueSet.iterate.<locals>.<listcomp>  s    999q1====r   )rm   rO  r  r   )r   r?   r@   rO  
type_iterslazy_valuess    ``   r   r>   zValueSet.iterate  s      CCCCCC[[[[[QUQZ[[[
&
3 	 	K''99K999     	 	r   c                 Z    t                               fd| j        D                       S )Nc              3   N   K   | ]}|j                             |          V   d S r   r!   )r*   rJ   r    s     r   r;   z#ValueSet.execute.<locals>.<genexpr>  s6      !]!]a!"3";";Ay"I"I!]!]!]!]!]!]r   r)   r=   r  r$   s    `r   r#   zValueSet.execute  s0    !!!]!]!]!]SWS\!]!]!]]]]r   c                 ^    t                               fd| j        D                       S )Nc              3   2   K   | ]} |j         i V  d S r   r0   r*   rJ   r   r   s     r   r;   z/ValueSet.execute_with_values.<locals>.<genexpr>  s6      !\!\Q"7!"7"H"H"H!\!\!\!\!\!\r   rW  r   s    ``r   r.   zValueSet.execute_with_values  s4    !!!\!\!\!\!\RVR[!\!\!\\\\r   c                 V    t          t          fd| j        D             g           S )Nc                 *    g | ]} |j         i S r   )rU   rZ  s     r   r+   z!ValueSet.goto.<locals>.<listcomp>  s*    GGGFAFD3F33GGGr   )r   r   r  r   s    ``r   rU   zValueSet.goto  s0    cGGGGGTYGGGLLLr   c                 ^    t                               fd| j        D                       S )Nc              3   2   K   | ]} |j         i V  d S r   )r`   rZ  s     r   r;   z.ValueSet.py__getattribute__.<locals>.<genexpr>  s6      ![![A"6!"6"G"G"G![![![![![![r   rW  r   s    ``r   r`   zValueSet.py__getattribute__  s4    !!![![![![![QUQZ![![![[[[r   c                 ^    t                               fd| j        D                       S )Nc              3   8   K   | ]}t          |gR i V  d S r   )r  rZ  s     r   r;   z$ValueSet.get_item.<locals>.<genexpr>  s;      !R!R1(1">t">">">v">">!R!R!R!R!R!Rr   rW  r   s    ``r   get_itemzValueSet.get_item  s2    !!!R!R!R!R!R	!R!R!RRRRr   c                     |                      g           }| j        D ]0}	 t          ||          }| |            z  }!# t          $ r Y -w xY w|S r   )r   r  r   r   )r   function_namer   rJ   methods        r   	try_mergezValueSet.try_merge  sv    NN2&&	 	& 	&A& M22 VVXX%		 "    s   >
A
Ac                 T    t                               d | j        D                       S )Nc                 6    g | ]}|                                 S r   )r4   rM  s     r   r+   z6ValueSet.gather_annotation_classes.<locals>.<listcomp>  s$    "T"T"TQ1#>#>#@#@"T"T"Tr   rW  r1   s    r   r4   z"ValueSet.gather_annotation_classes   s'    !!"T"T$)"T"T"TUUUr   c                 $    d | j         D             S )Nc                 @    g | ]}|                                 D ]}|S r   )r   )r*   rJ   sigs      r   r+   z+ValueSet.get_signatures.<locals>.<listcomp>  s1    EEE!2B2B2D2DEE3EEEEr   rC  r1   s    r   r   zValueSet.get_signatures  s    EETYEEEEr   Tc                 t   fd| j         D             }t          t          d |                    }t          |          dk    r|d         S d|v }|r|                    d           t          |          dk    rd S t          |          dk    r	|d         }ndd                    |          z  }|rd|z  }|S )Nc                 <    g | ]}|                                S ))r   )r   )r*   vr   s     r   r+   z*ValueSet.get_type_hint.<locals>.<listcomp>  s'    OOOQ__N_;;OOOr      r   Nonez	Union[%s]r7  zOptional[%s])r  sortedr<  r4  remover:  )r   r   t
type_hintsoptionalr9  s    `    r   r   zValueSet.get_type_hint  s    OOOOTYOOOF4OO,,
z??aa= Z' 	&f%%%z??a4__!!1AAdii
333A 	#"Ar   c                 h    ddl m} i }| j        D ]!} |||                    |                     "|S )Nr   )merge_type_var_dicts)!jedi.inference.gradual.annotationrv  r  r   )r   r   rv  type_var_dictr   s        r   r   zValueSet.infer_type_vars  s`    JJJJJJY 	 	E  %%i00    r   r   r   )r   r   r   r   r   r!  r=   r)  r,  r.  r2  r5  r   r<  r   rD  rF  rI  rL  r>   r#   r.   rU   r`   ra  re  r4   r   r   r   r   r   r   r)   r)     s       3 3 3
   [
 
; 
; [
;= = == = =      @ @ @> > >  ' ' '& & &  < < <   ^ ^ ^] ] ]M M M\ \ \S S S	 	 	V V VF F F   (
 
 
 
 
r   r)   c                       fd}|S )Nc                  .    t           | i |          S r   r(   )r   r   funcs     r   wrapperz&iterator_to_value_set.<locals>.wrapper+  s     d-f--...r   r   )r{  r|  s   ` r   iterator_to_value_setr}  *  s#    / / / / / Nr   r   )%r   	functoolsr   r   r   	itertoolsr   parso.python.treer   jedir   jedi.parser_utilsr   jedi.inference.helpersr
   jedi.inference.utilsr   jedi.inference.cacher   
jedi.cacher   objectr   	Exceptionr   r   r   r   r   r   r   r   r  r  r)   r   r}  r   r   r   <module>r     s                ! ! ! ! ! ! " " " " " "       3 3 3 3 3 3 8 8 8 8 8 8 . . . . . . F F F F F F % % % % % %688	 	 	 	 	9 	 	 	o1 o1 o1 o1 o1 o1 o1 o1da a a a a a a aH   2 2 2 2 2( 2 2 2*" " " " "( " " "I I I I I$ I I IF F F F F F F FU U U U U U U U  6H H H H H H H HV HRLL	    r   