+
    کh                        R t ^ RIt^ RIt^ RIHt ^ RIt^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHtHt ^ RIHt ]P"                  ! ]4      tRtR!t]P,                  t]P.                  t]P0                  t]P2                  t]P4                  tR	 tR
 tR tR 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]*4      t+R t, ! R R4      t- ! R R4      t. ! R R 4      t/R# )#aa  
The diff parser is trying to be a faster version of the normal parser by trying
to reuse the nodes of a previous pass over the same file. This is also called
incremental parsing in parser literature. The difference is mostly that with
incremental parsing you get a range that needs to be reparsed. Here we
calculate that range ourselves by using difflib. After that it's essentially
incremental parsing.

The biggest issue of this approach is that we reuse nodes in a mutable way. The
intial design and idea is quite problematic for this parser, but it is also
pretty fast. Measurements showed that just copying nodes in Python is simply
quite a bit slower (especially for big files >3 kLOC). Therefore we did not
want to get rid of the mutable nodes, since this is usually not an issue.

This is by far the hardest software I ever wrote, exactly because the initial
design is crappy. When you have to account for a lot of mutable state, it
creates a ton of issues that you would otherwise not have. This file took
probably 3-6 months to write, which is insane for a parser.

There is a fuzzer in that helps test this whole thing. Please use it if you
make changes here. If you run the fuzzer like::

    test/fuzz_diff_parser.py random -n 100000

you can be pretty sure that everything is still fine. I sometimes run the
fuzzer up to 24h to make sure everything is still ok.
N)
namedtuple)split_lines)Parser)	EndMarker)PythonTokenBOM_UTF8_STRING)PythonTokenTypesFc                 V    V P                   R 8H  ;'       d    V P                  \        9   # )
error_leaf)type
token_type_INDENTATION_TOKENSnodes   &3/usr/lib/python3/dist-packages/parso/python/diff.py_is_indentation_error_leafr   3   s#    99$OO<O)OO    c                 \    V '       d$   \        V 4      '       d   V P                  4       p K+  V # N)r   get_previous_leafleafs   &r   !_get_previous_leaf_if_indentationr   7   s#    
-d33%%'Kr   c                 \    V '       d$   \        V 4      '       d   V P                  4       p K+  V # r   )r   get_next_leafr   s   &r   _get_next_leaf_if_indentationr   =   s#    
-d33!!#Kr   c                 :    \        V P                  ^,          4      #    )_get_indentationchildren	tree_nodes   &r   _get_suite_indentationr#   C   s    I..q122r   c                 (    V P                   ^,          # r   )	start_posr!   s   &r   r   r   G   s    q!!r   c                    V P                   pV F'  pVP                  V 8X  g	   Q W34       h\        V4       K)  	  R#   \         Ed    T P                  R8X  dA   T P
                  \        9   d,   T P                  '       d   Q hT P                  '       d   Q h R# \        T P                  4       4      pTf   T P                  pRpMLTP                  T P                  8:  g	   Q Y034       hTP                  T P                  ,           pTP                  pRT9   g   RT9   dA   \        T4      pT^ ,          \        T4      ,           ^,
          pT\        TR,          4      3pMkT^ ,          T^,          \        T4      ,           3pTP                  \         4      '       d/   T P#                  4       R8X  d   T^ ,          T^,          ^,
          3pT P                  T8X  g   Q T P                  T34       h R# i ; i)zr
Checks if the parent/children relationship is correct.

