Hacked By AnonymousFox

Current Path : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/calltip.cpython-36.pyc

3

� f��@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
Z
Gdd�d�Zdd�Zd	Z
d
ZdZejd
�ZdZdZdZdd�Zedkr�ddlmZeddd�dS)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)�CalltipNcCs0|dkrd|_n||_|j|_d|_|j|_dS)N)�editwin�text�active_calltip�_make_tk_calltip_window�_calltip_window)�selfr�r�4/opt/alt/python36/lib64/python3.6/idlelib/calltip.py�__init__szCalltip.__init__cCs
d|_dS)N)r	)r
rrr�closesz
Calltip.closecCstj|j�S)N)rZ
CalltipWindowr)r
rrrr szCalltip._make_tk_calltip_windowcCs|jr|jj�d|_dS)N)rZhidetip)r
�eventrrr�_remove_calltip_window$s
zCalltip._remove_calltip_windowcCs|jd�dS)z9The user selected the menu entry or hotkey, open the tip.T�break)�open_calltip)r
rrrr�force_open_calltip_event)s
z Calltip.force_open_calltip_eventcCs|jd�dS)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.
        FN)r)r
rrrr�try_open_calltip_event.szCalltip.try_open_calltip_eventcCs|jr|jjr|jd�dS)NF)rZ	tipwindowr)r
rrrr�refresh_calltip_event5szCalltip.refresh_calltip_eventcCs�|j�t|jd�}|jd�}|s&dS|j|d�|j�}|sDdS|r\|jd�dkr\dS|j|�}|sndS|j�|_	|j	j
||d|d�dS)N�insert�(r����)rrrZget_surrounding_bracketsZ	set_indexZget_expression�find�	fetch_tipr	rZshowtip)r
Z	evalfuncsZhpZ	sur_paren�
expression�argspecrrrr9s 


zCalltip.open_calltipc
CsRy|jjjjj}Wntk
r*d}YnX|rB|jdd|fi�Stt|��SdS)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)	rZflistZpyshellZinterp�rpcclt�AttributeErrorZ
remotecall�get_argspec�
get_entity)r
rrrrrrLs

zCalltip.fetch_tip)N)N)�__name__�
__module__�__qualname__r
rrrrrrrrrrrrrs
	
rcCs>|r:tjj�}|jtj�y
t||�Stk
r8dSXdS)zwReturn the object corresponding to expression evaluated
    in a namespace spanning sys.modules and __main.dict__.
    N)�sys�modules�copy�update�__main__�__dict__�eval�
BaseException)r�	namespacerrrr"es

r"�U�� �z(?<=\()\w*\,?\s*zSee source or doczinvalid method signaturez4
['/' marks preceding arguments as positional-only]
c
Csrd}}y
|j}Wntk
r&|SXt|tj�r8|n|}yttj|��}Wn8tk
r�}zt|�}|j	t
�rvt
SWYdd}~XnXd|kr�|t7}t|t�r�|dkr�t
}t|�tkr�tj|ttd�n|r�|gng}t|tj�r�|j}nt|dd�}|�rdxZ|jdt�dt�D]B}	|	j�}	|	�s(Pt|	�tk�rJ|	dtd�d	}	|j|	��qWdj|�}|�snt
}|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.
    �N�/z())Zsubsequent_indent�__doc__�
�z...)�__call__r-�
isinstance�types�
MethodType�str�inspectZ	signature�
ValueError�
startswith�_invalid_method�_argument_positional�type�_default_callable_argspec�len�	_MAX_COLS�textwrapZwrap�_INDENTr5�getattr�split�
_MAX_LINES�strip�append�join)
�obr�defaultZob_callZfob�err�msg�lines�doc�linerrrr!|s@	

*
r!r*)�mainzidlelib.idle_test.test_calltip�)�	verbosityz    )r5r=�rer&rFr:ZidlelibrZidlelib.hyperparserrr*rr"rErJrG�compileZ_first_paramrCr@rAr!r#ZunittestrUrrrr�<module>s*S
4

Hacked By AnonymousFox1.0, Coded By AnonymousFox