U
    ¿|cZà  ã                
   @   sÔ  d dl Z edkr e jd e jd< zd dlT W n* ek
rV   ede jd edƒ‚Y nX e jdkržz d dl	Z	dZ
e	 d	¡ e
¡ W n eeefk
rœ   Y nX d d
lmZ edk rðeƒ at ¡  d dlmZ etƒ ejdde td edƒ‚d dlmZ d dlZd dlZd dlZd dlmZ d dlZd dlZd dlZd dl m!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) d dl*m+Z+ d dl*m,Z, d dl-m.Z.m/Z/ d dl0m1Z1 d dl2m3Z3 d dl*m4Z4 d dlm5Z5m6Z6m7Z7 d dl8m9Z9 dZ:d Z;e ja<d;dd„Z=da>d d!„ Z?e?d"ƒ dej@fd#d$„ZAeAe_@G d%d&„ d&e.ƒZBG d'd(„ d(e1ƒZCG d)d*„ d*e'ƒZDG d+d,„ d,e9ƒZEG d-d.„ d.e4jFƒZGd/d0„ ZHG d1d2„ d2eƒZIG d3d4„ d4e3ƒZJd5d6„ ZKd7ZLd8d9„ ZMedkrÈeMƒ  e?d:ƒ dS )<é    NÚ__main__zidlelib.pyshell)Ú*zJ** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **©Úfileé   Zwin32Zshcore)Ú
messageboxg      !@©Úfix_scalingzIdle Cannot Startz"Idle requires tcl/tk 8.5+, not %s.©Úparent)ÚInteractiveInterpreter)Úpython_version)ÚTextWrapper)ÚColorDelegator)ÚidleConf©Údebugger)Ú
debugger_r)ÚEditorWindowÚfixwordbreaks)ÚFileList)ÚOutputWindow)Úrpc)Úidle_formatwarningÚStdInputFileÚStdOutputFile)ÚUndoDelegatorz	127.0.0.1c              	   C   sP   |dkrt }z&| t| ||||d¡ | d¡ W n ttfk
rJ   Y nX dS )a   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.
    N)Úlineú>>> )Úwarning_streamÚwriter   ÚAttributeErrorÚOSError)ÚmessageÚcategoryÚfilenameÚlinenor   r   © r'   ú lib/python3.8/idlelib/pyshell.pyÚidle_showwarningE   s        ÿr)   c                 C   s0   | rt dkr,tja tt_nt dk	r,t t_da dS )z>Replace warning.showwarning with idle_showwarning, or reverse.N)Ú_warnings_showwarningÚwarningsÚshowwarningr)   )Zcapturer'   r'   r(   Úcapture_warningsX   s    r-   Tc                 C   sX   t j}i }t|ƒD ].}|dd… |dd…  dkr| |¡||< q|| ƒ | |¡ dS )ao  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.
    Nr   éÿÿÿÿú<>)Ú	linecacheÚcacheÚlistÚpopÚupdate)r%   Zorig_checkcacher1   ÚsaveÚkeyr'   r'   r(   Úextended_linecache_checkcacheg   s    r7   c                   @   s~   e Zd ZdZdd„ Zdddddd	gZd dd„Zdd„ Zd!dd„Zd"dd„Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )#ÚPyShellEditorWindowz6Regular text edit window in IDLE, supports breakpointsc                 G   s”   g | _ tj| f|žŽ  | j d| j¡ | j d| j¡ | j d| jj¡ t	j
 tjd¡| _| jj| fdd„}| j |¡ | jjrˆ|  ¡  |  ¡  d S )Nú<<set-breakpoint-here>>ú<<clear-breakpoint-here>>z<<open-python-shell>>zbreakpoints.lstc                 S   s   |  ¡  | ƒ  d S ©N)Úrestore_file_breaks)Zold_hookÚselfr'   r'   r(   Úfilename_changed_hookŒ   s    z;PyShellEditorWindow.__init__.<locals>.filename_changed_hook)Úbreakpointsr   Ú__init__ÚtextÚbindÚset_breakpoint_hereÚclear_breakpoint_hereÚflistÚ
open_shellÚosÚpathÚjoinr   ZuserdirÚbreakpointPathÚioZfilename_change_hookZset_filename_change_hookr%   r<   Úcolor_breakpoint_text)r=   Úargsr>   r'   r'   r(   r@      s      ÿÿ
zPyShellEditorWindow.__init__)ZCutz<<cut>>Úrmenu_check_cut)ZCopyz<<copy>>Zrmenu_check_copy)ZPastez	<<paste>>Úrmenu_check_paste)NNN)zSet Breakpointr9   N)zClear Breakpointr:   NTc                 C   sD   | j dkrdS |r(t ¡ }t |d¡}n
dddœ}| j d|¡ dS )z,Turn colorizing of breakpoint text on or offNÚbreakÚ )Ú
foregroundÚ
backgroundÚBREAK)rK   r   ÚCurrentThemeÚGetHighlightrA   Z
tag_config)r=   ZcolorÚthemeZcfgr'   r'   r(   rL   ž   s    

z)PyShellEditorWindow.color_breakpoint_textc                 C   sˆ   | j }| jj}| dd| d|d  ¡ z| j |¡ W n  tk
rX   | j |¡ Y nX z| jj	j
j}| ||¡ W n   Y nX d S )NrT   z%d.0r   )rA   rK   r%   Útag_addr?   ÚindexÚ
ValueErrorÚappendrE   ÚpyshellÚinterpr   rC   )r=   r&   rA   r%   Údebugr'   r'   r(   Úset_breakpointª   s    z"PyShellEditorWindow.set_breakpointNc                 C   s>   | j }| jj}|s| ¡  d S tt| d¡ƒƒ}|  |¡ d S )NÚinsert)rA   rK   r%   ÚbellÚintÚfloatrY   r_   )r=   ÚeventrA   r%   r&   r'   r'   r(   rC   ¸   s    z'PyShellEditorWindow.set_breakpoint_herec                 C   sŠ   | j }| jj}|s| ¡  d S tt| d¡ƒƒ}z| j |¡ W n   Y nX | 	ddd¡ z| j
jjj}| ||¡ W n   Y nX d S )Nr`   rT   úinsert linestartzinsert lineend +1char)rA   rK   r%   ra   rb   rc   rY   r?   ÚremoveÚ
tag_removerE   r\   r]   r   rD   )r=   rd   rA   r%   r&   r^   r'   r'   r(   rD   Á   s$    ÿz)PyShellEditorWindow.clear_breakpoint_herec                 C   sd   | j r`| j}| jj}|s$| ¡  d S g | _ | ddt¡ z| jjj	j
}| |¡ W n   Y nX d S )NrT   ú1.0)r?   rA   rK   r%   ra   rg   ZENDrE   r\   r]   r   Úclear_file_breaks)r=   rA   r%   r^   r'   r'   r(   ri   Ô   s    z%PyShellEditorWindow.clear_file_breaksc              
   C   s  | j }| jj}z$t| jdƒ}| ¡ }W 5 Q R X W n tk
