+
    e*                     $   ^ RI 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 0 RmtRtR R ltR	 tR
 tR tR tR tR tR!R ltR tR tR tR tR R lt]! ]4      tR tR tR t R t!R t"]"! R4      t#]"! R4      t$]"! RR4      t%R# )"    N)literal_eval)cleandocWeakKeyDictionary)tree)parser_cache)split_linesc                   . pV P                   pVR8X  dL   V P                  4       pVRJ d4   V P                  P                   R8w  d   VR8w  d   VP                  V 4       V# VR8X  d;   VP                  V 4       V P                   F  pV\        VRR7      ,          pK  	  V# VR8X  dG   V P                  R,          R	8X  d-   V P                  R,          p V R
8w  d   V\        V 4      ,          pV#  V P                  pV P                   \        9   d   V'       g   VP                  V 4       V F  pV\        WQ4      ,          pK  	  V#   \         d     T# i ; i)z
For static analysis.
nameFparam=	expr_stmtT)
last_added	decorator)()typeget_next_leafparentappendchildrenget_executable_nodes_EXECUTE_NODESAttributeError)noder   resulttyp	next_leafchildr   s   &&     3/usr/lib/python3/dist-packages/jedi/parser_utils.pyr   r      sH    F
))C
f}&&(	4;;#3#3w#>9PSCSMM$2 M1 
	 	d]]E*5TBBF #( M% 
	==#==$Ds{.t44 M		B}}H yyN*:d#!.uAA " M  	 M	s   0E EEc              #     "   V x  V P                   R,          p VP                  R8X  d   VP                   ^,          x  M)VP                  R8X  d   Vx  MVP                  R8X  g   R# VP                   R,          pKf  5i)   comp_forsync_comp_forcomp_ifNr   r   )r%   lasts   & r"   get_sync_comp_forsr+   :   sf     
NR D
99
"--""YY/)Ji'}}R s   A>B c                B    V P                   ^,          P                  R8H  # )z
Returns True if only one name is returned: ``for x in y``.
Returns False if the for loop is more complicated: ``for x, z in y``.

:returns: bool
r   r)   )for_stmts   &r"   for_stmt_defines_one_namer.   G   s      Q$$..    c                 $   VP                   pV P                   Tu;8  d   V P                  8:  g   M \        R 4      hRp\        V P                  4       F8  w  rEW%P                   8  d   Vu # VP                  4       pV\        9   g   K6  TpK:  	  R# )z!The node is not part of the flow.N)	start_posend_pos
ValueError	enumerater   get_first_leaf_FLOW_KEYWORDS)	flow_noder   r1   keywordir!   
first_leafs   &&     r"   get_flow_branch_keywordr;   Q   s{    I)@y/@/@@<==Gi001&N))+
' G 2 r/   c                j    V P                  4       pVe   \        \        VP                  4      4      # R# )z2Returns a cleaned version of the docstring token.  )get_doc_noder   safe_literal_evalvalue)
scope_noder   s   & r"   clean_scope_docstringrB   `   s0    ""$D
 )$**566r/   c                    V P                   R 8X  dt   V P                  p V P                  4       pVeT   VP                   R8X  dC   VP                  ^ ,          pVP                   R8X  d   \	        \        VP                  4      4      # R# )r   simple_stmtstringr=   )r   r   get_next_siblingr   r   r?   r@   )	tree_nodemaybe_strings   & r"   find_statement_documentationrI   l   ss    ~~$$$	 113#  M1+44Q7$$0#$5l6H6H$IJJr/   c                 t    V R ,          P                  4       pV^ ,          R8X  g   VR9   d   R# \        V 4      # ):N   Nfr=   )frrf)lowerr   )r@   	first_twos   & r"   r?   r?   x   s5    b	!I|si<7 r/   c                   Vf+   V P                   R8X  d   RpMV P                  P                  pV P                  4       pV'       d
   VR,          pRRP	                  R V 4       4      P                  4       ,           R,           p\        P                  ! RR	V4      pV P                  '       d+   V'       g#   R
