+
    e&J                        R t ^ RI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 ^ RIHt ^ RIHtHt ^ RIHt ]! R. R'O4      tR tR tR(R lt R t!R t"R t# ! R R]$4      t%R t&R t'R t(R(R lt) ! R R4      t*R t+R t,R  t-R! t.]! R"4      R# 4       t/R$ t0R)R% lt1R& t2R# )*z
Helpers for the API
N)
namedtuple)dedent)chainwraps)	Parameter)Parser)tree)	NO_VALUES)
infer_atom)infer_call_of_leaf)get_string_value_set)signature_time_cachememoize_method)get_parent_scopeCompletionPartsc                 $    V P                  V4      # N)
startswith)string	like_names   &&2/usr/lib/python3/dist-packages/jedi/api/helpers.py_start_matchr      s    Y''    c                     \        V4      ^8:  d   W9   # V P                  V^ ,          4      pV^ 8  d   \        W^,           R VR,          4      # R# )   N:r   NNF)lenfind_fuzzy_match)r   r   poss   && r   r   r      sM    
9~""
++il
#C
axF78,im<<r   c                 >    V'       d   \        W4      # \        W4      # r   )r   r   )r   r   fuzzys   &&&r   matchr"   &   s    F..F..r   c                     \        V R  R7      # )c                     \        V P                  ;'       g    R 4      V P                  ;'       g    ^ V P                  ;'       g    ^ V P                  3# ) )strmodule_pathlinecolumnname)xs   &r   <lambda>$sorted_definitions.<locals>.<lambda>/   s;    s1==+>+>B'?'(vv{{'(xx}}1'(vv'/r   )key)sorted)defss   &r   sorted_definitionsr1   -   s    $ / 0 0r   c                 \   V P                  V4      pVe   VP                  R9   dG   W^ ,          ^,
          ,          p\        P                  ! RVR V^,           4      P	                  ^ 4      # VP                  R9  d   R# VP
                  R V^,          VP                  ^,          ,
           # )Nz(?!\d)\w+$|$r%   )r   
error_leaf)r*   keyword)get_leaf_for_positiontyperesearchgroupvalue	start_pos)module_nodelinespositionleafr(   s   &&&  r   get_on_completion_namer@   5   s    ,,X6D|tyy$<< a[1_%yy$|*<=CCAFF	-	-::6x{T^^A%6677r   c                     W^ ,          ^,
          V^ ,           pVR,          RV^,           VR&   V^ ,          V^,          R V^ &   RP                  V4      # )    Nr%   )join)
code_linesr;   end_posr=   s   &&& r   	_get_coderG   C   sW    |a'
3Eb	+71:&E"IQx	!&E!H775>r   c                   0   a  ] tR t^Mt o ]R 4       tRtV tR# )OnErrorLeafc                (    V P                   ^ ,          # rB   )argsselfs   &r   r3   OnErrorLeaf.error_leafN   s    yy|r    N)__name__
__module____qualname____firstlineno__propertyr3   __static_attributes____classdictcell____classdict__s   @r   rI   rI   M   s      r   rI   c                 <   VP                   V8  d   VP                  4       pVf   R# VP                  R8H  pVP                  R8X  d   VP                  4       pVe   K'  R# VP                  R8X  g   VP                  R8X  d-   VP                   ^ ,          V^ ,          8  d   R# \        V4      hTp VP                  P                  R9   d   MVP                  pK+  V'       d"   VP                   ^,          V^,          8  d   R# \        WP                  4       V4      # )Nr%   newliner3   r   )
file_inputsuitesimple_stmt)r;   get_previous_leafr6   rI   parentrG   get_start_pos_of_prefix)rE   r?   r>   is_after_newline	user_stmts   &&&  r   _get_code_for_stackrd   S   s     ~~!%%'<yyI-
))y
 %%'<yyL DII$9>>!x{* $	$$(NN!((I""1%3  %F%F%H(SSr   c                X  a aa  ! R R\         4      oVV V3R lp\        \        WV4      4      pRoVR,           S,           p\        S P                  RR7      p VP                  V! V4      R7       \        R	\        T! T4      4      ,          4      h  S d    TP                  u # i ; i)