rJ   g }Y nX zjt| jdƒT}|D ]}| |d ¡s`| |¡ q`|  	¡  | j }|rª| |d t
|ƒ d ¡ W 5 Q R X W nT tk
r
 } z4t| jddƒsúd| j_tjdd	t
|ƒ | jd
 W 5 d}~X Y nX dS )z#Save breakpoints when file is savedÚrÚwú=Ú
Úbreakpoint_error_displayedFTz
IDLE Errorz$Unable to update breakpoint list:
%s)Útitler#   r   N)r?   rK   r%   ÚopenrJ   Ú	readlinesr"   Ú
startswithr    Úupdate_breakpointsÚstrÚgetattrÚrootrn   r   Ú	showerrorrA   )r=   Zbreaksr%   ÚfpÚlinesZnew_filer   Úerrr'   r'   r(   Ústore_file_breaksã   s2    
(ÿýz%PyShellEditorWindow.store_file_breaksc              	   C   s¢   | j  ¡  | jd krd S | jj}|d kr,d S tj | j¡ržt| jdƒ}| 	¡ }W 5 Q R X |D ]>}| 
|d ¡r^t|t|ƒd d … ƒ}|D ]}|  |¡ qŒq^d S )Nrj   rl   r   )rA   r4   rK   r%   rG   rH   ÚisfilerJ   rp   rq   rr   ÚevalÚlenr_   )r=   r%   rx   ry   r   Zbreakpoint_linenumbersZbreakpoint_linenumberr'   r'   r(   r<     s    

z'PyShellEditorWindow.restore_file_breaksc                 C   s$   | j }| d¡}|  |¡}|| _dS )z3Retrieves all the breakpoints in the current windowrT   N)rA   Z
tag_rangesÚranges_to_linenumbersr?   )r=   rA   ÚrangesZlinenumber_listr'   r'   r(   rs     s    

z&PyShellEditorWindow.update_breakpointsc                 C   sb   g }t dt|ƒdƒD ]H}tt|| jƒƒ}tt||d  jƒƒ}||k r| |¡ |d7 }q@q|S )Nr   é   r   )Úranger~   rb   rc   Ústringr[   )r=   r€   ry   rY   r&   Úendr'   r'   r(   r   %  s    
z)PyShellEditorWindow.ranges_to_linenumbersc                 C   s   |   ¡  t | ¡ dS )z7Extend base method - clear breaks when module is closedN)ri   r   Ú_close©r=   r'   r'   r(   r…   6  s    zPyShellEditorWindow._close)T)N)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r@   Úrmenu_specsrL   r_   rC   rD   ri   r{   r<   rs   r   r…   r'   r'   r'   r(   r8   ~   s&   ú	

	
*r8   c                   @   s"   e Zd ZdZeZdZddd„ZdS )ÚPyShellFileListz8Extend base class: IDLE supports a shell and breakpointsNc                 C   s8   | j r| j j ¡  nt| ƒ| _ | j r2| j  ¡ s2d S | j S r;   )r\   ÚtopÚwakeupÚPyShellÚbegin©r=   rd   r'   r'   r(   rF   E  s    

zPyShellFileList.open_shell)N)r‡   rˆ   r‰   rŠ   r8   r   r\   rF   r'   r'   r'   r(   rŒ   <  s   rŒ   c                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfc                 C   s   t  | ¡ |  ¡  d S r;   )r   r@   ÚLoadTagDefsr†   r'   r'   r(   r@   S  s    
zModifiedColorDelegator.__init__c                 C   s*   |   ddd¡ |  ddd¡ t | ¡ d S )NZTODOrh   ÚiomarkZSYNC)rg   rX   r   Úrecolorize_mainr†   r'   r'   r(   r•   W  s    z&ModifiedColorDelegator.recolorize_mainc              	   C   sJ   t  | ¡ t ¡ }| j d d dœt |d¡t |d¡t |d¡dœ¡ d S )N)rS   rR   ÚstdoutÚstderrÚconsole)Ústdinr–   r—   r˜   )r   r“   r   rU   Útagdefsr4   rV   )r=   rW   r'   r'   r(   r“   \  s    



üz"ModifiedColorDelegator.LoadTagDefsc                 C   s   | j D ]}|  |dd¡ qd S )Nr”   r„   )rš   rg   )r=   Útagr'   r'   r(   Úremovecolorsf  s    
z#ModifiedColorDelegator.removecolorsN)r‡   rˆ   r‰   rŠ   r@   r•   r“   rœ   r'   r'   r'   r(   r’   P  s
   
r’   c                   @   s$   e Zd ZdZddd„Zddd„ZdS )	ÚModifiedUndoDelegatorz;Extend base class: forbid insert/delete before the I/O markNc                 C   sN   z$| j  |dd¡r"| j  ¡  W d S W n tk
r8   Y nX t | |||¡ d S ©Nú<r”   )ÚdelegateÚcomparera   ÚTclErrorr   r`   )r=   rY   ÚcharsÚtagsr'   r'   r(   r`   n  s    