This is a check that only runs during debugging/testing.
r
   N
)r       )r    parent_assert_valid_graphAttributeErrorr   r   r   valueprefixr   r   end_posr%   r   len
startswithr   get_start_pos_of_prefix)	r   r    childprevious_leafcontentprevious_start_possplittedlineactuals	   &        r   r,   r,   K   s   %'==D E<<4'6$6'& C  B 99$<O)Ozzz!>{{{"? :$:P:P:RS kkG!% ((DNN: &%&: $))DKK7G!.!8!87?dgo"7+H%a(3x=81<D3x|,,F'*,>q,ACL,PPF!!/22446&@F1IM1~~'A$..&)AA'?Bs#   = AG3G3G3EG32G3c                     V P                   p VP                   p\        Y#4       F  w  rE\        YE4       K  	  \        T4      \        T4      8X  g/   Q R\        T4      ,           R,           \        T4      ,           4       hR#   \         d
    Q Y34       hi ; i  \         d    \        TR4      '       d	   Q Y34       hT P                  TP                  8X  g	   Q Y34       hT P                  TP                  8X  g	   Q Y34       hT P
                  TP
                  8X  g	   Q Y34       hT P                  TP                  8X  g	   Q Y34       h R# i ; i)Fr    Nr'   )r    r-   hasattrr.   r   r/   r%   zip_assert_nodes_are_equalr1   repr)node1node2	children1	children2n1n2s   &&    r   r>   r>   y   s*   )NN		)I i+' ,y>S^+\TDO-Cd-JTR[_-\\+	  	)(5.(5	)  5*--=~=-{{ekk)9E>9)zzUZZ'7%7'||u||+;e^;+%//1AE>A1s   B B BB1EEc                    \        V P                  4       R R7      p\        P                  ! W#4      p\        P                  ! W4      p^ RIpRVP
                  : RRP                  V4      : RRP                  V4      : 2# )TkeependsNz=There's an issue with the diff parser. Please report (parso vz) - Old/New:
 z
Actual Diff (May be empty):
)r   get_codedifflibunified_diffparso__version__join)module	old_lines	new_linescurrent_linescurrent_diffold_new_diffrM   s   &&&    r   _get_debug_error_messagerV      sd     1DAM''	AL''	=L bggl3RWW\5J	Lr   c                 (   V P                  4       p\        V4      '       d   VP                  ^ ,          # VP                  4       pVP                  R8X  d,   RVP
                  9   d   VP                  ^ ,          ^,           # VP                  ^ ,          # )r)   	endmarkerr'   )get_last_leaf_ends_with_newliner%   r   r   r/   r0   )node_or_leaf	last_leafns   &  r   _get_last_liner^      sz    **,I)$$""1%%##%66[ TQXX%5 $$Q'!++  ##r   c                 v    V e5   V P                   R8X  d$   V P                  R8X  d   V P                  4       p K8  V # )Nr
   DEDENT)r   r   r   r   s   &r   _skip_dedent_error_leavesra      s2    

tyyL8T__PX=X%%'Kr   c                     \        V 4      p V P                  R 8X  d   V P                  P                  4       pMV P                  pVR8H  ;'       g+    VP	                  R4      ;'       g    VP	                  R4      # )r
   newliner'   r(   )ra   r   r   lowerendswith)r   suffixtyps   && r   rZ   rZ      s`    $T*DyyL oo##%ii)MMvt4MM8MMr   c                @    V F  pVP                   R9   g   K   R# 	  R# )z[
if, while, for and try might not be finished, because another part might
still be parsed.
FT)if_stmt
while_stmtfor_stmttry_stmt)nonterminalpgen_grammarstack
stack_nodes   && r   _flows_finishedrr      s%    
 
!!%VV  r   c                     V P                   R 8X  d   V P                  R,          p V P                   R9   d   V P                  R,          p V P                   R9   ;'       d!    V P                  R,          P                   R8H  # )	decoratedsuiter*   async_funcdef
async_stmtclassdeffuncdef)r   r    r   s   &r   _func_or_class_has_suiter|      sc    yyK}}R yy33}}R 99//UUDMM"4E4J4Jg4UUr   c                     \        W4      '       g   R # \        V4       FB  pVP                  R8X  d    R # VP                  R8X  g   K*  \        VP                  4      ^8  u # 	  R# )F	decoratorru   T)rr   reversedrm   r1   nodesrn   s   && r   _suite_or_file_input_is_validr      sX    <//uo
!![0!!W,z''(1,, & r   c                     V P                   R 8X  d   V P                  ^,          p  V P                  ^ ,          P                  pTR9   #   \         d     R# i ; i)rx   F)ifforwhiletrywith)r   r    r.   r-   )r   r.   s   & r   _is_flow_noder      sW    yyL }}Qa && 999  s   A AAc                       ] tR t^tRtR# )_PositionUpdatingFinished N)__name__
__module____qualname____firstlineno____static_attributes__r   r   r   r   r      s    r   r   c                     V  F  p VP                   p\        WAV4       K  	  R #   \         d)    T;P                  T,          un        Y2J d   \        h KT  i ; ir   )r    _update_positionsr-   r9   r   )r   line_offsetr\   r   r    s   &&&  r   r   r      sW    	@}}H hY?   	0II$I // !	0s   %/AAc                   ^   a  ] tR t^t o RtR tR tR tR tR t	R t
R tR	 tRR
 ltRtV tR# )
DiffParserzu
An advanced form of parsing a file faster. Unfortunately comes with huge
side effects. It changes the given module.
c                *    Wn         W n        W0n        R # r   )_pgen_grammar
_tokenizer_module)selfro   	tokenizerrP   s   &&&&r   __init__DiffParser.__init__   s    )#r   c                V    ^ V n         ^ V n        \        V P                  4      V n        R# r)   N)_copy_count_parser_count
_NodesTreer   _nodes_treer   s   &r   _resetDiffParser._reset  s#    %dll3r   c           	     f   \         P                  R4       RV P                  n        W n        V P                  4        \        V4      p\        P                  ! RWP                  4      pVP                  4       p\         P                  R\        V4      : RV: 24       V F  w  rgrp
\         P                  RWg^,           W^,           V
4       W8X  d   VR,          R8X  d
   V