zM
Returns the possible node names (e.g. import_from, xor_test or yield_stmt).
c                       ] tR t^tRtR# )/get_stack_at_position.<locals>.EndMarkerReachedrP   N)rQ   rR   rS   rT   rV   rP   r   r   EndMarkerReachedrg      s    r   rh   c              3   $  <"   SP                  V 4      pV Fs  pVP                  S8X  d   S! 4       hVP                  P                  S4      '       d   S! 4       hVP                  P                  S4      '       d   Vx  S! 4       hVx  Ku  	  R # 5ir   )	_tokenizer   prefixendswith)codetokenstokenrh   grammarsafewords   &  r   tokenize_without_endmarker9get_stack_at_position.<locals>.tokenize_without_endmarker   s}      ""4(E||x'&((&&x00&((&&x00&(( s   AB'B;B)ZZZ_USER_WANTS_TO_COMPLETE_HERE_WITH_JEDI T)error_recovery)rn   z7This really shouldn't happen. There's a bug in Jedi:
%s)		Exceptionr   rd   r   _pgen_grammarparsestackSystemErrorlist)	rp   rE   r?   r   rr   rm   prh   rq   s	   f&&&   @@r   get_stack_at_positionr~   {   s    9 " %j<=D ;H#: Dw$$T:A	1$78 B
)$/
0	1   wws   B B)(B)c                    VP                   R 8X  d   V P                  W4      # VP                  p\        pVP                   R8X  d   VP	                  VP                  4      pV# VP                   R8X  d   \        W4      pV# \        V\        P                  4      '       d   \        W4      # VP                   R9   d   \        V 4      # V# )r*   atomtrailer)fstring_stringfstring_startfstring_end)r6   inferr`   r
   
