Ë
    ¬;j+  ã                   ó$  — d dl Z d dl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 h d£Zd	Zd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d„Z ee«      Zd„ Zd„ Zd„ Z d„ Z!d„ Z" e"d„ «      Z# e"d„ «      Z$ e"d„ «      Z%y)!é    N)Úliteral_eval)Úcleandoc©ÚWeakKeyDictionary)Útree)Úparser_cache)Úsplit_lines>   ÚatomÚexprÚtermÚtestÚpowerÚfactorÚfuncdefÚor_testÚand_exprÚand_testÚclassdefÚnot_testÚxor_exprÚ	atom_exprÚ
arith_exprÚ
comparisonÚ
shift_exprÚimport_fromÚimport_name)	ÚtryÚexceptÚfinallyÚelseÚifÚelifÚwithÚforÚwhilec                 óN  — g }| j                   }|dk(  rE| j                  «       }|du r/| j                  j                   dk7  r|dk7  r|j                  | «       |S |dk(  r4|j                  | «       | j                  D ]  }|t        |d¬«      z  }Œ |S |dk(  r6| j                  d	   d
k(  r"| j                  d   } | dk7  r|t        | «      z  }|S 	 | j                  }| j                   t        v r|s|j                  | «       |D ]  }|t        ||«      z  }Œ |S # t        $ r Y |S w xY w)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Úchildr5   s          úb/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/jedi/parser_utils.pyr6   r6      sJ  € ð €FØ
�)‰)€CØ
ˆf‚}Ø×&Ñ&Ó(ˆ	Ø˜Ñ 4§;¡;×#3Ñ#3°wÒ#>À9ÐPSÒCSØ�M‰M˜$Ôð2 €Mð1 
�Ò	ð 	�‰�dÔØ—]”]ˆEØÔ*¨5¸TÔBÑB‰Fð #ð( €Mð% 
�Ò	à�=‰=˜Ñ Ò#Ø—=‘= Ñ$ˆDØ�sŠ{ØÔ.¨tÓ4Ñ4�ð €Mð		BØ—}‘}ˆHð �y‰yœNÑ*±:Ø—‘˜dÔ#ã!�ØÔ.¨u°jÓAÑA‘ð "ð €Møô ò 	Øð €Mð	ús   ÃD Ä	D$Ä#D$c              #   óÜ   K  — | –— | j                   d   }	 |j                  dk(  r|j                   d   –— n$|j                  dk(  r|–— n|j                  dk(  sy |j                   d   }ŒU­w)NéÿÿÿÿÚcomp_foré   Úsync_comp_forÚcomp_if©r5   r1   )rA   Úlasts     r>   Úget_sync_comp_forsrG   :   sl   è ø€ Ø
‚NØ×Ñ˜RÑ €DØ
Ø�9‰9˜
Ò"Ø—-‘- Ñ"Ó"Ø�Y‰Y˜/Ò)Ø‹JØ—‘˜iÒ'ØØ�}‰}˜RÑ ˆð ùs   ‚A*A,c                 ó:   — | j                   d   j                  dk(  S )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
    rB   r'   rE   )Úfor_stmts    r>   Úfor_stmt_defines_one_namerJ   G   s    € ð ×Ñ˜QÑ×$Ñ$¨Ñ.Ð.ó    c                 ó"  — |j                   }| j                   |cxk  r| j                  k  st        d«      ‚ t        d«      ‚d }t        | j                  «      D ]3  \  }}||j                   k  r|c S |j                  «       }|t        v sŒ2|}Œ5 y )Nz!The node is not part of the flow.)Ú	start_posÚend_posÚ