zModifiedUndoDelegator.insertc                 C   sL   z$| j  |dd¡r"| j  ¡  W d S W n tk
r8   Y nX t | ||¡ d S rž   )r    r¡   ra   r¢   r   Údelete)r=   Zindex1Zindex2r'   r'   r(   r¥   w  s    

zModifiedUndoDelegator.delete)N)N)r‡   rˆ   r‰   rŠ   r`   r¥   r'   r'   r'   r(   r   k  s   
	r   c                   @   s   e Zd Zdd„ ZdS )ÚMyRPCClientc                 C   s   t ‚dS )z0Override the base class - just re-raise EOFErrorN)ÚEOFErrorr†   r'   r'   r(   Ú
handle_EOFƒ  s    zMyRPCClient.handle_EOFN)r‡   rˆ   r‰   r¨   r'   r'   r'   r(   r¦     s   r¦   c                 C   s^   d|pd› d}| t |ƒkrNt| t |ƒ dƒ\}}|| d › |› |d › S |dd… S dS )z¹Return width long restart line formatted with filename.

    Fill line with balanced '='s, with any extras and at least one at
    the beginning.  Do not end with a trailing space.
    z= RESTART: ZShellz =r   rl   Néþÿÿÿ)r~   Údivmod)Úwidthr%   r›   ZdivÚmodr'   r'   r(   Úrestart_line‡  s
    r­   c                   @   s  e Zd Zdd„ ZdZdZdZdd„ Zdd„ Zdd	„ Z	d?dd„Z
dd„ Zdd„ Zdd„ Zdd„ Zd@dd„ZdZdd„ ZdZdd„ Zdd„ Zdd„ Zd d!„ Zd"Zd#d$„ ZdAd%d&„Zd'd(„ Zd)d*„ Zd+d,„ ZdBd-d.„Zd/d0„ Zd1d2„ Zd3d4„ Z d5d6„ Z!d7d8„ Z"d9d:„ Z#d;d<„ Z$d=d>„ Z%dS )CÚModifiedInterpreterc                 C   sB   || _ tjd j}tj| |d d| _d | _t| _	| j
jj| _d S )Nr   )ÚlocalsF)Ú	tkconsoleÚsysÚmodulesÚ__dict__r   r@   Ú
restartingÚsubprocess_arglistÚPORTÚportÚcompileÚcompilerÚflagsÚoriginal_compiler_flags)r=   r°   r¯   r'   r'   r(   r@   —  s    zModifiedInterpreter.__init__Nc                 C   s&   | j d kr|  ¡ | _ t | j ¡| _d S r;   )rµ   Úbuild_subprocess_arglistÚ
subprocessÚPopenÚ
rpcsubprocr†   r'   r'   r(   Úspawn_subprocess¤  s    

z$ModifiedInterpreter.spawn_subprocessc                 C   s\   | j dkstdƒ‚dd„ tjD ƒ}tjddddd	d
}d|f }tjg| d|t| j ƒg S )Nr   z/Socket should have been assigned a port number.c                 S   s   g | ]}d | ‘qS )z-Wr'   )Ú.0Úsr'   r'   r(   Ú
<listcomp>¬  s     z@ModifiedInterpreter.build_subprocess_arglist.<locals>.<listcomp>ÚmainÚGeneralzdelete-exitfuncFÚbool)ÚdefaultÚtypez&__import__('idlelib.run').run.main(%r)ú-c)r·   ÚAssertionErrorr±   Úwarnoptionsr   Ú	GetOptionÚ
executablert   )r=   rk   Z	del_exitfZcommandr'   r'   r(   r¼   ©  s    ÿ
 ÿ
z,ModifiedInterpreter.build_subprocess_arglistc              	   C   s\  t | jf}tdƒD ]8}t |¡ zt|ƒ| _W  qXW q tk
rH   Y qX q|  ¡  d S | jj	 
¡ d | _tdkrˆ| jj	 tjtjd¡ |  ¡  | jj	 d¡ z| j ¡  W n  tjk
rÌ   |  ¡  Y d S X | j d| j¡ | j d| jj¡ | j d| jj¡ | j d| jj¡ | j d	| jj¡ | j d
t¡ | j d| ¡ | jdd |  ¡  | jS )Né   r   r   é
   r˜   r™   r–   r—   rE   r0   r]   T©Úwith_cwd)ÚHOSTr·   r‚   ÚtimeÚsleepr¦   Úrpccltr"   Údisplay_port_binding_errorÚlistening_sockZgetsocknamer¶   Z
setsockoptÚsocketZ
SOL_SOCKETZSO_REUSEADDRrÀ   Z
settimeoutÚacceptÚtimeoutÚdisplay_no_subprocess_errorÚregisterr°   r™   r–   r—   rE   r0   Útransfer_pathÚpoll_subprocess)r=   ZaddrÚir'   r'   r(   Ústart_subprocessµ  sB    



 ÿz$ModifiedInterpreter.start_subprocessFrQ   c                 C   s2  | j r| jS d| _ |  ¡ }|r<zt | j¡ W n   Y nX | j ¡  |  ¡  | j}|j}d|_|  	¡  z| j 
¡  W n  tjk
r–   |  ¡  Y d S X | j|d | ¡  |j dd¡ | d¡ | t|j|ƒ¡ |j dd¡ |j dd¡ |s | ¡  |rt | j¡ | ¡  | j| jj_d| _ | jS )	NTFrÐ   r”   úend-1crm   ÚrestartÚleft)r´   rÕ   Úgetdebuggerr   Zclose_subprocess_debuggerÚcloseÚterminate_subprocessr°   Ú	executingrÀ   rÙ   rØ   rÚ   rÛ   rÝ   Ústop_readlinerA   r¥   r    r­   r«   Úmark_setÚmark_gravityÚ
showpromptZrestart_subprocess_debuggerÚload_breakpointsr»   r¸   r¹   rº   )r=   rÑ   r%   r^   r˜   Zwas_executingr'   r'   r(   Úrestart_subprocessà  sF    

z&ModifiedInterpreter.restart_subprocessc                 C   s   | j  dddi ¡ d S )NÚexecZinterrupt_the_serverr'   )rÕ   Z
remotecallr†   r'   r'   r(   Z__request_interrupt  s    z'ModifiedInterpreter.__request_interruptc                 C   s   t j| jd ¡  d S )N)Útarget)Ú	threadingZThreadÚ'_ModifiedInterpreter__request_interruptÚstartr†   r'   r'   r(   Úinterrupt_subprocess  s    z(ModifiedInterpreter.interrupt_subprocessc                 C   s~   | j d k	r| jj | j ¡ z| jj ¡  W n tk
r>   Y nX z| j ¡  W n tk
rb   Y nX |  ¡  d| j_	d | _d S )NF)
Ú_afteridr°   rA   Zafter_cancelrÕ   r×   rå   r!   ræ   rç   r†   r'   r'   r(   Úkill_subprocess  s    
z#ModifiedInterpreter.kill_subprocessc                 C   sP   z| j  ¡  W n tk
r$   Y dS X z| j  ¡  W n tk
rJ   Y dS X dS )z"Make sure subprocess is terminatedN)r¿   Úkillr"   Úwaitr†   r'   r'   r(   ræ   !  s    z(ModifiedInterpreter.terminate_subprocessc                 C   s2   |rdg}|  tj¡ ntj}|  d|f ¡ d S )NrQ   zRif 1:
        import sys as _sys
        _sys.path = %r
        del _sys
        
)Úextendr±   rH   Ú
runcommand)r=   rÑ   rH   r'   r'   r(   rÝ   .  s    üz!ModifiedInterpreter.transfer_pathc              
   C   s8  | j }|d krd S z|j| jdd}W n4 tttfk
rZ   | jjrJY d S d }|  ¡  Y nX |r| j 	¡  d | _|\}}| jj
}|dkr¤|d k	rìtt|ƒ|d nH|dkrÂ| j d¡rì|  ¡  n*|dkrìd}t||tjd t|||d z| j ¡  W n tk
r   Y nX | jjs4| jj | jj| j¡| _d S )	Ngš™™™™™©?)r÷   ZOKr   Z	EXCEPTIONú<<toggle-jit-stack-viewer>>ÚERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR:
)rÕ   ZpollresponseÚ
active_seqr§   r"   ÚKeyboardInterruptr°   Úclosingrí   Úresetoutputr˜   ÚprintÚreprÚgetvarÚremote_stack_viewerr±   Ú
__stderr__Úendexecutingr!   rA   ÚafterÚpollintervalrÞ   rô   )r=   ZcltÚresponseZhowZwhatr˜   Úerrmsgr'   r'   r(   rÞ   =  sD    


 ÿz#ModifiedInterpreter.poll_subprocessc                 C   s
   || _ d S r;   r   )r=   r   r'   r'   r(   Úsetdebuggere  s    zModifiedInterpreter.setdebuggerc                 C   s   | j S r;   r   r†   r'   r'   r(   rä   h  s    zModifiedInterpreter.getdebuggerc                 C   s   | j j d| j¡ dS )a’  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°   rA   r  r  r†   r'   r'   r(   Úopen_remote_stack_viewerk  s    
z,ModifiedInterpreter.open_remote_stack_viewerc                 C   s°   ddl m} | j dddi ¡}|d kr6| jj ¡  d S | | j|¡}ddlm	}m
} t| jjƒ}t ¡ }t |d¡d }|||dd	}	|	jjd
dd ||	jd |ƒ}
|
 ¡  d S )Nr   )Ú
debugobj_rrî   Zstackviewer)rE   )ÚScrolledCanvasÚTreeNodeÚnormalrS   )ZbgZhighlightthicknessr   Zboth)ÚexpandZfill)Úidlelibr  rÕ   Úremotequeuer°   rv   ra   ZStubObjectTreeItemZidlelib.treer  r  ZToplevelr   rU   rV   ÚframeZpackZcanvasr  )r=   r  ZoidÚitemr  r  r   rW   rS   ZscZnoder'   r'   r(   r  x  s    z'ModifiedInterpreter.remote_stack_viewerr   c                 C   s   |   |¡}|  ||¡ dS )z1Like runsource() but assumes complete exec sourceN)ÚstuffsourceÚexecfile©r=   Úsourcer%   r'   r'   r(   Ú
execsource‹  s    
zModifiedInterpreter.execsourcec              	   C   s®   |dkrFt  |¡.}| ¡ }tr<dtj |¡› d| d }W 5 Q R X zt||dƒ}W nH tt	fk
rž   | j
 ¡  td| j
jd t | |¡ | j
 ¡  Y nX |  |¡ dS )zExecute an existing fileNz__file__ = r'''z'''
z
del __file__rî   zB*** Error in script or command!
Traceback (most recent call last):r   )Útokenizerp   ÚreadÚuse_subprocessrG   rH   Úabspathr¸   ÚOverflowErrorÚSyntaxErrorr°   rÿ   r   r—   r   Úshowsyntaxerrorrë   Úruncode)r=   r%   r  rx   Úcoder'   r'   r(   r    s&    ÿÿ
þzModifiedInterpreter.execfilec                 C   s&   |   |¡}t|tƒst‚t | ||¡S )zBExtend base class method: Stuff the source in the line cache first)r  Ú
isinstancert   rÊ   r   Ú	runsourcer  r'   r'   r(   r$  ¤  s    
zModifiedInterpreter.runsourcec                 C   s>   d| j  }| j d | _ | d¡}t|ƒd d||ftj|< |S )z"Stuff source in the filename cachez<pyshell#%d>r   rm   r   )ÚgidÚsplitr~   r0   r1   )r=   r  r%   ry   r'   r'   r(   r  ­  s
    

zModifiedInterpreter.stuffsourcec                 C   s   |   d|f ¡ dS )z>Prepend sys.path with file's directory if not already includeda(  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%   r'   r'   r(   Úprepend_syspathµ  s    øz#ModifiedInterpreter.prepend_syspathc                 C   sÄ   | j }|j}| ddd¡ t ¡ \}}}t|ddƒp:|p:d}t|ddƒpJd}t|d	dƒpZd
}	|	d
krl|d7 }|dkr‚d|	d  }
nd|d |	d f }
| ||
¡ | ¡  |  d| ¡ | 	¡  dS )z§Override Interactive Interpreter method: Use Colorizing

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

        rû   rh   r„   ÚmsgrQ   z<no detail available>r&   r   Úoffsetr   ziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s
N)
r°   rA   rg   r±   Úexc_inforu   Zcolorize_syntax_errorrÿ   r    rë   )r=   r%   r°   rA   rÈ   ÚvalueÚtbr)  r&   r*  Úposr'   r'   r(   r   Á  s$    ÿz#ModifiedInterpreter.showsyntaxerrorc                 C   s6   | j  ¡  |  ¡  t | ¡ | j  d¡r2| j  ¡  dS )z1Extend base class method to reset output properlyrú   N)r°   rÿ   Úchecklinecacher   Úshowtracebackr  Úopen_stack_viewerr†   r'   r'   r(   r0  Û  s
    

z!ModifiedInterpreter.showtracebackc                 C   s>   t j}t| ¡ ƒD ]&}|d d… |dd …  dkr||= qd S )Nr   r.   r/   )r0   r1   r2   Úkeys)r=   Úcr6   r'   r'   r(   r/  ã  s    z"ModifiedInterpreter.checklinecachec                 C   s@   | j jr|  ¡  dS | jr0| j dd|fi ¡ nt|| jƒ dS )z*Run the code without invoking the debuggerr   rî   r!  r   )r°   rç   Údisplay_executing_dialogrÕ   r  rî   r¯   )r=   r"  r'   r'   r(   rù   é  s    zModifiedInterpreter.runcommandc                 C   sL  | j jr|  ¡  |  ¡  | j}zúzT| j  ¡  |sR| j	dk	rR| j	 
dd|fi ¡| _n |rf| || j¡ nt|| jƒ W n  tk
r¶   | j js°tjddd| j jdr¦‚ q²|  ¡  n‚ Y n`   trätd| j jd	 |  ¡  | j  ¡  n,| j jrd
| j _td| j jd	 n|  ¡  Y nX W 5 tsFz| j  ¡  W n tk
rD   Y nX X dS )úOverride base class methodNrî   r!  zExit?zDo you want to exit altogether?Zyes©rÇ   r   z IDLE internal error in runcode()r   Frý   )r°   rç   rí   r/  r   r  r  r!   ÚbeginexecutingrÕ   Z
asyncqueuerü   Úrunr¯   rî   Ú
SystemExitrþ   r   ZaskyesnorA   r0  r   r—   Úcanceled)r=   r"  r   r'   r'   r(   r!  õ  sR    

 ÿü
