ó
    Ð]jg  ã                   ó  • S r SSKJr  SSKJr  SSKJr  SSKJrJrJ	r	J
r
  SSKJr  SSKJr  SSKJr  \" 5       rS	 r\" \S
9\R(                  S 5       5       rS r " S S\	5      r " S S\
5      r " S S\5      r " S S\5      rg)aü  
A module to deal with stuff like `list.append` and `set.add`.

Array modifications
*******************

If the content of an array (``set``/``list``) is requested somewhere, the
current module will be checked for appearances of ``arr.append``,
``arr.insert``, etc.  If the ``arr`` name points to an actual array, the
content will be added

This can be really cpu intensive, as you can imagine. Because |jedi| has to
follow **every** ``append`` and check whether it's the right array. However this
works pretty good, because in *slow* cases, the recursion detector and other
settings will stop this process.

It is important to note that:

1. Array modifications work only in the current module.
2. Jedi only checks Array additions; ``list.pop``, etc are ignored.
é    )Údebug)Úsettings)Ú	recursion)ÚValueSetÚ	NO_VALUESÚHelperValueMixinÚValueWrapper)ÚLazyKnownValues)Úinfer_call_of_leaf)Úinference_state_method_cachec                 óD   • UR                   S;  a  [        $ [        X5      $ )zHJust a mapper function for the internal _internal_check_array_additions )ÚlistÚset)Ú
array_typer   Ú_internal_check_array_additions)ÚcontextÚsequences     Ú`/home/mande/repo/quber/.venv/lib/python3.13/site-packages/jedi/inference/value/dynamic_arrays.pyÚcheck_array_additionsr   "   s!   € à×Ñ /Ó1äÐä*¨7Ó=Ð=ó    )Údefaultc           	      óú  ^• SSK Jm  [        R                  " SU-  SS9  U R	                  5       n[
        R                  (       a  UR                  5       (       a  [        R                  " SSS9  [        $ U4S jn[
        R                  Ssn[
        l	        UR                  R                  S	:H  nU(       a  / S
QOSS/n[        5       nU GHS  n UR                  R                  5       U   n	U	 GH*  n
U R                  nUR                  U
R                  s=:  a  UR                   :  d  O  M?  U
R"                  nUR"                  nUR$                  R'                  U5      n UR$                  US-      nUR(                  S:w  d&  UR$                  S   S:w  d  UR$                  S   S:X  a  M½   U R-                  U
5      n[.        R0                  " U R2                  U5       nU(       a*  [5        UU
SS9nUU;   a  Xs" UUR$                  S   U5      -  nSSS5        GM-     GMV     U[
        l	        [        R                  " SUSS9  U$ ! [*         a     GMe  f = f! , (       d  f       GMy  = f! [6         a     GM®  f = f)zb
Checks if a `Array` has "add" (append, insert, extend) statements:

>>> a = [""]
>>> a.append(1)
r   ©Ú	argumentszDynamic array search for %sÚMAGENTA)ÚcolorzDynamic array search aborted.c                 óV  >• [        TR                  U R                  X5      R                  5       5      n[	        5       nUS;   a  USS  nUS;   a  U H  u  pVUR                  U5        M     U$ US;   a5  U H/  u  pVU[	        UR                  5       R                  5       5      -  nM1     U$ )N)Úinserté   )ÚappendÚaddr   )ÚextendÚupdate)r   ÚTreeArgumentsÚinference_stateÚunpackr   r!   ÚinferÚiterate)r   ÚarglistÚadd_nameÚparamsÚresultÚkeyÚ
lazy_valuer   s          €r   Úfind_additionsÚ7_internal_check_array_additions.<locals>.find_additions<   s¨   ø€ Ü�i×-Ñ-¨g×.EÑ.EÀwÓX×_Ñ_ÓaÓbˆÜ“ˆØ�zÓ!Ø˜A˜B�ZˆFØÐ2Ó2Û#)‘�Ø—
‘
˜:Ö&ñ $*ð
 ˆð Ð-Ó-Û#)‘�Øœ#˜j×.Ñ.Ó0×8Ñ8Ó:Ó;Ñ;’ñ $*àˆr   Fr   )r    r"   r   r!   r#   r   ÚtrailerÚ(Ú)T)Úcut_own_trailerNzDynamic array result %s)Újedi.inferencer   r   ÚdbgÚget_root_contextr   Údynamic_array_additionsÚis_compiledr   Ú dynamic_params_for_other_modulesÚnameÚstring_namer   Ú	tree_nodeÚget_used_namesÚ	start_posÚend_posÚparentÚchildrenÚindexÚtypeÚ
IndexErrorÚcreate_contextr   Úexecution_allowedr%   r   ÚKeyError)r   r   Úmodule_contextr/   Útemp_param_addÚis_listÚsearch_namesÚadded_typesr*   Úpossible_namesr;   Ú
value_noder1   ÚpowerÚtrailer_posÚexecution_trailerÚrandom_contextÚallowedÚfoundr   s                      @r   r   r   +   sH  ø€ õ )ä	‡I‚IÐ+¨hÑ6¸iÒHØ×-Ñ-Ó/€NÜ×+×+¨~×/IÑ/I×/KÑ/KÜ�	Š	Ð1¸ÒCÜÐõô 	×1Ñ1°5ð >€N”HÔ=ð �m‰m×'Ñ'¨6Ñ1€GÞ6=Ó2ÀEÈ8ÐCT€Lä“%€KÜ ˆð%	Ø+×5Ñ5×DÑDÓFÀxÑPˆNô '�Ø$×.Ñ.�
Ø"×,Ñ,¨t¯~©~ÕRÀ
×@RÑ@RÕRÙØŸ+™+�ØŸ™�Ø#Ÿn™n×2Ñ2°7Ó;�ð!Ø(-¯©°{ÀQ±Ñ(GÐ%ð )×-Ñ-°Ó:Ø0×9Ñ9¸!Ñ<ÀÓCØ0×9Ñ9¸!Ñ<ÀÓCÙ ð  Dð ")×!7Ñ!7¸Ó!=�ä×0Ò0°×1HÑ1HÈ%ÔPÐT[ÞÜ 2Ø*Ø Ø,0ñ!˜ð
 $ uÓ,à'¨>Ø .Ø 1× :Ñ :¸1Ñ =Ø (ó,ñ ˜K÷ QÒPô' 'ñ !ðR 1?„HÔ-Ü	‡I‚IÐ'¨¸IÒFØÐøô9 "ó Ûðú÷ Q×Pûô- ó 	Ûð	ús0   ÃI+Å"IÇ2IÉ
IÉIÉ
I(É+
I:É9I:c                 ó\   • [        X5      nSSKJn  UR                  [	        U/5      /5      $ )z$Used for set() and list() instances.r   r   )Ú_DynamicArrayAdditionsr5   r   ÚValuesArgumentsr   )Úinstancer   Úais      r   Úget_dynamic_array_instancer[   ~   s)   € ä	 Ó	4€BÝ(Ø×$Ñ$¤h°¨t£nÐ%5Ó6Ð6r   c                   ó8   • \ rS rSrSrS rS rS	S jrS
S jrSr	g)rW   é…   aN  
Used for the usage of set() and list().
This is definitely a hack, but a good one :-)
It makes it possible to use set/list conversions.

This is not a proper context, because it doesn't have to be. It's not used
in the wild, it's just used within typeshed as an argument to `__init__`
for set/list and never used in any other place.
c                 ó   • Xl         X l        g ©N)Ú	_instanceÚ
_arguments)ÚselfrY   r   s      r   Ú__init__Ú_DynamicArrayAdditions.__init__�   s   € Ø!ŒØ#�r   c                 óh   • U R                   R                  R                  R                  S5      u  nU$ )NÚtuple)r`   r%   Úbuiltins_moduleÚpy__getattribute__)rb   Útuple_s     r   Úpy__class__Ú"_DynamicArrayAdditions.py__class__“   s*   € Ø—.‘.×0Ñ0×@Ñ@×SÑSÐT[Ó\‰ˆØˆr   Nc              #   óR  #   • U R                   n [        UR                  5       5      u  p4UR                  5       R	                  5        S h  v•N   SSKJn  [        X%5      (       a+  [        UR                  U R                  5      nU S h  v•N   g g  NF! [
         a     NPf = f N7f)Nr   )r$   )ra   Únextr&   r'   r(   ÚStopIterationÚjedi.inference.argumentsr$   Ú