infer_noder   
isinstancer	   Literalr   r   )inference_statecontextr?   r`   definitionss   &&&  r   r   r      s    yyF$$W33[[FK{{f((5  
		!(7  
D$,,	'	''((	H	H#O44r   c              #     "   V  F  pVP                  4       '       dd   \        \        VP                  4       VR 7      4      pRpV'       d   V F  pVP                  e   K  RpK  	  V'       d   Vx  Kp  T Rj  xL
  K|  Vx  K  	  R#  L5i))follow_builtin_importsFNT)	is_importr|   filter_follow_importsgotor;   )namesr   r*   	new_namesfound_builtinnew_names   &&    r   r   r      s|     >>2		'= I "M% )H))1(, !* 
$$$J#  %s   AB!B/B:B;Bc                   h   a  ] tR t^t o R t]R 4       t]R 4       t]R 4       t	R t
R tR tRtV tR	# )
CallDetailsc                *    Wn         W n        W0n        R # r   )bracket_leaf	_children	_position)rN   r   childrenr>   s   &&&&r   __init__CallDetails.__init__   s    (!!r   c                P    \        V P                  V P                  4      ^ ,          # rK   _get_index_and_keyr   r   rM   s   &r   indexCallDetails.index       !$..$..A!DDr   c                P    \        V P                  V P                  4      ^,          # )r   r   rM   s   &r   keyword_name_strCallDetails.keyword_name_str   r   r   c                T    \        \        V P                  V P                  4      4      # r   )r|   _iter_argumentsr   r   rM   s   &r   _list_argumentsCallDetails._list_arguments   s    ODNNDNNCDDr   c                   ^ p\        4       pRpV P                  4       pV'       g   V'       d   ^ # R# Rp\        V4       Fb  w  pw  rHp	WiV^8H  ,          ,          pV'       d   K%  V^,           \        V4      8w  g   K>  V	'       d   VP	                  V4       KY  V^,          pKd  	  \        V4       EF#  w  rzV
P                  4       pV'       gI   V\        P                  8X  d   Vu # V\        P                  \        P                  39   d   Wr8X  d   Vu # Xe   V^8X  d
   V^8X  g   Kz  V
P                  V9  d   V\        P                  8X  g   V\        P                  8X  dV   W'8:  dP   V'       d   Vu # X	'       d   V
P                  V8X  d   Vu # M%V
P                  P                  V4      '       d   Vu # V\        P                  8X  g   EK"  Vu # 	  R# )rB   NFrC   )setr   	enumerater   addget_kindr   VAR_POSITIONALPOSITIONAL_OR_KEYWORDPOSITIONAL_ONLYstring_nameKEYWORD_ONLYr   VAR_KEYWORD)rN   param_namespositional_count
used_names
star_countrL   is_kwargi	key_start	had_equal
param_namekinds   &&          r   calculate_indexCallDetails.calculate_index   s   U

##%5>t_1A1
yZ1_55Hq5CI% "y1(A-( 6E '{3MA&&(D9333HI;;Y=V=VWW, $Z1_
a));!Y%;%;; $	(G(G G!1!6!  %11Y>#$H ? &11<<YGG#$H9000H3 44 r   c              #     "   \        V P                  4       4       F  w  rpV'       g   K  V'       g   K  Vx  K   	  R # 5ir   )r|   r   )rN   r   r   r   s   &   r   iter_used_keyword_arguments'CallDetails.iter_used_keyword_arguments  s1     04T5I5I5K0L,J9yYY 1Ms   %A A 
A c                |    ^ pV P                  4       RR  F"  w  r#pV'       g	   V'       d    V# V^,          pK$  	  V# )rB   NrC   )r   )rN   countr   r   r   s   &    r   count_positional_arguments&CallDetails.count_positional_arguments  sF    040D0D0Fs0K,J9Y QJE 1L r   )r   r   r   N)rQ   rR   rS   rT   r   rU   r   r   r   r   r   r   r   rV   rW   rX   s   @r   r   r      sa     "
 E E E E E E1f 
 r   r   c              #   ^  a"   V3R  lpV  Uu. uF  q3P                   S8  g   K  VNK  	  ppVR,          P                  R8X  d(   \        VR,          P                  S4       Rj  xL
  R# Rp^ p\	        V4       EFe  w  rxVP                  R8X  d   RpVP                  ^ ,          p	VP                  ^,          p
V
R8X  dC   V
P                   S8  d$   V	P                  R8X  d   ^ V	P
                  R3x  Mz^ V! V	4      R3x  MlV	R9   d"   \        V	P
                  4      V! V
4      R3x  MDVP                  4       pVP                  R8X  d    VP                   S8  d   ^ V! V4      R3x  MRx  ^ pK  VP                  R8X  dw   VP                  R	,           F7  pVP                  R
8X  d   ^pVP                  ^,          pWb! V4      R3x  ^ pK9  	  \        \        VP                  4      ^,          4      pEK  \        V\        P                  4      '       d(   VP
                  R8X  d   V'       g
   VRR3x  ^ pRpEK  \        V\        P                  4      '       d*   VP
                  R9   d   \        VP
                  4      pEK  VR8X  g   EK  VR,          '       g   EK+  RpWG^,
          ,          pVP                  R8X  d   ^ VP
                  R3x  MRx  ^ pEKh  	  V'       g7   VR,          P                  R8X  d   Wb! VR,          4      R3x  R# VRR3x  R# R# u upi  EL5i)c                    < V P                   R 8w  d   R# V P                  RS^,          V P                  ^,          ,
           # )r*   N)r6   r:   r;   )r*   r>   s   &r   remove_after_pos)_iter_arguments.<locals>.remove_after_pos"  s6    99zz:8A;)::;;r   arglistNFargumentT=r*   testlist_star_expr:NN   	star_expr,r%   rC   )*z**)rB   NF)r;   r6   r   r   r   r:   r   get_first_leafboolr   r	   
PythonLeaf)nodesr>   r   cnodes_beforeprevious_node_yielded
stars_seenr   nodefirstsecond
first_leafnbefores   &f            r   r   r   !  s    <  %?u!h(>AAuL?B	)"<#3#<#<hGGG!J\*99
"$(!MM!$E]]1%F}##h.5::3GU[[$..-e4e;;+%%++&(8(@%GG "002
??f,1E1E1Q-j95@@((JYY..]]3''66[(!"J

1A "21"5u<<
 ( %)T]]);a)?$@!doo..4::3D( "e++
$)!doo..4::3LTZZJS[\"--$(!!a%(F{{f$t++$$JY +\ !  F*.|B/?@%GGb%''	 !k @Gs;   L-L%L%:L-%L*&GL-3AL-L-&AL-->L-c                   V  Uu. uF  q"P                   V8  g   K  VNK  	  ppVR,          P                  R8X  d   \        VR,          P                  V4      # RpVR,          pVP                  R8X  dY   VP                  ^,          R8X  dA   VP                  ^,          P                  V8:  d   VP                  ^ ,          P
                  pMVR8X  d   VR,          P
                  pVP                  R4      V3# u upi )z?
Returns the amount of commas and the keyword argument string.
r   Nr   r   r   rC   )r;   r6   r   r   rF   r:   r   )r   r>   r   r   key_strlasts   &&    r   r   r   d  s      %?u!h(>AAuL?B	)!,r"2";";XFFGDyyJ4==#3s#:a ((H4--"((	r"((c"G++ @s
   C:C:c                 |   \        \        \        V P                  4      4      4       F  w  r4VR 8X  g   K  VP                  V8:  g   K!  V^ 8  g   K*  V P                  VR pVP                  4       pVf   KO  VP                  R8X  g   VP                  P                  R9   g   K}  \        WEV,           V4      u # 	  R# )(Nr*   )r   r   )	reversedr|   r   r   rF   r_   r6   r`   r   )r   additional_childrenr>   r   elementr   r*   s   &&&    r   &_get_signature_details_from_error_noder   y  s    "4	$--(@#ABc>goo9eai }}UV,H,,.D|yyF"dkk&6&6:M&M"77J,JHUU Cr   c                    V P                  VR R7      pVP                  V8  d   VP                  4       pVf   R# VP                  pVEev   VP                  R9   d   R# . p\        VP                  4       F^  pVP                  V8  g   K  VP                  R8X  d&   \        WTV4      pVe   Vu # VP                  VR&   KL  VP                  ^ V4       K`  	  VP                  R8X  d   VP                  ^ ,          R8X  g*   VP                  R8X  d   VP                  ^,          R8X  d   W#P                  R	,          J d   WP                  8  gc   VP                  4       pVf   R# \        VP                  R8X  d   VP                  ^ ,          MVP                  ^,          VP                  V4      # VP                  pEKz  R# )