ÿ
zModifiedInterpreter.runcodec                 C   s   | j j |¡S )r5  )r°   r—   r    )r=   rÂ   r'   r'   r(   r    #  s    zModifiedInterpreter.writec                 C   s   t jdd| jjd d S )NzPort Binding ErroraA  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.r
   ©r   rw   r°   rA   r†   r'   r'   r(   rÖ   '  s
    øz.ModifiedInterpreter.display_port_binding_errorc                 C   s   t jdd| jjd d S )NzSubprocess Connection Errorz¢IDLE's subprocess didn't make connection.
See the 'Startup failure' section of the IDLE doc, online at
https://docs.python.org/3/library/idle.html#startup-failurer
   r;  r†   r'   r'   r(   rÛ   2  s
    ûz/ModifiedInterpreter.display_no_subprocess_errorc                 C   s   t jdd| jjd d S )NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.r
   r;  r†   r'   r'   r(   r4  :  s
    üz,ModifiedInterpreter.display_executing_dialog)FrQ   )F)N)N)&r‡   rˆ   r‰   r@   rô   rÕ   r¿   rÀ   r¼   rà   rí   rñ   ró   rõ   ræ   rÝ   rü   rÞ   r   r
  rä   r  r  r%  r  r  r$  r  r(  r   r0  r/  rù   r!  r    rÖ   rÛ   r4  r'   r'   r'   r(   r®   •  sF   	+
,
&
	
.r®   c                       sš  e Zd Zdeƒ  ZeZeZddddddgZ	e
jdg Zd	Zd
dlmZ dUdd„Zdd„ Zd	Zd	Zd	Zd	Zd	Zd	Zdd„ Zdd„ ZdVdd„Zdd„ ZdWdd„Zdd„ Zdd„ Zdd „ Zd!d"„ Zd#d$„ Z d%d&„ Z!d'd(„ Z"d)d*„ Z#d+d,„ Z$d-Z%d.d/„ Z&d0d1„ Z'd2d3„ Z(d4d5„ Z)dXd6d7„Z*d8d9„ Z+d:d;„ Z,d<d=„ Z-d>d?„ Z.d@dA„ Z/dYdBdC„Z0dZdDdE„Z1d[dFdG„Z2dHdI„ Z3dJdK„ Z4dLdM„ Z5d\dOdP„Z6‡ fdQdR„Z7‡ fdSdT„Z8‡  Z9S )]r   zIDLE Shell )r   Z_File)ZeditZ_Edit)r^   Z_Debug)ZoptionsZ_Options)ZwindowZ_Window)ÚhelpZ_Help)ZSqueezeú<<squeeze-current-text>>Fr   )ÚHistoryNc                 C   s$  t r&| j}|d d dkr&| dd¡ t| ƒ| _|d krVtƒ }t|ƒ | ¡  t|ƒ}t	 
| |d d ¡ d| _d| _ttdƒr‚tjnd| _| j d	¡d
 | _| j| _| j}|jdd | d| j¡ | d| j¡ | d| j¡ | d| j¡ | d| j¡ | d| j¡ | d| j¡ t r8| d| j¡ | d| j¡ |   | ¡}| d|j!¡ tj"| _#tj$| _%tj&| _'ddl(m)} t*| d|j+|j,ƒ| _&t-| d|j+|j,ƒ| _"t-| d|j+dƒ| _$t-| d|j+|j,ƒ| _.t sà| j"t_"| j$t_$| j&t_&zdd l/}|j0|_1W n   tj2t_$‚ Y nX |  3| j¡| _4d| _5d S )Nr   r   Úshell)r?  ZShe_llTé   Úps1r   rm   r.   Úchar)Úwrapz<<newline-and-indent>>z<<plain-newline-and-indent>>z<<interrupt-execution>>z<<end-of-file>>z<<open-stack-viewer>>ú<<toggle-debugger>>rú   z<<view-restart>>z<<restart-shell>>r=  )Úiomenur™   r–   r—   Úbackslashreplacer˜   é2   )6r  Ú