^,          p
VR8X  d$   W,
          pV P                  W^,           W4       Kt  VR8X  d   V P                  V
R	7       K  VR
8X  d   V P                  V
R	7       K  VR8X  d   K  Q h	  V P                  P                  4        \        '       d    RP                  V4      pV P                  P!                  4       V8X  g   Q h\#        V P                  4       \%        V P&                  RR7      P)                  V P+                  V4      4      p\-        V P                  V4       V P                  P4                  ^ ,          pW8w  d0   \7        RV: RV: R2\3        V P                  W4      ,           4      h\         P                  R4       V P                  #   \.         d"    \1        \3        T P                  Y4      4       h i ; i)a  
The algorithm works as follows:

Equal:
    - Assure that the start is a newline, otherwise parse until we get
      one.
    - Copy from parsed_until_line + 1 to max(i2 + 1)
    - Make sure that the indentation is correct (e.g. add DEDENT)
    - Add old and change positions
Insert:
    - Parse from parsed_until_line + 1 to min(j2 + 1), hopefully not
      much more.

Returns the new module node.
zdiff parser startNzline_lengths old: z; new: z!-> code[%s] old[%s:%s] new[%s:%s]rI   equalreplace)
until_lineinsertdeleteTerror_recovery(z != z) zdiff parser endr*   )LOGdebugr   _used_names_parser_lines_newr   r1   rK   SequenceMatcherget_opcodes_copy_from_old_parser_parser   closeDEBUG_DIFF_PARSERrO   rJ   r,   r   r   parser   r>   AssertionErrorprintrV   r0   	Exception)r   rQ   rR   line_lengthsmopcodes	operationi1i2j1j2r   codewithout_diff_parser_modulelast_poss   &&&            r   updateDiffParser.update
  s/     			%&#' !*)n$$T96L6LM.."		S^[QR)0%I22II9a!VR9  Yr]b%8aG# g**;QGi'r*h&r* H,,,! *1( 	 wwy)||,,.$666#DLL1-3&&#'. %	23 + (6PQ
 <<''*""*K8*4<<NO  			#$|| " .t||YRSs   ?BJ ,J0c                    V P                   P                  4       R P                  V4      8w  d8   \        P	                  RR P                  V4      R P                  V4      4       R# R# )rI   zparser issue:
