+
    e                        R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHt ^ R	IHt ^ R
IHtHt ^ RIHt ^ RIHt ^tR t]P6                  ]R 4       4       t]! RR7      ]R 4       4       tR tR tR t R# )a  
One of the really important features of |jedi| is to have an option to
understand code like this::

    def foo(bar):
        bar. # completion here
    foo(1)

There's no doubt wheter bar is an ``int`` or not, but if there's also a call
like ``foo('str')``, what would happen? Well, we'll just show both. Because
that's what a human would expect.

It works as follows:

- |Jedi| sees a param
- search for function calls named ``foo``
- execute these calls and check the input.
)settings)debug)get_parent_scope)inference_state_method_cache)TreeArguments)get_executed_param_names)is_stdlib_path)to_list)instance)ValueSet	NO_VALUES)#get_module_contexts_containing_name)	recursionc                    a  V 3R  lpV# )c                   < V P                   p\        P                  ! W P                  4      ;_uu_ 4       pV'       dF   V;P                  ^,          un         S! W4      V;P                  ^,          un        uuRRR4       # \
        uuRRR4       #   T;P                  ^,          un        i ; i  + '       g   i     R# ; i)   N)inference_stater   execution_allowed	tree_nodedynamic_params_depthr   )function_valueparam_indexinfallowedfuncs   &&  ?/usr/lib/python3/dist-packages/jedi/inference/dynamic_params.pywrapper"_avoid_recursions.<locals>.wrapper&   s    ,,((.F.FGG7 ((A-(2<,,1, HG  HG ,,1, HGGs)   "B2B B2B2B//B22C	 )r   r   s   f r   _avoid_recursionsr   %   s     N    c                .  a a S P                   P                  '       g   \        # S P                  pS P	                  4       P                  4       pVe   \        V4      '       d   \        # VP                  R8X  d   \        V4      pVf   \        # MVP                  P                  p\        P                  ! RVRR7       S P	                  4       p\        WRV4      p\        P                  ! V V3R lV 4       4      p\        P                  ! RRR7       V# )a  
A dynamic search for param values. If you try to complete a type:

>>> def func(foo):
...     foo
>>> func(1)
>>> func("")

It is not known what the type ``foo`` without analysing the whole code. You
have to look for all calls to ``func`` to find out what ``foo`` possibly
is.
lambdefzDynamic param search in %s.MAGENTA)colorc              3   f   <"   T F&  p\        SV4      S,          P                  4       x  K(  	  R # 5i)N)r   infer).0	argumentsr   r   s   & r   	<genexpr>'dynamic_param_lookup.<locals>.<genexpr>\   s:        (I 	!I	

	uw	 (s   .1zDynamic param result finished)r   do_dynamic_params_searchr   r   get_root_context