T)include_prefixesN
error_node:rB   rB   Nr   r   	decorator)funcdefclassdef	decorated
async_stmtrC   )r5   r;   r_   r`   r6   r   r   r   insertrF   r   )moduler>   r?   r   r   r   results   &&     r   get_signature_detailsr     s   ''4'HD ~~!%%'< ;;D

99JJ  $--(A{{X%66\)CF )%/0zz',#**1a0 ) 99	!dmmA&6#&=99+a0@C0G
 MM"--(ll2J--/<"(,		Y(>DMM!$DMMRSDTMM  {{r   call_signatures_validityc              #    "   V^ ,          ^,
          pW5,          RV^,           pW2P                   ^ ,          V pRP                  Wv.,           4      p\        P                  ! RV\        P                  4      p	VP                  4       P                  4       p
V
f   Rx  MWVP                   3x  \        V VVP                  4       4      x  R# 5i)z'This function calculates the cache key.Nr%   z.*\()	r;   rD   r7   r"   DOTALLget_root_context
py__file__r   r_   )r   r   r   rE   user_pos
line_indexbefore_cursorother_lineswholebefore_bracketr'   s   &&&&&      r   cache_signaturesr    s      !qJ*<HQK8M33A6zBKGGK/12EXXgubii8N**,779K
L,B,BCC
&&( s   CCc                 4   a  \        S 4      RV 3R ll4       pV# )Nc                   < Vf    \        \        V P                  4      ^4      MTp^ Tu;8  d   \        V P                  4      8:  g   M \        R4      hV P                  V^,
          ,          p\        V4      pVP	                  R4      '       d   V^,          pM VP	                  R4      '       d
   V^,          pVf   TMTp^ Tu;8:  d   V8:  g   M \        RW&W3,          4      hS! WV.VO5/ VB # )Nz)`line` parameter is not in a valid range.z

zH`column` parameter (%d) is not in a valid range (0-%d) for line %d (%r).)maxr   _code_lines
ValueErrorrl   )rN   r(   r)   rL   kwargsline_stringline_lenfuncs   &&&*,  r   wrapper%validate_line_column.<locals>.wrapper  s    04s3t''(!,$D1C 0 011HII&&tax0{#''MH!!$''MH#^V'x' 8!'4;FF G G D8888r   )NNr   )r  r  s   f r   validate_line_columnr    s     
4[9 9$ Nr   c                  a aa VV3R lp\        \        P                  ! S P                  4       P	                  4       4      4      pV'       g'   V 3R lpV Uu. uF  qv! V4      '       g   K  VNK  	  pp\        WE4      # u upi )zN
Returns a dictionary with name parts as keys and their call paths as
values.
c                 n   < V P                  4       pS;'       d    T;'       g    S;'       d    V'       * # r   )is_definition)r*   is_defr   
referencess   & r   def_ref_filter(get_module_names.<locals>.def_ref_filter  s1    ##%%%vBB)B)BF
Br   c                 r   < \        V 4      pV'       d   VP                  R 8X  d   VP                  pVSR39   # )r   N)r   r6   r`   )r*   parent_scoper   s   & r   is_module_scope_name.get_module_names.<locals>.is_module_scope_name  s7    +D1L 1 1\ A+22FD>11r   )r|   r   from_iterableget_used_namesvaluesfilter)r   
all_scopesr   r  r  r   r  r   s   f&ff    r   get_module_namesr"    sj    
C $$V%:%:%<%C%C%EFGE	2 "=Eq%9!%<E=.(( >s   A?,A?c                 `    V P                  R 4      w  rpVR8X  d   RpWP                  R4      3# )ru   deffunction.)
rpartitionsplit)r*   r6   _dotted_namess   &   r   split_search_stringr+    s5     OOC0D\u}##C(((r   )pathhas_dotr*   )F)TF)3__doc__r7   collectionsr   textwrapr   	itertoolsr   	functoolsr   inspectr   parso.python.parserr   parso.pythonr	   jedi.inference.base_valuer
   jedi.inference.syntax_treer   jedi.inference.helpersr   jedi.inference.compiledr   
jedi.cacher   r   jedi.parser_utilsr   r   r   r   r"   r1   r@   rG   rw   rI   rd   r~   r   r   r   r   r   r   r   r  r  r"  r+  rP   r   r   <module>r<     s    
 "     &  / 1 5 8 ; . .0KL(/08) %TP'T(*P Pf@(F,*V4n 01 2*.)6)r   