%s
%sN)r   rJ   rO   r   warning)r   rQ   	lines_news   &&&r   _enabled_debuggingDiffParser._enabled_debuggingV  sH    <<  "bggi&88KK/1CRWWYEWX 9r   c                8   RpW@P                   P                  8  Ed   V P                   P                  V,
          pV P                  V^,           4      pVf/   V P                  V P                   P                  ^,           4       EM[VP                  P
                  pVP                  V4      p	V^8X  d>   V^ ,          P                  4       P                  P                  \        4      '       d   . p
M<V P                   P                  ^,           pV P                   P                  WR VV4      p
V
'       d   V ;P                  ^,          un        V P                   P                  p\        P                  RV
^ ,          P                  ^ ,          V
R,          P                   ^ ,          ^,
          XV4       M,V P                  V P                   P                  ^,           4       WPP                   P                  8w  g   Q V4       hV P                   P                  pEK  R# )r   Nzcopy old[%s:%s] new[%s:%s]r*   )r   parsed_until_line_get_old_line_stmtr   r+   r    indexget_first_leafr/   r2   r   
copy_nodesr   r   r   r%   r0   )r   r   start_line_olduntil_line_olduntil_line_newlast_until_lineparsed_until_line_old	line_stmt
p_childrenr   copied_nodesfrom_tos   &&&&&        r   r    DiffParser._copy_from_old_parserZ  s   //AAA$($4$4$F$F$T!//0E0IJI  D,,>>BC&--66
"((3!Q&&qM88:AALL_]] $&L ,,>>BE#'#3#3#>#>"6*&#$L  $$)$));;BII:*1o77:*2.66q9A=ubJ KK 0 0 B BQ FG #&6&6&H&HHY/YH"..@@OQ Br   c                H   V P                   P                  V^ 3RR7      p\        V4      '       d   VP                  4       pVP	                  4       ^ ,          V8X  dF   TpVP
                  P                  R9  d   VP
                  pK)  VP                  ^ ,          V8  d   V# R# )r)   T)include_prefixesN)
file_inputru   )r   get_leaf_for_positionrZ   r   r3   r+   r   r%   )r   old_liner   r   s   &&  r   r   DiffParser._get_old_line_stmt  s    ||118Q-RV1Wd##%%'D'')!,8D++""*AA{{ ~~a H,r   c                Z   ^ pWP                   P                  8  Ed   V P                  V4      pVP                  pV P                   P	                  W@P
                  4       V P                  e$   V P                  V P                   P                  R&   \        P                  RV^ ,          P                  4       ^ ,          V P                   P                  VP                  ^ ,          ^,
          4       W P                   P                  8w  g   Q V4       hV P                   P                  pEK(  R# )za
Parses at least until the given line, but might just parse more until a
valid state is reached.
Nz/parse_part from %s to %s (to %s in part parser)r*   )r   r   _try_parse_partr    add_parsed_nodes_keyword_token_indents_replace_tos_indentindentsr   r   r3   r0   )r   r   r   r   r   s   &&   r   r   DiffParser._parse  s    
 ++===''