py__file__r   type_get_lambda_namenamevaluer   dbg_search_function_argumentsr   	from_sets)r   r   funcdefpathstring_namemodule_contextarguments_listvaluess   ff      r   dynamic_param_lookupr;   6   s     ))BBB&&G**,779DN400
 ||y &w/  ll((	II+[	J#446N/UN   (	  F 
II-Y?Mr    N)defaultc           	   #    "   TpVR8X  d5   \        V4      pVP                  R8X  d   VP                  P                  pTpRp^ pV P                  p\
        P                  '       d   \        Wp.V^R7      pMV .pV Fu  p	\        W4       FX  w  rV^,          pWgP                  ,          \        8  d     R# V	P                  V
4      p\        W|W:V4       F	  pRpVx  K  	  KZ  	  V'       g   Kt   R# 	  R# 5i)z 
Returns a list of param names.
__init__classdefF)limit_reductionNT)r   r.   r0   r1   r   r    dynamic_params_for_other_modulesr   _get_potential_nodesr   MAX_PARAM_SEARCHEScreate_context_check_name_for_execution)r8   r5   r7   compare_nodeclsfound_argumentsir   module_contextsfor_mod_contextr0   trailerrandom_contextr(   s   &&&           r   r3   r3   f   s      Lj w'88z!((..KLO	A$44O000=-{
 ***1/OMDFA
 777:LL,;;DAN6#\R	"&R P" ?' +s   A#C6&BC6/C6c                     V P                   pVP                  R 8X  dR   \        VP                  4       R4      pVR8X  d1   VP                  ^ ,          pVP                  R8X  d   VP
                  # R# )	expr_stmtN=r0   )parentr.   nextyield_operatorschildrenr1   )nodestmtfirst_operatorfirsts   &   r   r/   r/      s[    ;;DyyKd224d;S MM!$EzzV#{{"r    c              #     "    V P                   P                  4       V,          pT F@  pTP                  4       pTP                  pTP
                  R8X  g   K2  TR8X  g   K;  Y53x  KB  	  R #   \         d     R # i ; i5i)NrL   ()r   get_used_namesKeyErrorget_next_leafrQ   r.   )module_valuefunc_string_namenamesr0   bracketrL   s   &&    r   rB   rB      st     &&5578HI $$&..<<9$C-	   s3   A?!A- /A?A?"A?-A<8A?;A<<A?c           	   #   2  a aa"   ^ RI Hp VV V3R lpS P                  SV4       EFc  pVP                  pW(8X  d   V! V4      x  K"  \	        VP
                  V4      '       g   K@  VP                  R8X  g   KS  VP
                  P                  4       p	\        V	4      ^8w  d   K  V	^ ,          P                  4       p
V
 Uu. uF  qP                  NK  	  upV.8X  g   K  SP                  4       pVP                  V! V4      4      p\        W^ ,          P                  4      pV Fa  w  poVP                  VP                  u;8  d   VP                  8  g   K5  M K9  VP                  V4      p\!        S VVVS4       Rj  xL
  Kc  	  EKf  	  R# u upi  L5i)    )BaseFunctionExecutionContextc                 F  < SP                   ^,          pVR8X  d   Rp\        SSVS4      p^ RIHp V P                  P
                  R8X  d,   \        P                  ! SV P                  V V4      pV! WB4      # V P                  4       '       d   V! V P                  V4      pV# )r   )N)InstanceArgumentsr?   )
rT   r   jedi.inference.value.instancerg   r   r.   r
   TreeInstanceparent_contextis_bound_method)r1   arglistargsrg   created_instancecontextr   rL   s   &    r   create_args._check_name_for_execution.<locals>.create_args   s    ""1%c>G_gwHC??:-'44$$	  %%5<<$$&&(>Kr    r5   N)jedi.inference.value.functionrd   r&   r   
isinstancerj   r.   get_param_nameslenr,   
as_contextrB   r7   	start_posend_posrD   rE   )r   ro   rF   r0   rL   rd   rp   r1   
value_nodeparam_namesr:   vr8   execution_contextpotential_nodesrM   s   ff&&f           r   rE   rE      sX    J& !&&w5__
%e$$,,.JKK %%2  ..>>@K;1$ ^))+F%+,VV,>!(!9!9!;$)$4$4[5G$H!"6~ST~GaGa"b%4MD'!++dnnQz?Q?QQQ):)I)I$)O#<+*( #$   &5% 6 -s8   AF&F9AF FFA5F'F FF)!__doc__jedir   r   jedi.parser_utilsr   jedi.inference.cacher   jedi.inference.argumentsr   jedi.inference.paramr   jedi.inference.helpersr   jedi.inference.utilsr	   jedi.inference.valuer
   jedi.inference.base_valuer   r   jedi.inference.referencesr   jedi.inferencer   rC   r   increase_indentr;   r3   r/   rB   rE   r   r    r   <module>r      s   &   . = 2 9 1 ( ) 9 I $  " +  +\ d++ 	 ,+\	
 1r    