Your IP : 3.145.202.209


Current Path : /lib64/python2.7/idlelib/
Upload File :
Current File : //lib64/python2.7/idlelib/CallTips.pyo

�
�mec@sMdZddlZddlZddlZddlmZddlmZddlZddd��YZ	d�Z
d�Zed	krId
�Z
dd�Zd�Zd
�Zd�Zdd�Zd�Zdefd��YZd�Ze�Ze
eeeeeeeej
ejejejejejejfZee�ndS(sCallTips.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.

i����N(t
CallTipWindow(tHyperParsertCallTipscBszeZdd
gfgZdd�Zd�Zd�Zdd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
RS(tedits
Show call tips<<force-open-calltip>>cCsG|dkrd|_dS||_|j|_d|_|j|_dS(N(tNoneteditwinttexttcalltipt_make_tk_calltip_windowt_make_calltip_window(tselfR((s(/usr/lib64/python2.7/idlelib/CallTips.pyt__init__s			cCs
d|_dS(N(RR	(R
((s(/usr/lib64/python2.7/idlelib/CallTips.pytclose"scCstj|j�S(N(RtCallTipR(R
((s(/usr/lib64/python2.7/idlelib/CallTips.pyR%scCs&|jr"|jj�d|_ndS(N(RthidetipR(R
tevent((s(/usr/lib64/python2.7/idlelib/CallTips.pyt_remove_calltip_window)s	
cCs|jt�dS(siHappens when the user really wants to open a CallTip, even if a
        function call is needed.
        N(topen_calltiptTrue(R
R((s(/usr/lib64/python2.7/idlelib/CallTips.pytforce_open_calltip_event.scCs|jt�dS(s�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.
        N(RtFalse(R
R((s(/usr/lib64/python2.7/idlelib/CallTips.pyttry_open_calltip_event4scCs,|jr(|jj�r(|jt�ndS(siIf there is already a calltip window, check if it is still needed,
        and if so, reload it.
        N(Rt	is_activeRR(R
R((s(/usr/lib64/python2.7/idlelib/CallTips.pytrefresh_calltip_event;scCs�|j�t|jd�}|jd�}|s5dS|j|d�|j�}|su|ry|jd�dkrydS|j|�}|s�dS|j�|_	|j	j
||d|d�dS(Ntinsertt(ii����i(RRRtget_surrounding_bracketst	set_indextget_expressiontfindt	fetch_tipR	Rtshowtip(R
t	evalfuncsthpt	sur_parent
expressiontarg_text((s(/usr/lib64/python2.7/idlelib/CallTips.pyRBs
#cCsoy|jjjjj}Wntk
r2d}nX|rR|jdd|fi�S|j|�}t	|�SdS(sRReturn the argument list and docstring of a function or class

        If there is a Python subprocess, get the calltip there.  Otherwise,
        either fetch_tip() is running in the subprocess itself or it was called
        in an IDLE EditorWindow before any script had been run.

        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.

        texectget_the_calltipN(
RtflisttpyshelltinterptrpcclttAttributeErrorRt
remotecallt
get_entitytget_arg_text(R
R#R*tentity((s(/usr/lib64/python2.7/idlelib/CallTips.pyRSs


cCsR|rNtjj�}|jtj�yt||�SWqNtk
rJdSXndS(sReturn the object corresponding to expression evaluated
        in a namespace spanning sys.modules and __main.dict__.
        N(	tsystmodulestcopytupdatet__main__t__dict__tevalt
BaseExceptionR(R
R#t	namespace((s(/usr/lib64/python2.7/idlelib/CallTips.pyR-ls
(s
Show call tips<<force-open-calltip>>N(t__name__t
__module__tmenudefsRRRRRRRRRRR-(((s(/usr/lib64/python2.7/idlelib/CallTips.pyRs								cCsVy|jjSWnAtk
rQx1|jD]"}t|�}|dk	r(|Sq(WnXdS(N(Rtim_funcR+t	__bases__t_find_constructorR(tclass_obtbasetrc((s(/usr/lib64/python2.7/idlelib/CallTips.pyR>zs
c
Cs#d}|dk	rt|d�rd}t|�tjtjfkrrt|�}|dkrid�}q�d}n-t|�tjkr�|j}d}n|}t|�tj	tj
gkr�|jj}|jj
||!}|jp�g}ttd�|��}dgt|�t|�|}td�||�}|jjd@rY|jd	�n|jjd
@ry|jd�ndj|�}d
tjdd|�}nt|dd�}|r|j�}|jd�}	|	dks�|	dkr�d}	n|r|d7}n|||	 7}qn|S(sZGet a string describing the arguments for the given object,
       only if it is callable.tt__call__icSsdS(N(R(((s(/usr/lib64/python2.7/idlelib/CallTips.pyt<lambda>�sicSsdt|�S(Ns=%s(trepr(tname((s(/usr/lib64/python2.7/idlelib/CallTips.pyRD�scSs||S(N((targtdflt((s(/usr/lib64/python2.7/idlelib/CallTips.pyRD�sis...is***s, s(%s)s\.\d+s<tuple>t__doc__s
iFN(Rthasattrttypettypest	ClassTypetTypeTypeR>t
MethodTypeR<tFunctionTypet
LambdaTypet	func_codetco_argcounttco_varnamest
func_defaultstlisttmaptlentco_flagstappendtjointretsubtgetattrtlstripR(
tobR$t
arg_offsettfobtargcountt	real_argstdefaultstitemstdoctpos((s(/usr/lib64/python2.7/idlelib/CallTips.pyR.�sF			!	
R4cCsdS(s()N((((s(/usr/lib64/python2.7/idlelib/CallTips.pytt1�scCsdS(s(a, b=None)N((tatb((s(/usr/lib64/python2.7/idlelib/CallTips.pytt2�scGsdS(s(a, ...)N((Rjtargs((s(/usr/lib64/python2.7/idlelib/CallTips.pytt3�scGsdS(s(...)N((Rm((s(/usr/lib64/python2.7/idlelib/CallTips.pytt4�scGsdS(s(a, ...)N((RjRm((s(/usr/lib64/python2.7/idlelib/CallTips.pytt5�scOsdS(s(a, b=None, ..., ***)N((RjRkRmtkw((s(/usr/lib64/python2.7/idlelib/CallTips.pytt6�scCs|\}}|\}}dS(s(<tuple>, c, <tuple>)N((t.0tct.2RjRktdte((s(/usr/lib64/python2.7/idlelib/CallTips.pytt7�stTCcBs_eZdZd	d�Zd�Zd	d�Zd�Zd�Zd�Z	d	d�Z
d�ZRS(
s(ai=None, ...)cGsdS(s(ai=None, ...)N((R
taiRk((s(/usr/lib64/python2.7/idlelib/CallTips.pyR�scCsdS(s()N((R
((s(/usr/lib64/python2.7/idlelib/CallTips.pyRi�scCsdS(s(ai, b=None)N((R
RzRk((s(/usr/lib64/python2.7/idlelib/CallTips.pyRl�scGsdS(s	(ai, ...)N((R
RzRm((s(/usr/lib64/python2.7/idlelib/CallTips.pyRn�scGsdS(s(...)N((R
Rm((s(/usr/lib64/python2.7/idlelib/CallTips.pyRo�scGsdS(s	(ai, ...)N((R
RzRm((s(/usr/lib64/python2.7/idlelib/CallTips.pyRp�scOsdS(s(ai, b=None, ..., ***)N((R
RzRkRmRq((s(/usr/lib64/python2.7/idlelib/CallTips.pyRr�scCs|\}}|\}}dS(s(<tuple>, c, <tuple>)N((R
t.1Rtt.3RzRkRvRw((s(/usr/lib64/python2.7/idlelib/CallTips.pyRx�sN(R9R:RIRRRiRlRnRoRpRrRx(((s(/usr/lib64/python2.7/idlelib/CallTips.pyRy�s				c	Cs�t�}g}x�|D]�}|jd|j}|j}yd|jj|f}Wntk
rl|}nX|j|�}||kr|j|�d}||j|t|�fGHqqWdt|�t|�fGHdS(Ns
s%s.%ss%s - expected %s, but got %ss%d of %d tests failed(	RRIR9tim_classR+RRZR.RX(	tteststcttfailedtttexpectedRFtqualified_nameR$tfmt((s(/usr/lib64/python2.7/idlelib/CallTips.pyttest�s	
	


"((RIR\R0RLtidlelibRtidlelib.HyperParserRR4RR>R.R9RiRRlRnRoRpRrRxtobjectRyR�ttcR~(((s(/usr/lib64/python2.7/idlelib/CallTips.pyt<module>s.i		2							3