ó q”þfc@sMdZddlZddlZddlZddlmZddlmZddlZddd„ƒYZ d„Z d„Z e 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(t HyperParsertCallTipscBszeZdd gfgZdd„Zd„Zd„Zdd„Zd„Zd„Z d „Z d „Z d „Z d „Z RS(tedits Show call tips<>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<>N(t__name__t __module__tmenudefsRR R RRRRRRRR-(((s(/usr/lib64/python2.7/idlelib/CallTips.pyRs        cCsVy|jjSWnAtk rQx1|jD]"}t|ƒ}|dk r(|Sq(WnXdS(N(R tim_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¤|j j }|j j ||!}|jpèg}ttd„|ƒƒ}dgt|ƒt|ƒ|}td„||ƒ}|j jd@rY|jd ƒn|j jd @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.pytsicSsdt|ƒ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+st__doc__s iFN(Rthasattrttypettypest ClassTypetTypeTypeR>t MethodTypeR<t FunctionTypet LambdaTypet func_codet co_argcountt co_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(, c, )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„Z RS( 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(, c, )N((R t.1Rtt.3RzRkRvRw((s(/usr/lib64/python2.7/idlelib/CallTips.pyRxÊsN( R9R:RIRR RiRlRnRoRpRrRx(((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.pyts.    i 2          3