ValueErrorÚ	enumerater5   Úget_first_leafÚ_FLOW_KEYWORDS)Ú	flow_noder9   rM   ÚkeywordÚir=   Ú
first_leafs          r>   Úget_flow_branch_keywordrW   Q   s‘   € Ø—‘€IØ×Ñ )Ô@¨y×/@Ñ/@Ò@ÜÐ<Ó=Ð=ð AÜÐ<Ó=Ð=à€GÜ˜i×0Ñ0Ö1‰ˆˆ5Ø�u—‘Ò&ØŠNØ×)Ñ)Ó+ˆ
ØœÒ'Ø ‰Gð 2ð rK   c                 ód   — | j                  «       }|�t        t        |j                  «      «      S y)z3 Returns a cleaned version of the docstring token. Ú )Úget_doc_noder   Úsafe_literal_evalÚvalue)Ú
scope_noder9   s     r>   Úclean_scope_docstringr^   `   s0   € à×"Ñ"Ó$€DØÐô
 Ô)¨$¯*©*Ó5Ó6Ð6ØrK   c                 óô   — | j                   dk(  ri| j                  } | j                  «       }|�K|j                   dk(  r<|j                  d   }|j                   dk(  rt	        t        |j                  «      «      S y)Nr*   Úsimple_stmtr   ÚstringrY   )r1   r3   Úget_next_siblingr5   r   r[   r\   )Ú	tree_nodeÚmaybe_strings     r>   Úfind_statement_documentationre   l   ss   € Ø‡~�~˜Ò$Ø×$Ñ$ˆ	Ø ×1Ñ1Ó3ˆØÐ#Ø× Ñ  MÒ1Ø+×4Ñ4°QÑ7�Ø×$Ñ$¨Ò0Ü#Ô$5°l×6HÑ6HÓ$IÓJÐJØrK   c                 óX   — | d d j                  «       }|d   dk(  s|dv ryt        | «      S )Né   r   Úf)ÚfrÚrfrY   )Úlowerr   )r\   Ú	first_twos     r>   r[   r[   x   s7   € Ø�b�q�	—‘Ó!€IØ��|�sÒ˜i¨<Ñ7ð ä˜ÓÐrK   c                 óÀ  — |€(| j                   dk(  rd}n| j                  j                  }| j                  «       }|r|dd }ddj	                  d„ |D «       «      j                  «       z   dz   }t        j                  d	d
|«      }| j                  r |sd| j                  j                  «       z   }nd}||z   |z   }dj	                  t        j                  ||«      «      S )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
    NÚlambdefz<lambda>rB   r0   rY   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­w©N)Úget_code)Ú.0r(   s     r>   Ú	<genexpr>z get_signature.<locals>.<genexpr>—   s   è ø€ Ð;±F¨5�e—n‘n×&±Fùs   ‚r.   z\s+Ú z ->Ú
)r1   r'   r\   Ú
get_paramsÚjoinÚstripÚreÚsubÚ
annotationrq   ÚtextwrapÚwrap)	r   ÚwidthÚcall_stringÚomit_first_paramÚomit_return_annotationÚparamsÚpÚrtypeÚcodes	            r>   Úget_signaturer†   ‚   sÑ   € ð ÐØ�<‰<˜9Ò$Ø$‰Kà!Ÿ,™,×,Ñ,ˆKØ×ÑÓ!€FÙØ˜˜�ˆØˆb�g‰gÑ;±FÓ;Ó;×AÑAÓCÑCÀcÑI€Aä
�‰ˆv�s˜AÓ€AØ×ÒÑ"8Ø˜×*Ñ*×3Ñ3Ó5Ñ5‰àˆØ˜‰?˜UÑ"€Dà�9‰9”X—]‘] 4¨Ó/Ó0Ð0rK   c                 óŒ   — 	 | j                   }|D ]  }t        ||«       Œ y# t        $ r | xj                  |z  c_        Y yw xY w)z$
    Move the `Node` start_pos.
    N)r5   Úmover8   Úline)r9   Úline_offsetr5   Úcs       r>   rˆ   rˆ   £   sE   € ð!Ø—=‘=ˆó ˆAÜ��KÕ ñ øô ò !Ø�	Š	�[Ñ �	ð!ús   ‚" ¢AÁAc                 ó‚  — 	 | j                   dk(  r(| j                  d   j                  «       j                  }n¤| j                   dk(  r(| j                  d   j                  «       j                  }nm| j                   dk(  r6| j                  d   j                  «       j	                  «       j                  }n(| j                  «       j	                  «       j                  }d|vry||j                  d«      d }d	|v r|d|j                  d	«       }d
|v r|d|j                  d
«       }|S # t        $ r Y yt        $ r Y yw xY w)zl
    returns (as string) any comment that appears on the same line,
    after the node, including the #
    rI   é   Ú	with_stmté   r   é   NÚ#Úru   )	r1   r5   rQ   Úprefixr2   Úget_last_leafr8   rO   Úindex)r9   Ú
whitespaceÚcomments      r>   Úget_following_comment_same_liner˜   °   s-  € ð
Ø�9‰9˜
Ò"ØŸ™ qÑ)×8Ñ8Ó:×AÑA‰JØ�Y‰Y˜+Ò%ØŸ™ qÑ)×8Ñ8Ó:×AÑA‰JØ�Y‰Y˜)Ò#àŸ™ qÑ)×8Ñ8Ó:×HÑHÓJ×QÑQ‰Jà×+Ñ+Ó-×;Ñ;Ó=×DÑDˆJð �*ÑØØ˜×)Ñ)¨#Ó.Ð/Ð0€GØˆw�ØÐ.˜7Ÿ=™=¨Ó.Ð/ˆØˆw�ØÐ.˜7Ÿ=™=¨Ó.Ð/ˆØ€Nøô ò ÙÜò ñ ðús   ‚CD( Ä(	D>Ä3D>Ä=D>c                 ód   — | j                   }|dk(  r| j                  d   j                   dk7  S |dv S )NrA   rB   rC   )Ú
file_inputr   r   rn   rC   )r1   r5   )r9   Úts     r>   Úis_scoperœ   Ï   s8   € Ø�	‰	€AØˆJ‚à�}‰}˜QÑ×$Ñ$¨Ñ7Ð7àÐQÐQÐQrK   c                 ó,   ‡ ‡— t        «       Šdˆˆ fd„	}|S )Nc                 óœ   •— | €	 ‰||«      S 	 ‰|    }	 ||   S # t         $ r
 i x}‰| <   Y Œw xY w# t         $ r  ‰||«      x}||<   |cY S w xY wrp   )ÚKeyError)Úparso_cache_noder9   Úinclude_flowsÚ
for_moduler:   ÚcacheÚfuncs        €€r>   Úwrapperz(_get_parent_scope_cache.<locals>.wrapperÛ   s‚   ø€ ØÐ#Ù˜˜mÓ,Ð,ð	6ØÐ/Ñ0ˆJð	Ø˜dÑ#Ð#øô	 ò 	6Ø35Ð5ˆJ˜Ð/Ó0ð	6ûô
 ò 	Ù(,¨T°=Ó(AÐAˆF�Z Ñ%ØŠMð	ús   Ž ”/ ™,«,¯AÁ
A©Fr   )r¤   r¥   r£   s   ` @r>   Ú_get_parent_scope_cacher§   Ø   s   ù€ ÜÓ€Eöð €NrK   c                 óŠ  ‡ — ‰ j                   }|€y	 t        |«      rË|j                  dv r»|j                  j	                  d«      }|j                  |   j
                  ‰ j
                  k\  rz‰ j                   j                  dk(  r‰ j                   j                  ‰ k(  r	 |S ‰ j                   j                  dk(  r‰ j                   j                  d   ‰ k(  r	 |S |j                   }ŒÕ|S |rMt        |t        j                  «      r3|j                  dk(  r"t        ˆ fd„|j                  «       D «       «      s|S |j                   }�Œ3)	z'
    Returns the underlying scope.
    N)r   r   rn   Ú:r(   Útfpdefr   Úif_stmtc              3   óz   •K  — | ]2  }|j                   ‰j                   cxk  xr |j                  k  nc –— Œ4 y ­wrp   )rM   rN   )rr   Únr9   s     €r>   rs   z#get_parent_scope.<locals>.<genexpr>  s2   øè ø€ ð =Ù%; ð ŸK™K¨4¯>©>ÖE¸A¿I¹I×EÐEÙ%;ùs   ƒ8;)r3   rœ   r1   r5   r•   rM   r'   Ú