menu_specsr`   r®   r]   ÚTkr   ÚwithdrawrŒ   r   r@   ZusetabsZindentwidthÚhasattrr±   rA  Úsys_ps1r&  Zprompt_last_lineÚpromptrA   Z	configurerB   Úenter_callbackÚlinefeed_callbackÚcancel_callbackÚeof_callbackr1  Útoggle_debuggerÚtoggle_jit_stack_viewerÚview_restart_markÚrestart_shellZSqueezerZsqueeze_current_text_eventr–   Úsave_stdoutr—   Úsave_stderrr™   Ú
save_stdinr  rE  r   ÚencodingÚerrorsr   r˜   ÚpydocZ
plainpagerZpagerr  r>  Úhistoryr  )r=   rE   Zmsrv   rA   ZsqueezerrE  r[  r'   r'   r(   r@   ^  s€    

ÿ ÿ ÿ ÿ ÿzPyShell.__init__c                 C   s   t jddS )NT)Z
shell_only)r   ZGetExtensionsr†   r'   r'   r(   Úget_standard_extension_names¡  s    z$PyShell.get_standard_extension_namesc                 C   s   |a d S r;   ©r   )r=   Ústreamr'   r'   r(   Úset_warning_stream«  s    zPyShell.set_warning_streamc                 C   s   t S r;   r^  r†   r'   r'   r(   Úget_warning_stream¯  s    zPyShell.get_warning_streamc                 C   sH   | j r$tjdd| jd |  ¡  dS | j ¡ }|r<|  ¡  n|  ¡  d S )NzDon't debug nowz*You can only toggle the debugger when idler
   rP   )	rç   r   rw   rA   Úset_debugger_indicatorr]   rä   Úclose_debuggerÚopen_debugger)r=   rd   Údbr'   r'   r(   rR  ²  s    þ

zPyShell.toggle_debuggerc                 C   s   | j  ¡ }|  d|  ¡ d S )NrD  )r]   rä   Zsetvar©r=   re  r'   r'   r(   rb  À  s    
zPyShell.set_debugger_indicatorc                 C   s   d S r;   r'   r‘   r'   r'   r(   rS  Ä  s    zPyShell.toggle_jit_stack_viewerc                 C   sh   | j  ¡ }|r\| j  d ¡ | ¡  | j jr8t | j j¡ |  ¡  | j 	d¡ | j
| _|  ¡  |  ¡  d S )Nz[DEBUG OFF]
)r]   rä   r
  rå   rÕ   r   Zclose_remote_debuggerrÿ   r˜   r    rL  rM  rë   rb  rf  r'   r'   r(   rc  Ç  s    
zPyShell.close_debuggerc                 C   sX   | j jrt | j j| ¡}n
t | ¡}| j  |¡ | ¡  d| j | _	|  
¡  |  ¡  d S )Nz[DEBUG ON]
)r]   rÕ   r   Zstart_remote_debuggerr   ZDebuggerr
  rì   rL  rM  rë   rb  )r=   Zdbg_guir'   r'   r(   rd  Ô  s    
ÿ
zPyShell.open_debuggerc                 C   s    | j r
dnd}|  dd|¡ d S )NÚdisabledr  r^   z*tack*iewer)rç   Zupdate_menu_state)r=   Ústater'   r'   r(   Údebug_menu_postcommandà  s    zPyShell.debug_menu_postcommandc                 C   s   |   ¡  d| _dS )úHelper for ModifiedInterpreterTN)rÿ   rç   r†   r'   r'   r(   r7  ä  s    zPyShell.beginexecutingc                 C   s   d| _ d| _|  ¡  dS )rj  FN)rç   r:  rë   r†   r'   r'   r(   r  é  s    zPyShell.endexecutingc                 C   sD   | j r&tjddd| jd}|dkr&dS |  ¡  d| _d| _t | ¡S )zExtend EditorWindow.close()zKill?z7Your program is still running!
 Do you want to kill it?Úokr6  FZcancelT)	rç   r   ZaskokcancelrA   rè   r:  rþ   r   rå   )r=   r  r'   r'   r(   rå   ï  s    üzPyShell.closec                 C   sV   |   ¡  tr| j ¡  | jt_| jt_| j	t_
d| _d| _d| j_d| _t | ¡ dS )zEExtend EditorWindow._close(), shut down debugger and execution serverN)rc  r  r]   rõ   rV  r±   r–   rW  r—   rX  r™   r˜   rE   r\   r\  r   r…   r†   r'   r'   r(   r…   þ  s    
zPyShell._closec                 C   s   dS )z8Override EditorWindow method: never remove the colorizerTr'   r'  r'   r'   r(   Úispythonsource  s    zPyShell.ispythonsourcec                 C   s   | j S r;   )Úshell_titler†   r'   r'   r(   Úshort_title  s    zPyShell.short_titlezHType "help", "copyright", "credits" or "license()" for more information.c                 C   sŒ   | j  dd¡ |  ¡  tr:d}| j ¡ }|sF|  ¡  dS nd}tjt	_|  
dt	jt	j| j|f ¡ | j  ¡  |  ¡  dd l}d|_d |_dS )	Nr”   r`   rQ   Fz›==== No Subprocess ====