isinstancer   r   r`   )rb   Úcontextualized_noder   Ú_r.   r$   Ú	additionss          r   Ú
py__iter__Ú!_DynamicArrayAdditions.py__iter__—   s•   é € Ø—O‘Oˆ	ð	4Ü  ×!1Ñ!1Ó!3Ó4‰MˆAð "×'Ñ'Ó)×1Ñ1Ó3×3Ð3å:Ü�i×/Ñ/Ü7¸	×8IÑ8IÈ4Ï>É>ÓZˆIØ × Ñ ð 0ñ 4øô ó 	Ùð	úñ !ùs?   ‚B'�B «!B'ÁBÁ?B'ÂB%ÂB'Â
B"ÂB'Â!B"Â"B'c                 ó$   • U R                  U5      $ r_   )rt   )rb   rq   Úis_asyncs      r   r(   Ú_DynamicArrayAdditions.iterate¥   s   € Ø�‰Ð2Ó3Ð3r   )ra   r`   r_   )NF)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rc   rj   rt   r(   Ú__static_attributes__© r   r   rW   rW   …   s   † ñò$òô!÷4r   rW   c                   ó4   ^ • \ rS rSrU 4S jrS rS rSrU =r$ )Ú_Modificationé©   c                 ó<   >• [         TU ]  U5        X l        X0l        g r_   )Úsuperrc   Ú_assigned_valuesÚ_contextualized_key)rb   Úwrapped_valueÚassigned_valuesÚcontextualized_keyÚ	__class__s       €r   rc   Ú_Modification.__init__ª   s   ø€ Ü‰Ñ˜Ô'Ø /ÔØ#5Õ r   c                 óT   • U R                   R                  " U0 UD6U R                  -  $ r_   )Ú_wrapped_valueÚpy__getitem__r…   )rb   ÚargsÚkwargss      r   rŽ   Ú_Modification.py__getitem__¯   s)   € Ø×"Ñ"×0Ò0°$ÐA¸&ÑAÀD×DYÑDYÑYÐYr   c                 óÞ   • U R                   R                  5        Vs/ s H  nUR                  [        5      PM     nnX;   a  U R                  $ U R
                  R                  U5      $ s  snf r_   )r†   r'   Úget_safe_valueÚ	_sentinelr…   r�   Úpy__simple_getitem__)rb   rC   ÚvÚactuals       r   r•   Ú"_Modification.py__simple_getitem__²   sm   € ð ×-Ñ-×3Ñ3Ô5ó