3DMME--e5P5PQ''3/3/G/G  ((,IIAa00215  22Q!#	 #&6&6&H&HHY/YH"..@@O% >r   c                   V ;P                   ^,          un         V P                  P                  pV P                  VR pV P	                  VVVR7      p\        V P                  RR7      V n        V P                  P                  VR7      # )z
Sets up a normal parser that uses a spezialized tokenizer to only parse
until a certain position (or a bit longer if the statement hasn't
ended.
N)r   Tr   )tokens)	r   r   r   r   _diff_tokenizer   r   _active_parserr   )r   r   r   lines_afterr   s   &&   r   r   DiffParser._try_parse_part  s     	a !,,>>,,->-?@$$) % 

 %
 ""(((77r   c              #  Z  "   R pV P                   P                  p\        V4      pV P                  VV^,           ^ 3VV^ 8H  R7      pV P                  P
                  pRV n        / V n        V EF  p	V	P                  p
V
\        8X  d   \        V4      V8  d    \        V4      ;w  rrp	V
\        \        39   d%   V
\        8X  d   V^,          ^,           V n        KD  KF   RT9   g   RT9   d   \        P                  ! RRT4      pMGT^,          \        T4      8  g   Q \        T4      4       hT^,          \        T4      ,
          ^ 8X  d   Rp\        \         RTT4      x   R# M}V
\"        8X  d   V	P$                  ^ ,          V8  d   RpMWV'       dP   R p\        V4      V8X  d>   \'        V P(                  V4      '       d"   \        \         RV	P$                  R4      x   R# V
\*        8X  d4   V	P,                  R9   d#   \/        V4      V P                  V	P$                  &   V	x  EK  	  R# 5i)	F)r%   r   is_first_tokenNTr'   r(   z
[^\n\r]+\ZrI   )classdef)r   r   r1   r   r   rp   r   r   r   r`   nextERROR_DEDENTresubr?   r   	ENDMARKERNEWLINEr%   r   r   NAMEstringlist)r   linesr   r   was_newliner   initial_indentation_countr   rp   tokenrg   r   r%   r/   s   &&&&          r   r   DiffParser._diff_tokenize  s    ""**$'L!"Q*&!+	 ! 
 ##))#' &(#E**Cf}w<";; AEfM6Y6<"88"l2 <EQ<!;K 8 $  3 "v~!#r6!B(|s6{:HDLH:$Q<#f+5:%'F%!2! 
 5 <6 EOOA$6*$D"#w<#<<4T5G5GOO))R"MMd{u||/???CG}++EOO<KY s   FH+BH+)
r   r   r   r   r   r   r   r   r   r   N)r)   )r   r   r   r   __doc__r   r   r   r   r   r   r   r   r   r   __classdictcell____classdict__s   @r   r   r      sB     
4JXY*AX"A48,; ;r   r   c                   ^   a  ] tR tRt o ]! RR4      tRR ltR tR tRR lt	R	 t
R
 tRtV tR# )_NodesTreeNodei  _ChildrenGroupz1prefix children line_offset last_line_offset_leafNc                F    Wn         . V n        W n        . V n        W0n        R # r   )r"   _children_groupsr+   _node_childrenindentation)r   r"   r+   r  s   &&&&r   r   _NodesTreeNode.__init__
  s"    " " &r   c                   . pV P                    FY  w  r#rE\        V^ ,          P                  4       4      pW&P                  ,           Vn        V^ 8w  d    \	        W4V4       W,          pK[  	  WP                  n        V F  pV P                  Vn        K  	  V P                   F  pVP                  4        K  	  R#   \
         d     Lhi ; ir   )r  r   r   r/   r   r   r"   r    r+   r  finish)	r   r    r/   children_partr   last_line_offset_leaf
first_leafr   
node_childs	   &        r   r  _NodesTreeNode.finish  s    IMI^I^EF;6a //1J !'):): :Ja%%4IK %H J_ #+D..DK  --J . 1 s   B;;C	C	c                <    V P                   P                  V4       R # r   )r  append)r   
child_nodes   &&r   add_child_node_NodesTreeNode.add_child_node(  s    "":.r   c                    Vf   VR,          P                  4       pV P                  WW44      pV P                  P                  V4       R # )Nr*   )rY   r  r  r  )r   r/   r    r   r  groups   &&&&& r   add_tree_nodes_NodesTreeNode.add_tree_nodes+  sF     ($,RL$>$>$@!##k
 	$$U+r   c                6   ^ pV P                   '       dg   V P                   R,          p\        VP                  4      pVP                  ^ ,          VP                  ,           p\        WA4      '       d
   V^,          pV\        \        V4      4      ^,
          ,          pV'       d8   VP                  R4      '       g!   VP                  R4      '       g
   V^,          pV P                  '       d,   \        W P                  R,          P                  V4      4      # V# )r)   r'   r(   r*   )r  r   r  r0   r   rZ   r1   r   re   r  maxget_last_line)r   rf   r9   children_groupr\   s   &&   r   r$  _NodesTreeNode.get_last_line4  s       !2226N944I $$Q'.*D*DDD ")44	K'(1,,&//$//8M8MAIDt004BB6JKKr   c                T    R V P                   P                  : RV P                  : R2# )<z: >)	__class__r   r"   r   s   &r   __repr___NodesTreeNode.__repr__L  s    !^^44dnnEEr   )r  r  r  r+   r"   )Nr)   r   )r   r   r   r   r   r  r   r  r  r   r$  r+  r   r  r  s   @r   r  r    s:     ;=N' ./,0F Fr   r  c                   j   a  ] tR tRt o R t]R 4       tR tR tR t	R t
R tR	 tRR
 ltR tRtV tR# )r   iP  c                    \        V4      V n        V P                  .V n        Wn        R V n        R V n        ^ .V n        R# )rI   N)r  
_base_node_working_stackr   _prefix_remainderr/   r   )r   rP   s   &&r   r   _NodesTree.__init__Q  s:    (0#/!#sr   c                Z    V P                   R,          P                  V P                  4      # )r   r*   )r0  r$  r/   r   s   &r   r   _NodesTree.parsed_until_lineY  s"    ""2&44T[[AAr   c                    \        \        V P                  4      4       FH  pVP                  V8  g   W P                  ^ ,          J d   Vu # V P                  P	                  4        KJ  	  R# r   )r   r   r0  r  pop)r   r  r   s   && r   _update_insertion_node!_NodesTree._update_insertion_node]  sQ    T$"5"567D+-9L9LQ9O1O##% 8r   c                   V P                   pV P                  V4      pV'       g   W0P                   ,           V n         R # V^ ,          P                  R8w  g   Q hV P                  V^ ,          P                  ^,          4      pVP
                  P                  R9   g   Q hVP                  W14       V P                  VR,          V4       R # )Nrc   )ru   r   r*   )r/   _remove_endmarkerr   r7  r%   r"   r   _update_parsed_node_tos)r   
tree_nodeskeyword_token_indents
old_prefixr   s   &&&  r   r   _NodesTree.add_parsed_nodesc  s    [[
++J7
${{2DK!}!!Y...**:a=+B+B1+EF~~""&====J3$$Z^5JKr   c                $   VP                   R 8X  d   VP                  P                  ^ ,          p\        VW#P                  ,          R,          R7      pVP                  R\        VP                  4      4       V P                  R,          P                  V4       V P                  P                  V4       V P                  VP                  R,          V4       R# \        V4      '       d&   V P                  VP                  R,          V4       R# R# )ru   r  rI   Nr*   )r   r+   r    r  r%   r   r   r0  r  r  r;  r|   )r   r"   r=  def_leafnew_toss   &&&  r   r;  "_NodesTree._update_parsed_node_tosr  s    >>W$ ''003H$12D2DEbIG ""2tI,>,>'?@#227;&&w/((););B)?AVW%i00((););B)?AVW 1r   c                   VR,          P                  4       pVP                  R8H  pRV n        V'       du   VP                  p\	        VP                  R4      VP                  R4      4      pVR8  d8   VP                  RV^,            VP                  V^,           R uVn        V n        RV n        V'       d   VP                  V n        VRR pV# )z5
Helps cleaning up the tree nodes that get inserted.
rX   rI   r'   r(   Nr*   )rY   r   r1  r/   r#  rfind)r   r<  r\   is_endmarkerr/   
separations   &&    r   r:  _NodesTree._remove_endmarker  s     rN002	 ~~4!#%%FV\\$/d1CDJB
 $$_j1n5y7G7G
UV7X 9	 $"8 #**DK#CRJr   c              #     "   \        V4      pV'       d   \        V4      x  \        V4      p\        V4      pV'       g   WPP                  9  d   R # Vx  V F  p\        V4      V8w  d    R # Vx  K  	  R # 5ir   )iterr   r   r   )r   r<  is_new_suitenode_iterator
first_nodeindentr]   s   &&&    r   _get_matching_indent_nodes%_NodesTree._get_matching_indent_nodes  sg     
 Z(}%%-(
!*-ll :A"f,G s   A7A9c                    V^ ,          P                   R9   d   . # \        V^ ,          4      p\        V P                  4      pV P                  pV P
                  pV P
                   Uu. uF  qV8:  g   K  VNK  	  upV n        V P                  V4       V P                  \        V P                  4      VVVV P                  4      w  qn        V n        p
V	'       d   V ;P
                  V
,          un        V	# WPn        W`n        Wpn        V	# u upi )za
Copies tree nodes from the old parser tree.

Returns the number of tree nodes that were copied.
r
   
error_node)r   r   r   r0  r/   r   r7  _copy_nodes)r   r<  r   r   r  old_working_stackr>  old_indentsi	new_nodesadded_indentss   &&&&       r   r   _NodesTree.copy_nodes  s     a=!== I&z!}5 !4!45[[
ll#'<<D<a3C<D##K0EIEUEU$$%KKF
B	&] LLM)L
  #4$K&L# Es   (D5Dc                   . p. p\        V P                  VVR 7      4      pRp	V EF5  p
