Ë
    #´˜jc  ã                   óÔ   — d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl	m
Z
  G d„ d«      Zd„ ZdZd	Zd
Z ej                   d«      ZdZdZd„ Zedk(  rddlmZ  edd¬«       yy)zúPop up a reminder of how to call a function.

Call Tips are floating windows which display function, class, and method
parameter and docstring information when you type an opening parenthesis, and
which disappear when you type a closing parenthesis.
é    N)Ú	calltip_w)ÚHyperParserc                   óF   — e Zd Zdd„Zd„ Zd„ Zdd„Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zy)ÚCalltipNc                 óx   — |€d | _         y || _         |j                  | _        d | _        | j                  | _        y ©N)ÚeditwinÚtextÚactive_calltipÚ_make_tk_calltip_windowÚ_calltip_window)Úselfr	   s     ú!lib/python3.12/idlelib/calltip.pyÚ__init__zCalltip.__init__   s6   € Øˆ?ØˆD�Là"ˆDŒLØŸ™ˆDŒIØ"&ˆDÔØ#'×#?Ñ#?ˆDÕ ó    c                 ó   — d | _         y r   )r   ©r   s    r   ÚclosezCalltip.close   s
   € Ø#ˆÕr   c                 ó@   — t        j                  | j                  «      S r   )r   ÚCalltipWindowr
   r   s    r   r   zCalltip._make_tk_calltip_window    s   € ä×&Ñ& t§y¡yÓ1Ð1r   c                 ó`   — | j                   r"| j                   j                  «        d | _         y y r   )r   Úhidetip©r   Úevents     r   Úremove_calltip_windowzCalltip.remove_calltip_window$   s*   € Ø×ÒØ×Ñ×'Ñ'Ô)Ø"&ˆDÕð r   c                 ó&   — | j                  d«       y)z9The user selected the menu entry or hotkey, open the tip.TÚbreak©Úopen_calltipr   s     r   Úforce_open_calltip_eventz Calltip.force_open_calltip_event)   s   € à×Ñ˜$ÔØr   c                 ó&   — | j                  d«       y)zªHappens when it would be nice to open a calltip, but not really
        necessary, for example after an opening bracket, so function calls
        won't be made.
        FNr   r   s     r   Útry_open_calltip_eventzCalltip.try_open_calltip_event.   s   € ð
 	×Ñ˜%Õ r   c                 ón   — | j                   r)| j                   j                  r| j                  d«       y y y )NF)r   Ú	tipwindowr   r   s     r   Úrefresh_calltip_eventzCalltip.refresh_calltip_event5   s0   € Ø×Ò 4×#6Ñ#6×#@Ò#@Ø×Ñ˜eÕ$ð $AÐr   c                 ó–  — t        | j                  d«      }|j                  d«      }|s| j                  «        y| j                  rWt        t        |d   j                  d«      «      \  }}||f| j                  j                  | j                  j                  fk(  ry|j                  |d   «       	 |j                  «       }|sy| j                  «        |s|j                  d«      dk7  ry| j                  |«      }|sy| j                  «       | _        | j                  j!                  ||d   |d   «       y# t        $ r d}Y Œ„w xY w)z’Maybe close an existing calltip and maybe open a new calltip.

        Called from (force_open|try_open|refresh)_calltip_event functions.
        ÚinsertÚ(Nr   Ú.éÿÿÿÿé   )r   r	   Úget_surrounding_bracketsr   r   ÚmapÚintÚsplitÚ	parenlineÚparencolÚ	set_indexÚget_expressionÚ
ValueErrorÚfindÚ	fetch_tipr   Úshowtip)r   Ú	evalfuncsÚhpÚ	sur_parenÚopener_lineÚ
opener_colÚ
expressionÚargspecs           r   r   zCalltip.open_calltip9   sD  € ô
 ˜Ÿ™ xÓ0ˆØ×/Ñ/°Ó4ˆ	ñ Ø×&Ñ&Ô(Øð ×ÒÜ&)¬#¨y¸©|×/AÑ/AÀ#Ó/FÓ&GÑ#ˆK˜à˜jÐ)Ø×$Ñ$×.Ñ.°×0CÑ0C×0LÑ0LÐMòNð à
�‰�Y˜q‘\Ô"ð	Ø×*Ñ*Ó,ˆJñ ð ð 	×"Ñ"Ô$ñ ˜jŸo™o¨cÓ2°bÒ8Øà—.‘. Ó,ˆÙØØ"×2Ñ2Ó4ˆÔØ×Ñ×#Ñ# G¨Y°q©\¸9ÀQ¹<ÕHøô/ ò 	ØŠJð	ús   Â3D: Ä:EÅEc                 óä   — 	 | j                   j                  j                  j                  j                  }|r|j                  dd|fi «      S t        t        |«      «      S # t
        $ r d}Y Œ8w xY w)aD  Return the argument list and docstring of a function or class.

        If there is a Python subprocess, get the calltip there.  Otherwise,
        either this fetch_tip() is running in the subprocess or it was
        called in an IDLE running without the subprocess.

        The subprocess environment is that of the most recently run script.  If
        two unrelated modules are being edited some calltips in the current
        module may be inoperative if the module was not the last to run.

        To find methods, fetch_tip must be fed a fully qualified name.

        NÚexecÚget_the_calltip)	r	   ÚflistÚpyshellÚinterpÚrpccltÚAttributeErrorÚ
remotecallÚget_argspecÚ
get_entity)r   r=   rE   s      r   r6   zCalltip.fetch_tipl   st   € ð	Ø—\‘\×'Ñ'×/Ñ/×6Ñ6×=Ñ=ˆFñ Ø×$Ñ$ VÐ->Ø&0 ]°Bó8ð 8ô œz¨*Ó5Ó6Ð6øô ò 	ØŠFð	ús   ‚4A! Á!A/Á.A/r   )Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r    r"   r%   r   r6   © r   r   r   r      s2   „ ó@ò$ò2ó'ò
ò
!ò%ò1Ióf7r   r   c                 ó„   — | r/i t         j                  ¥t        j                  ¥}	 t	        | |«      S y# t
        $ r Y yw xY w)zwReturn the object corresponding to expression evaluated
    in a namespace spanning sys.modules and __main.dict__.
    N)ÚsysÚmodulesÚ__main__Ú__dict__ÚevalÚBaseException)r=   Ú	namespaces     r   rI   rI   …   sM   € ñ Ø8”s—{‘{Ð8¤h×&7Ñ&7Ð8ˆ	ð	Ü˜
 IÓ.Ð.ð øô ò 	ñ ð	ús   ¦3 ³	?¾?éU   é   z    z(?<=\()\w*\,?\s*zSee source or doczinvalid method signaturec                 ó  — 	 | j                   }t        |t        j                  «      r|n| }	 t        t        j                  |«      «      }t        |t        «      r|dk(  rt        }t        |«      t        kD  r t        j                   |t        t"        ¬«      n|r|gng }t        j$                  | «      }|rh|j'                  dt(        «      dt(         D ]H  }|j+                  «       }|s n4t        |«      t        kD  r|dt        dz
   dz   }|j-                  |«       ŒJ dj/                  |«      }|xs t        S # t        $ r Y yw xY w# t        $ r8}t        |«      }|j                  t        «      rt        cY d}~S d}Y d}~�Œ9d}~ww xY w)a¡  Return a string describing the signature of a callable object, or ''.

    For Python-coded functions and methods, the first line is introspected.
    Delete 'self' parameter for classes (.__init__) and bound methods.
    The next lines are the first lines of the doc string up to the first
    empty line or _MAX_LINES.    For builtins, this typically includes
    the arguments in addition to the return value.
    Ú Nz())Úsubsequent_indentÚ
é   z...)Ú__call__rT   Ú
isinstanceÚtypesÚ
MethodTypeÚstrÚinspectÚ	signatureÚ	ExceptionÚ
startswithÚ_invalid_methodÚtypeÚ_default_callable_argspecÚlenÚ	_MAX_COLSÚtextwrapÚwrapÚ_INDENTÚgetdocr/   Ú
_MAX_LINESÚstripÚappendÚjoin)	ÚobÚob_callÚfobr>   ÚerrÚmsgÚlinesÚdocÚlines	            r   rH   rH   š   sV  € ðØ—+‘+ˆô   ¬×)9Ñ)9Ô:‰'À€CðÜ”g×'Ñ'¨Ó,Ó-ˆô �#”tÔ ¨D¢ä+ˆô �G“œyÒ(ô �]‰]˜7¤IÄÕIÙ;B¨w©iÈð 
ô �.‰.˜Ó
€CÙ
Ø—I‘I˜d¤JÓ/°´Ó<ˆDØ—:‘:“<ˆDÙÙÜ�4‹yœ9Ò$Ø˜Oœi¨!™mÐ,¨uÑ4�Ø�L‰L˜Õð =ð �i‰i˜Ó€GàÒ/Ô/Ð/øôE ò Ùðûô ò Ü�#‹hˆØ�>‰>œ/Ô*Ü"Õ"àŽGûðús4   ‚D9 ­E Ä9	EÅEÅ	F	Å%FÅ6F	Å<FÆF	rQ   )Úmainzidlelib.idle_test.test_calltipé   )Ú	verbosity)Ú__doc__rQ   rb   ÚrerO   rk   r_   Úidlelibr   Úidlelib.hyperparserr   r   rI   rj   ro   rm   ÚcompileÚ_first_paramrh   rf   rH   rJ   Úunittestr{   rM   r   r   Ú<module>r…      s†   ðñó Û Û 	Û 
Û Û å Ý +÷p7ñ p7òfð €	Ø€
Ø
€Øˆr�z‰zÐ-Ó.€Ø/Ð Ø,€ò.0ðb ˆzÒÝÙÐ	)°QÖ7ð r   