â5�ð ×ÑœYÖ'Ù5ð 	ð 
ð ‹?Ø×(Ñ(Ð(Ø×"Ñ"×7Ñ7¸Ó>Ð>ùò
s   �A*)r…   r†   )	ry   rz   r{   r|   rc   rŽ   r•   r~   Ú__classcell__)rŠ   s   @r   r�   r�   ©   s   ø† õ6ò
Z÷?ð ?r   r�   c                   ó$   • \ rS rSrSS jrS rSrg)ÚDictModificationé¼   Nc              #   ór   #   • U R                   R                  U5       S h  v•N   U R                  v •  g  N7fr_   )r�   rt   r†   ©rb   rq   s     r   rt   ÚDictModification.py__iter__½   s2   é € Ø×&Ñ&×1Ñ1Ð2EÓF×FÐFØ×&Ñ&Ó&ñ 	Gùs   ‚7¡5¢7c                 ól   • U R                   R                  5       U R                  R                  5       -  $ r_   )r�   Úget_key_valuesr†   r'   )rb   s    r   r¡   ÚDictModification.get_key_valuesÁ   s+   € Ø×"Ñ"×1Ñ1Ó3°d×6NÑ6N×6TÑ6TÓ6VÑVÐVr   r   r_   )ry   rz   r{   r|   rt   r¡   r~   r   r   r   r›   r›   ¼   s   † ô'õWr   r›   c                   ó   • \ rS rSrSS jrSrg)ÚListModificationéÅ   Nc              #   ó„   #   • U R                   R                  U5       S h  v•N   [        U R                  5      v •  g  N7fr_   )r�   rt   r
   r…   rž   s     r   rt   ÚListModification.py__iter__Æ   s7   é € Ø×&Ñ&×1Ñ1Ð2EÓF×FÐFÜ˜d×3Ñ3Ó4Ó4ñ 	Gùs   ‚A ¡>¢A r   r_   )ry   rz   r{   r|   rt   r~   r   r   r   r¤   r¤   Å   s   † ÷5r   r¤   N)r}   Újedir   r   r5   r   Újedi.inference.base_valuer   r   r   r	   Újedi.inference.lazy_valuer
   Újedi.inference.helpersr   Újedi.inference.cacher   Úobjectr”   r   Úincrease_indentr   r[   rW   r�   r›   r¤   r   r   r   Ú<module>r¯      s—   ðñõ* Ý Ý $÷ó å 5Ý 5Ý =á‹H€	ò>ñ  iÑ0Ø×ÑñNó ó 1ðNòb7ô!4Ð-ô !4ôH?�Lô ?ô&W�}ô Wô5�}õ 5r   