WARNING: Running IDLE without a Subprocess is deprecated
and will be removed in a later version. See Help/IDLE Help
for details.

zPython %s on %s
%s
%sr   T)rA   ré   rÿ   r  r]   rà   rå   r   Údisplayhookr±   r    ÚversionÚplatformÚ	COPYRIGHTZfocus_forcerë   ÚtkinterZ_support_default_rootZ_default_root)r=   ZnosubZclientrs  r'   r'   r(   r     s&    
ÿ
zPyShell.beginc                 C   s   | j s
d S d| _| j ¡  d S ©NT)ÚreadingÚ_stop_readline_flagr   Úquitr†   r'   r'   r(   rè   2  s    zPyShell.stop_readlinec                 C   s‚   | j }zd| _ | j ¡  W 5 || _ X | jr4d| _dS | j dd¡}t|ƒdkrRd}|  ¡  | jrnd| _t	snt
‚| jr~d| _d}|S )NTFrQ   r”   rá   r   rm   )ru  r   Úmainlooprv  rA   Úgetr~   rÿ   r:  r  rý   Ú	endoffile)r=   r5   r   r'   r'   r(   Úreadline8  s(    zPyShell.readlinec                 C   s   dS rt  r'   r†   r'   r'   r(   ÚisattyO  s    zPyShell.isattyc                 C   s¢   z| j  ddd¡rW d S W n   Y nX | jsT| jsT|  ¡  | j d¡ |  ¡  dS d| _d| _	| jrŽ| jj
rŽ| j ¡ r„| j ¡  n
| j ¡  | jrž| j ¡  dS )Nú	sel.firstz!=úsel.lastzKeyboardInterrupt
rP   FT)rA   r¡   rç   ru  rÿ   r]   r    rë   rz  r:  rÕ   rä   rí   ró   r   rw  r‘   r'   r'   r(   rP  R  s&    



zPyShell.cancel_callbackc                 C   sf   | j r| jsd S | j ddd¡r0| j ddd¡s4d S | j sL|  ¡  |  ¡  nd| _d| _| j 	¡  dS )Nr”   z==r`   rá   FTrP   )
rç   ru  rA   r¡   rÿ   rå   r:  rz  r   rw  r‘   r'   r'   r(   rQ  h  s    ÿ

zPyShell.eof_callbackc                 C   s0   | j r"| j dd¡ | j d¡ n
|  |¡ dS )Nr`   rm   rP   )ru  rA   r`   ÚseeÚnewline_and_indent_eventr‘   r'   r'   r(   rO  w  s
    
zPyShell.linefeed_callbackc                 C   s:  | j r| jsd S z8| j dd¡}|rF| j ddd¡rF|  ||¡ W dS W n   Y nX | j ddd¡rX| j d	d¡}|r°| j dd|d
 ¡r°|  | j |d |d
 ¡|¡ dS | j d	d¡}|rø| j dd|d ¡rø|  | j |d |d
 ¡|¡ dS | j dd¡}|r>| j |d dd¡r>|  | j |d
 d¡|¡ n|  | j dd¡|¡ dS | j ddd¡rx| j dd¡ | j dd¡}|r¤| 	¡ s¤| j 
dd¡ | j ddd¡rÄ|  |¡ dS | j dd¡ | jrö| j dd¡ | j d¡ n
|  |¡ | j d	dd¡ | j ¡  | jr.| j ¡  n|  ¡  dS )Nr}  r~  z<=r”   rP   r`   rŸ   úiomark linestartr™   r   r   zinsert lineendz>=r˜   re   rá   zend-1c linestartrm   )rç   ru  rA   ry  r¡   ÚrecallZtag_prevrangeZtag_nextrangeré   Ústripr¥   r€  r`   r  rX   Zupdate_idletasksr   rw  Úrunit)r=   rd   ÚselÚprevÚnextÚindicesrÂ   r'   r'   r(   rN  €  sZ    
ÿ


zPyShell.enter_callbackc              	   C   s6  t  dd|¡}t  dd|¡}| d¡}| j ¡  zè| j ddd¡ | j dd	¡ | j 	d
d¡}| 
¡  d¡r„|  |¡ | j 	d
d¡}| j d|d  ¡ ¡ t|ƒdkrt  d|d ¡ d¡}t  d|¡ d¡}|dd … D ]8}| |¡rþ||t|ƒd …  }| j dd| 
¡  ¡ qÜW 5 | j d¡ | j ¡  X d S )Nz^\s*\nrQ   z\n\s*$rm   r`   r…  rh   r„   rá   re   ú:r   r   z	^([ \t]*))ÚreÚsubr&  rA   Zundo_block_startr  Zundo_block_stoprg   ré   ry  ÚrstripÚendswithr€  r`   rƒ  r~   ÚsearchÚgrouprr   )r=   rÂ   rd   ry   ÚprefixZorig_base_indentZnew_base_indentr   r'   r'   r(   r‚  ¿  s*    



zPyShell.recallc                 C   s–   | j  dd¡}t|ƒ}|dkr8||d  dkr8|d }q|dkrX||d  dkrX|d }|dkrz||d  dkrz|d }qX|d |… }| j |¡ d S )Nr”   rá   r   r   z 	rm   )rA   ry  r~   r]   r$  )r=   r   rß   r'   r'   r(   r„  Ù  s    

zPyShell.runitc                 C   s\   | j jr| j  ¡ S z
tj W n    tjdd| jd Y d S X ddlm	} || j
| jƒ d S )NzNo stack tracez@There is no stack trace yet.
(sys.last_traceback is not defined)r
   r   )ÚStackBrowser)r]   rÕ   r  r±   Úlast_tracebackr   rw   rA   Zidlelib.stackviewerr‘  rv   rE   )r=   rd   r‘  r'   r'   r(   r1  ç  s    

ýzPyShell.open_stack_viewerc                 C   s   | j  d¡ | j  d¡ d S )Nr”   râ   )rA   r  r‘   r'   r'   r(   rT  õ  s    zPyShell.view_restart_markc                 C   s   | j jdd dS )z&Callback for Run/Restart Shell Cntl-F6TrÐ   N)r]   rí   r‘   r'   r'   r(   rU  ù  s    zPyShell.restart_shellc                 C   s:   |   ¡  | j | j¡ | j dd¡ |  ¡  | j ¡  d S )Nr`   rá   )	rÿ   r˜   r    rM  rA   ré   Úset_line_and_columnrK   Z
reset_undor†   r'   r'   r(   rë   ý  s
    zPyShell.showpromptc                 C   sP   | j jj}t|ddd}d | |¡¡}| d¡s:|d7 }| jj 	d|d¡ d S )Nr@  T)r«   ÚtabsizeZexpand_tabsrm   r  r—   )
