^Rc@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddlmZyddlTWn+ek rejdIJejdnXddlZddlmZmZddlmZdd lmZdd lmZdd lm Z dd l!m"Z"dd l#m$Z$ddl#m%Z%ddl#m&Z&ddl#m'Z'ddl#m(Z(ej)ej*dZ+dZ,dZ-yddl.m/Z/Wnek rdZ/nXeja0yddl1Z1Wnek r4n.Xe2e2dZ3e3e1_4e2dZ5e5e1_6e2e j7dZ8e8e _7defdYZ9defdYZ:defdYZ;d efd!YZ<d"e%j=fd#YZ>d$efd%YZ?d&e fd'YZ@d(e jAfd)YZBd*eBfd+YZCd,eBfd-YZDd.ZEd/ZFeGd0krejHd0ejHd&>> N(Rt linecachetgetlinetstript__name__(RRRRRts((s%/usr/lib/python2.7/idlelib/PyShell.pytidle_formatwarningFs  cCsotj}i}xBt|D]4}|d |ddkr|j||| entries Rather than repeating the linecache code, patch it to save the entries, call the original linecache.checkcache() (skipping them), and then restore the saved entries. orig_checkcache is bound at definition time to the original method, allowing it to be patched. iis<>N(Rtcachetlisttpoptupdate(Rtorig_checkcacheR$tsavetkey((s%/usr/lib/python2.7/idlelib/PyShell.pytextended_linecache_checkcacheSs  tPyShellEditorWindowcBseZdZdZdddddgZdZddZddZdZ dZ dZ dZ dZ dZRS(s6Regular text edit window in IDLE, supports breakpointscGsg|_tj|||jjd|j|jjd|j|jjd|jjt j j t j d|_|jj|d}|jj||jjr|jndS(Ns<>s<>s<>sbreakpoints.lstcSs|j|dS(N(trestore_file_breaks(told_hooktself((s%/usr/lib/python2.7/idlelib/PyShell.pytfilename_changed_hookws (t breakpointsRt__init__ttexttbindtset_breakpoint_heretclear_breakpoint_heretflistt open_shelltostpathtjoinR t GetUserCfgDirtbreakpointPathtiotfilename_change_hooktset_filename_change_hookRR-(R/targsR0((s%/usr/lib/python2.7/idlelib/PyShell.pyR2ms     tCuts<>trmenu_check_cuttCopys<>trmenu_check_copytPastes <>trmenu_check_pastesSet Breakpoints<>sClear Breakpoints<>cCs|j}|jj}|jdd|d|dy|jj|}Wn!tk rm|jj|nXy&|jj j j }|j ||WnnXdS(NtBREAKs%d.0i( R3R>Rttag_addR1tindext ValueErrortappendR7tpyshelltinterptdebuggerR5(R/RR3Rtitdebug((s%/usr/lib/python2.7/idlelib/PyShell.pytset_breakpoints   cCsU|j}|jj}|s)|jdStt|jd}|j|dS(Ntinsert(R3R>RtbelltinttfloatRJRR(R/teventR3RR((s%/usr/lib/python2.7/idlelib/PyShell.pyR5s   cCs|j}|jj}|s)|jdStt|jd}y|jj|WnnX|j dddy&|j j j j }|j||WnnXdS(NRSRHsinsert linestartsinsert lineend +1char(R3R>RRTRURVRJR1tremovet tag_removeR7RMRNROR6(R/RWR3RRRQ((s%/usr/lib/python2.7/idlelib/PyShell.pyR6s"    cCs|jr~|j}|jj}|s2|jdSg|_|jddty#|jjj j }|j |Wq~q~XndS(NRHs1.0( R1R3R>RRTRYtENDR7RMRNROtclear_file_breaks(R/R3RRQ((s%/usr/lib/python2.7/idlelib/PyShell.pyR[s     c CsO|j}|jj}y+t|jd}|j}WdQXWntk rYg}nXyt|jdv}x1|D])}|j|dsy|j|qyqyW|j |j}|r|j|dt |dnWdQXWn`tk rJ}t |j dt sKt|j _tjddd d t |d |jqKnXdS( s#Save breakpoints when file is savedtrNtwt=s tbreakpoint_error_displayedttitles IDLE ErrorRs$Unable to update breakpoint list: %stparent(R1R>RtopenR=t readlinesRt startswithRtupdate_breakpointststrtgetattrtroottFalsetTrueR_t tkMessageBoxt showerrorR3(R/tbreaksRtold_filetlinestnew_fileRterr((s%/usr/lib/python2.7/idlelib/PyShell.pytstore_file_breakss.       ,  cCs|jj|jdkr dS|jj}|dkr<dStjj|jrt |jdj }x_|D]T}|j |drpt |t |d}x|D]}|j|qWqpqpWndS(NR\R^i(R3R'R>RRR9R:tisfileR=RbRcRdtevaltlenRR(R/RRoRtbreakpoint_linenumberstbreakpoint_linenumber((s%/usr/lib/python2.7/idlelib/PyShell.pyR-s     cCs4|j}|jd}|j|}||_dS(s3Retrieves all the breakpoints in the current windowRHN(R3t tag_rangestranges_to_linenumbersR1(R/R3trangestlinenumber_list((s%/usr/lib/python2.7/idlelib/PyShell.pyRes cCsg}xtdt|dD]f}tt||j}tt||dj}x'||kr|j||d7}q^WqW|S(Niii(trangeRuRURVtstringRL(R/RzRoRJRtend((s%/usr/lib/python2.7/idlelib/PyShell.pyRys cCs|jtj|dS(s7Extend base method - clear breaks when module is closedN(R[Rt_close(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRs (RBs<>srmenu_check_cut(RDs<>RE(RFs <>srmenu_check_pasteN(sSet Breakpoints<>N(sClear Breakpoints<>N(R!t __module__t__doc__R2Rt rmenu_specsRRR5R6R[RrR-ReRyR(((s%/usr/lib/python2.7/idlelib/PyShell.pyR,js       /   tPyShellFileListcBs&eZdZeZdZddZRS(s8Extend base class: IDLE supports a shell and breakpointscCsQ|jr|jjjn.t||_|jrJ|jjsJdSn|jS(N(RMttoptwakeuptPyShelltbeginR(R/RW((s%/usr/lib/python2.7/idlelib/PyShell.pyR8&s  N(R!RRR,RRRMR8(((s%/usr/lib/python2.7/idlelib/PyShell.pyRstModifiedColorDelegatorcBs2eZdZdZdZdZdZRS(s8Extend base class: colorizer for the shell window itselfcCstj||jdS(N(RR2t LoadTagDefs(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyR24s cCs7|jddd|jdddtj|dS(NtTODOs1.0tiomarktSYNC(RYRIRtrecolorize_main(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyR8scCstj|tjddd}|jjiidd6dd6d6tj|dd6tj|dd6tj|d d 6dS( NtmaintThemetnamet backgroundt foregroundtstdintstdouttstderrtconsole(RRR t GetOptionttagdefsR'Rt GetHighlight(R/ttheme((s%/usr/lib/python2.7/idlelib/PyShell.pyR=s  cCs+x$|jD]}|j|ddq WdS(NRR~(RRY(R/ttag((s%/usr/lib/python2.7/idlelib/PyShell.pyt removecolorsGs(R!RRR2RRR(((s%/usr/lib/python2.7/idlelib/PyShell.pyR1s    tModifiedUndoDelegatorcBs&eZdZddZddZRS(s;Extend base class: forbid insert/delete before the I/O markcCs[y-|jj|ddr,|jjdSWntk r@nXtj||||dS(Nt      cCs|jr|jSt|_|j}|rLytj|jWqLqLXn|jj|j|j}|j }t |_ |j y|jj Wn!t jk r}|jdSX|jd||j|jjdd|r |jd|jnt|jddd}|j|d||jjd d|jjd d |j|rtj|j}|jn|j|jj_ t |_|jS( NRRsend-1cs iiR^s RESTART trestarttleft(!RRRjt getdebuggerR tclose_subprocess_debuggertclosetunix_terminateRt executingRiRRRRRRRt stop_readlineR3RRt showpromptRUtwidthtmark_sett mark_gravitytrestart_subprocess_debuggertload_breakpointsRRRR(R/RRQRt was_executingRqthalfbartgui((s%/usr/lib/python2.7/idlelib/PyShell.pytrestart_subprocesssJ                cCs|jjdddidS(Ntexectinterrupt_the_server((Rt remotecall(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyt__request_interruptscCstjd|jjdS(Nttarget(t threadingtThreadt'_ModifiedInterpreter__request_interrupttstart(R/((s%/usr/lib/python2.7/idlelib/PyShell.pytinterrupt_subprocessscCsHy|jjWntk r$nX|jt|j_d|_dS(N(RRtAttributeErrorRRiRRR(R/((s%/usr/lib/python2.7/idlelib/PyShell.pytkill_subprocesss   cCsnttdrjytj|jtWntk r:dSXytj|jdWqjtk rfdSXndS(s;UNIX: make sure subprocess is terminated and collect statustkillNi(thasattrR9RRRtOSErrortwaitpid(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRs  cCsC|r"dg}|jtjn tj}|jd|fdS(NtsRif 1: import sys as _sys _sys.path = %r del _sys (textendRR:t runcommand(R/RR:((s%/usr/lib/python2.7/idlelib/PyShell.pyR s   cCs|j}|dkrdSy|j|jdd}Wn:tttfk rq|jjr^dSd}|j nX|rb|jj d|_|\}}|jj }|dkr|dk r:|t |IJq:nf|dkr|jj dr:|jq:n8|dkr:d}tj|I|IJ||I|IJny|jjWqbtk r^qbXn|jjs|jjj|jj|jndS(Ntwaitg?tOKt EXCEPTIONs<>tERRORs/PyShell.ModifiedInterpreter: Subprocess ERROR: (RRt pollresponset active_seqRRtKeyboardInterruptRtclosingRt resetoutputRtreprtgetvartremote_stack_viewerRt __stderr__t endexecutingRR3taftert pollintervalR(R/tclttresponsethowtwhatRterrmsg((s%/usr/lib/python2.7/idlelib/PyShell.pyRs@             cCs ||_dS(N(RO(R/RO((s%/usr/lib/python2.7/idlelib/PyShell.pyt setdebuggerAscCs|jS(N(RO(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRDscCs|jjjd|jdS(sInitiate the remote stack viewer from a separate thread. This method is called from the subprocess, and by returning from this method we allow the subprocess to unblock. After a bit the shell requests the subprocess to open the remote stack viewer which returns a static object looking at the last exception. It is queried through the RPC mechanism. i,N(RR3RR(R/((s%/usr/lib/python2.7/idlelib/PyShell.pytopen_remote_stack_viewerGs c Csddlm}|jjdddi}|dkrK|jjjdS|j|j|}ddl m }m }t |jj}t jddd }t j|d d }||d |d d} | jjdddd|| jd|} | jdS(Ni(tRemoteObjectBrowserRt stackviewerR7(tScrolledCanvastTreeNodeRRRtnormalRtbgthighlightthicknessitexpanditfilltboth(sflist(tidlelibRRt remotequeueRRRhRTtStubObjectTreeItemtidlelib.TreeWidgetR R!tToplevelR RRtframetpacktcanvasR%( R/RtoidtitemR R!RRRtsctnode((s%/usr/lib/python2.7/idlelib/PyShell.pyRTs icCs#|j|}|j||dS(s1Like runsource() but assumes complete exec sourceN(t stuffsourcetexecfile(R/tsourceR((s%/usr/lib/python2.7/idlelib/PyShell.pyt execsourcegscCs|dkr$t|dj}nyt||d}Wnattfk r|jj|jj}|dIJ|dIJt j |||jj nX|j |dS(sExecute an existing fileR\Rs *** Error in script or command! s"Traceback (most recent call last):N( RRbtreadRt OverflowErrort SyntaxErrorRRRRtshowsyntaxerrorRtruncode(R/RR6tcodettkerr((s%/usr/lib/python2.7/idlelib/PyShell.pyR5ls     cCs|j|}d|_tj|_tjdddtt|tj rddl m }y|j |j }Wqtk r|jj|jddSXnztj|||SWd|jdk r|jtj(d|_nXdS( sBExtend base class method: Stuff the source in the line cache firstitactionRRi(t IOBindings Unsupported characters in input N(R4tmoreRtfiltersRtfilterwarningst SyntaxWarningt isinstancettypest UnicodeTypeR(R@tencodetencodingt UnicodeErrorRRRRt runsourceR(R/R6RR@((s%/usr/lib/python2.7/idlelib/PyShell.pyRK|s"      cCsSd|j}|jd|_|jd}t|dd||ftj|<|S(s"Stuff source in the filename caches is i(tgidtsplitRuRR$(R/R6RRo((s%/usr/lib/python2.7/idlelib/PyShell.pyR4s  #cCs|jd|fdS(s>Prepend sys.path with file's directory if not already includeds(if 1: _filename = %r import sys as _sys from os.path import dirname as _dirname _dir = _dirname(_filename) if not _dir in _sys.path: _sys.path.insert(0, _dir) del _filename, _sys, _dirname, _dir N(R(R/R((s%/usr/lib/python2.7/idlelib/PyShell.pytprepend_syspathsc Cs|jj}|j}|r|\}}}}|dkrMd|d}nd|d|df}|jd||j||j|} | r| tkr|jd|d|n|jj|jdt |n|jjt j |||jj dS(sExtend base class method: Add Colorizing Color the offending position instead of printing it and pointing at it with a caret. isiomark + %d charss&iomark linestart + %d lines + %d charsR s wordstartsSyntaxError: %s N( RR3t unpackerrorRItseetgett IDENTCHARSRRRfRR;R( R/RR3tstufftmsgRtoffsetRtpostchar((s%/usr/lib/python2.7/idlelib/PyShell.pyR;s$      c Cstj\}}}|tk}|rey+|\}\}}}} |sQd}nWqed}qeXn|r{|||| fSdSdS(Ni(Rtexc_infoR:R( R/RtvaluettbtokRTtdummy_filenameRRUR((s%/usr/lib/python2.7/idlelib/PyShell.pyROs   cCsJ|jj|jtj||jjdrF|jjndS(s1Extend base class method to reset output properlys<>N(RRtchecklinecacheRt showtracebackRtopen_stack_viewer(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyR^s    cCsFtj}x6|jD](}|d |ddkr||=qqWdS(Niis<>(RR$tkeys(R/tcR*((s%/usr/lib/python2.7/idlelib/PyShell.pyR]s cBsQ|jjr|jdS|jrB|jjdd|fin ||jUdS(s*Run the code without invoking the debuggeriRR<i(RRtdisplay_executing_dialogRR)R(R/R=((s%/usr/lib/python2.7/idlelib/PyShell.pyRs    cBs|jjr|jjn|j|jd k rN|jej(d |_n|j }z;yr|jj | r|j d k r|j j dd|fi|_ n'|r|j||jn ||jUWnek r%|jjsejddddd|jjrq"|jqnlerX|jjdIJ|j|jjq|jjre|j_|jjd IJq|jnXWd esy|jjWqek rqXnXd S( sOverride base class methodRR<sExit?sDo you want to exit altogether?Rtyestmasters IDLE internal error in runcode()R N(RRRNRR]RRRRBROtbeginexecutingRt asyncqueueR trunRt SystemExitRRktaskyesnoR3R^tuse_subprocessRRtcanceledRiR(R/R=RO((s%/usr/lib/python2.7/idlelib/PyShell.pyR<sR              cCs|jjj|dS(sOverride base class methodN(RRR(R/R"((s%/usr/lib/python2.7/idlelib/PyShell.pyRscCs tjddd|jjdS(NsPort Binding ErrorsAIDLE can't bind to a TCP/IP port, which is necessary to communicate with its Python execution server. This might be because no networking is installed on this computer. Run IDLE with the -n command line switch to start without a subprocess and refer to Help/IDLE Help 'Running without a subprocess' for further details.Rd(RkRlRR3(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyR!scCs tjddd|jjdS(NsSubprocess Startup ErrorsIDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or personal firewall software is blocking the connection.Rd(RkRlRR3(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyR,scCs tjddd|jjdS(NsAlready executingsYThe Python Shell window is already executing a command; please wait until it is finished.Rd(RkRlRR3(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRb4sN('R!RR2RRRRRRRiRRRRRRR RRORRRRRLR7R5RKR4RNR;ROR^R]RR<RRRRb(((s%/usr/lib/python2.7/idlelib/PyShell.pyRisF    + .     &            1  RcBseZdedZeZeZd6d7d8d9d:d;gZe j r[ed=d<edd3Z5d4Z6d5Z7RS(?sPython s ShellRt_Fileteditt_EditRQt_Debugtoptionst_Optionstwindowst_Windowsthelpt_Helpit_Windowii(tHistorycCsatr9|j}|dddkr9|jddq9nt||_|dkrt}t||jt |}nt j ||ddt |_ d|_t |_|j}|jdd|jd|j|jd |j|jd |j|jd |j|jd |j|jd |j|jd|jtr~|jd|j|jd|jntj|_tj|_ tj!|_"ddl#m$}t%|d|j&|_!t'|d|j&|_t'|d|j&|_t'|d|j&|_(ts?|jt_|jt_|j!t_!n|j)|j|_*d|_+dS(NiitshelltShe_llitwrapRWs<>s<>s<>s<>s<>s<>s<>s<>s<>i(R@RRRRi2(sshellRy(,Rjt menu_specsRSRRNRtTkRtwithdrawRRR2Rjtusetabst indentwidthtcontext_use_ps1R3t configureR4tenter_callbacktlinefeed_callbacktcancel_callbackt eof_callbackR_ttoggle_debuggerttoggle_jit_stack_viewertview_restart_markt restart_shellRRt save_stdoutRt save_stderrRt save_stdinR(R@tPseudoInputFileRItPseudoOutputFileRRwthistoryR(R/R7tmsRhR3R@((s%/usr/lib/python2.7/idlelib/PyShell.pyR2VsP              cCstjdtS(Nt shell_only(R t GetExtensionsRj(R/((s%/usr/lib/python2.7/idlelib/PyShell.pytget_standard_extension_namesscCs |adS(N(R(R/tstream((s%/usr/lib/python2.7/idlelib/PyShell.pytset_warning_streamscCstS(N(R(R/((s%/usr/lib/python2.7/idlelib/PyShell.pytget_warning_streamscCs`|jr0tjddd|j|jdS|jj}|rR|jn |jdS(NsDon't debug nows*You can only toggle the debugger when idleRdtbreak( RRkRlR3tset_debugger_indicatorRNRtclose_debuggert open_debugger(R/RWtdb((s%/usr/lib/python2.7/idlelib/PyShell.pyRs     cCs%|jj}|jd| dS(Ns<>(RNRtsetvar(R/R((s%/usr/lib/python2.7/idlelib/PyShell.pyRscCsdS(N((R/RW((s%/usr/lib/python2.7/idlelib/PyShell.pyRscCs|jj}|r|jjd|j|jjrQtj|jjn|j|j j ddt _ |j n|jdS(Ns [DEBUG OFF] s>>> (RNRRRRRR tclose_remote_debuggerRRRRtps1RR(R/R((s%/usr/lib/python2.7/idlelib/PyShell.pyRs     cCsq|jjr'tj|jj|}ntj|}|jj||jdt_|j |j dS(Ns[DEBUG ON] >>> ( RNRR tstart_remote_debuggerR RRRRRR(R/tdbg_gui((s%/usr/lib/python2.7/idlelib/PyShell.pyRs     cCs|jd|_dS(sHelper for ModifiedInterpreteriN(RR(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRes cCs d|_d|_|jdS(sHelper for ModifiedInterpreteriN(RRkR(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRs  cCsz|jr=tjddddd|j}|tkr=dSn|jt|_t|_|jj d|j |j dS( sExtend EditorWindow.close()sKill?s6The program is still running! Do you want to kill it?RR[RatcanceliN( RRkt askokcancelR3RiRRjRkRRRtclose2(R/R((s%/usr/lib/python2.7/idlelib/PyShell.pyRs      cCs tj|S(N(RR(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRscCs||jtr |jjn|jt_|jt_|j t_ d|_d|_ d|j _d|_tj|dS(sEExtend EditorWindow._close(), shut down debugger and execution serverN(RRjRNRRRRRRRRRRR7RMRRR(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRs        cCstS(s8Override EditorWindow method: never remove the colorizer(Rj(R/R((s%/usr/lib/python2.7/idlelib/PyShell.pytispythonsourcescCs|jS(N(t shell_title(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyt short_titless@Type "copyright", "credits" or "license()" for more information.cCs|jtr<d}|jj}|sB|jtSnd}|jdtjtj |j |f|j ddl }d|_tS(NRs==== No Subprocess ====sPython %s on %s %s %si(RRjRNRRRiRRtversionRt COPYRIGHTRtTkinterRt _default_rootRj(R/tnosubtclientR((s%/usr/lib/python2.7/idlelib/PyShell.pyRs      cCs'|js dSt|_|jjdS(N(treadingRjt_stop_readline_flagRtquit(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRs  cCs|j}zd|_|jjWd||_X|jrFt|_dS|jjdd}t|dkrvd}nt|t rddl m }y|j |j }Wqtk rqXn|j|jrd|_tstqn|jr d|_d}n|S( NiRRsend-1cis i(R@(RRtmainloopRRiR3RQRuREtunicodeR(R@RHRIRJRRkRjR t endoffile(R/R)RR@((s%/usr/lib/python2.7/idlelib/PyShell.pytreadlines4              cCstS(N(Rj(R/((s%/usr/lib/python2.7/idlelib/PyShell.pytisatty3scCsy |jjdddrdSWnnX|jp9|jsd|j|jjd|jdSd|_d|_ |jr|jj r|jj r|jj q|jj n|jr|jjndS(Ns sel.firsts!=ssel.lastsKeyboardInterrupt Rii(R3RRRRRNRRRRkRRRRRR(R/RW((s%/usr/lib/python2.7/idlelib/PyShell.pyR6s&     cCs|jr|j rdS|jjdddoD|jjdddsKdS|jsk|j|jnd|_d|_|jj dS(NRs==RSsend-1ciiR( RRR3RRRRkRRR(R/RW((s%/usr/lib/python2.7/idlelib/PyShell.pyRLs      cCs@|jr/|jjdd|jjdn |j|dS(NRSs R(RR3RSRPtnewline_and_indent_event(R/RW((s%/usr/lib/python2.7/idlelib/PyShell.pyR[s   c Cs|jr|j rdSyN|jjdd}|rd|jjdddrd|j||dSnWnnX|jjdddr|jjd d}|r|jjdd|d r|j|jj|d |d |dS|jjd d}|rK|jjd d |d rK|j|jj|d |d |dS|jjdd}|r|jj|d ddr|j|jj|d d |n|j|jjdd |dS|jjdddr|jjddn|jjdd}|r7|j r7|jj ddn|jjdddr`|j |dS|jjdd|jr|jj dd|jj dn |j ||jjd dd|jj|jr|jjn |jdS(Ns sel.firstssel.lasts<=RRRSRsiomark linestartRiisinsert lineends>=Rsinsert linestartsend-1csend-1c linestarts (RRR3RQRtrecallt tag_prevranget tag_nextrangeRR RRRSRPRItupdate_idletasksRRtrunit(R/RWtseltprevtnexttindicesR"((s%/usr/lib/python2.7/idlelib/PyShell.pyRdsX "'"'&      cCstjdd|}tjdd|}|jd}|jjz@|jjddd|jjdd |jjd d}|jj d r|j ||jjd d}n|jj d|d j t |d krtjd|d jd }tjd|jd }xX|d D]I}|j|ra||t |}n|jj dd|jq5WnWd|jjd|jjXdS(Ns^\s*\nRs\n\s*$s Rs1.0R~RSsend-1csinsert linestartt:iis ^([ \t]*)(tretsubRMR3tundo_block_startRYRRQtrstriptendswithRRSR RutsearchtgroupRdRPtundo_block_stop(R/R"RWRotprefixtorig_base_indenttnew_base_indentR((s%/usr/lib/python2.7/idlelib/PyShell.pyRs*  (cCs|jjdd}t|}x.|dkrQ||ddkrQ|d}q$W|dkr||ddkr|d}nx.|dkr||ddkr|d}qW|| }|jj|}dS(NRsend-1ciis s (R3RQRuRNRK(R/RRPRA((s%/usr/lib/python2.7/idlelib/PyShell.pyRs #  # cCsq|jjr|jjSy tjWn!tjddd|jdSXddlm }||j |j }dS(NsNo stack traces@There is no stack trace yet. (sys.last_traceback is not defined)Rdi(t StackBrowser( RNRRRtlast_tracebackRkRlR3tidlelib.StackViewerRRhR7(R/RWRtsv((s%/usr/lib/python2.7/idlelib/PyShell.pyR_s     cCs$|jjd|jjddS(NRR(R3RP(R/RW((s%/usr/lib/python2.7/idlelib/PyShell.pyRscCs|jjdtdS(s&Callback for Run/Restart Shell Cntl-F6RN(RNRRj(R/RW((s%/usr/lib/python2.7/idlelib/PyShell.pyRscCsk|jyttj}Wn d}nX|jj||jjdd|j|j j dS(NRRSsend-1c( RRfRRRRR3Rtset_line_and_columnR>t reset_undo(R/R"((s%/usr/lib/python2.7/idlelib/PyShell.pyRs   cCs|jjdd}|jr1|jj|n|jjddkr_|jjddn|jjdd|jdtj_ dS(NRsend-1csend-2cs i( R3RQRt history_storeRSRRRRt softspace(R/R6((s%/usr/lib/python2.7/idlelib/PyShell.pyRs  cCsry@|jjddtj|||d|jjddWnnX|jrnd|_tsntqnndS(NRtrightRi(R3RRRRkRjR (R/R"R((s%/usr/lib/python2.7/idlelib/PyShell.pyRs  cCsHy |jjdddrdSWntk r4dSXtt|jS(Ns sel.firstRRtdisabled(R3RRtsuperRRC(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRCs  cCs/|jjdddrdStt|jS(NRSRRR(R3RRRRG(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRG s(sfileRl(RmRn(sdebugRo(RpRq(RrRs(shelpRu(RrRvN((8R!RRRRRRRR{RtrunningAsOSXApptidlelib.IdleHistoryRwRR2RRiRRRkRRRRRRRRRRReRRRRRRRRRRRRRRRRRR_RRRRRRCRG(((s%/usr/lib/python2.7/idlelib/PyShell.pyR<sl    2                    ?      t PseudoFilecBs;eZddZedZedZdZRS(cCs(||_||_d|_||_dS(Ni(RxRRt _encoding(R/RxRRI((s%/usr/lib/python2.7/idlelib/PyShell.pyR2s   cCs|jS(N(R(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRIscCs d|jS(Ns<%s>(R(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRscCstS(N(Rj(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyRsN(R!RRR2tpropertyRIRR(((s%/usr/lib/python2.7/idlelib/PyShell.pyRs RcBseZdZdZRS(cCstS(N(Rj(R/((s%/usr/lib/python2.7/idlelib/PyShell.pytwritable%scCs_|jrtdnt|ttfsItdt|jn|jj ||j S(Nswrite to closed filesmust be string, not ( tclosedRKREt basestringt bytearrayt TypeErrorRR!RxRR(R/R"((s%/usr/lib/python2.7/idlelib/PyShell.pyR(s  (R!RRR(((s%/usr/lib/python2.7/idlelib/PyShell.pyR#s RcBs>eZddZdZddZddZdZRS(cCs#tj||||d|_dS(NR(RR2t _line_buffer(R/RxRRI((s%/usr/lib/python2.7/idlelib/PyShell.pyR22scCstS(N(Rj(R/((s%/usr/lib/python2.7/idlelib/PyShell.pytreadable6sicCs|jrtdn|dkr-d}n+t|tsXtdt|jn|j}d|_|dkrxt r|j j }|sPn||7}qyWnSx9t ||kr|j j }|sPn||7}qW|||_|| }|S(Nsread from closed fileismust be int, not Ri( RRKRRERURRR!RRjRxRRu(R/tsizetresultR((s%/usr/lib/python2.7/idlelib/PyShell.pyR89s,         cCs|jrtdn|dkr-d}n+t|tsXtdt|jn|jpm|j j }|dkrt |}n|||_|| S(Nsread from closed fileismust be int, not i( RRKRRERURRR!RRxRRu(R/RR((s%/usr/lib/python2.7/idlelib/PyShell.pyRPs     cCs|jjdS(N(RxR(R/((s%/usr/lib/python2.7/idlelib/PyShell.pyR]sN(R!RRR2RR8RR(((s%/usr/lib/python2.7/idlelib/PyShell.pyR0s     s USAGE: idle [-deins] [-t title] [file]* idle [-dns] [-t title] (-c cmd | -r file) [arg]* idle [-dns] [-t title] - [arg]* -h print this help message and exit -n run IDLE without a subprocess (see Help/IDLE Help for details) The following options will override the IDLE 'settings' configuration: -e open an edit window -i open a shell window The following options imply -i and will open a shell: -c cmd run the command in a shell, or -r file run script from file -d enable the debugger -s run $IDLESTARTUP or $PYTHONSTARTUP before anything else -t title set title of shell window A default edit window will be bypassed when -c, -r, or - are used. [arg]* are passed to the command (-c) or script (-r) in sys.argv[1:]. Examples: idle Open an edit window or shell depending on IDLE's configuration. idle foo.py foobar.py Edit the files, also open a shell if configured to start with shell. idle -est "Baz" foo.py Run $IDLESTARTUP or $PYTHONSTARTUP, edit foo.py, and open a shell window with the title "Baz". idle -c "import sys; print sys.argv" "foo" Open a shell window and run the command, passing "-c" in sys.argv[0] and "foo" in sys.argv[1]. idle -d -s -r foo.py "Hello World" Open a shell window, run a startup script, enable the debugger, and run foo.py, passing "foo.py" in sys.argv[0] and "Hello World" in sys.argv[1]. echo "import sys; print sys.argv" | idle - "foobar" Open a shell window, run the script piped in, passing '' in sys.argv[0] and "foobar" in sys.argv[1]. cCstat}t}t}d}d}t}y#tjtjdd\}}WnMtjk r}tjj dt |tjj t tj dnXx.|D]&\} } | dkr| }t}n| dkrt}t}n| dkrt}n| dkr$tj j t tj n| d kr9t}n| d krNtan| d kr| }tjj|rund G|GHtj t}n| d krt}t}n| dkr| t_t}qqW|r|ddkrtjj}t}nx=tttjD]&} tjjtj| tj| RR=RRRRt ImportErrorRRRktidlelib.EditorWindowRRtidlelib.FileListRtidlelib.ColorDelegatorRtidlelib.UndoDelegatorRtidlelib.OutputWindowRtidlelib.configHandlerR R(R R R R Rt ascii_letterstdigitsRRRRtsignalRRRRRt showwarningR#Rt checkcacheR+R,RRRt RPCClientRRRt TextIOBaseRRRRRR!R(((s%/usr/lib/python2.7/idlelib/PyShell.pyts                        d