V P                  P                  4       ,           pMRpW&,           V,           pRP	                  \        P                  ! W4      4      # )z
Generate a string signature of a function.

:param width: Fold lines if a line is longer than this value.
:type width: int
:arg func_name: Override function name when given.
:type func_name: str

:rtype: str
lambdefz<lambda>r$   NNr   r=   c              3   @   "   T F  qP                  4       x  K  	  R # 5iN)get_code).0r   s   & r"   	<genexpr> get_signature.<locals>.<genexpr>   s     ;F5nn&&Fs   r   z\s+ z ->
)r   r   r@   
get_paramsjoinstripresub
annotationrV   textwrapwrap)	funcdefwidthcall_stringomit_first_paramomit_return_annotationparamsprtypecodes	   &&&&&    r"   get_signaturerm      s     <<9$$K!,,,,K!Fbgg;F;;AACCcIA
vsAA"8**3355?U"D99X]]4/00r/   c                     V P                   pV F  p\        W14       K  	  R#   \         d    T ;P                  T,          un         R# i ; i)z
Move the `Node` start_pos.
N)r   mover   line)r   line_offsetr   cs   &&  r"   ro   ro      sE    !== A    !		[ 		!s   $ $AAc                    V P                   R8X  d-   V P                  ^,          P                  4       P                  pMV P                   R8X  d-   V P                  ^,          P                  4       P                  pMtV P                   R8X  d;   V P                  ^,          P                  4       P	                  4       P                  pM)V P                  4       P	                  4       P                  p RV9  d   R# WP                  R4      R pRV9   d   VRVP                  R4       pRV9   d   VRVP                  R4       pV#   \         d     R# \         d     R# i ; i)z`
returns (as string) any comment that appears on the same line,
after the node, including the #
r-   	with_stmtrd   N#r[   )	r   r   r5   prefixr   get_last_leafr   r3   index)r   
whitespacecomments   &  r"   get_following_comment_same_liner|      s+   
99
"q)88:AAJYY+%q)88:AAJYY)#q)88:HHJQQJ++-;;=DDJ *))#./0Gw.7==./w.7==./N    s/   <E <E <A
E (E E E E E c                 r    V P                   pVR 8X  d!   V P                  ^,          P                   R8g  # VR9   # )r%   r&   )
file_inputclassdefrd   rR   r&   )r   r   )r   ts   & r"   is_scoper      s8    		AJ}}Q$$77QQQr/   c                 0   a a \        4       oRVV 3R llpV# )Fc                    < V f	   S! W4      #  SV ,          p W1,          #   \          d    / ;pST &    Li ; i  \          d    S! Y4      ;qCT&   Tu # i ; irU   )KeyError)parso_cache_noder   include_flows
for_moduler   cachefuncs   &&&  r"   wrapper(_get_parent_scope_cache.<locals>.wrapper   sz    #,,	6/0J	##	  	6355J/0	6
  	(,T(AAF%M	s   	! 9 66AAFr   )r   r   r   s   f @r"   _get_parent_scope_cacher      s    E  Nr/   c                Z  a  S P                   pVf   R#  \        V4      '       d   VP                  R	9   d   VP                  P	                  R4      pVP                  V,          P
                  S P
                  8  d   S P                   P                  R8X  d   S P                   P                  S 8X  d    V# S P                   P                  R8X  d&   S P                   P                  ^ ,          S 8X  d    V# VP                   pK  V# V'       d   \        V\        P                  4      '       dp   VP                  R8X  d]   \        ;QJ d-    V 3R lVP                  4        4       F  '       g   K   RM"	  RM! V 3R lVP                  4        4       4      '       g   V# VP                   pEK  )
z
Returns the underlying scope.
NT:r   tfpdefif_stmtc              3      <"   T F9  pVP                   SP                   u;8*  ;'       d    VP                  8  Mu x  K;  	  R # 5irU   )r1   r2   )rW   nr   s   & r"   rX   #get_parent_scope.<locals>.<genexpr>  s4      =%; KK4>>EEAIIEE%;s
   &AAF)r   rd   rR   )r   r   r   r   ry   r1   r   