r]   r°   r«   r   rI   rC  r  ZperZbottomr`   )r=   r)  r«   ÚwrapperZwrapped_msgr'   r'   r(   Úshow_warning  s    

zPyShell.show_warningc                 C   sb   | j  dd¡}| jr | j |¡ | j  d¡dkr>| j  dd¡ | j  dd¡ |  ¡  | j ¡  d S )Nr”   rá   zend-2crm   )	rA   ry  r\  Zstorer`   ré   r“  ZctipZremove_calltip_window)r=   r  r'   r'   r(   rÿ     s    zPyShell.resetoutputr'   c                 C   sX   z0| j  dd¡ t | ||d¡}| j  dd¡ W n   ‚ Y nX | jrTd| _tsTt‚|S )Nr”   Úrightrã   F)rA   rê   r   r    r:  r  rý   )r=   rÂ   r¤   Úcountr'   r'   r(   r      s    zPyShell.writec                    s<   z| j  ddd¡rW dS W n tk
r0   Y dS X tƒ  ¡ S )Nr}  rŸ   r”   rg  )rA   r¡   r¢   ÚsuperrN   r†   ©Ú	__class__r'   r(   rN   $  s    
zPyShell.rmenu_check_cutc                    s   | j  ddd¡rdS tƒ  ¡ S )Nr`   rŸ   r”   rg  )rA   r¡   r™  rO   r†   rš  r'   r(   rO   ,  s    zPyShell.rmenu_check_paste)N)N)N)N)N)N)N)r'   ):r‡   rˆ   r‰   r   rm  r’   r   r   r   rH  r   r‹   Zallow_line_numbersZidlelib.historyr>  r@   r]  ru  rç   r:  rz  rþ   rv  r`  ra  rR  rb  rS  rc  rd  ri  r7  r  rå   r…   rl  rn  rr  r   rè   r{  r|  rP  rQ  rO  rN  r‚  r„  r1  rT  rU  rë   r–  rÿ   r    rN   rO   Ú__classcell__r'   r'   rš  r(   r   B  st   
ú
ÿ
C

ÿ
	?




r   c              
   C   s2   | j dkr.dD ]}|  |dd|  |d¡ ¡ qdS )z6Make paste replace selection on x11.  See issue #5124.Zx11)ZTextZEntryZSpinboxz	<<Paste>>z%catch {%W delete sel.first sel.last}
