m๒ &UฒIc @sdZdkZdkZdkZdkZdkZdfd„ƒYZd„Zd„Ze djoฎd„Z dd„Z d „Z d „Zd „Zdd „Zd fd„ƒYZd„ZeƒZe e e eeeeei ei ei eieieif ZeeƒndS(sPCallTips.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. Future plans include extending the functionality to include class attributes. NtCallTipscBsˆtZgZdd„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z d e i e iZd „Zd „Zd „ZRS( NcCsL|djod|_dSn||_|i|_d|_|i|_dS(N(teditwintNonetselfttexttcalltipt_make_tk_calltip_windowt_make_calltip_window(RR((t-/data/zmath/lib/python2.4/idlelib/CallTips.pyt__init__s     cCs d|_dS(N(RRR(R((Rtclose scCsti|iƒS(N(t CallTipWindowtCallTipRR(R((RR#scCs(|io|iiƒd|_ndS(N(RRthidetipR(R((Rt_remove_calltip_window's  cCsh|iƒ|iƒ}|i|ƒ}|o8|iidƒ|_|i ƒ|_ |i i |ƒndS(Ntinsertt( RRtget_name_at_cursortnamet fetch_tiptarg_textRtindext calltip_startRRtshowtip(RteventRR((Rtparen_open_event,s  cCs|iƒdS(NR(RR(RR((Rtparen_close_event6s cCs\|ioN|iidd|iƒp |iidd|idƒo|iƒqXndS(NRs<=t>s lineendR(RRRtcompareRR(RR((Rtcheck_calltip_cancel_event<s <cCs|iƒdS(NR(RR(RR((Rtcalltip_cancel_eventGs s._cCs`|i}|iiddƒ}t|ƒ}x+|o#||d|jo|d8}q-W||S(Nsinsert linestartRi(Rt_CallTips__IDCHARStidcharsRtgettstrtlenti(RR$R R"((RRMs  cCsjy|iiiii}Wn d}nX|o|idd|fhƒSn|i |ƒ}t |ƒSdS(s Return 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. texectget_the_calltipN( RRtflisttpyshelltinterptrpccltRt remotecallRt get_entitytentityt get_arg_text(RRR*R-((RRUs   cCsM|oBtiiƒ}|itiƒyt||ƒSWqIdSqIXndS(sALookup name in a namespace spanning sys.modules and __main.dict__N( Rtsystmodulestcopyt namespacetupdatet__main__t__dict__tevalR(RRR2((RR,ls(t__name__t __module__tmenudefsRR R RRRRRRtstringt ascii_letterstdigitsRRRR,(((RRs       cCs]y|iiSWnHtj o<x7|iD]'}t|ƒ}|dj o|Sq)q)WnXdS(N( tclass_obR tim_functAttributeErrort __bases__tbaset_find_constructortrcR(R=RARC((RRBvs   c Csd}|dj od}t|ƒtijo0t|ƒ}|djo d„}qŽd}n0t|ƒti jo|i }d}n|}t|ƒti ti gjoๆyุ|i i||i i!}|ipg}ttd„|ƒƒ}dgt|ƒt|ƒ|}td„||ƒ}|i id@o|idƒn|i id @o|id ƒnd i|ƒ}d |}Wq“q“Xnt|d dƒ}|of|iƒ}|idƒ}|djp |djo d}n|o|d7}n||| 7}qn|S(s:Get a string describing the arguments for the given objectRicCsdS(N(R(((RtŠsicCsd|S(Ns=%s(R(R((RRD™scCs||S(N(targtdflt(RERF((RRD›sis...is***s, s(%s)t__doc__s iFN(targTexttobRt argOffsetttypettypest ClassTypeRBtfobt MethodTypeR>t FunctionTypet LambdaTypet func_codet co_varnamest co_argcounttrealArgst func_defaultstdefaultstlisttmapR#titemstco_flagstappendtjointgetattrtdoctlstriptfindtpos( RIRWRZRbRURJRHRNR_((RR.sL       !  R4cCsdS(s()N((((Rtt1ถscCsdS(s (a, b=None)N((tatb((Rtt2ทscGsdS(s(a, ...)N((Rdtargs((Rtt3ธscGsdS(s(...)N((Rg((Rtt4นscGsdS(s(a, ...)N((RdRg((Rtt5บscOsdS(s(a, b=None, ..., ***)N((RdReRgtkw((Rtt6ปstTCcBsVtZdZed„Zd„Zed„Zd„Zd„Zd„Z ed„Z RS(s (a=None, ...)cGsdS(s (a=None, ...)N((RRdRe((RR ฟscCsdS(s()N((R((RRcภscCsdS(s (a, b=None)N((RRdRe((RRfมscGsdS(s(a, ...)N((RRdRg((RRhยscGsdS(s(...)N((RRg((RRiรscGsdS(s(a, ...)N((RRdRg((RRjฤscOsdS(s(a, b=None, ..., ***)N((RRdReRgRk((RRlลs( R7R8RGRR RcRfRhRiRjRl(((RRmฝs       cCsกtƒ}g}xp|D]h}|id|i}|i}|i |ƒ}||jo)|i |ƒd||t t ƒfGHqqWdt|ƒt|ƒfGHdS(Ns s%s - expected %s, but got %ss%d of %d tests failed(RtcttfailedtteststtRGtexpectedR7RRRR\R.R-R#(RpRRoRqRRrRn((Rttestวs     (RGR/R:RLR R4RRBR.R7RcRRfRhRiRjRlRmRsttcRp(R:RRlRiRjRfRhRcR/RtRpRBR4RsR RmRLR.((Rt? s(     d 3        ?