isinstancer   Flowanyget_test_nodes)r   r   scopery   s   f&  r"   get_parent_scoper      sC    KKE}
E??zz??,,S1>>%(22dnnD{{''72t{{7G7G47O L ))X5$++:N:Nq:QUY:Y L !& Lz%;; JJ)+ =%*%9%9%;= =%*%9%9%;= = =r/   c                ,    \        W4      P                  # )z
Basically access the cached code lines in parso. This is not the nicest way
to do this, but we avoid splitting all the lines again.
)get_parso_cache_nodelinesgrammarpaths   &&r"   get_cached_code_linesr     s    
  .444r/   c                >    \         V P                  ,          V,          # )z
This is of course not public. But as long as I control parso, this
shouldn't be a problem. ~ Dave

The reason for this is mostly caching. This is obviously also a sign of a
broken caching architecture.
)r   _hashedr   s   &&r"   r   r     s     (..r/   c                .   \        V P                  RR7      RV^ ,          V P                  ,
          ^,            pV^,          pV P                  V^ ,          8X  d   W0P                  ,          pV'       g   R# VR,          RV VR&   RP	                  V4      # )z+
Cuts of the value of the leaf at position
T)keependsNr=   r(   )r	   r@   rp   columnr]   )leafpositionr   r   s   &&  r"   cut_value_at_positionr   "  s{     

T23OHQK$))4Ka4OPEa[FyyHQK++b	'6"E"I775>r/   c                   V P                   R8X  dQ   \        V P                  4      ^8X  d5   V P                  ^ ,          R8X  d   \        V P                  ^,          4      # R# V P                   R8X  dy   V P                  pV^ ,          R8X  d   R# \        V^ ,          4      '       g   R# \        ;QJ d#    R VR,           4       F  '       d   K   R# 	  R# ! R VR,           4       4      # V P                   R	8H  # )
zH
Checks if a path looks like `name` or `name.foo.bar` and not `name()`.
atomr   F	atom_exprawaitc              3   L   "   T F  qP                   ^ ,          R8H  x  K  	  R# 5i)r   .N)r   )rW   rr   s   & r"   rX   !expr_is_dotted.<locals>.<genexpr>?  s     >A::a=C's   "$rS   Tr   )r   lenr   expr_is_dottedall)r   r   s   & r"   r   r   0  s     yyFt}}"t}}Q'73'>!$--"233yyK==A;'!hqk**s>">ss>s>s>">>>99r/   c                     a  V 3R  lpV# )c                   < V P                  4        F.  pVP                  ^,          pVP                  4       S9   g   K-   R# 	  R# )z
This is a heuristic. It will not hold ALL the times, but it will be
correct pretty much for anyone that doesn't try to beat it.
staticmethod/classmethod are builtins and unless overwritten, this will
be correct.
TF)get_decoratorsr   rV   )function_noder   dotted_namemethod_namess   &  r"   r   &_function_is_x_method.<locals>.wrapperD  sA     '557I#,,Q/K##%5 8 r/    )r   r   s   j r"   _function_is_x_methodr   C  s     Nr/   staticmethodclassmethodpropertycached_property>   r   exprtermtestpowerfactorrd   or_testand_exprand_testr   not_testxor_exprr   
arith_expr
comparison
shift_exprimport_fromimport_name)	tryexceptfinallyelseifelifwithforwhiler   )H   NFF)&r_   rb   astr   inspectr   weakrefr   parso.pythonr   parso.cacher   parsor	   r   r6   r   r+   r.   r;   rB   rI   r?   rm   ro   r|   r   r   r   get_cached_parent_scoper   r   r   r   r   function_is_staticmethodfunction_is_classmethodfunction_is_propertyr   r/   r"   <module>r      s    	    %  $ B

"J
!/		1B
!>R(@ 22BC 5/&  1@ /> ,Z9JK r/   