N)Z_windowingsystemZ
bind_class)rv   Úclsr'   r'   r(   Úfix_x11_paste2  s    

ÿýrž  a¢  
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 (DEPRECATED,
             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               
      sV  dd l } ddlm} ddlm} ddlm} tdƒ dad}d}d}d }d }d}	z|   tj	dd … d¡\}
}W nD | j
k
r² } z$td	|tf tjd
 t d¡ W 5 d }~X Y nX |
D ]Ô\}}|dkrÐ|}d}|dkràd}d}|dkrìd}|dkr
tj t¡ t ¡  |dkrd}|dkr4tdtjd
 da|dkrh|}tj |¡rRntd|ƒ t ¡  d}|dkrzd}	d}|dkr¸|t_d}q¸|r°|d dkr°tj ¡ }d}tttjƒƒD ]}tj tj| ¡tj|< q¾|r|d dkrdg|dd …  t_	nª|rdg| t_	n–|r0|g| t_	n‚|rd}g }|D ]}| tj |¡¡ qB|D ],}tj |¡}|tjkr`tj d|¡ q`n"t ¡ }|tjkr²tj d|¡ tj ddddd}|pÌ|}|pØ| }trì|sìt!ƒ  t"dda#t# $¡  dd l%m&} |t#ƒ tj 'tj t(¡d!¡‰|ƒ d"krPtj 'ˆd#¡}t#j)|d$ nV| *¡ s¦t+d%krnd&‰ d'}nd(‰ d)}‡ ‡fd*d+„|D ƒ}d,d+„ |D ƒ}t#j,d0|žŽ  t-t#ƒ t.t#ƒ t/t#ƒa0| 1t#t0¡ |r|s|s|d d … D ] }t0 2|¡d krè| 3|¡ qè|st0 4¡  |rNt0 5¡ }|s0d S | *¡ rTt0j6rT|j7 8¡  nt0j9}|rb| :¡  |	r¢tj; <d-¡p€tj; <d.¡}|r¢tj |¡r¢|j= >|¡ |s®|rö|j= ?d/tj	f ¡ |rÖ|j= @|¡ n|r.|j= A|¡ |j= >|¡ n8|r.| Bt#¡}|r| C|¡ | D¡ }|r.| C|¡ t0jErBt# F¡  q.t# G¡  tdƒ d S )1Nr   )Úsystem)Útesting)ÚmacosxTFr   zc:deihnr:st:zError: %s
%sr   r   rÉ   z-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-tú-rQ   rÄ   rÅ   zeditor-on-startuprÆ   )rÈ   ZIdle)Z	classNamer   ZIconsZWindowszidle.ico)rÇ   g333333!@z.png)é   é    é0   é   z.gif)r£  r¤  r¥  c                    s"   g | ]}t j ˆd |ˆ f ¡‘qS )z	idle_%d%s)rG   rH   rI   )rÁ   Úsize©ZextZicondirr'   r(   rÃ   Ü  s   ÿzmain.<locals>.<listcomp>c                 S   s   g | ]}t t|d ‘qS ))Zmasterr   )Z
PhotoImagerv   )rÁ   Úiconfiler'   r'   r(   rÃ   Þ  s   ÿZIDLESTARTUPZPYTHONSTARTUPzbif 1:
            import sys as _sys
            _sys.argv = %r
            del _sys
            
)T)HÚgetoptrq  rŸ  r  r   r¡  r-   r  r±   ÚargvÚerrorr   Ú	usage_msgr—   Úexitr–   r    rG   rH   r|   r   rm  r™   r  r‚   r~   r  r[   Údirnamer`   Úgetcwdr   rÌ   ZNoDefaultRootrI  rv   rJ  Úidlelib.runr	   rI   Ú__file__Zwm_iconbitmapZisAquaTkÚ	TkVersionZwm_iconphotor   rž  rŒ   rE   ZsetupApprp   rf   ÚnewrF   Údictr   Úlowerr\   rd  Úenvironry  r]   r  rù   r  r(  ZtkVersionWarningr–  ZpreferTabsPreferenceWarningZinversedictrx  Zdestroy)rª  rŸ  r   r¡  Zenable_shellZenable_editr^   ÚcmdZscriptZstartupZoptsrM   r)  ÚoÚarß   Zpathxr%   ÚdirZ
edit_startr	   r©  ZsizesZ	iconfilesZiconsr?  ZtkversionwarningZprefer_tabs_preference_warningr'   r¨  r(   rÄ   s  s&   


ÿ



 ÿ



ÿÿ
ÿü


rÄ   F)NN)Nr±   r‡   r²   rs  ÚImportErrorr   r  r9  rq  ZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessr!   r"   r   r³  rI  rv   rJ  r±  r	   rw   r"  r   r0   rG   Úos.pathr   rŠ  rØ   r½   Útextwrapr   rð   rÓ   r  r+   Zidlelib.colorizerr   Zidlelib.configr   r  r   r   Zidlelib.editorr   r   Zidlelib.filelistr   Zidlelib.outwinr   r   r   r   r   Zidlelib.undor   rÒ   r¶   r   r)   r*   r-   Ú
checkcacher7   r8   rŒ   r’   r   Z	RPCClientr¦   r­   r®   r   rž  r­  rÄ   r'   r'   r'   r(   Ú<module>   sª   ÿ
þ   ÿ
ÿ
 ?   0   s6 6