isinstancer   ÚFlowÚanyÚget_test_nodes)r9   r¡   Úscoper•   s   `   r>   Úget_parent_scoper³   ì   s   ø€ ð �K‰K€EØ€}Øà
Ü�EŒ?Ø�z‰zÐ?Ñ?ØŸ™×,Ñ,¨SÓ1�Ø—>‘> %Ñ(×2Ñ2°d·n±nÒDØ—{‘{×'Ñ'¨7Ò2°t·{±{×7GÑ7GÈ4Ò7OØð ˆLð Ÿ™×)Ñ)¨XÒ5¸$¿+¹+×:NÑ:NÈqÑ:QÐUYÒ:YØð ˆLð !&§¡˜Ø ØˆLÙœz¨%´·±Ô;ð —J‘J )Ò+Üó =Ø%*×%9Ñ%9Ô%;ó=ô =à�à—‘ˆñ+ rK   c                 ó.   — t        | |«      j                  S )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Ð4rK   c                 ó.   — t         | j                     |   S )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   € ô ˜Ÿ™Ñ(¨Ñ.Ð.rK   c                 óæ   — t        | j                  d¬«      d|d   | j                  z
  dz    }|d   }| j                  |d   k(  r|| j                  z  }|sy|d   d| |d<   dj	                  |«      S )z3
    Cuts of the value of the leaf at position
    T)ÚkeependsNr   rB   rY   r@   )r	   r\   r‰   Úcolumnrw   )ÚleafÚpositionr¶   r¿   s       r>   Úcut_value_at_positionrÂ   "  s}   € ô ˜Ÿ
™
¨TÔ2Ð3O°H¸Q±KÀ$Ç)Á)Ñ4KÈaÑ4OÐP€EØ�a‰[€FØ‡y�y�H˜Q‘KÒØ�$—+‘+ÑˆÙØØ�b‘	˜'˜6Ð"€Eˆ"�IØ�7‰7�5‹>ÐrK   c                 óT  — | j                   dk(  rCt        | j                  «      dk(  r*| j                  d   dk(  rt        | j                  d   «      S y| j                   dk(  r9| j                  }|d   dk(  ryt        |d   «      syt	        d	„ |dd
 D «       «      S | j                   dk(  S )zP
    Checks if a path looks like `name` or `name.foo.bar` and not `name()`.
    r
   r�   r   r0   rB   Fr   Úawaitc              3   ó@   K  — | ]  }|j                   d    dk(  –— Œ y­w)r   Ú.N)r5   )rr   r‹   s     r>   rs   z!expr_is_dotted.<locals>.<genexpr>?  s   è ø€ Ð>±¨A�1—:‘:˜a‘= CÕ'±ùs   ‚Nr'   )r1   Úlenr5   Úexpr_is_dottedÚall)r9   r5   s     r>   rÈ   rÈ   0  s¡   € ð ‡y�y�FÒÜˆt�}‰}Ó Ò" t§}¡}°QÑ'7¸3Ò'>Ü! $§-¡-°Ñ"2Ó3Ð3ØØ‡y�y�KÒØ—=‘=ˆØ�A‰;˜'Ò!ØÜ˜h q™kÔ*ØäÑ>°¸!¸"±Ó>Ó>Ð>Ø�9‰9˜ÑÐrK   c                 ó   ‡ — ˆ fd„}|S )Nc                 ó~   •— | j                  «       D ])  }|j                  d   } ‰|j                  «       «      sŒ) y y)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.
        rB   TF)Úget_decoratorsr5   rq   )Úfunction_noder,   Údotted_nameÚdecorator_checkers      €r>   r¥   z&_function_is_x_method.<locals>.wrapperD  sA   ø€ ð '×5Ñ5Ö7ˆIØ#×,Ñ,¨QÑ/ˆKÙ  ×!5Ñ!5Ó!7Õ8Ùð 8ð rK   © )rÏ   r¥   s   ` r>   Ú_function_is_x_methodrÑ   C  s   ø€ ôð €NrK   c                 ó   — | dk(  S )NÚstaticmethodrÐ   ©Úms    r>   Ú<lambda>rÖ   S  s	   € ¸1ÀÒ;NrK   c                 ó   — | dk(  S )NÚclassmethodrÐ   rÔ   s    r>   rÖ   rÖ   T  s	   € ¸!¸}Ò:LrK   c                 ó@   — | dk(  xs | dk(  xs | j                  d«      S )NÚpropertyÚcached_propertyz.setter)ÚendswithrÔ   s    r>   rÖ   rÖ   V  s,   € ˆa�:‰oò ØÐÑòà	�
‰
�9ÓðrK   r¦   )éH   NFF)&ry   r|   Úastr   Úinspectr   Úweakrefr   Úparso.pythonr   Úparso.cacher   Úparsor	   r7   rR   r6   rG   rJ   rW   r^   re   r[   r†   rˆ   r˜   rœ   r§   r³   Úget_cached_parent_scoperº   rµ   rÂ   rÈ   rÑ   Úfunction_is_staticmethodÚfunction_is_classmethodÚfunction_is_propertyrÐ   rK   r>   Ú<module>rè      sÊ   ðÛ 	Û Ý Ý Ý %å Ý $Ý òB€ð
€ó
"òJ
!ò/òò	ò	òð 26ØAFó1òB
!òò>Ròó(ñ@ 2Ð2BÓCÐ ò5ò/òòò&ñ  1Ñ1NÓOÐ Ù/Ñ0LÓMÐ Ù,ñóÑ rK   