Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.12.136.222
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : calltip.cpython-310.pyc
o

_bc�@s�dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
Gdd�d�Zdd�Zd	Z
d
ZdZe�d�Zd
ZdZdd�ZedkrVddlmZeddd�dSdS)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@sXeZdZddd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)�CalltipNcCs2|dur	d|_dS||_|j|_d|_|j|_dS�N)�editwin�text�active_calltip�_make_tk_calltip_window�_calltip_window)�selfr�r�8/usr/local/python-3.10/lib/python3.10/idlelib/calltip.py�__init__s
zCalltip.__init__cCs
d|_dSr)r
�rrrr
�closes
z
Calltip.closecCst�|j�Sr)rZ
CalltipWindowrrrrr
r	 szCalltip._make_tk_calltip_windowcCs|jr
|j��d|_dSdSr)rZhidetip�r�eventrrr
�remove_calltip_window$s

�zCalltip.remove_calltip_windowcC�|�d�dS)z9The user selected the menu entry or hotkey, open the tip.T�break��open_calltiprrrr
�force_open_calltip_event)s
z Calltip.force_open_calltip_eventcCr)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.
        FNrrrrr
�try_open_calltip_event.szCalltip.try_open_calltip_eventcCs$|jr|jjr|�d�dSdSdS)NF)rZ	tipwindowrrrrr
�refresh_calltip_event5s�zCalltip.refresh_calltip_eventcCs�t|jd�}|�d�}|s|��dS|jr0tt|d�d��\}}||f|jj|jj	fkr0dS|�
|d�z|��}WntyHd}Ynw|sMdS|��|s\|�
d�dkr\dS|�|�}|sedS|��|_|j�||d|d�dS)z�Maybe close an existing calltip and maybe open a new calltip.

        Called from (force_open|try_open|refresh)_calltip_event functions.
        �insert�(Nr�.����)rrZget_surrounding_bracketsrr�map�int�splitZ	parenlineZparencolZ	set_indexZget_expression�
ValueError�find�	fetch_tipr
Zshowtip)rZ	evalfuncsZhpZ	sur_parenZopener_lineZ
opener_col�
expression�argspecrrr
r9s8
���

zCalltip.open_calltipcCsLz	|jjjjj}Wntyd}Ynw|r |�dd|fi�Stt|��S)aDReturn 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�execZget_the_calltip)	r�flistZpyshellZinterp�rpcclt�AttributeErrorZ
remotecall�get_argspec�
get_entity)rr&r*rrr
r%ls��zCalltip.fetch_tipr)�__name__�
__module__�__qualname__rrr	rrrrrr%rrrr
rs
	
3rcCs:|ritj�tj�}zt||�WStyYdSwdS)zwReturn the object corresponding to expression evaluated
    in a namespace spanning sys.modules and __main.dict__.
    N)�sys�modules�__main__�__dict__�eval�
BaseException)r&�	namespacerrr
r-�s��r-�U�z    z(?<=\()\w*\,?\s*zSee source or doczinvalid method signaturec	
CsFz|j}Wn
tyYdSwt|tj�r|n|}z	tt�|��}Wn%tyH}zt|�}|�	t
�r<t
WYd}~Sd}WYd}~nd}~wwt|t�rT|dkrTt}t
|�tkrbtj|ttd�n|rg|gng}t�|�}|r�|�dt�dt�D]}|��}|s�q�t
|�tkr�|dtd�d}|�|�qzd�|�}|p�tS)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__r6�
isinstance�types�
MethodType�str�inspectZ	signature�	Exception�
startswith�_invalid_method�type�_default_callable_argspec�len�	_MAX_COLS�textwrap�wrap�_INDENTZgetdocr"�
_MAX_LINES�strip�append�join)	�obZob_callZfobr'�err�msg�lines�doc�linerrr
r,�s@

�
��
��

r,r3)�mainzidlelib.idle_test.test_calltip�)�	verbosity)�__doc__r3rC�rer1rKr@ZidlelibrZidlelib.hyperparserrrr-rJrNrM�compileZ_first_paramrHrFr,r.ZunittestrXrrrr
�<module>s,s
1�
© 2025 GrazzMean