��Qc@sMdZddlZddlZddlZddlmZddlmZddlZddd��YZ d�Z
d�Zed 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�Zd�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&/sys/lib/python2.7/idlelib/CallTips.pyt__init__s cCs
d|_dS(N(RR (R
((s&/sys/lib/python2.7/idlelib/CallTips.pytclose"scCstj|j�S(N(RtCallTipR(R
((s&/sys/lib/python2.7/idlelib/CallTips.pyR%scCs&|jr"|jj�d|_ndS(N(RthidetipR(R
tevent((s&/sys/lib/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(topen_calltiptTrue(R
R((s&/sys/lib/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&/sys/lib/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&/sys/lib/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&/sys/lib/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_entitytget_arg_text(R
R#R*tentity((s&/sys/lib/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&/sys/lib/python2.7/idlelib/CallTips.pyR-ls
(s
Show call tips<<force-open-calltip>>N(t__name__t
__module__tmenudefsRRRRRRRRRRR-(((s&/sys/lib/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&/sys/lib/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�}ttd�|��}dgt|�t|�|}td�||�}|jjd@rY|jd �n|jjd
@ry|jd�ndj|�}d
tjdd|�}nt|dd�}|r|j�}|jd�} | dks� dkr�} 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&/sys/lib/python2.7/idlelib/CallTips.pyt<lambda>�sicSsdt|�S(Ns=%s(trepr(tname((s&/sys/lib/python2.7/idlelib/CallTips.pyRD�scSs||S(N((targtdflt((s&/sys/lib/python2.7/idlelib/CallTips.pyRD�sis...is***s, s(%s)s\.\d+s<tuple>t__doc__s
iFN(Rthasattrttypettypest ClassTypetTypeTypeR>t
MethodTypeR<tFunctionTypet
LambdaTypet func_codetco_argcounttco_varnamest
func_defaultstlisttmaptlentco_flagstappendtjointretsubtgetattrtlstripR(
tobR$t
arg_offsettfobtargcountt real_argstdefaultstitemstdoctpos((s&/sys/lib/python2.7/idlelib/CallTips.pyR.�sF !
R4cCsdS(s()N((((s&/sys/lib/python2.7/idlelib/CallTips.pytt1�scCsdS(s(a, b=None)N((tatb((s&/sys/lib/python2.7/idlelib/CallTips.pytt2�scGsdS(s(a, ...)N((Rjtargs((s&/sys/lib/python2.7/idlelib/CallTips.pytt3�scGsdS(s(...)N((Rm((s&/sys/lib/python2.7/idlelib/CallTips.pytt4�scGsdS(s(a, ...)N((RjRm((s&/sys/lib/python2.7/idlelib/CallTips.pytt5�scOsdS(s(a, b=None, ..., ***)N((RjRkRmtkw((s&/sys/lib/python2.7/idlelib/CallTips.pytt6�scCs|\}}|\}}dS(s(<tuple>, c, <tuple>)N((t.0tct.2RjRktdte((s&/sys/lib/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&/sys/lib/python2.7/idlelib/CallTips.pyR�scCsdS(s()N((R
((s&/sys/lib/python2.7/idlelib/CallTips.pyRi�scCsdS(s(ai, b=None)N((R
RzRk((s&/sys/lib/python2.7/idlelib/CallTips.pyRl�scGsdS(s (ai, ...)N((R
RzRm((s&/sys/lib/python2.7/idlelib/CallTips.pyRn�scGsdS(s(...)N((R
Rm((s&/sys/lib/python2.7/idlelib/CallTips.pyRo�scGsdS(s (ai, ...)N((R
RzRm((s&/sys/lib/python2.7/idlelib/CallTips.pyRp�scOsdS(s(ai, b=None, ..., ***)N((R
RzRkRmRq((s&/sys/lib/python2.7/idlelib/CallTips.pyRr�scCs|\}}|\}}dS(s(<tuple>, c, <tuple>)N((R
t.1Rtt.3RzRkRvRw((s&/sys/lib/python2.7/idlelib/CallTips.pyRx�sN(R9R:RIRRRiRlRnRoRpRrRx(((s&/sys/lib/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&/sys/lib/python2.7/idlelib/CallTips.pyttest�s
"((RIR\R0RLtidlelibRtidlelib.HyperParserRR4RR>R.R9RiRRlRnRoRpRrRxtobjectRyR�ttcR~(((s&/sys/lib/python2.7/idlelib/CallTips.pyt<module>s.i 2 3
|