
]c           @  s  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l	 Z	 d  d l
 Z
 d  d l Z d  d l Z d  d l m Z d  d l m Z m Z y d  d l TWn1 e k
 r e d d e j e j d  n Xd  d l Z d  d	 l m Z m Z d  d
 l m Z d  d l m Z d  d l m  Z  d  d l! m" Z" d  d l# m$ Z$ d  d l% m& Z& d  d l% m' Z' d  d l% m( Z( d  d l% m) Z) d  d l% m* Z* e j+ e j, d Z- d Z. d Z/ y d  d l0 m1 Z1 Wn e k
 rd Z1 n Xe j a2 d  d l3 Z3 e4 d  Z5 e4 e4 d  Z6 e4 a7 d   Z8 e8 e9  e4 e j: d  Z; e; e _: d e f d     YZ< d e f d      YZ= d! e f d"     YZ> d# e  f d$     YZ? d% e& j@ f d&     YZA d' e f d(     YZB d) e" f d*     YZC d+ e jD f d,     YZE d- eE f d.     YZF d/ eE f d0     YZG d1   ZH d2 ZI d3   ZJ eK d4 k re jL d4 e jL d) <eJ   n  e8 eM  d S(5   i(   t   print_functionN(   t   InteractiveInterpreter(   t   python_versiont   system(   t   *sJ   ** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **t   filei   (   t   EditorWindowt   fixwordbreaks(   t   FileList(   t   ColorDelegator(   t   UndoDelegator(   t   OutputWindow(   t   idleConf(   t   rpc(   t   Debugger(   t   RemoteDebugger(   t   macosxSupport(   t	   IOBindingt   _s	   127.0.0.1i    (   t   SIGTERMi   c         C  sy   d } | d | | f 7} | d k r; t j | |  } n  | j   } | r^ | d | 7} n  | d | j |  f 7} | S(   s   Format warnings the IDLE way.s!   
Warning (from warnings module):
s     File "%s", line %s
s       %s
s   %s: %s
N(   t   Nonet	   linecachet   getlinet   stript   __name__(   t   messaget   categoryt   filenamet   linenot   linet   s(    (    s    lib/python2.7/idlelib/PyShell.pyt   idle_formatwarning7   s    c         C  sf   | d k r t } n  y3 | j t |  | | | d |  | j d  Wn t t f k
 ra n Xd S(   s   Show Idle-format warning (after replacing warnings.showwarning).

    The differences are the formatter called, the file=None replacement,
    which can be None, the capture of the consequence AttributeError,
    and the output of a hard-coded prompt.
    R   s   >>> N(   R   t   warning_streamt   writeR   t   AttributeErrort   IOError(   R   R   R   R   R   R   (    (    s    lib/python2.7/idlelib/PyShell.pyt   idle_showwarningD   s    		c         C  sL   |  r* t  d k rH t j a  t t _ qH n t  d k	 rH t  t _ d a  n  d S(   s>   Replace warning.showwarning with idle_showwarning, or reverse.N(   t   _warnings_showwarningR   t   warningst   showwarningR$   (   t   capture(    (    s    lib/python2.7/idlelib/PyShell.pyt   capture_warningsW   s    		c         C  so   t  j } i  } xB t |  D]4 } | d  | d d k r | j |  | | <q q W| |   | j |  d S(   so  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()
    (skipping them), and then restore the saved entries.

    orig_checkcache is bound at definition time to the original
    method, allowing it to be patched.
    i   is   <>N(   R   t   cachet   listt   popt   update(   R   t   orig_checkcacheR*   t   savet   key(    (    s    lib/python2.7/idlelib/PyShell.pyt   extended_linecache_checkcachef   s    	
t   PyShellEditorWindowc           B  s   e  Z d  Z d   Z d d d d d g Z e d  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 j |  |  |  j j d |  j  |  j j d |  j  |  j j d |  j j  t	 j
 j t j   d  |  _ |  j j |  d  } |  j j |  |  j j r |  j   n  |  j   d  S(   Ns   <<set-breakpoint-here>>s   <<clear-breakpoint-here>>s   <<open-python-shell>>s   breakpoints.lstc         S  s   | j    |    d  S(   N(   t   restore_file_breaks(   t   old_hookt   self(    (    s    lib/python2.7/idlelib/PyShell.pyt   filename_changed_hook   s    
(   t   breakpointsR   t   __init__t   textt   bindt   set_breakpoint_heret   clear_breakpoint_heret   flistt
   open_shellt   ost   patht   joinR   t   GetUserCfgDirt   breakpointPatht   iot   filename_change_hookt   set_filename_change_hookR   R3   t   color_breakpoint_text(   R5   t   argsR6   (    (    s    lib/python2.7/idlelib/PyShell.pyR8      s    		t   Cuts   <<cut>>t   rmenu_check_cutt   Copys   <<copy>>t   rmenu_check_copyt   Pastes	   <<paste>>t   rmenu_check_pastes   Set Breakpoints   <<set-breakpoint-here>>s   Clear Breakpoints   <<clear-breakpoint-here>>c         C  se   |  j  d k r d S| r: t j   } t j | d  } n i d d 6d d 6} |  j j d |  d S(   s,   Turn colorizing of breakpoint text on or offNt   breakt    t
   foregroundt
   backgroundt   BREAK(   RD   R   R   t   CurrentThemet   GetHighlightR9   t
   tag_config(   R5   t   colort   themet   cfg(    (    s    lib/python2.7/idlelib/PyShell.pyRG      s    c         C  s   |  j  } |  j j } | j d d | d | d  y |  j j |  Wn! t k
 rk |  j j |  n Xy& |  j j	 j
 j } | j | |  Wn n Xd  S(   NRS   s   %d.0i   (   R9   RD   R   t   tag_addR7   t   indext
   ValueErrort   appendR=   t   pyshellt   interpt   debuggerR;   (   R5   R   R9   R   t   debug(    (    s    lib/python2.7/idlelib/PyShell.pyt   set_breakpoint   s    	c         C  sU   |  j  } |  j j } | s) | j   d  St t | j d    } |  j |  d  S(   Nt   insert(   R9   RD   R   t   bellt   intt   floatR[   Rb   (   R5   t   eventR9   R   R   (    (    s    lib/python2.7/idlelib/PyShell.pyR;      s    	
c         C  s   |  j  } |  j j } | s) | j   d  St t | j d    } y |  j j |  Wn n X| j	 d d d  y& |  j
 j j j } | j | |  Wn n Xd  S(   NRc   RS   s   insert linestarts   insert lineend +1char(   R9   RD   R   Rd   Re   Rf   R[   R7   t   removet
   tag_removeR=   R^   R_   R`   R<   (   R5   Rg   R9   R   R   Ra   (    (    s    lib/python2.7/idlelib/PyShell.pyR<      s"    	
c         C  s   |  j  r~ |  j } |  j j } | s2 | j   d  Sg  |  _  | j d d t  y# |  j j j	 j
 } | j |  Wq~ q~ Xn  d  S(   NRS   s   1.0(   R7   R9   RD   R   Rd   Ri   t   ENDR=   R^   R_   R`   t   clear_file_breaks(   R5   R9   R   Ra   (    (    s    lib/python2.7/idlelib/PyShell.pyRk      s    		
	c      	   C  sO  |  j  } |  j j } y+ t |  j d   } | j   } Wd QXWn t k
 rY g  } n Xy t |  j d  v } x1 | D]) } | j | d  sy | j |  qy qy W|  j	   |  j  } | r | j | d t
 |  d  n  Wd QXWn` t k
 rJ} t |  j d t  sKt |  j _ t j d d d	 d
 t
 |  d |  j  qKn Xd S(   s#   Save breakpoints when file is savedt   rNt   wt   =s   
t   breakpoint_error_displayedt   titles
   IDLE ErrorR   s$   Unable to update breakpoint list:
%st   parent(   R7   RD   R   t   openRC   t	   readlinesR#   t
   startswithR!   t   update_breakpointst   strt   getattrt   roott   Falset   TrueRo   t   tkMessageBoxt	   showerrorR9   (   R5   t   breaksR   t   old_filet   linest   new_fileR   t   err(    (    s    lib/python2.7/idlelib/PyShell.pyt   store_file_breaks   s.    	

	,c         C  s   |  j  j   |  j d  k r  d  S|  j j } | d  k r< d  St j j |  j  r t	 |  j d  j
   } x_ | D]T } | j | d  rp t | t |  d  } x | D] } |  j |  q Wqp qp Wn  d  S(   NRl   Rn   i   (   R9   R-   RD   R   R   R?   R@   t   isfileRC   Rr   Rs   Rt   t   evalt   lenRb   (   R5   R   R   R   t   breakpoint_linenumberst   breakpoint_linenumber(    (    s    lib/python2.7/idlelib/PyShell.pyR3   
  s    c         C  s4   |  j  } | j d  } |  j |  } | |  _ d S(   s3   Retrieves all the breakpoints in the current windowRS   N(   R9   t
   tag_rangest   ranges_to_linenumbersR7   (   R5   R9   t   rangest   linenumber_list(    (    s    lib/python2.7/idlelib/PyShell.pyRu     s    	c         C  s   g  } x t  d t |  d  D]f } t t | | j   } t t | | d j   } x' | | k  r | j |  | d 7} q^ Wq W| S(   Ni    i   i   (   t   rangeR   Re   Rf   t   stringR]   (   R5   R   R   R[   R   t   end(    (    s    lib/python2.7/idlelib/PyShell.pyR   !  s    c         C  s   |  j    t j |   d S(   s7   Extend base method - clear breaks when module is closedN(   Rk   R   t   _close(   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyR   2  s    
(   RI   s   <<cut>>RJ   (   RK   s   <<copy>>RL   (   RM   s	   <<paste>>RN   N(   s   Set Breakpoints   <<set-breakpoint-here>>N(   s   Clear Breakpoints   <<clear-breakpoint-here>>N(   R   t
   __module__t   __doc__R8   R   t   rmenu_specsRz   RG   Rb   R;   R<   Rk   R   R3   Ru   R   R   (    (    (    s    lib/python2.7/idlelib/PyShell.pyR2   }   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  sQ   |  j  r |  j  j j   n. t |   |  _  |  j  rJ |  j  j   sJ d  Sn  |  j  S(   N(   R^   t   topt   wakeupt   PyShellt   beginR   (   R5   Rg   (    (    s    lib/python2.7/idlelib/PyShell.pyR>   A  s    		N(   R   R   R   R2   R   R   R^   R>   (    (    (    s    lib/python2.7/idlelib/PyShell.pyR   8  s   t   ModifiedColorDelegatorc           B  s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s8   Extend base class: colorizer for the shell window itselfc         C  s   t  j |   |  j   d  S(   N(   R	   R8   t   LoadTagDefs(   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyR8   O  s    c         C  s7   |  j  d d d  |  j d d d  t j |   d  S(   Nt   TODOs   1.0t   iomarkt   SYNC(   Ri   RZ   R	   t   recolorize_main(   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyR   S  s    c         C  s{   t  j |   t j   } |  j j i i d  d 6d  d 6d 6t j | d  d 6t j | d  d 6t j | d  d 6 d  S(   NRR   RQ   t   stdint   stdoutt   stderrt   console(   R	   R   R   RT   t   tagdefsR-   R   RU   (   R5   RX   (    (    s    lib/python2.7/idlelib/PyShell.pyR   X  s    c         C  s+   x$ |  j  D] } |  j | d d  q
 Wd  S(   NR   R   (   R   Ri   (   R5   t   tag(    (    s    lib/python2.7/idlelib/PyShell.pyt   removecolorsb  s    (   R   R   R   R8   R   R   R   (    (    (    s    lib/python2.7/idlelib/PyShell.pyR   L  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- |  j  j | d d  r, |  j  j   d  SWn t k
 r@ n Xt j |  | | |  d  S(   Nt   <R   (   t   delegatet   compareRd   t   TclErrorR
   Rc   (   R5   R[   t   charst   tags(    (    s    lib/python2.7/idlelib/PyShell.pyRc   j  s    c         C  sX   y- |  j  j | d d  r, |  j  j   d  SWn t k
 r@ n Xt j |  | |  d  S(   NR   R   (   R   R   Rd   R   R
   t   delete(   R5   t   index1t   index2(    (    s    lib/python2.7/idlelib/PyShell.pyR   s  s    N(   R   R   R   R   Rc   R   (    (    (    s    lib/python2.7/idlelib/PyShell.pyR   g  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(   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyt
   handle_EOF  s    (   R   R   R   (    (    (    s    lib/python2.7/idlelib/PyShell.pyR   }  s   t   ModifiedInterpreterc           B  sI  e  Z d    Z d  Z d  Z d  Z d   Z d   Z d   Z	 e
 d d  Z d   Z d   Z d   Z d	   Z e
 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  sf   | |  _  t j d j } t j |  d | d  |  _ t |  _	 d  |  _
 t |  _ |  j j j |  _ d  S(   Nt   __main__t   locals(   t	   tkconsolet   syst   modulest   __dict__R   R8   R   t   save_warnings_filtersRy   t
   restartingt   subprocess_arglistt   PORTt   portt   compilet   compilert   flagst   original_compiler_flags(   R5   R   R   (    (    s    lib/python2.7/idlelib/PyShell.pyR8     s    					c         C  sL   |  j  d  k r! |  j   |  _  n  |  j  } t j t j t j |  |  _ d  S(   N(	   R   R   t   build_subprocess_arglistR?   t   spawnvt   P_NOWAITR   t
   executablet   rpcpid(   R5   RH   (    (    s    lib/python2.7/idlelib/PyShell.pyt   spawn_subprocess  s    	c         C  s  |  j  d k s t d   g  t j D] } d | ^ q% } d d d k r[ | j d  n  t j d d d	 d
 t d d } t d k r d | f } n d | f } t j	 d  d k r d t j
 k r d t j
 } n	 t j
 } | g | d | t |  j   g S(   Ni    s/   Socket should have been assigned a port number.s   -Wi   i   s   -Qnewt   maint   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   AssertionErrorR   t   warnoptionsR]   R   t	   GetOptionRy   R   t   platformR   Rv   (   R5   R   Rm   t	   del_exitft   commandt   decorated_exec(    (    s    lib/python2.7/idlelib/PyShell.pyR     s    	 "	c         C  s  t  |  j f } xZ t d  D]> } t j |  y t |  |  _ PWq t j k
 rY q Xq W|  j	   d  S|  j j j   d |  _ t d k r |  j j j t j t j d  n  |  j   |  j j j d  y |  j j   Wn t j k
 r|  j   d  SX|  j j d |  j  |  j j d |  j j  |  j j d |  j j  |  j j d |  j j  |  j j d	 |  j j  |  j j d
 t  |  j j d |   |  j d t  |  j   |  j S(   Ni   i   i    i
   R   R   R   R   R=   R   R_   t   with_cwd(    t   HOSTR   R   t   timet   sleepR   t   rpccltt   sockett   errort   display_port_binding_errorR   t   listening_sockt   getsocknameR   t
   setsockoptt
   SOL_SOCKETt   SO_REUSEADDRR   t
   settimeoutt   acceptt   timeoutt   display_no_subprocess_errort   registerR   R   R   R   R=   R   t   transfer_pathRz   t   poll_subprocess(   R5   t   addrt   i(    (    s    lib/python2.7/idlelib/PyShell.pyt   start_subprocess  s>    



RP   c         C  s  |  j  r |  j St |  _  |  j   } | rL y t j |  j  WqL qL Xn  |  j j   |  j   |  j } | j	 } t
 | _	 |  j   y |  j j   Wn t j k
 r |  j   d  SX|  j d |  | j   | j j d d  d | r | n d } t | j  t |  d d d } | j d	 j | |   | j j d
 d  | j j d
 d  | su| j   n  | rt j |  j  | j   n  |  j |  j  j! _" t
 |  _  |  j S(   NR   R   s   end-1cs	   RESTART: t   Shelli   i   Rn   s   
{0} {1} {0}t   restartt   left(#   R   R   Rz   t   getdebuggerR   t   close_subprocess_debuggert   closet   unix_terminateR   t	   executingRy   R   R   R   R   R   R   R   t   stop_readlineR9   R   Re   t   widthR   R!   t   formatt   mark_sett   mark_gravityt
   showpromptt   restart_subprocess_debuggert   load_breakpointsR   R   R   R   (   R5   R   R   Ra   R   t   was_executingR   t   halfbar(    (    s    lib/python2.7/idlelib/PyShell.pyt   restart_subprocess  sH    		
			


%	c         C  s   |  j  j d d d i   d  S(   Nt   exect   interrupt_the_server(    (   R   t
   remotecall(   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyt   __request_interrupt  s    c         C  s   t  j d |  j  j   d  S(   Nt   target(   t	   threadingt   Threadt'   _ModifiedInterpreter__request_interruptt   start(   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyt   interrupt_subprocess  s    c         C  sp   |  j  d  k	 r( |  j j j |  j   n  y |  j j   Wn t k
 rL n X|  j   t	 |  j _
 d  |  _ d  S(   N(   t   _afteridR   R   R9   t   after_cancelR   R   R"   R   Ry   R   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyt   kill_subprocess  s    
c         C  sn   t  t d  rj y t j |  j t  Wn t k
 r: d SXy t j |  j d  Wqj t k
 rf d SXn  d S(   s;   UNIX: make sure subprocess is terminated and collect statust   killNi    (   t   hasattrR?   R  R   R   t   OSErrort   waitpid(   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyR     s    c         C  sC   | r" d g } | j  t j  n	 t j } |  j d | f  d  S(   NRP   sR   if 1:
        import sys as _sys
        _sys.path = %r
        del _sys
        
(   t   extendR   R@   t
   runcommand(   R5   R   R@   (    (    s    lib/python2.7/idlelib/PyShell.pyR   '  s    		c         C  s  |  j  } | d  k r d  Sy | j |  j d d } Wn: t t t f k
 rq |  j j r^ d  Sd  } |  j	   n X| rn|  j j
   d  |  _ | \ } } |  j j } | d k r | d  k	 rFt t |  d | qFnl | d k r|  j j d  rF|  j   qFn> | d k rFd } t | | d t j t | | d | n  y |  j j   Wqnt k
 rjqnXn  |  j j s|  j j j |  j j |  j  |  _ n  d  S(	   Nt   waitg?t   OKR   t	   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   printt   reprt   getvart   remote_stack_viewerR   t
   __stderr__t   endexecutingR"   R9   t   aftert   pollintervalR   R
  (   R5   t   cltt   responset   howt   whatR   t   errmsg(    (    s    lib/python2.7/idlelib/PyShell.pyR   6  s@    		c         C  s   | |  _  d  S(   N(   R`   (   R5   R`   (    (    s    lib/python2.7/idlelib/PyShell.pyt   setdebugger^  s    c         C  s   |  j  S(   N(   R`   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyR   a  s    c         C  s   |  j  j j d |  j  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 exception.  It is queried through
        the RPC mechanism.

        i,  N(   R   R9   R"  R  (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyt   open_remote_stack_viewerd  s    
c         C  s   d d l  m } |  j j d d d i   } | d  k rK |  j j j   d  S| j |  j |  } d d l	 m
 } m } t |  j j  } t j   } t j | d  d } | | d	 | d
 d }	 |	 j j d d d d  | |	 j d  |  }
 |
 j   d  S(   Ni(   t   RemoteObjectBrowserR   t   stackviewerR=   (   t   ScrolledCanvast   TreeNodet   normalRR   t   bgt   highlightthicknessi    t   expandi   t   fillt   both(   R=   (   t   idlelibR+  R   t   remotequeueR   R   Rx   Rd   t   StubObjectTreeItemt   idlelib.TreeWidgetR-  R.  t   ToplevelR   RT   RU   t   framet   packt   canvasR2  (   R5   R+  t   oidt   itemR-  R.  R   RX   RR   t   sct   node(    (    s    lib/python2.7/idlelib/PyShell.pyR  q  s    i    c         C  s#   |  j  |  } |  j | |  d S(   s1   Like runsource() but assumes complete exec sourceN(   t   stuffsourcet   execfile(   R5   t   sourceR   (    (    s    lib/python2.7/idlelib/PyShell.pyt
   execsource  s    c         C  s   | d k r$ t | d  j   } n  y t | | d d t } WnW t t f k
 r |  j j   t	 d d |  j j
 t j |  |  |  j j   n X|  j |  d S(   s   Execute an existing fileRl   R   t   dont_inheritsB   *** Error in script or command!
Traceback (most recent call last):R   N(   R   Rr   t   readR   Rz   t   OverflowErrort   SyntaxErrorR   R  R  R   R   t   showsyntaxerrorR   t   runcode(   R5   R   RC  t   code(    (    s    lib/python2.7/idlelib/PyShell.pyRB    s    	c         C  s   |  j  |  } d |  _ t j |  _ t j d d d t  t | t  r t	 j
 d k r y# d t	 j
 | j t	 j
  f } Wq t k
 r |  j j   |  j d  d SXn  z t j |  | |  SWd |  j d k	 r |  j t j (d |  _ n  Xd S(	   sB   Extend base class method: Stuff the source in the line cache firsti    t   actionR   R   s   utf-8s   # -*- coding: %s -*-
%ss    Unsupported characters in input
N(   RA  t   moreR&   t   filtersR   t   filterwarningst   SyntaxWarningt
   isinstancet   unicodeR   t   encodingt   encodet   UnicodeErrorR   R  R!   R   t	   runsourceR   (   R5   RC  R   (    (    s    lib/python2.7/idlelib/PyShell.pyRV    s$    	c         C  sS   d |  j  } |  j  d |  _  | j d  } t |  d d | | f t j | <| S(   s"   Stuff source in the filename caches   <pyshell#%d>i   s   
i    (   t   gidt   splitR   R   R*   (   R5   RC  R   R   (    (    s    lib/python2.7/idlelib/PyShell.pyRA    s
    #c         C  s   |  j  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  (   R5   R   (    (    s    lib/python2.7/idlelib/PyShell.pyt   prepend_syspath  s    c   
      C  s  |  j  j } |  j   } | r | \ } } } } | d k rM d | d } n d | d | d f } | j d |  | j |  | j |  }	 |	 r |	 t k r | j d | d |  n  |  j  j   |  j d t	 |   n |  j  j   t
 j |  |  |  j  j   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   R9   t   unpackerrorRZ   t   seet   gett
   IDENTCHARSR  R!   Rv   R   RI  R   (
   R5   R   R9   t   stufft   msgR   t   offsetR   t   post   char(    (    s    lib/python2.7/idlelib/PyShell.pyRI    s$    c   
      C  s   t  j   \ } } } | t k } | re y+ | \ } \ } } } }	 | sQ d } n  Wqe d } qe Xn  | r{ | | | |	 f Sd  Sd  S(   Ni    (   R   t   exc_infoRH  R   (
   R5   R   t   valuet   tbt   okR_  t   dummy_filenameR   R`  R   (    (    s    lib/python2.7/idlelib/PyShell.pyRZ    s    c         C  sJ   |  j  j   |  j   t j |   |  j  j d  rF |  j  j   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(   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyRi    s
    
c         C  sF   t  j } x6 | j   D]( } | d  | d d k r | | =q q Wd  S(   Ni   is   <>(   R   R*   t   keys(   R5   t   cR0   (    (    s    lib/python2.7/idlelib/PyShell.pyRh    s    	c         B  sQ   |  j  j r |  j   d S|  j rB |  j j d d | f i   n | |  j Ud S(   s*   Run the code without invoking the debuggeri    R   RJ  i   (   R   R   t   display_executing_dialogR   R6  R   (   R5   RK  (    (    s    lib/python2.7/idlelib/PyShell.pyR    s    
	c         B  s  |  j  j r |  j j   n  |  j   |  j d k	 rN |  j e j (d |  _ n  |  j	 } zGyr |  j  j
   | r |  j d k	 r |  j j d d | f i   |  _ n' | r | j | |  j  n | |  j UWn e k
 r%|  j  j se j d d d d d |  j  j r  q"|  j   q  nx e r^e d d	 |  j  j |  j   |  j  j   q|  j  j re |  j  _ e d
 d	 |  j  j q|  j   n XWd e sy |  j  j   Wqe k
 rqXn  Xd S(   s   Override base class methodR   RJ  s   Exit?s   Do you want to exit altogether?R   t   yesRq   s    IDLE internal error in runcode()R   R  N(   R   R   R_   R   Rh  R   R   R&   RN  R`   t   beginexecutingR   t
   asyncqueueR  t   runR   t
   SystemExitR  R{   t   askyesnoR9   Ri  t   use_subprocessR  R   R!  t   canceledRy   R"   (   R5   RK  R`   (    (    s    lib/python2.7/idlelib/PyShell.pyRJ  
  sR    
	 	
c         C  s   |  j  j j |  d S(   s   Override base class methodN(   R   R   R!   (   R5   R   (    (    s    lib/python2.7/idlelib/PyShell.pyR!   ;  s    c         C  s    t  j d d d |  j j d  S(   Ns   Port Binding ErrorsA  IDLE 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.Rq   (   R{   R|   R   R9   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyR   ?  s    c         C  s    t  j d d d |  j j 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.Rq   (   R{   R|   R   R9   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyR   J  s    c         C  s    t  j d d d |  j j d  S(   Ns   Already executingsY   The Python Shell window is already executing a command; please wait until it is finished.Rq   (   R{   R|   R   R9   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyRm  R  s    N((   R   R   R8   R   R
  R   R   R   R   R   Ry   R   R  R	  R  R   R   R  R   R`   R)  R   R*  R  RW  RD  RB  RV  RA  RY  RI  RZ  Ri  Rh  R  RJ  R!   R   R   Rm  (    (    (    s    lib/python2.7/idlelib/PyShell.pyR     sH   	
			+-					&													1			R   c           B  s  e  Z d  e   d Z e Z e Z d2 d3 d4 d5 d6 d7 g Z d d l	 m
 Z
 d8 d  Z d   Z e Z e Z e Z e Z e Z e Z d   Z d   Z d8 d  Z d   Z d8 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& d8 d$  Z' d%   Z( d&   Z) d'   Z* d(   Z+ d)   Z, d8 d*  Z- d8 d+  Z. d8 d,  Z/ d-   Z0 d.   Z1 d9 d/  Z2 d0   Z3 d1   Z4 RS(:   s   Python s    ShellR   t   _Filet   editt   _EditRa   t   _Debugt   optionst   _Optionst   windowst   _Windowt   helpt   _Helpi(   t   Historyc         C  sa  t  r9 |  j } | d d d k r9 | j d d  q9 n  t |   |  _ | d  k r t   } t |  | j   t	 |  } n  t
 j |  | d  d   t |  _ d |  _ t |  _ |  j } | j d d  | j d |  j  | j d	 |  j  | j d
 |  j  | j d |  j  | j d |  j  | j d |  j  | j d |  j  t  r~| j d |  j  | j d |  j  n  t j |  _ t j |  _  t j! |  _" d d l# m$ } t% |  d | j&  |  _! t' |  d | j&  |  _ t' |  d | j&  |  _ t' |  d | j&  |  _( t  s?|  j t _ |  j t _ |  j! t _! n  |  j) |  j  |  _* d |  _+ d  S(   Ni   i    t   shellt   She_lli   t   wrapRb  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   R   R   i2   (   R  R  (,   Rt  t
   menu_specsRc   R   R_   R   t   TkR   t   withdrawR   R   R8   Rz   t   usetabst   indentwidtht   context_use_ps1R9   t	   configureR:   t   enter_callbackt   linefeed_callbackt   cancel_callbackt   eof_callbackRj  t   toggle_debuggert   toggle_jit_stack_viewert   view_restart_markt   restart_shellR   R   t   save_stdoutR   t   save_stderrR   t
   save_stdinR5  R   t   PseudoInputFileRS  t   PseudoOutputFileR   R  t   historyR#  (   R5   R=   t   msRx   R9   R   (    (    s    lib/python2.7/idlelib/PyShell.pyR8   p  sP    		

				c         C  s   t  j d t  S(   Nt
   shell_only(   R   t   GetExtensionsRz   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyt   get_standard_extension_names  s    c         C  s
   | a  d  S(   N(   R    (   R5   t   stream(    (    s    lib/python2.7/idlelib/PyShell.pyt   set_warning_stream  s    c         C  s   t  S(   N(   R    (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyt   get_warning_stream  s    c         C  s`   |  j  r0 t j d d d |  j |  j   d S|  j j   } | rR |  j   n
 |  j   d  S(   Ns   Don't debug nows*   You can only toggle the debugger when idleRq   RO   (	   R   R{   R|   R9   t   set_debugger_indicatorR_   R   t   close_debuggert   open_debugger(   R5   Rg   t   db(    (    s    lib/python2.7/idlelib/PyShell.pyR    s    		

c         C  s%   |  j  j   } |  j d |  d  S(   Ns   <<toggle-debugger>>(   R_   R   t   setvar(   R5   R  (    (    s    lib/python2.7/idlelib/PyShell.pyR    s    c         C  s   d  S(   N(    (   R5   Rg   (    (    s    lib/python2.7/idlelib/PyShell.pyR    s    c         C  s   |  j  j   } | r |  j  j d   | j   |  j  j rQ t j |  j  j  n  |  j   |  j	 j
 d  d t _ |  j   n  |  j   d  S(   Ns   [DEBUG OFF]
s   >>> (   R_   R   R)  R   R   R   R   t   close_remote_debuggerR  R   R!   R   t   ps1R   R  (   R5   R  (    (    s    lib/python2.7/idlelib/PyShell.pyR    s    

	c         C  sq   |  j  j r' t j |  j  j |   } n t j |   } |  j  j |  | j   d t _ |  j	   |  j
   d  S(   Ns   [DEBUG ON]
>>> (   R_   R   R   t   start_remote_debuggerR   R)  R   R   R  R   R  (   R5   t   dbg_gui(    (    s    lib/python2.7/idlelib/PyShell.pyR    s    
	
c         C  s   |  j    d |  _ d S(   s   Helper for ModifiedInterpreteri   N(   R  R   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyRo    s    
c         C  s    d |  _  d |  _ |  j   d S(   s   Helper for ModifiedInterpreteri    N(   R   Ru  R   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyR!    s    		c         C  sf   |  j  r= t j d d d d d |  j } | t k r= d Sn  |  j   t |  _ t |  _ t	 j
 |   S(   s   Extend EditorWindow.close()s   Kill?s7   Your program is still running!
 Do you want to kill it?R   Rf  Rq   t   cancel(   R   R{   t   askokcancelR9   Ry   R   Rz   Ru  R  R   R   (   R5   R%  (    (    s    lib/python2.7/idlelib/PyShell.pyR     s    	
		c         C  s|   |  j    t r  |  j j   n  |  j t _ |  j t _ |  j	 t _
 d |  _ d |  _ d |  j _ d |  _ t j |   d S(   sE   Extend EditorWindow._close(), shut down debugger and execution serverN(   R  Rt  R_   R  R  R   R   R  R   R  R   R   R   R=   R^   R  R   R   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyR     s    
			c         C  s   t  S(   s8   Override EditorWindow method: never remove the colorizer(   Rz   (   R5   R   (    (    s    lib/python2.7/idlelib/PyShell.pyt   ispythonsource  s    c         C  s   |  j  S(   N(   t   shell_title(   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyt   short_title  s    sH   Type "help", "copyright", "credits" or "license()" for more information.c         C  s   |  j    t r< d } |  j j   } | sB |  j   t Sn d } |  j d t j t j	 |  j
 | f  |  j j   |  j   d d  l } d  | _ t S(   NRP   s   ==== No Subprocess ====s   Python %s on %s
%s
%si(   R  Rt  R_   R   R   Ry   R!   R   t   versionR   t	   COPYRIGHTR9   t   focus_forceR   t   TkinterR   t   _default_rootRz   (   R5   t   nosubt   clientR  (    (    s    lib/python2.7/idlelib/PyShell.pyR     s    

	
	c         C  s'   |  j  s d  St |  _ |  j j   d  S(   N(   t   readingRz   t   _stop_readline_flagR   t   quit(   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyR   '  s    		c         C  s  |  j  } z d |  _  |  j j   Wd  | |  _  X|  j rF t |  _ d S|  j j d d  } t |  d k rv d } n  t | t	  r d d l
 m } y | j | j  } Wq t k
 r q Xn  |  j   |  j r d |  _ t s t  q n  |  j rd |  _ d } n  | S(	   Ni   RP   R   s   end-1ci    s   
i(   R   (   R  R   t   mainloopR  Ry   R9   R\  R   RQ  RR  R5  R   RT  RS  RU  R  Ru  Rt  R  t	   endoffile(   R5   R/   R   R   (    (    s    lib/python2.7/idlelib/PyShell.pyt   readline-  s4    		
			
					c         C  s   t  S(   N(   Rz   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyt   isattyJ  s    c         C  s   y  |  j  j d d d  r d  SWn n X|  j p9 |  j sd |  j   |  j j d  |  j   d Sd |  _ d |  _	 |  j r |  j j
 r |  j j   r |  j j   q |  j j   n  |  j r |  j j   n  d S(   Ns	   sel.firsts   !=s   sel.lasts   KeyboardInterrupt
RO   i    i   (   R9   R   R   R  R  R_   R!   R   R  Ru  R   R   R   R	  R   R  (   R5   Rg   (    (    s    lib/python2.7/idlelib/PyShell.pyR  M  s&    

			c         C  s   |  j  r |  j r d  S|  j j d d d  oD |  j j d d d  sK d  S|  j  sk |  j   |  j   n d |  _ d |  _ |  j j	   d S(   NR   s   ==Rc   s   end-1ci    i   RO   (
   R   R  R9   R   R  R   Ru  R  R   R  (   R5   Rg   (    (    s    lib/python2.7/idlelib/PyShell.pyR  c  s    	
		c         C  s@   |  j  r/ |  j j d d  |  j j d  n |  j |  d S(   NRc   s   
RO   (   R  R9   Rc   R[  t   newline_and_indent_event(   R5   Rg   (    (    s    lib/python2.7/idlelib/PyShell.pyR  r  s
    	c         C  s  |  j  r |  j r d  SyN |  j j d d  } | rd |  j j d d d  rd |  j | |  d Sn  Wn n X|  j j d d d  r|  j j d	 d  } | r |  j j d d | d
  r |  j |  j j | d | d
  |  d S|  j j d	 d  } | rK|  j j d d | d  rK|  j |  j j | d | d
  |  d S|  j j d d  } | r|  j j | d d d  r|  j |  j j | d
 d  |  n |  j |  j j d d  |  d S|  j j d d d  r|  j j d d  n  |  j j d d  } | r7| j	   r7|  j j
 d d  n  |  j j d d d  r`|  j |  d S|  j j d d  |  j r|  j j d d  |  j j d  n |  j |  |  j j d	 d d  |  j j   |  j r|  j j   n
 |  j   d S(   Ns	   sel.firsts   sel.lasts   <=R   RO   Rc   R   s   iomark linestartR   i   i    s   insert lineends   >=R   s   insert linestarts   end-1cs   end-1c linestarts   
(   R   R  R9   R\  R   t   recallt   tag_prevranget   tag_nextrangeR   R   R   R  Rc   R[  RZ   t   update_idletasksR   R  t   runit(   R5   Rg   t   selt   prevt   nextt   indicesR   (    (    s    lib/python2.7/idlelib/PyShell.pyR  {  sX    "'"'&		
c         C  s  t  j d d |  } t  j d d |  } | j d  } |  j j   z@|  j j d d d  |  j j d d	  |  j j d
 d  } | j   j	 d  r |  j
 |  |  j j d
 d  } n  |  j j d | d j    t |  d k rt  j d | d  j d  } t  j d |  j d  } xX | d D]I } | j |  ra| | t |  } n  |  j j d d | j    q5Wn  Wd  |  j j d  |  j j   Xd  S(   Ns   ^\s*\nRP   s   \n\s*$s   
R  s   1.0R   Rc   s   end-1cs   insert linestartt   :i    i   s	   ^([ \t]*)(   t   ret   subRX  R9   t   undo_block_startRi   R   R\  t   rstript   endswithR  Rc   R   R   t   searcht   groupRt   R[  t   undo_block_stop(   R5   R   Rg   R   t   prefixt   orig_base_indentt   new_base_indentR   (    (    s    lib/python2.7/idlelib/PyShell.pyR    s*    (c         C  s   |  j  j d d  } t |  } x. | d k rQ | | d d k rQ | d } q$ W| d k r | | d d k r | d } n  x. | d k r | | d d k r | d } q W| |  } |  j j |  d  S(   NR   s   end-1ci    i   s    	s   
(   R9   R\  R   R_   RV  (   R5   R   R   (    (    s    lib/python2.7/idlelib/PyShell.pyR    s    # #
c         C  so   |  j  j r |  j  j   Sy t j Wn! t j d d d |  j d  SXd d l m	 } | |  j
 |  j  d  S(   Ns   No stack traces@   There is no stack trace yet.
(sys.last_traceback is not defined)Rq   i(   t   StackBrowser(   R_   R   R  R   t   last_tracebackR{   R|   R9   t   idlelib.StackViewerR  Rx   R=   (   R5   Rg   R  (    (    s    lib/python2.7/idlelib/PyShell.pyRj    s    	
c         C  s$   |  j  j d  |  j  j d  d  S(   NR   R   (   R9   R[  (   R5   Rg   (    (    s    lib/python2.7/idlelib/PyShell.pyR    s    c         C  s   |  j  j d t  d S(   s&   Callback for Run/Restart Shell Cntl-F6R   N(   R_   R   Rz   (   R5   Rg   (    (    s    lib/python2.7/idlelib/PyShell.pyR    s    c         C  sk   |  j    y t t j  } Wn d } n X|  j j |  |  j j d d  |  j   |  j	 j
   d  S(   NRP   Rc   s   end-1c(   R  Rv   R   R  R   R!   R9   R   t   set_line_and_columnRD   t
   reset_undo(   R5   R   (    (    s    lib/python2.7/idlelib/PyShell.pyR     s    


c         C  s   |  j  j d d  } |  j r1 |  j j |  n  |  j  j d  d k r_ |  j  j d d  n  |  j  j d d  |  j   d t j _	 d  S(   NR   s   end-1cs   end-2cs   
i    (
   R9   R\  R  t   storeRc   R   R  R   R   t	   softspace(   R5   RC  (    (    s    lib/python2.7/idlelib/PyShell.pyR    s    	
c         C  sr   y@ |  j  j d d  t j |  | | d  |  j  j d d  Wn n X|  j rn d |  _ t sn t  qn n  d  S(   NR   t   rightR   i    (   R9   R   R   R!   Ru  Rt  R  (   R5   R   R   (    (    s    lib/python2.7/idlelib/PyShell.pyR!     s    		c         C  sH   y  |  j  j d d d  r d SWn t k
 r4 d SXt t |   j   S(   Ns	   sel.firstR   R   t   disabled(   R9   R   R   t   superR   RJ   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyRJ     s    c         C  s/   |  j  j d d d  r d St t |   j   S(   NRc   R   R   R  (   R9   R   R  R   RN   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyRN   !  s    (   R   Rv  (   Rw  Rx  (   Ra   Ry  (   Rz  R{  (   R|  R}  (   R~  R  N(    (5   R   R   R   R  R   R	   R   R
   R  t   idlelib.IdleHistoryR  R   R8   R  Ry   R  R   Ru  R  R  R  R  R  R  R  R  R  R  Ro  R!  R   R   R  R  R  R   R   R  R  R  R  R  R  R  R  Rj  R  R  R   R  R!   RJ   RN   (    (    (    s    lib/python2.7/idlelib/PyShell.pyR   Z  sd   	2																				?				
	t
   PseudoFilec           B  s;   e  Z d d   Z e d    Z e d    Z d   Z RS(   c         C  s(   | |  _  | |  _ d |  _ | |  _ d  S(   Ni    (   R  R   R  t	   _encoding(   R5   R  R   RS  (    (    s    lib/python2.7/idlelib/PyShell.pyR8   (  s    			c         C  s   |  j  S(   N(   R  (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyRS  .  s    c         C  s   d |  j  S(   Ns   <%s>(   R   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyt   name2  s    c         C  s   t  S(   N(   Rz   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyR  6  s    N(   R   R   R   R8   t   propertyRS  R  R  (    (    (    s    lib/python2.7/idlelib/PyShell.pyR  &  s   R  c           B  s   e  Z d    Z d   Z RS(   c         C  s   t  S(   N(   Rz   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyt   writable<  s    c         C  s   |  j  r t d   n  t |  t t t f k r t | t  r] t j | t d    } q t | t  r~ t j
 |  } q t | t  r t j
 |  } q t d t |  j   n  |  j j | |  j  S(   Ns   write to closed files   must be string, not (   t   closedR\   R   RR  Rv   t	   bytearrayRQ  t   __getitem__t   sliceR   t   __str__t	   TypeErrorR   R  R!   R   (   R5   R   (    (    s    lib/python2.7/idlelib/PyShell.pyR!   ?  s    	(   R   R   R  R!   (    (    (    s    lib/python2.7/idlelib/PyShell.pyR  :  s   	R  c           B  s>   e  Z d d   Z d   Z d d  Z d d  Z d   Z RS(   c         C  s#   t  j |  | | |  d |  _ d  S(   NRP   (   R  R8   t   _line_buffer(   R5   R  R   RS  (    (    s    lib/python2.7/idlelib/PyShell.pyR8   Q  s    c         C  s   t  S(   N(   Rz   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyt   readableU  s    ic         C  s  |  j  r t d   n  | d  k r- d } n1 t | t t f  s^ t d t |  j   n  |  j	 } d |  _	 | d k  r x t
 r |  j j   } | s Pn  | | 7} q WnS x9 t |  | k  r |  j j   } | s Pn  | | 7} q W| | |  _	 | |  } | S(   Ns   read from closed fileis   must be int, not RP   i    (   R  R\   R   RQ  Re   t   longR  R   R   R  Rz   R  R  R   (   R5   t   sizet   resultR   (    (    s    lib/python2.7/idlelib/PyShell.pyRF  X  s,    					  
c         C  s   |  j  r t d   n  | d  k r- d } n1 t | t t f  s^ t d t |  j   n  |  j	 ps |  j
 j   } | d k  r t |  } n  | j d d |  } | d k r | d } n  | | |  _	 | |  S(   Ns   read from closed fileis   must be int, not i    s   
i   (   R  R\   R   RQ  Re   R  R  R   R   R  R  R  R   t   find(   R5   R  R   t   eol(    (    s    lib/python2.7/idlelib/PyShell.pyR  o  s    		c         C  s   |  j  j   d  S(   N(   R  R   (   R5   (    (    s    lib/python2.7/idlelib/PyShell.pyR     s    N(   R   R   R   R8   R  RF  R  R   (    (    (    s    lib/python2.7/idlelib/PyShell.pyR  O  s
   	c         C  sJ   |  j  d k rF x4 d D]) } |  j | d d |  j | d   q Wn  d S(	   s6   Make paste replace selection on x11.  See issue #5124.t   x11t   Textt   Entryt   Spinboxs	   <<Paste>>s%   catch {%W delete sel.first sel.last}
N(   R  R  R  (   t   _windowingsystemt
   bind_class(   Rx   t   cls(    (    s    lib/python2.7/idlelib/PyShell.pyt   fix_x11_paste  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  t  t a t }  t } t } d  } d  } t } y# t j t j d d  \ } } Wn@ t j k
 r } t	 d | t
 f d t j t j d  n Xx;| D]3\ }	 }
 |	 d k r |
 } t }  n  |	 d k r t } t }  n  |	 d k r t } n  |	 d	 k r!t j j t
  t j   n  |	 d
 k r6t }  n  |	 d k rKt a n  |	 d k r|
 } t j j |  rrn  t	 d | d t j t j   t }  n  |	 d k rt } t }  n  |	 d k r |
 t _ t }  q q W| r| d d k rt j j   } t }  n  x= t t t j   D]& } t j j t j |  t j | <qW| rs| d d k rsd g | d t _ n | rd g | t _ n | r| g | t _ n | r,t } g  } x' | D] } | j t j j |   qWxy | D]= } t j j |  } | t j k rt j j d |  qqWn1 t j   } | t j k r]t j j d |  n  t j d d d d d } | p| } |  p| }  t d d  a  t  j!   d d l" m# } | t   t j j$ t j j t%  d  } t&   d k rt j j$ | d  } t  j' d |  n t( d  k rt j) d! k rt( d" k rId# n d$ } g  d4 D]% } t j j$ | d( | | f  ^ qV} g  | D] } t* d |  ^ q} t  j+ j, d) d* t- t   d+ |  n  t. t   t/ t   t0 t   a1 t2 j3 t  t1  t2 j4   r7t  j5 d, d-  t  j5 d, d.  t  j5 d, d/  n  | r| pF| sx4 | D]+ } t1 j6 |  d  k rQ| j7 |  qQqQW| st1 j8   qqn  |  rt1 j9   } | sd  St2 j4   rt1 j: r| j; j<   qn	 t1 j= } | r| j>   n  | rQt j? j@ d0  p t j? j@ d1  } | rQt j j |  rQ| jA jB |  qQn  | s]| r| jA jC d2 t j f  | r| jA jD |  q| r| jA jE |  | jA jB |  qn5 | rt2 jF t   } | r| jA jC d3 |  qn  x t1 jG r
t  jH   qWt  jI   t  t  d  S(5   Ni   s   c:deihnr:st:s   Error: %s
%sR   i   s   -cs   -ds   -es   -hs   -is   -ns   -rs   No script file: s   -ss   -ti    t   -RP   R   R   s   editor-on-startupR   R   t	   classNamet   Idlei(   t   fix_scalingt   Iconst   Windowss   idle.icoR   g      !@t   darwing333333!@s   .pngs   .gifi   i    i0   s	   idle_%d%st   wmt	   iconphotos   -defaultR  s   <B2>s   <B2-Motion>s   <<PasteSelection>>t   IDLESTARTUPt   PYTHONSTARTUPsb   if 1:
            import sys as _sys
            _sys.argv = %r
            del _sys
            
s   print('%s')(   i   i    i0   (J   R)   Rz   Rt  Ry   R   t   getoptR   t   argvR   R  t	   usage_msgR   t   exitR   R!   R?   R@   R   R   R  R   RF  R   R   t   abspathR]   t   dirnameRc   t   getcwdR   R   R  Rx   R  t   idlelib.runR  RA   t   __file__R   t   wm_iconbitmapt	   TkVersionR   t
   PhotoImaget   tkt   callRv   R   R  R   R=   R   t   setupAppt   isAquaTkt   unbind_classRr   Rh   t   newR>   t   dictR   t   lowerR^   R  t   environR\  R_   RB  R  RD  RY  t   tkVersionWarningt   inversedictR  t   destroy(   t   enable_shellt   enable_editRa   t   cmdt   scriptt   startupt   optsRH   R_  t   ot   aR   t   pathxR   t   dirt
   edit_startR  t   icondirt   iconfilet   extR  t	   iconfilest   iconsR  t   tkversionwarning(    (    s    lib/python2.7/idlelib/PyShell.pyR     s    
#					
				$

!/"%

		
R   (N   t
   __future__R    R?   t   os.pathR   R   R  R  R   R   R  RD   R   RK  R   R   R   R   R  t   ImportErrorR  R   R  R{   t   idlelib.EditorWindowR   R   t   idlelib.FileListR   t   idlelib.ColorDelegatorR	   t   idlelib.UndoDelegatorR
   t   idlelib.OutputWindowR   t   idlelib.configHandlerR   R5  R   R   R   R   R   t   ascii_letterst   digitsR]  R   R   t   signalR   R    R&   R   R   R$   R%   R)   Rz   t
   checkcacheR1   R2   R   R   R   t	   RPCClientR   R   R   t
   TextIOBaseR  R  R  R  R  R   R   R   Ry   (    (    (    s    lib/python2.7/idlelib/PyShell.pyt   <module>   s   	

		
	  4	>	