V
P                  ^ ,          V8  d    EMV
P                  R8X  d    EMV
P                  R8X  d   V
P                  R9   d    M\        V
4      V8  d%   \        V
4      '       d   VP                  V
4        M V
P                  pT
pVP                  R8X  d   VP                  R,          pVP                  R9   d   VP                  R,          pVP                  R9   d   VP                  R,          pM	VR,          pVP                  R9   d    M VP                  V
4       EK8  	  V'       d   V'       d   VR,          pVP                  R9   g   \        VR,          4      '       dX   Rp	VP                  4        V'       d<   VR,          pVP                  4       P                  R8X  d   MVP                  4        KC  K  \        V4      ^8  d+   VR,          P                  R8X  d   VP                  4        K   V'       g   . WV3# VR,          pVR,          pRp\        V4      '       d   TpVP                  R8w  d   VP                  R,          pK&  \        V4      pVP                  V4       \        V\!        V4      R	7      pV P#                  VV.,           VP                  W4R
R7      w  ppp	pVV,          p\        V4      ^8  d   VP                  4        Rp	MV'       g   Q hVP%                  V4       TpR
pV'       Ed   \'        VR,          P                  4       4      '       g>   V'       g6   VR,          P)                  4       P*                  p\-        VR
R7      ^ ,          p	V'       d}   VR,          pVP                  R8X  d   VP                  R,          pVP                  R9   d   VP                  R,          pVP                  R,          P                  4       pVR8X  g   Q hMVR,          P                  4       pVP/                  WWVV4       T	pRV n        WqWX3#   \         d     EL"i ; i))rL  rI   rX   r
   rt   rT  rc   Fru   rA  T)	is_nestedrG   :)r`   r   r*   rv   ry   rS  )r   rP  r%   r   r   r^   r|   r  r    r-   r   r6  rY   r1   r#   r  r   rU  r  rZ   r   r/   r   r   r1  )r   working_stackr   r   r   r/   r]  rY  rZ  
new_prefixr   cr]   
suite_node	last_nodetoshad_valid_suite_lastru   rO  	suite_tossuite_nodesnew_working_stackaiplastr  s   &&&&&&&                   r   rU  _NodesTree._copy_nodes  s   	T44" 5 
 
 
D~~a :-yyK'yyL(T__@Z-Z d#j0+D11$$T*MM 66[(

2A66<<

2A6644!"BJ!"2J??&BB C T"O T %bM	NN&BB(277 "$JMMO#$-bM	$22499YF!!y>A%)B-*<*<*L
 MMO}m;;BbM	$#I..E**'r*+E2F  (&u:J9:UVI >B=M=M+U^^Z >N >:K*J RM;!#
  y""9- 1'+$9%im&A&A&CDDMabM//188
 )T:1=
# }99+==,D99 ??==,D(,b(9(G(G(I%,333(1"(C(C(E%;0E  F%'D">>] " s   1QQ,+Q,c                X   V P                   P                  4         V P                  P                  4       p\	        V4      p\        VP                  4      p\        V P                  4      p\        V4      ^ 8  g   Q h\        V4      ^8X  dg   V^ ,          P                  \        4      '       d   V^^ .8X  d   V^;;,          ^,          uu&   V^;;,          \        V^ ,          4      ,          uu&   M:V^ ;;,          \        V4      ^,
          ,          uu&   \        VR,          4      V^&   \        R\        V4      V P                  V P                  ,           4      pV P                  Vn        V P                  P"                  P%                  V4       R#   \         d	    ^^ .p ELRi ; i)r   rI   Nr*   )r/  r  r   rY   ra   r   r0   
IndexErrorr   r/   r1   r2   r   r   tupler1  r+   r    r  )r   r\   r0   r  rX   s   &    r   r   _NodesTree.close_  s7    	.224I 2)<I9,,-GDKK(5zA~~u:?Qx""?33Aq68I
a
AJ#eAh-'JAJ#e*q.(JU2YGAJb%.$++@V@V2VW	<<	$$Y/#  	!fG	s   F F)(F))r/  r   r1  r0  r   r/   N)rI   F)r   r   r   r   r   propertyr   r7  r   r;  r:  rP  r   rU  r   r   r  r  s   @r   r   r   P  sR      B B&LX 2( DL?\0 0r   r   )INDENTr   r`   )rI   )0r  r   rK   collectionsr   loggingparso.utilsr   parso.python.parserr   parso.python.treer   parso.python.tokenizer   r   parso.python.tokenr   	getLoggerr   r   r   r   r   r`   r   r   r   r   r   r   r#   r   r,   r>   rV   r^   ra   rZ   rr   r|   r   r   r   r   r   r   r  r   r   r   r   <module>r|     s  6 
  "  # & ' > /! 8 

"
"		 	 ,,&&	P3"+'\](	$"NV":		 	
@H HVHF HFVf0 f0r   