Ñò
ïžòKc        (   @   sB  d  d k  Z  d  d k Z  d  d k Z d  d k Z d  d k Z d  d k Z d  d k Z d  d k Z d  d k Z d  d k	 Z	 d  d k
 Z
 d  d k Z d  d k Z d  d k l Z y d  d k TWn- e j
 o! e i d IJe i d ƒ n Xd  d k Z d  d k l Z l Z d  d k l Z d  d k l Z d  d	 k l Z d  d
 k l Z d  d k l Z d  d k Z d  d k Z d  d k Z d  d k Z e i  e i! d Z" d Z# y d  d k$ l% Z% Wn e j
 o d Z% n Xe i a& y d  d k' Z' Wn e j
 o n2 Xe( e( d „ Z) e) e' _* e( e( d „ Z+ e+ e' _, e( e i- d „ Z. e. e _- d e f d „  ƒ  YZ/ d e f d „  ƒ  YZ0 d e f d „  ƒ  YZ1 d e f d „  ƒ  YZ2 d e i3 f d „  ƒ  YZ4 d e f d „  ƒ  YZ5 d e f d  „  ƒ  YZ6 d! e7 f d" „  ƒ  YZ8 d# Z9 d$ „  Z: e; d% j o e i< d% e i< d <e: ƒ  n d S(&   iÿÿÿÿN(   t   InteractiveInterpreter(   t   *sK   ** IDLE can't import Tkinter.  Your Python may not be configured for Tk. **i   (   t   EditorWindowt   fixwordbreaks(   t   FileList(   t   ColorDelegator(   t   UndoDelegator(   t   OutputWindow(   t   idleConft   _s	   127.0.0.1(   t   SIGTERMi   c         C   sO   t  } y/ | i t i |  | | | d | d | ƒƒ Wn t j
 o n Xd  S(   Nt   filet   line(   t   warning_streamt   writet   warningst   formatwarningt   IOError(   t   messaget   categoryt   filenamet   linenoR   R   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   idle_showwarning:   s    c         C   sz   d } | d | | f 7} | d j o t i | | ƒ i ƒ  n | } | o | d | 7} n | d | i |  f 7} | S(   s   Format warnings the IDLE ways!   
Warning (from warnings module):
s     File "%s", line %s
s       %s
s   %s: %s
>>> N(   t   Nonet	   linecachet   getlinet   stript   __name__(   R   R   R   R   R   R   t   s(    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   idle_formatwarningC   s    ,c         C   si   t  i } h  } x? | i ƒ  D]1 }  |  d  |  d d j o | |  | |  <q q W| ƒ  | i | ƒ d S(   sv  Extend linecache.checkcache to preserve the <pyshell#...> entries

    Rather than repeating the linecache code, patch it to save the
    <pyshell#...> entries, call the original linecache.checkcache()
    (which destroys them), and then restore the saved entries.

    orig_checkcache is bound at definition time to the original
    method, allowing it to be patched.

    i   iÿÿÿÿs   <>N(   R   t   cachet   keyst   update(   R   t   orig_checkcacheR   t   save(    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   extended_linecache_checkcacheP   s    	 t   PyShellEditorWindowc           B   sz   e  Z d  Z d „  Z d d g Z d „  Z d d „ Z d d „ Z d	 „  Z	 d
 „  Z
 d „  Z d „  Z d „  Z d „  Z RS(   s6   Regular text edit window in IDLE, supports breakpointsc         G   sÀ   g  |  _  t i |  | Œ |  i i d |  i ƒ |  i i d |  i ƒ |  i i d |  i i ƒ t	 i
 i t i ƒ  d ƒ |  _ |  i i o |  i ƒ  n |  i i |  d „ } |  i i | ƒ d  S(   Ns   <<set-breakpoint-here>>s   <<clear-breakpoint-here>>s   <<open-python-shell>>s   breakpoints.lstc         S   s   | i  ƒ  |  ƒ  d  S(   N(   t   restore_file_breaks(   t   old_hookt   self(    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   filename_changed_hookv   s    
(   t   breakpointsR   t   __init__t   textt   bindt   set_breakpoint_heret   clear_breakpoint_heret   flistt
   open_shellt   ost   patht   joinR   t   GetUserCfgDirt   breakpointPatht   ioR   R%   t   filename_change_hookt   set_filename_change_hook(   R'   t   argsR(   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR*   k   s    	 	s   Set Breakpoints   <<set-breakpoint-here>>s   Clear Breakpoints   <<clear-breakpoint-here>>c      	   C   s¤   |  i  } |  i i } | i d d | d | d ƒ y |  i i | ƒ } Wn# t j
 o |  i i | ƒ n Xy& |  i i	 i
 i } | i | | ƒ Wn n Xd  S(   Nt   BREAKs   %d.0i   (   R+   R6   R   t   tag_addR)   t   indext
   ValueErrort   appendR/   t   pyshellt   interpt   debuggerR-   (   R'   R   R+   R   t   it   debug(    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   set_breakpoint   s    	c         C   sW   |  i  } |  i i } | p | i ƒ  d  St t | i d ƒ ƒ ƒ } |  i | ƒ d  S(   Nt   insert(   R+   R6   R   t   bellt   intt   floatR<   RD   (   R'   t   eventR+   R   R   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR-   �   s    	
c      	   C   s«   |  i  } |  i i } | p | i ƒ  d  St t | i d ƒ ƒ ƒ } y |  i i | ƒ Wn n X| i	 d d d ƒ y& |  i
 i i i } | i | | ƒ Wn n Xd  S(   NRE   R:   s   insert linestarts   insert lineend +1char(   R+   R6   R   RF   RG   RH   R<   R)   t   removet
   tag_removeR/   R?   R@   RA   R.   (   R'   RI   R+   R   R   RC   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR.   –   s"    	
c         C   s†   |  i  ox |  i } |  i i } | p | i ƒ  d  Sg  |  _  | i d d t ƒ y# |  i i i	 i
 } | i | ƒ Wq‚ q‚ Xn d  S(   NR:   s   1.0(   R)   R+   R6   R   RF   RK   t   ENDR/   R?   R@   RA   t   clear_file_breaks(   R'   R+   R   RC   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRM   ©   s    
	
	c      	   C   sà   |  i  } |  i i } y t |  i d ƒ i ƒ  } Wn t j
 o g  } n Xt |  i d ƒ } x3 | D]+ } | i | d ƒ p | i | ƒ qf qf W|  i	 ƒ  |  i  } | o# | i | d t
 | ƒ d ƒ n | i ƒ  d S(   s#   Save breakpoints when file is savedt   rt   wt   =s   
N(   R)   R6   R   t   openR5   t	   readlinesR   t
   startswithR   t   update_breakpointst   strt   close(   R'   t   breaksR   t   linest   new_fileR   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   store_file_breaks¸   s     	 
	#c         C   sÂ   |  i  i ƒ  |  i i } | d  j o d  St i i |  i ƒ o} t	 |  i d ƒ i
 ƒ  } xb | D]V } | i | d ƒ o< t | t | ƒ d ƒ } x | D] } |  i | ƒ q› Wq` q` Wn d  S(   NRN   RP   i   (   R+   R    R6   R   R   R1   R2   t   isfileR5   RQ   RR   RS   t   evalt   lenRD   (   R'   R   RX   R   t   breakpoint_linenumberst   breakpoint_linenumber(    (    s%   scripts/common/Lib/idlelib/PyShell.pyR%   ß   s      c         C   s4   |  i  } | i d ƒ } |  i | ƒ } | |  _ d S(   s3   Retrieves all the breakpoints in the current windowR:   N(   R+   t
   tag_rangest   ranges_to_linenumbersR)   (   R'   R+   t   rangest   linenumber_list(    (    s%   scripts/common/Lib/idlelib/PyShell.pyRT   ì   s    	c         C   s‰   g  } x| t  d t | ƒ d ƒ D]b } t t | | ƒ ƒ } t t | | d ƒ ƒ } x) | | j  o | i | ƒ | d 7} qX Wq W| S(   Ni    i   i   (   t   rangeR]   RG   RH   R>   (   R'   Rb   RX   R<   R   t   end(    (    s%   scripts/common/Lib/idlelib/PyShell.pyRa   ó   s      c         C   s   |  i  ƒ  t i |  ƒ d S(   s7   Extend base method - clear breaks when module is closedN(   RM   R   t   _close(   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRf     s    
(   s   Set Breakpoints   <<set-breakpoint-here>>(   s   Clear Breakpoints   <<clear-breakpoint-here>>N(   R   t
   __module__t   __doc__R*   t   rmenu_specsRD   R   R-   R.   RM   RZ   R%   RT   Ra   Rf   (    (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR$   h   s   						'			t   PyShellFileListc           B   s&   e  Z d  Z e Z d Z d d „ Z RS(   s8   Extend base class: IDLE supports a shell and breakpointsc         C   sW   |  i  o |  i  i i ƒ  n3 t |  ƒ |  _  |  i  o |  i  i ƒ  p d  Sn |  i  S(   N(   R?   t   topt   wakeupt   PyShellt   beginR   (   R'   RI   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR0     s    

	N(   R   Rg   Rh   R$   R   R   R?   R0   (    (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRj   
  s   t   ModifiedColorDelegatorc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s8   Extend base class: colorizer for the shell window itselfc         C   s   t  i |  ƒ |  i ƒ  d  S(   N(   R   R*   t   LoadTagDefs(   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR*   !  s    c         C   s7   |  i  d d d ƒ |  i d d d ƒ t i |  ƒ d  S(   Nt   TODOs   1.0t   iomarkt   SYNC(   RK   R;   R   t   recolorize_main(   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRt   %  s    c         C   s„   t  i |  ƒ t i d d d ƒ } |  i i h h d  d 6d  d 6d 6t i | d ƒ d 6t i | d ƒ d 6t i | d	 ƒ d	 6ƒ d  S(
   Nt   maint   Themet   namet
   backgroundt
   foregroundt   stdint   stdoutt   stderrt   console(   R   Rp   R   t	   GetOptiont   tagdefsR    R   t   GetHighlight(   R'   t   theme(    (    s%   scripts/common/Lib/idlelib/PyShell.pyRp   *  s    (   R   Rg   Rh   R*   Rt   Rp   (    (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRo     s   		t   ModifiedUndoDelegatorc           B   s&   e  Z d  Z d d „ Z d d „ Z RS(   s;   Extend base class: forbid insert/delete before the I/O markc         C   s_   y/ |  i  i | d d ƒ o |  i  i ƒ  d  SWn t j
 o n Xt i |  | | | ƒ d  S(   Nt   <Rr   (   t   delegatet   compareRF   t   TclErrorR   RE   (   R'   R<   t   charst   tags(    (    s%   scripts/common/Lib/idlelib/PyShell.pyRE   7  s    	c         C   s\   y/ |  i  i | d d ƒ o |  i  i ƒ  d  SWn t j
 o n Xt i |  | | ƒ d  S(   NRƒ   Rr   (   R„   R…   RF   R†   R   t   delete(   R'   t   index1t   index2(    (    s%   scripts/common/Lib/idlelib/PyShell.pyR‰   @  s    	N(   R   Rg   Rh   R   RE   R‰   (    (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR‚   4  s   	t   MyRPCClientc           B   s   e  Z d  „  Z RS(   c         C   s
   t  ‚ d S(   s0   Override the base class - just re-raise EOFErrorN(   t   EOFError(   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt
   handle_EOFL  s    (   R   Rg   RŽ   (    (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRŒ   J  s   t   ModifiedInterpreterc           B   s@  e  Z d  „  Z d Z d  Z d  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z d	 „  Z d
 „  Z d  Z d „  Z d  Z d „  Z d „  Z d „  Z d „  Z d Z d „  Z d  d „ Z d „  Z d „  Z d „  Z d  d „ Z d „  Z d „  Z d „  Z  d „  Z! d „  Z" d „  Z# d „  Z$ d „  Z% d „  Z& RS(!   c         C   sQ   | |  _  t i d i } t i |  d | ƒd  |  _ t |  _	 |  i
 ƒ  |  _ d  S(   Nt   __main__t   locals(   t	   tkconsolet   syst   modulest   __dict__R    R*   R   t   save_warnings_filterst   Falset
   restartingt   build_subprocess_arglistt   subprocess_arglist(   R'   R’   R‘   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR*   S  s    			i�"  c         C   s+   |  i  } t i t i t i | ƒ |  _ d  S(   N(   Rš   R1   t   spawnvt   P_NOWAITR“   t
   executablet   rpcpid(   R'   R9   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   spawn_subprocess_  s    	c      
   C   sõ   g  } t  i D] } | d | q ~ } d d d j o | i d ƒ n t i d d d d	 t d
 d ƒ} t d j o d | f } n d | f } t  i d  d j o! d t  i j o d t  i } n
 t  i } | g | d | t	 |  i
 ƒ g S(   Ns   -Wi   i   i    s   -QnewRu   t   Generals   delete-exitfunct   defaultt   typet   bools   idlelib.PyShells&   __import__('idlelib.run').run.main(%r)s   __import__('run').main(%r)i   t   wint    s   "%s"s   -c(   R“   t   warnoptionsR>   R   R~   R—   R   t   platformR�   RU   t   port(   R'   t   _[1]R   RO   t	   del_exitft   commandt   decorated_exec(    (    s%   scripts/common/Lib/idlelib/PyShell.pyR™   c  s    ($	c         C   sf  |  i  ƒ  t |  i f } x^ t d ƒ D]B } t i | ƒ y t | ƒ |  _ PWq& t i	 j
 o	 } q& Xq& W|  i
 ƒ  d  S|  i i i d ƒ y |  i i ƒ  Wn# t i j
 o } |  i ƒ  d  SX|  i i d |  i ƒ |  i i d |  i i ƒ |  i i d |  i i ƒ |  i i d |  i i ƒ |  i i d t ƒ |  i i d |  ƒ |  i ƒ  |  i ƒ  |  i S(	   Ni   i
   Rz   R{   R|   R/   R   R@   (   RŸ   t	   LOCALHOSTR¨   Rd   t   timet   sleepRŒ   t   rpccltt   sockett   errort   display_port_binding_errorR   t   listening_sockt
   settimeoutt   acceptt   timeoutt   display_no_subprocess_errort   registerR’   R{   R|   R/   R   t   transfer_patht   poll_subprocess(   R'   t   addrRB   t   err(    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   start_subprocessw  s6    
 	



c      	   C   s™  |  i  o |  i St |  _  |  i ƒ  } | o" y t i |  i ƒ WqP qP Xn |  i i ƒ  |  i ƒ  |  i } | i	 } t
 | _	 |  i ƒ  y |  i i ƒ  Wn# t i j
 o } |  i ƒ  d  SX|  i ƒ  | i i d d ƒ | o | i d ƒ | i ƒ  n t | i ƒ d d d } | i | d | ƒ | i i d d ƒ | i i d d	 ƒ | i ƒ  | o  t i |  i ƒ } | i ƒ  n t
 |  _  |  i S(
   NRr   s   end-1cs   
i   i   RP   s	    RESTART t   restartt   left(   R˜   R°   t   Truet   getdebuggert   RemoteDebuggert   close_subprocess_debuggerRV   t   unix_terminateR’   t	   executingR—   RŸ   R¶   R±   R·   R¸   R   Rº   R+   R‰   R   t
   showpromptRG   t   widtht   mark_sett   mark_gravityt   restart_subprocess_debuggert   load_breakpoints(   R'   RC   R}   t   was_executingR½   t   halfbart   gui(    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   restart_subprocess˜  sF    
	
			



	c         C   s   |  i  i d d d h  ƒ d  S(   Nt   exect   interrupt_the_server(    (   R°   t
   remotecall(   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   __request_interruptÄ  s    c         C   s   t  i d |  i ƒ i ƒ  d  S(   Nt   target(   t	   threadingt   Threadt'   _ModifiedInterpreter__request_interruptt   start(   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   interrupt_subprocessÇ  s    c         C   sJ   y |  i  i ƒ  Wn t j
 o n X|  i ƒ  t |  i _ d  |  _  d  S(   N(   R°   RV   t   AttributeErrorRÅ   R—   R’   RÆ   R   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   kill_subprocessÊ  s    
c      	   C   st   t  t d ƒ o` y t i |  i t ƒ Wn t j
 o d SXy t i |  i d ƒ Wqp t j
 o d SXn d S(   s;   UNIX: make sure subprocess is terminated and collect statust   killNi    (   t   hasattrR1   RÝ   Rž   R
   t   OSErrort   waitpid(   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRÅ   Ó  s    c         C   s   |  i  d t i f ƒ d  S(   NsR   if 1:
        import sys as _sys
        _sys.path = %r
        del _sys
        
(   t
   runcommandR“   R2   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRº   á  s    c      	   C   sª  |  i  } | d  j o d  Sy | i |  i d d ƒ} Wn> t t t f j
 o) |  i i o d  Sd  } |  i	 ƒ  n X| o÷ |  i i
 ƒ  d  |  _ | \ } } |  i i } | d j o% | d  j	 o | t | ƒ IJqKnm | d j o% |  i i d ƒ o |  i ƒ  qKn; | d j o- d } t i | I| IJ| | I| IJn y |  i i ƒ  Wqvt j
 o qvXn |  i i p# |  i i i |  i i |  i ƒ n d  S(   Nt   waitgš™™™™™©?t   OKt	   EXCEPTIONs   <<toggle-jit-stack-viewer>>t   ERRORs/   PyShell.ModifiedInterpreter: Subprocess ERROR:
(   R°   R   t   pollresponset
   active_seqR�   R   t   KeyboardInterruptR’   t   closingRÐ   t   resetoutputR}   t   reprt   getvart   remote_stack_viewerR“   t
   __stderr__t   endexecutingRÛ   R+   t   aftert   pollintervalR»   (   R'   t   cltt   responset   howt   whatR}   t   errmsg(    (    s%   scripts/common/Lib/idlelib/PyShell.pyR»   ê  s@    			c         C   s   | |  _  d  S(   N(   RA   (   R'   RA   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   setdebugger  s    c         C   s   |  i  S(   N(   RA   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRÂ     s    c         C   s   |  i  i i d |  i ƒ d S(   s“  Initiate 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 exceptiopn.  It is queried through
        the RPC mechanism.

        i,  N(   R’   R+   Rð   Rí   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   open_remote_stack_viewer  s    
c         C   s  d d  k  } |  i i d d d h  ƒ } | d  j o |  i i i ƒ  d  S| i |  i | ƒ } d d k l	 } l
 } t |  i i ƒ } t i d d d ƒ } t i | d	 ƒ d
 } | | d | d d ƒ}	 |	 i i d d d d ƒ | |	 i d  | ƒ }
 |
 i ƒ  d  S(   NiÿÿÿÿRÑ   t   stackviewerR/   (   t   ScrolledCanvast   TreeNodeRu   Rv   Rw   t   normalRx   t   bgt   highlightthicknessi    t   expandi   t   fillt   both(   s   flist(   t   RemoteObjectBrowserR°   t   remotequeueR   R’   t   rootRF   t   StubObjectTreeItemt
   TreeWidgetRú   Rû   t   ToplevelR   R~   R€   t   framet   packt   canvasRÿ   (   R'   R  t   oidt   itemRú   Rû   Rk   R�   Rx   t   sct   node(    (    s%   scripts/common/Lib/idlelib/PyShell.pyRí   %  s    i    c         C   s#   |  i  | ƒ } |  i | | ƒ d S(   s1   Like runsource() but assumes complete exec sourceN(   t   stuffsourcet   execfile(   R'   t   sourceR   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt
   execsource8  s    c         C   s³   | d j o t | d ƒ i ƒ  } n y t | | d ƒ } Wnc t t f j
 oQ |  i i ƒ  |  i i } | d IJ| d IJt	 i
 |  | ƒ |  i i ƒ  n X|  i | ƒ d S(   s   Execute an existing fileRN   RÑ   s    *** Error in script or command!
s"   Traceback (most recent call last):N(   R   RQ   t   readt   compilet   OverflowErrort   SyntaxErrorR’   Rê   R|   R    t   showsyntaxerrorRÇ   t   runcode(   R'   R   R  t   codet   tkerr(    (    s%   scripts/common/Lib/idlelib/PyShell.pyR  =  s    

c         C   sî   |  i  | ƒ } d |  _ t i |  _ t i d d d t ƒ t | t i	 ƒ oW d d k
 } y | i | i ƒ } Wq¥ t j
 o" |  i i ƒ  |  i d ƒ d SXn z t i |  | | ƒ SWd |  i d j	 o |  i t i (d |  _ n Xd S(   sB   Extend base class method: Stuff the source in the line cache firsti    t   actionR²   R   iÿÿÿÿNs    Unsupported characters in input
(   R  t   moreR   t   filtersR–   t   filterwarningst   SyntaxWarningt
   isinstancet   typest   UnicodeTypet	   IOBindingt   encodet   encodingt   UnicodeErrorR’   Rê   R   R    t	   runsourceR   (   R'   R  R   R#  (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR'  M  s"    	
c         C   sS   d |  i  } |  i  d |  _  | i d ƒ } t | ƒ d d | | f t i | <| S(   s"   Stuff source in the filename caches   <pyshell#%d>i   s   
i    (   t   gidt   splitR]   R   R   (   R'   R  R   RX   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR  d  s
    #c         C   s   |  i  d | f ƒ d S(   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%   scripts/common/Lib/idlelib/PyShell.pyt   prepend_syspathl  s    c   
      C   s  |  i  i } |  i ƒ  } | oÌ | \ } } } } | d j o d | d } n d | d | d f } | i d | ƒ | i | ƒ | i | ƒ }	 |	 o( |	 t j o | i d | d | ƒ n |  i  i ƒ  |  i d t	 | ƒ ƒ n |  i  i ƒ  t
 i |  | ƒ |  i  i ƒ  d S(   s˜   Extend base class method: Add Colorizing

        Color the offending position instead of printing it and pointing at it
        with a caret.

        i   s   iomark + %d charss&   iomark linestart + %d lines + %d charsRå   s
    wordstarts   SyntaxError: %s
N(   R’   R+   t   unpackerrorR;   t   seet   gett
   IDENTCHARSRê   R   RU   R    R  RÇ   (
   R'   R   R+   t   stufft   msgR   t   offsetR   t   post   char(    (    s%   scripts/common/Lib/idlelib/PyShell.pyR  x  s$    c   
      C   s‰   t  i ƒ  \ } } } | t j } | oA y- | \ } \ } } } }	 | p
 d } n Wqi d } qi Xn | o | | | |	 f Sd  Sd  S(   Ni    (   R“   t   exc_infoR  R   (
   R'   R¢   t   valuet   tbt   okR0  t   dummy_filenameR   R1  R   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR+  ”  s    c         C   sL   |  i  i ƒ  |  i ƒ  t i |  ƒ |  i  i d ƒ o |  i  i ƒ  n d S(   s1   Extend base class method to reset output properlys   <<toggle-jit-stack-viewer>>N(   R’   Rê   t   checklinecacheR    t   showtracebackRì   t   open_stack_viewer(   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR:  £  s
    
c         C   sH   t  i } x8 | i ƒ  D]* } | d  | d d j o | | =q q Wd  S(   Ni   iÿÿÿÿs   <>(   R   R   R   (   R'   t   ct   key(    (    s%   scripts/common/Lib/idlelib/PyShell.pyR9  «  s
    	 c         B   sU   |  i  i o |  i ƒ  d S|  i o  |  i i d d | f h  ƒ n | |  i Ud S(   s*   Run the code without invoking the debuggeri    RÑ   R  i   (   R’   RÆ   t   display_executing_dialogR°   R  R‘   (   R'   R  (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRá   ±  s    

 c         B   sß  |  i  i o |  i i ƒ  n |  i ƒ  |  i d
 j	 o |  i e i (d
 |  _ n |  i	 } zJyw |  i  i
 ƒ  | o5 |  i d
 j	 o% |  i i d d | f h  ƒ |  _ n* | o | i | |  i ƒ n | |  i UWnÌ e j
 oQ |  i  i p: e i d d d d d |  i  i ƒo ‚  q0|  i ƒ  q¤‚  nq t o+ |  i  i d IJ|  i ƒ  |  i  i ƒ  q¤|  i  i o  e |  i  _ |  i  i d	 IJq¤|  i ƒ  n XWd
 t p+ y |  i  i ƒ  WqÚe j
 o qÚXn Xd
 S(   s   Override base class methodRÑ   R  s   Exit?s   Do you want to exit altogether?R¡   t   yest   masters    IDLE internal error in runcode()Rè   N(   R’   RÆ   R@   RÐ   R9  R–   R   R   R  RA   t   beginexecutingR°   t
   asyncqueueRç   t   runR‘   t
   SystemExitRé   t   tkMessageBoxt   askyesnoR+   R:  t   use_subprocessR|   Rï   t   canceledR—   RÛ   (   R'   R  RA   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR  ½  sR    
	 

c         C   s   |  i  i i | ƒ d S(   s   Override base class methodN(   R’   R|   R   (   R'   R   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR   î  s    c         C   s    t  i d d d |  i i ƒd  S(   Ns   Port Binding Errorsg  IDLE can't bind TCP/IP port 8833, which is necessary to communicate with its Python execution server.  Either no networking is installed on this computer or another process (another IDLE?) is using the port.  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.R@  (   RE  t	   showerrorR’   R+   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR³   ò  s    c         C   s    t  i d d d |  i i ƒd  S(   Ns   Subprocess Startup Errors‰   IDLE's subprocess didn't make connection.  Either IDLE can't start a subprocess or personal firewall software is blocking the connection.R@  (   RE  RI  R’   R+   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR¸   þ  s    c         C   s    t  i d d d |  i i ƒd  S(   Ns   Already executingsY   The Python Shell window is already executing a command; please wait until it is finished.R@  (   RE  RI  R’   R+   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR>    s    N('   R   Rg   R*   R¨   R   R°   Rž   RŸ   R™   R¾   RÐ   RØ   RÚ   RÜ   RÅ   Rº   Rç   R»   RA   R÷   RÂ   Rø   Rí   R(  R  R  R'  R  R*  R  R+  R:  R9  Rá   R  R   R³   R¸   R>  (    (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR�   Q  sH   				!	,							&													1			Rm   c           B   s½  e  Z d  Z e Z e Z d3 d4 d5 d6 d7 d8 g Z e i	 ƒ  o e d =d9 e d <n d d k
 l Z d: d „ Z d „  Z e Z e Z e Z e Z e Z d „  Z d „  Z d: d „ Z d „  Z d: d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z  d  „  Z! d! „  Z" d" Z# d# Z$ d$ „  Z% d% „  Z& d& „  Z' d: d' „ Z( d( „  Z) d) „  Z* d* „  Z+ d+ „  Z, d, „  Z- d: d- „ Z. d: d. „ Z/ d: d/ „ Z0 d0 „  Z1 d1 „  Z2 d; d2 „ Z3 RS(<   s   Python ShellR   t   _Filet   editt   _EditRC   t   _Debugt   optionst   _Optionst   windowst   _Windowst   helpt   _Helpiýÿÿÿt   _Windowiþÿÿÿiÿÿÿÿ(   t   Historyc         C   sL  t  o6 |  i } | d d d j o | i d d ƒ q= n t |  ƒ |  _ | d  j o- t ƒ  } t | ƒ | i ƒ  t	 | ƒ } n t
 i |  | d  d  ƒ t |  _ d |  _ t |  _ |  i } | i d d ƒ | i d |  i ƒ | i d	 |  i ƒ | i d
 |  i ƒ | i d |  i ƒ | i d |  i ƒ | i d |  i ƒ | i d |  i ƒ t  o* | i d |  i ƒ | i d |  i ƒ n t i |  _ t i |  _  t i! |  _" d d  k# } t$ |  d | i% ƒ |  _ t$ |  d | i% ƒ |  _ t$ |  d | i% ƒ |  _& t  p% |  i t _ |  i t _ |  t _! n |  i' |  i ƒ |  _( d |  _) d  S(   Ni   i    t   shellt   She_lli   t   wrapR3  s   <<newline-and-indent>>s   <<plain-newline-and-indent>>s   <<interrupt-execution>>s   <<end-of-file>>s   <<open-stack-viewer>>s   <<toggle-debugger>>s   <<toggle-jit-stack-viewer>>s   <<view-restart>>s   <<restart-shell>>iÿÿÿÿR{   R|   R}   i2   (   s   shellRW  (*   RG  t
   menu_specsRE   R�   R@   R   t   TkR   t   withdrawRj   R   R*   RÁ   t   usetabst   indentwidtht   context_use_ps1R+   t	   configureR,   t   enter_callbackt   linefeed_callbackt   cancel_callbackt   eof_callbackR;  t   toggle_debuggert   toggle_jit_stack_viewert   view_restart_markt   restart_shellR“   R{   t   save_stdoutR|   t   save_stderrRz   t
   save_stdinR#  t
   PseudoFileR%  R}   RU  t   historyRñ   (   R'   R/   t   msR  R+   R#  (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR*   (  sN    		

				c         C   s   t  i d t ƒ S(   Nt
   shell_only(   R   t   GetExtensionsRÁ   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   get_standard_extension_namesY  s    c         C   s
   | a  d  S(   N(   R   (   R'   t   stream(    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   set_warning_streamb  s    c         C   s   t  S(   N(   R   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   get_warning_streamf  s    c         C   sd   |  i  o( t i d d d |  i ƒ|  i ƒ  d S|  i i ƒ  } | o |  i ƒ  n |  i ƒ  d  S(   Ns   Don't debug nows*   You can only toggle the debugger when idleR@  t   break(	   RÆ   RE  RI  R+   t   set_debugger_indicatorR@   RÂ   t   close_debuggert   open_debugger(   R'   RI   t   db(    (    s%   scripts/common/Lib/idlelib/PyShell.pyRd  i  s    
	

c         C   s%   |  i  i ƒ  } |  i d | ƒ d  S(   Ns   <<toggle-debugger>>(   R@   RÂ   t   setvar(   R'   Rx  (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRu  w  s    c         C   s   d  S(   N(    (   R'   RI   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRe  {  s    c         C   s“   |  i  i ƒ  } | oo |  i  i d  ƒ | i ƒ  |  i  i o t i |  i  i ƒ n |  i ƒ  |  i	 i
 d ƒ d t _ |  i ƒ  n |  i ƒ  d  S(   Ns   [DEBUG OFF]
s   >>> (   R@   RÂ   R÷   R   RV   R°   RÃ   t   close_remote_debuggerRê   R}   R   R“   t   ps1RÇ   Ru  (   R'   Rx  (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRv  ~  s    

	c         C   ss   |  i  i o t i |  i  i |  ƒ } n t i |  ƒ } |  i  i | ƒ | i ƒ  d t _ |  i	 ƒ  |  i
 ƒ  d  S(   Ns   [DEBUG ON]
>>> (   R@   R°   RÃ   t   start_remote_debuggert   DebuggerR÷   RÌ   R“   R{  RÇ   Ru  (   R'   t   dbg_gui(    (    s%   scripts/common/Lib/idlelib/PyShell.pyRw  ‹  s    
	
c         C   s   |  i  ƒ  d |  _ d S(   s   Helper for ModifiedInterpreteri   N(   Rê   RÆ   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRA  —  s    
c         C   s    d |  _  d |  _ |  i ƒ  d S(   s   Helper for ModifiedInterpreteri    N(   RÆ   RH  RÇ   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRï   œ  s    		c         C   s�   |  i  o7 t i d d d d d |  i ƒ} | t j o d Sn |  i o |  i i ƒ  n t |  _	 t |  _
 |  i i d |  i |  i ƒ d S(	   s   Extend EditorWindow.close()s   Kill?s6   The program is still running!
 Do you want to kill it?R¡   R7  t   parentt   canceli   N(   RÆ   RE  t   askokcancelR+   R—   t   readingRk   t   quitRÁ   RH  Ré   Rð   Rñ   t   close2(   R'   Ró   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRV   ¢  s    
	
		c         C   s   t  i |  ƒ S(   N(   R   RV   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR„  ³  s    c         C   s~   |  i  ƒ  t o |  i i ƒ  n |  i t _ |  i t _ |  i	 t _
 d |  _ d |  _ d |  i _ d |  _ t i |  ƒ d S(   sE   Extend EditorWindow._close(), shut down debugger and execution serverN(   Rv  RG  R@   RÜ   Rh  R“   R{   Ri  R|   Rj  Rz   R   R}   R/   R?   Rl  R   Rf   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRf   ¶  s    
			c         C   s   t  S(   s8   Override EditorWindow method: never remove the colorizer(   RÁ   (   R'   R   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   ispythonsourceÆ  s    c         C   s   |  i  S(   N(   t   shell_title(   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   short_titleÊ  s    s@   Type "copyright", "credits" or "license()" for more information.s˜  
    ****************************************************************
    Personal firewall software may warn about the connection IDLE
    makes to its subprocess using this computer's internal loopback
    interface.  This connection is not visible on any external
    interface and no data is sent to or received from the Internet.
    ****************************************************************
    c         C   s›   |  i  ƒ  t o/ d } |  i i ƒ  } | p |  i ƒ  t Sn d } |  i d t i t i	 |  i
 |  i t i | f ƒ |  i ƒ  d d  k } d  | _ t S(   Nt    s   ==== No Subprocess ====s&   Python %s on %s
%s
%s
IDLE %s      %s
iÿÿÿÿ(   Rê   RG  R@   R¾   RV   R—   R   R“   t   versionR§   t	   COPYRIGHTt   firewallmessaget   idlevert   IDLE_VERSIONRÇ   t   TkinterR   t   _default_rootRÁ   (   R'   t   nosubt   clientRŽ  (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRn   Ù  s    

		
	c      	   C   s  |  i  } z d |  _  |  i i ƒ  Wd  | |  _  X|  i i d d ƒ } t | ƒ d j o
 d } n t | t ƒ o< d d  k } y | i	 | i
 ƒ } Wq® t j
 o q® Xn |  i ƒ  |  i o d |  _ t p
 t ‚ qà n |  i o d |  _ d } n | S(   Ni   Rr   s   end-1ci    s   
iÿÿÿÿRˆ  (   R‚  Rk   t   mainloopR+   R-  R]   R   t   unicodeR#  R$  R%  R&  Rê   RH  RG  Rè   t	   endoffile(   R'   R"   R   R#  (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   readlineë  s.    		

	

	
	
c         C   s   t  S(   N(   RÁ   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   isatty  s    c         C   sã   y" |  i  i d d d ƒ o d  SWn n X|  i p |  i p) |  i ƒ  |  i i d ƒ |  i ƒ  d Sd |  _ d |  _	 |  i o? |  i i
 o2 |  i i ƒ  o |  i i ƒ  qÄ |  i i ƒ  n |  i o |  i i ƒ  n d S(   Ns	   sel.firsts   !=s   sel.lasts   KeyboardInterrupt
Rt  i    i   (   R+   R…   RÆ   R‚  Rê   R@   R   RÇ   R”  RH  R°   RÂ   RÐ   RÚ   Rk   Rƒ  (   R'   RI   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRb    s&    	

		
c         C   s–   |  i  o |  i o d  S|  i i d d d ƒ o |  i i d d d ƒ p d  S|  i  p |  i ƒ  |  i ƒ  n  d |  _ d |  _ |  i i	 ƒ  d S(   NRr   s   ==RE   s   end-1ci    i   Rt  (
   RÆ   R‚  R+   R…   Rê   RV   RH  R”  Rk   Rƒ  (   R'   RI   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRc    s    

		c         C   sB   |  i  o' |  i i d d ƒ |  i i d ƒ n |  i | ƒ d S(   NRE   s   
Rt  (   R‚  R+   RE   R,  t   newline_and_indent_event(   R'   RI   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRa  -  s
    
c         C   s  |  i  o |  i o d  SyR |  i i d d ƒ } | o2 |  i i d d d ƒ o |  i | | ƒ d Sn Wn n X|  i i d d d ƒ oN|  i i d	 d ƒ } | oI |  i i d d | d
 ƒ o, |  i |  i i | d | d
 ƒ | ƒ d S|  i i d	 d ƒ } | oI |  i i d d | d ƒ o, |  i |  i i | d | d
 ƒ | ƒ d S|  i i d d ƒ } | oD |  i i | d d d ƒ o' |  i |  i i | d
 d ƒ | ƒ n  |  i |  i i d d ƒ | ƒ d S|  i i d d d ƒ o |  i i d d ƒ n |  i i d d ƒ } | o% | i	 ƒ  o |  i i
 d d ƒ n |  i i d d d ƒ o |  i | ƒ d S|  i i d d ƒ |  i o' |  i i d d ƒ |  i i d ƒ n |  i | ƒ |  i i d	 d d ƒ |  i i ƒ  |  i o |  i i ƒ  n |  i ƒ  d S(   Ns	   sel.firsts   sel.lasts   <=Rr   Rt  RE   Rƒ   s   iomark linestartRz   i   i    s   insert lineends   >=R}   s   insert linestarts   end-1cs   end-1c linestarts   
(   RÆ   R‚  R+   R-  R…   t   recallt   tag_prevranget   tag_nextrangeRÉ   R   R‰   R—  RE   R,  R;   t   update_idletasksRk   Rƒ  t   runit(   R'   RI   t   selt   prevt   nextt   indicesR   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR`  6  sX    $'$''


c      
   C   s±  t  i d d | ƒ } t  i d d | ƒ } | i d ƒ } |  i i ƒ  zF|  i i d d d ƒ |  i i d d	 ƒ |  i i d
 d ƒ } | i ƒ  i	 d ƒ o& |  i
 | ƒ |  i i d
 d ƒ } n |  i i d | d i ƒ  ƒ t | ƒ d j o˜ t  i d | d ƒ i d ƒ } t  i d | ƒ i d ƒ } x[ | d D]K } | i | ƒ o | | t | ƒ } n |  i i d d | i ƒ  ƒ q8Wn Wd  |  i i d ƒ |  i i ƒ  Xd  S(   Ns   ^\s*\nRˆ  s   \n\s*$s   
R�  s   1.0Re   RE   s   end-1cs   insert linestartt   :i    i   s	   ^([ \t]*)(   t   ret   subR)  R+   t   undo_block_startRK   RÉ   R-  t   rstript   endswithR—  RE   R   R]   t   searcht   groupRS   R,  t   undo_block_stop(   R'   R   RI   RX   t   prefixt   orig_base_indentt   new_base_indentR   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR˜  u  s,     )c         C   sÙ   |  i  i d d ƒ } t | ƒ } x1 | d j o# | | d d j o | d } q$ W| d j o# | | d d j o | d } n x1 | d j o# | | d d j o | d } qˆ W| |  } |  i i | ƒ } d  S(   NRr   s   end-1ci    i   s    	s   
(   R+   R-  R]   R@   R'  (   R'   R   RB   R  (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRœ  �  s     "" "
c         C   ss   |  i  i o |  i  i ƒ  Sy t i Wn! t i d d d |  i ƒd  SXd d k l	 } | |  i
 |  i ƒ } d  S(   Ns   No stack traces@   There is no stack trace yet.
(sys.last_traceback is not defined)R@  iÿÿÿÿ(   t   StackBrowser(   R@   R°   Rí   R“   t   last_tracebackRE  RI  R+   t   StackViewerR­  R  R/   (   R'   RI   R­  t   sv(    (    s%   scripts/common/Lib/idlelib/PyShell.pyR;  �  s    	
c         C   s$   |  i  i d ƒ |  i  i d ƒ d  S(   NRr   R¿   (   R+   R,  (   R'   RI   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRf  «  s    c         C   s   |  i  i ƒ  d  S(   N(   R@   RÐ   (   R'   RI   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRg  ¯  s    c         C   sk   |  i  ƒ  y t t i ƒ } Wn d } n X|  i i | ƒ |  i i d d ƒ |  i ƒ  |  i	 i
 ƒ  d  S(   NRˆ  RE   s   end-1c(   Rê   RU   R“   R{  R}   R   R+   RÉ   t   set_line_and_columnR6   t
   reset_undo(   R'   R   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRÇ   ²  s    


c         C   s�   |  i  i d d ƒ } |  i o |  i i | ƒ n |  i  i d ƒ d j o |  i  i d d ƒ n |  i  i d d ƒ |  i ƒ  d t i _	 d  S(   NRr   s   end-1cs   end-2cs   
i    (
   R+   R-  Rl  t   history_storeRE   RÉ   R±  R“   R{   t	   softspace(   R'   R  (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRê   ½  s    

c         C   sv   y@ |  i  i d d ƒ t i |  | | d ƒ |  i  i d d ƒ Wn n X|  i o d |  _ t p
 t ‚ qr n d  S(   NRr   t   rightRÀ   i    (   R+   RÊ   R   R   RH  RG  Rè   (   R'   R   Rˆ   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR   Ç  s    
	(   s   fileRJ  (   RK  RL  (   s   debugRM  (   RN  RO  (   RP  RQ  (   s   helpRS  (   RP  RT  N(    (4   R   Rg   R†  Ro   R   R‚   R   RY  t   macosxSupportt   runningAsOSXAppt   IdleHistoryRU  R   R*   Rp  R—   R‚  RÆ   RH  R”  Ré   Rr  Rs  Rd  Ru  Re  Rv  Rw  RA  Rï   RV   R„  Rf   R…  R‡  RŠ  R‹  Rn   R•  R–  Rb  Rc  Ra  R`  R˜  Rœ  R;  Rf  Rg  RÇ   Rê   R   (    (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRm     sf   	1																					?				
Rk  c           B   s8   e  Z d d  „ Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s(   | |  _  | |  _ d |  _ | |  _ d  S(   Ni    (   RV  Rˆ   R´  R%  (   R'   RV  Rˆ   R%  (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR*   Õ  s    			c         C   s   |  i  i | |  i ƒ d  S(   N(   RV  R   Rˆ   (   R'   R   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR   Û  s    c         C   s   t  |  i | ƒ d  S(   N(   t   mapR   (   R'   t   l(    (    s%   scripts/common/Lib/idlelib/PyShell.pyt
   writelinesÞ  s    c         C   s   d  S(   N(    (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   flushá  s    c         C   s   t  S(   N(   RÁ   (   R'   (    (    s%   scripts/common/Lib/idlelib/PyShell.pyR–  ä  s    N(   R   Rg   R   R*   R   R»  R¼  R–  (    (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRk  Ó  s
   			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].
c          C   s–  t  a t }  t } t } d  } d  } t } y# t i t i d d ƒ \ } } WnO t i j
 o@ } t i i	 d t
 | ƒ ƒ t i i	 t ƒ t i d ƒ n XxB| D]:\ }	 }
 |	 d j o |
 } t  }  n |	 d j o t  } t  }  n |	 d j o
 t  } n |	 d j o t i i	 t ƒ t i ƒ  n |	 d	 j o
 t  }  n |	 d
 j o
 t a n |	 d j o: |
 } t i i | ƒ o n d G| GHt i ƒ  t  }  n |	 d j o t  } t  }  n |	 d j o |
 t _ t  }  q¦ q¦ W| o* | d d j o t i i ƒ  } t  }  n x= t t t i ƒ ƒ D]& } t i i t i | ƒ t i | <q+W| o) | d d j o d g | d t _ nõ | o d g | t _ nÚ | o | g | t _ n¿ | o„ t  } g  } x' | D] } | i t i i | ƒ ƒ qÕWx~ | D]? } t i i | ƒ } | t i j o t i i d | ƒ qÿqÿWn4 t i ƒ  } | t i j o t i i d | ƒ n t i d d d d d ƒ} | p | } |  p | }  t d d ƒ a t  t ƒ t i! ƒ  t" t ƒ a# t$ i% t t# ƒ | oI | p | p7 x | D] } t# i& | ƒ q
W| p t# i' ƒ  q:q>n |  oD t# i( ƒ  } | p d  St$ i) ƒ  o t# i* o | i+ i, ƒ  q‰n t# i- } | o | i. ƒ  n | oW t i/ i0 d ƒ p t i/ i0 d ƒ } | o' t i i | ƒ o | i1 i2 | ƒ qn | o | p | od | i1 i3 d t i f ƒ | o | i1 i4 | ƒ q~| o$ | i1 i5 | ƒ | i1 i2 | ƒ q~n t i6 ƒ  t i7 ƒ  d  S(   Ni   s   c:deihnr:st:s
   Error: %s
i   s   -cs   -ds   -es   -hs   -is   -ns   -rs   No script file: s   -ss   -ti    t   -Rˆ  Ru   R    s   editor-on-startupR¢   R£   t	   classNamet   Idlet   IDLESTARTUPt   PYTHONSTARTUPsb   if 1:
            import sys as _sys
            _sys.argv = %r
            del _sys
            
(8   RÁ   RG  R—   R   t   getoptR“   t   argvR²   R|   R   RU   t	   usage_msgt   exitR{   R1   R2   R[   Rm   R†  Rz   R  Rd   R]   t   abspathR>   t   dirnameRE   t   getcwdR   R~   RZ  R  R   R[  Rj   R/   R¶  t   setupAppRQ   t   newR0   R·  t   dictRk   t   lowerR?   Rw  t   environR-  R@   R  Rá   R  R*  R’  t   destroy(   t   enable_shellt   enable_editRC   t   cmdt   scriptt   startupt   optsR9   R0  t   ot   aRB   t   pathxR   t   dirt
   edit_startRV  (    (    s%   scripts/common/Lib/idlelib/PyShell.pyRu     sÚ    # 




	


	
 $  

 		
R�   (=   R1   t   os.pathR“   t   stringRÂ  R¢  R±   R®   RÖ   t	   tracebackR!  R¶  R   R  R    RŽ  t   ImportErrorRî   RÅ  RE  R   R   R   R   R   R   t   configHandlerR   RŒ  t   rpcR}  RÃ   t   ascii_letterst   digitsR.  R­   t   signalR
   R   R   R   R   t   showwarningR   R   t
   checkcacheR#   R$   Rj   Ro   R‚   t	   RPCClientRŒ   R�   Rm   t   objectRk  RÄ  Ru   R   R”   (    (    (    s%   scripts/common/Lib/idlelib/PyShell.pyt   <module>   s|   		
		¢ÿ ¾ÿ ÆH	~