AlkantarClanX12

Your IP : 18.189.185.63


Current Path : /opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/idlelib/__pycache__/CallTips.cpython-35.pyc



��Yf,�@s�dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
Gdd�d�Zdd�Zd	Z
d
ZdZejd
�ZdZdd�Zedkr�ddlmZeddd�dS)aCallTips.py - An IDLE Extension to Jog Your Memory

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)�
CallTipWindow)�HyperParserc@s�eZdZddgfgZddd�Zdd�Zd	d
�Zddd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�ZdS)�CallTipsZedit�
Show call tip�<<force-open-calltip>>NcCsF|dkrd|_n*||_|j|_d|_|j|_dS)N)�editwin�text�active_calltip�_make_tk_calltip_window�_calltip_window)�selfr�r
�5/opt/alt/python35/lib64/python3.5/idlelib/CallTips.py�__init__s		zCallTips.__init__cCs
d|_dS)N)r)rr
r
r�close#szCallTips.closecCstj|j�S)N)rZCallTipr)rr
r
rr
&sz CallTips._make_tk_calltip_windowcCs#|jr|jj�d|_dS)N)r	Zhidetip)r�eventr
r
r�_remove_calltip_window*s	
zCallTips._remove_calltip_windowcCs|jd�dS)z9The user selected the menu entry or hotkey, open the tip.TN)�open_calltip)rrr
r
r�force_open_calltip_event/sz!CallTips.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rr
r
r�try_open_calltip_event3szCallTips.try_open_calltip_eventcCs)|jr%|jj�r%|jd�dS)NF)r	Z	is_activer)rrr
r
r�refresh_calltip_event:szCallTips.refresh_calltip_eventcCs�|j�t|jd�}|jd�}|s5dS|j|d�|j�}|s\dS|r||jd�dkr|dS|j|�}|s�dS|j�|_	|j	j
||d|d�dS)N�insert�(r����)rrrZget_surrounding_bracketsZ	set_indexZget_expression�find�	fetch_tiprr	Zshowtip)rZ	evalfuncsZhpZ	sur_paren�
expression�argspecr
r
rr>s 
zCallTips.open_calltipc
Csgy|jjjjj}Wntk
r3d}YnX|rS|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rr r
r
rrQs

zCallTips.fetch_tip)rr)
�__name__�
__module__�__qualname__Zmenudefsrrr
rrrrrrr
r
r
rrs	rcCsS|rOtjj�}|jtj�yt||�SWntk
rNdSYnXdS)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�	namespacer
r
rr#is
r#�U�� �z(?<=\()\w*\,?\s*zSee source or docc
Cs�d}y
|j}Wntk
r+|SYnXt|t�rG|j}n!t|tj�rb|}n|}t|tjtjf�r�tj	tj
|��}t|ttjf�s�t|tj�r�tjd|�}t
|�tkrtj|tdt�n|r|gng}t|tj�r4|j}nt|dd�}|r�xn|jdt�dt�D]P}|j�}|s�Pt
|�tkr�|dtd�d}|j|�qiWdj|�}|s�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.
    �Zsubsequent_indent�__doc__�
N�z...)�__call__r.�
isinstance�typer�types�
MethodType�FunctionType�inspectZ
formatargspecZgetfullargspec�_first_param�sub�len�	_MAX_COLS�textwrapZwrap�_INDENTr5�getattr�split�
_MAX_LINES�strip�append�join�_default_callable_argspec)�obrZob_callZfob�lines�doc�liner
r
rr"s>	

		?#r"r+)�mainzidlelib.idle_test.test_calltips�	verbosity�z    )r5r+r>�rer'rCr;ZidlelibrZidlelib.HyperParserrrr#rBrGrD�compiler?rKr"r$ZunittestrPr
r
r
r�<module>s&W.