Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/idlelib/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/idlelib/__pycache__/pyshell.cpython-39.opt-1.pyc

a

��g��
@s�ddlZedkr ejdejd<zddlTWn(eyTedejd�ed��Yn0ejdkr�z ddl	Z	dZ
e	�d	��e
�Wnee
efy�Yn0dd
lmZedkr�e�at��ddlmZet�ejd
detd�ed��ddlmZddlZddlZddlZddlmZddlZddlZddlZddl m!Z!ddl"Z"ddl#Z#ddl$Z$ddl%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl*m,Z,ddl-m.Z.m/Z/ddl0m1Z1ddl2m3Z3ddl*m4Z4ddlm5Z5m6Z6m7Z7ddl8m9Z9dZ:dZ;zdZ<e<e=_<e<e>_<Wne?�yYn0eja@d<dd �ZAdaBd!d"�ZCeCd#�dejDfd$d%�ZEeEe_DGd&d'�d'e.�ZFGd(d)�d)e1�ZGGd*d+�d+e'�ZHGd,d-�d-e9�ZIGd.d/�d/e4jJ�ZKd0d1�ZLGd2d3�d3e�ZMGd4d5�d5e3�ZNd6d7�ZOd8ZPd9d:�ZQedk�r�eQ�eCd;�dS)=�N�__main__zidlelib.pyshell)�*zJ** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **��file��win32Zshcore)�
messageboxg!@��fix_scalingzIdle 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.1zCtrl-D (end-of-file)c	CsN|durt}z&|�t|||||d��|�d�WnttfyHYn0dS)aShow 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�linenorr�r(�+/usr/local/lib/python3.9/idlelib/pyshell.py�idle_showwarningLs
�r*cCs0|rtdur,tjatt_ntdur,tt_dadS)z>Replace warning.showwarning with idle_showwarning, or reverse.N)�_warnings_showwarning�warnings�showwarningr*)�capturer(r(r)�capture_warnings_sr/TcCsXtj}i}t|�D].}|dd�|dd�dkr|�|�||<q||�|�|�dS)aoExtend 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&Zorig_checkcacher3�save�keyr(r(r)�extended_linecache_checkcachensr9c@sveZdZdZdd�Zgd�Zddd�Zdd	�Zddd�Zdd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd
S)�PyShellEditorWindowz6Regular text edit window in IDLE, supports breakpointscGs�g|_tj|g|�R�|j�d|j�|j�d|j�|j�d|jj�t	j
�tj
d�|_|jj|fdd�}|j�|�|jjr�|��|��dS)N�<<set-breakpoint-here>>�<<clear-breakpoint-here>>z<<open-python-shell>>zbreakpoints.lstcSs|��|�dS�N)�restore_file_breaks)Zold_hook�selfr(r(r)�filename_changed_hook�sz;PyShellEditorWindow.__init__.<locals>.filename_changed_hook)�breakpointsr�__init__�text�bind�set_breakpoint_here�clear_breakpoint_here�flist�
open_shell�os�path�joinrZuserdir�breakpointPath�ioZfilename_change_hookZset_filename_change_hookr&r>�color_breakpoint_text)r?�argsr@r(r(r)rB�s��
zPyShellEditorWindow.__init__))ZCutz<<cut>>�rmenu_check_cut)ZCopyz<<copy>>Zrmenu_check_copy)ZPastez	<<paste>>�rmenu_check_paste)NNN)zSet Breakpointr;N)zClear Breakpointr<NTcCsD|jdurdS|r(t��}t�|d�}n
ddd�}|j�d|�dS)z,Turn colorizing of breakpoint text on or offN�break�)�
foreground�
background�BREAK)rMr�CurrentTheme�GetHighlightrCZ
tag_config)r?Zcolor�themeZcfgr(r(r)rN�s

z)PyShellEditorWindow.color_breakpoint_textcCs�|j}|jj}|�dd|d|d�z|j�|�WntyV|j�|�Yn0z|jj	j
j}|�||�WnYn0dS)NrVz%d.0r)
rCrMr&�tag_addrA�index�
ValueError�appendrG�pyshell�interprrE)r?r'rCr&�debugr(r(r)�set_breakpoint�sz"PyShellEditorWindow.set_breakpointNcCs>|j}|jj}|s|��dStt|�d���}|�|�dS)N�insert)rCrMr&�bell�int�floatr[ra)r?�eventrCr&r'r(r(r)rE�sz'PyShellEditorWindow.set_breakpoint_herecCs�|j}|jj}|s|��dStt|�d���}z|j�|�WnYn0|�	ddd�z|j
jjj
}|�||�WnYn0dS)NrbrV�insert linestartzinsert lineend +1char)rCrMr&rcrdrer[rA�remove�
tag_removerGr^r_rrF)r?rfrCr&r'r`r(r(r)rF�s$�z)PyShellEditorWindow.clear_breakpoint_herecCsd|jr`|j}|jj}|s$|��dSg|_|�ddt�z|jjj	j
}|�|�WnYn0dS)NrV�1.0)rArCrMr&rcriZENDrGr^r_r�clear_file_breaks)r?rCr&r`r(r(r)rk�sz%PyShellEditorWindow.clear_file_breaksc
Cs:|j}|jj}z8t|jd��}|��}Wd�n1s:0YWnty\g}Yn0z~t|jd��^}|D]}|�|d�sr|�|�qr|�	�|j}|r�|�|dt
|�d�Wd�n1s�0YWnXt�y4}z>t|jdd��s d|j_
tjd	d
t
|�|jd�WYd}~n
d}~00dS)z#Save breakpoints when file is saved�rN�w�=�
�breakpoint_error_displayedFTz
IDLE Errorz$Unable to update breakpoint list:
%s)�titler$r)rArMr&�openrL�	readlinesr#�
startswithr!�update_breakpoints�str�getattr�rootrpr�	showerrorrC)r?Zbreaksr&�fp�linesZnew_filer�errr(r(r)�store_file_breaks�s2*
<��z%PyShellEditorWindow.store_file_breakscCs�|j��|jdurdS|jj}|dur,dStj�|j�r�t|jd��}|�	�}Wd�n1sd0Y|D]>}|�
|d�rrt|t|�dd��}|D]}|�
|�q�qrdS)Nrlrnr)rCr6rMr&rIrJ�isfilerLrrrsrt�eval�lenra)r?r&rzr{rZbreakpoint_linenumbersZbreakpoint_linenumberr(r(r)r>s

&z'PyShellEditorWindow.restore_file_breakscCs$|j}|�d�}|�|�}||_dS)z3Retrieves all the breakpoints in the current windowrVN)rCZ
tag_ranges�ranges_to_linenumbersrA)r?rC�rangesZlinenumber_listr(r(r)ru%s

z&PyShellEditorWindow.update_breakpointscCsbg}tdt|�d�D]H}tt||j��}tt||dj��}||kr|�|�|d7}q@q|S)Nr�r)�ranger�rdre�stringr])r?r�r{r[r'�endr(r(r)r�,s
z)PyShellEditorWindow.ranges_to_linenumberscCs|��t�|�dS)z7Extend base method - clear breaks when module is closedN)rkr�_close�r?r(r(r)r�=szPyShellEditorWindow._close)T)N)N)�__name__�
__module__�__qualname__�__doc__rB�rmenu_specsrNrarErFrkr}r>rur�r�r(r(r(r)r:�s	

	
*r:c@s"eZdZdZeZdZddd�ZdS)�PyShellFileListz8Extend base class: IDLE supports a shell and breakpointsNcCs8|jr|jj��nt|�|_|jr2|j��s2dS|jSr=)r^�top�wakeup�PyShell�begin�r?rfr(r(r)rHLs

zPyShellFileList.open_shell)N)r�r�r�r�r:rr^rHr(r(r(r)r�Csr�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�ModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfcCst�|�|��dSr=)rrB�LoadTagDefsr�r(r(r)rBZs
zModifiedColorDelegator.__init__cCs*|�ddd�|�ddd�t�|�dS)NZTODOrj�iomarkZSYNC)rirZr�recolorize_mainr�r(r(r)r�^sz&ModifiedColorDelegator.recolorize_mainc	CsJt�|�t��}|j�ddd�t�|d�t�|d�t�|d�d��dS)N)rUrT�stdout�stderr�console)�stdinr�r�r�)rr�rrW�tagdefsr6rX)r?rYr(r(r)r�cs



�z"ModifiedColorDelegator.LoadTagDefscCs|jD]}|�|dd�qdS)Nr�r�)r�ri)r?�tagr(r(r)�removecolorsms
z#ModifiedColorDelegator.removecolorsN)r�r�r�r�rBr�r�r�r(r(r(r)r�Ws

r�c@s$eZdZdZddd�Zddd�ZdS)	�ModifiedUndoDelegatorz;Extend base class: forbid insert/delete before the I/O markNcCsLz$|j�|dd�r"|j��WdSWnty6Yn0t�||||�dS�N�<r�)�delegate�comparerc�TclErrorrrb)r?r[�chars�tagsr(r(r)rbus

zModifiedUndoDelegator.insertcCsJz$|j�|dd�r"|j��WdSWnty6Yn0t�|||�dSr�)r�r�rcr�r�delete)r?Zindex1�index2r(r(r)r�~s

zModifiedUndoDelegator.delete)N)N)r�r�r�r�rbr�r(r(r(r)r�rs
	r�c@seZdZdd�ZdS)�MyRPCClientcCst�dS)z0Override the base class - just re-raise EOFErrorN)�EOFErrorr�r(r(r)�
handle_EOF�szMyRPCClient.handle_EOFN)r�r�r�r�r(r(r(r)r��sr�cCs^d|pd�d�}|t|�krNt|t|�d�\}}||d�|�|d��S|dd�SdS)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: ZShellz =r�rnN���)r��divmod)�widthr&r�Zdiv�modr(r(r)�restart_line�s
r�c@seZdZdd�ZdZdZdZdd�Zdd�Zdd	�Z	d?dd
�Z
dd�Zdd�Zdd�Z
dd�Zd@dd�ZdZdd�ZdZdd�Zdd�Zdd�Zd d!�Zd"Zd#d$�ZdAd%d&�Zd'd(�Zd)d*�Zd+d,�ZdBd-d.�Zd/d0�Zd1d2�Zd3d4�Z d5d6�Z!d7d8�Z"d9d:�Z#d;d<�Z$d=d>�Z%dS)C�ModifiedInterpretercCsB||_tjdj}tj||d�d|_d|_t|_	|j
jj|_
dS)Nr)�localsF)�	tkconsole�sys�modules�__dict__r
rB�
restarting�subprocess_arglist�PORT�port�compile�compiler�flags�original_compiler_flags)r?r�r�r(r(r)rB�szModifiedInterpreter.__init__NcCs&|jdur|��|_t�|j�|_dSr=)r��build_subprocess_arglist�
subprocess�Popen�
rpcsubprocr�r(r(r)�spawn_subprocess�s

z$ModifiedInterpreter.spawn_subprocesscCsJdd�tjD�}tjdddddd�}d	|f}tjg|d
|t|j�gS)NcSsg|]}d|�qS)z-Wr()�.0�sr(r(r)�
<listcomp>��z@ModifiedInterpreter.build_subprocess_arglist.<locals>.<listcomp>�main�Generalzdelete-exitfuncF�bool)�default�typez&__import__('idlelib.run').run.main(%r)�-c)r��warnoptionsr�	GetOption�
executablervr�)r?rmZ	del_exitfZcommandr(r(r)r��s
�
z,ModifiedInterpreter.build_subprocess_arglistc	CsXt|jf}td�D]6}t�|�zt|�|_WqVWqtyFYq0q|��dS|jj	�
�d|_tdkr�|jj	�t
jt
jd�|��|jj	�d�z|j��Wnt
jy�|��YdS0|j�d|j�|j�d|jj�|j�d|jj�|j�d|jj�|j�d	|jj�|j�d
t�|j�d|�|jdd
�|��|jS)N�rr�
r�r�r�r�rGr2r_T��with_cwd)�HOSTr�r��time�sleepr��rpccltr#�display_port_binding_error�listening_sock�getsocknamer��
setsockopt�socket�
SOL_SOCKET�SO_REUSEADDRr��
settimeout�accept�timeout�display_no_subprocess_error�registerr�r�r�r�rGr2�
transfer_path�poll_subprocess)r?�addr�ir(r(r)�start_subprocess�s@



�z$ModifiedInterpreter.start_subprocessFrScCs0|jr|jSd|_|��}|r<zt�|j�WnYn0|j��|��|j}|j}d|_|�	�z|j�
�Wntjy�|�
�YdS0|j|d�|��|j�dd�|�d�|�t|j|��|j�dd�|j�dd�|�s�|��|�rt�|j�|��|j|jj_d|_|jS)	NTFr�r��end-1cro�restart�left)r�r��getdebuggerrZclose_subprocess_debugger�close�terminate_subprocessr��	executingr�r�r�r�r�r��
stop_readlinerCr�r!r�r��mark_set�mark_gravity�
showpromptZrestart_subprocess_debugger�load_breakpointsr�r�r�r�)r?r�r&r`r�Z
was_executingr(r(r)�restart_subprocess�sF

z&ModifiedInterpreter.restart_subprocesscCs|j�dddi�dS)N�execZinterrupt_the_serverr()r�Z
remotecallr�r(r(r)Z__request_interruptsz'ModifiedInterpreter.__request_interruptcCstj|jd���dS)N)�target)�	threading�Thread�'_ModifiedInterpreter__request_interrupt�startr�r(r(r)�interrupt_subprocesssz(ModifiedInterpreter.interrupt_subprocesscCsz|jdur|jj�|j�z|jj��Wnty<Yn0z|j��Wnty^Yn0|��d|j_	d|_dS)NF)
�_afteridr�rCZafter_cancelr�r�r�r"r�r�r�r(r(r)�kill_subprocesss
z#ModifiedInterpreter.kill_subprocesscCsLz|j��Wnty"YdS0z|j��WntyFYdS0dS)z"Make sure subprocess is terminatedN)r��killr#�waitr�r(r(r)r�(sz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}|�tj�ntj}|�d|f�dS)NrSzRif 1:
        import sys as _sys
        _sys.path = %r
        del _sys
        
)�extendr�rJ�
runcommand)r?r�rJr(r(r)r�5s�z!ModifiedInterpreter.transfer_pathc
Cs4|j}|durdSz|j|jdd�}Wn2tttfyX|jjrHYdSd}|��Yn0|�r|j�	�d|_|\}}|jj
}|dkr�|dur�tt|�|d�nH|dkr�|j�
d�r�|��n*|dkr�d}t||tjd�t|||d�z|j��Wnt�yYn0|jj�s0|jj�|jj|j�|_dS)	Ng�������?)rZOKrZ	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"rC�after�pollintervalr�r�)r?Zclt�response�howZwhatr��errmsgr(r(r)r�DsB



�z#ModifiedInterpreter.poll_subprocesscCs
||_dSr=r)r?rr(r(r)�setdebuggerlszModifiedInterpreter.setdebuggercCs|jSr=rr�r(r(r)r�oszModifiedInterpreter.getdebuggercCs|jj�d|j�dS)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�rCrr
r�r(r(r)�open_remote_stack_viewerrs
z,ModifiedInterpreter.open_remote_stack_viewercCs�ddlm}|j�dddi�}|dur6|jj��dS|�|j|�}ddlm	}m
}t|jj�}t�
�}t�|d�d}|||dd	�}	|	jjd
dd�||	jd|�}
|
��dS)
Nr)�
debugobj_rr�Zstackviewer)rG)�ScrolledCanvas�TreeNode�normalrU)�bgZhighlightthicknessrZboth)�expand�fill)�idlelibrr��remotequeuer�rxrcZStubObjectTreeItemZidlelib.treerrZToplevelrrWrX�frame�packZcanvasr)r?rZoid�itemrrr�rYrUZscZnoder(r(r)r
sz'ModifiedInterpreter.remote_stack_viewerrcCs|�|�}|�||�dS)z1Like runsource() but assumes complete exec sourceN)�stuffsource�execfile�r?�sourcer&r(r(r)�
execsource�s
zModifiedInterpreter.execsourcec	Cs�|durZt�|��8}|��}tr<dtj�|��d�|d}Wd�n1sP0Yzt||d�}WnFtt	fy�|j
��td|j
j
d�t�||�|j
��Yn0|�|�dS)zExecute an existing fileNz__file__ = r'''z'''
z
del __file__r�zB*** Error in script or command!
Traceback (most recent call last):r)�tokenizerr�read�use_subprocessrIrJ�abspathr��
OverflowError�SyntaxErrorr�r	r
r�r
�showsyntaxerrorr��runcode)r?r&r&rz�coder(r(r)r$�s&��"
�zModifiedInterpreter.execfilecCs|�|�}t�|||�S)zBExtend base class method: Stuff the source in the line cache first)r#r
�	runsourcer%r(r(r)r1�s
zModifiedInterpreter.runsourcecCs>d|j}|jd|_|�d�}t|�dd||ftj|<|S)z"Stuff source in the filename cachez<pyshell#%d>rror)�gid�splitr�r2r3)r?r&r&r{r(r(r)r#�s


zModifiedInterpreter.stuffsourcecCs|�d|f�dS)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_syspathcCs�|j}|j}|�ddd�t��\}}}t|dd�p:|p:d}t|dd�pJd}t|d	d�pZd
}	|	d
krl|d7}|dkr�d|	d}
nd|d|	df}
|�||
�|��|�d
|�|�	�dS)z�Override Interactive Interpreter method: Use Colorizing

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

        rrjr��msgrSz<no detail available>r'r�offsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s
N)
r�rCrir��exc_inforwZcolorize_syntax_errorr	r!r�)r?r&r�rCr��value�tbr6r'r7�posr(r(r)r.�s$�z#ModifiedInterpreter.showsyntaxerrorcCs6|j��|��t�|�|j�d�r2|j��dS)z1Extend base class method to reset output properlyrN)r�r	�checklinecacher
�
showtracebackr�open_stack_viewerr�r(r(r)r=�s


z!ModifiedInterpreter.showtracebackcCs>tj}t|���D]&}|dd�|dd�dkr||=qdS)Nrr0r1)r2r3r4�keys)r?�cr8r(r(r)r<�sz"ModifiedInterpreter.checklinecachecCs@|jjr|��dS|jr0|j�dd|fi�nt||j�dS)z*Run the code without invoking the debuggerrr�r/r)r�r��display_executing_dialogr�rr�r�)r?r0r(r(r)r�szModifiedInterpreter.runcommandcCst|jjr|��|��|j}�z"zT|j��|sT|jdurT|j�dd|fi�|_n |rh|�	||j
�nt||j
�Wn�ty�|jj
s�tjddd|jjd�r��q�|��n�Yn`tr�td|jjd	�|��|j��n,|jj�rd
|j_td|jjd	�n|��Yn0Wt�spz|j��Wnt�y@Yn0n,t�snz|j��Wnt�ylYn00dS)�Override base class methodNr�r/zExit?zDo you want to exit altogether?Zyes�r�rz IDLE internal error in runcode()rFr)r�r�r�r<r�beginexecutingr�Z
asyncqueuer�runr�r��
SystemExitrrZaskyesnorCr=r*r
r�r�canceledr")r?r0rr(r(r)r/�sZ

��
�
�zModifiedInterpreter.runcodecCs|jj�|�S)rB)r�r�r!)r?r�r(r(r)r!*szModifiedInterpreter.writecCstjdd|jjd�dS)NzPort Binding ErroraAIDLE 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�rryr�rCr�r(r(r)r�.s
�z.ModifiedInterpreter.display_port_binding_errorcCstjdd|jjd�dS)NzSubprocess 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-failurerrHr�r(r(r)r�9s
�z/ModifiedInterpreter.display_no_subprocess_errorcCstjdd|jjd�dS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.rrHr�r(r(r)rAAs
�z,ModifiedInterpreter.display_executing_dialog)FrS)F)N)N)&r�r�r�rBr�r�r�r�r�r�r�r�r�r�r�r�rr�rrr�rr
r2r'r$r1r#r5r.r=r<rr/r!r�r�rAr(r(r(r)r��sF	+
,

&

	
.r�cs�eZdZde�ZeZeZgd�Z	e
jdgZdZddl
mZdPdd	�Zd
d�ZdZdZdZdZdZdZdd
�Zdd�ZdQdd�Zdd�ZdRdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z d d!�Z!d"d#�Z"d$d%�Z#d&d'�Z$d(Z%d)d*�Z&d+d,�Z'd-d.�Z(d/d0�Z)dSd1d2�Z*d3d4�Z+d5d6�Z,d7d8�Z-d9d:�Z.d;d<�Z/dTd=d>�Z0dUd?d@�Z1dVdAdB�Z2dCdD�Z3dEdF�Z4dGdH�Z5dWdJdK�Z6�fdLdM�Z7�fdNdO�Z8�Z9S)Xr�zIDLE Shell ))rZ_File)ZeditZ_Edit)r`Z_Debug)�optionsZ_Options)ZwindowZ_Window)�helpZ_Help)ZSqueeze�<<squeeze-current-text>>Fr)�HistoryNcCs$tr&|j}|dddkr&|�dd�t|�|_|durVt�}t|�|��t|�}t	�
||dd�d|_d|_t
td�r�tjnd|_|j�d	�d
|_|j|_|j}|jdd�|�d
|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�t�r8|�d|j�|�d|j�|� |�}|�d|j!�tj"|_#tj$|_%tj&|_'ddl(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_&zddl/}|j0|_1Wntj2t_$�Yn0|�3|j�|_4d|_5dS)Nr�r�shell)rMZShe_llT��ps1rror0�char)�wrapz<<newline-and-indent>>z<<plain-newline-and-indent>>z<<interrupt-execution>>z<<end-of-file>>z<<open-stack-viewer>>�<<toggle-debugger>>rz<<view-restart>>z<<restart-shell>>rK)�iomenur�r�r��backslashreplacer��2)6r*�
menu_specsrbr�r_�Tkr�withdrawr�rrBZusetabsZindentwidth�hasattrr�rO�sys_ps1r3Zprompt_last_line�promptrCZ	configurerD�enter_callback�linefeed_callback�cancel_callback�eof_callbackr>�toggle_debugger�toggle_jit_stack_viewer�view_restart_mark�
restart_shellZSqueezerZsqueeze_current_text_eventr��save_stdoutr��save_stderrr��
save_stdinrrSr�encoding�errorsrr��pydocZ
plainpagerZpagerrrL�historyr)r?rG�msrxrCZsqueezerrSrir(r(r)rBesx

�����zPyShell.__init__cCstjdd�S)NT)Z
shell_only)rZ
GetExtensionsr�r(r(r)�get_standard_extension_names�sz$PyShell.get_standard_extension_namescCs|adSr=�r )r?�streamr(r(r)�set_warning_stream�szPyShell.set_warning_streamcCstSr=rmr�r(r(r)�get_warning_stream�szPyShell.get_warning_streamcCsH|jr$tjdd|jd�|��dS|j��}|r<|��n|��dS)NzDon't debug nowz*You can only toggle the debugger when idlerrR)	r�rryrC�set_debugger_indicatorr_r��close_debugger�
open_debugger)r?rf�dbr(r(r)r`�s�

zPyShell.toggle_debuggercCs|j��}|�d|�dS)NrR)r_r�Zsetvar�r?rtr(r(r)rq�s
zPyShell.set_debugger_indicatorcCsdSr=r(r�r(r(r)ra�szPyShell.toggle_jit_stack_viewercCsh|j��}|r\|j�d�|��|jjr8t�|jj�|��|j�	d�|j
|_|��|�
�dS)Nz[DEBUG OFF]
)r_r�rr�r�rZclose_remote_debuggerr	r�r!rZr[r�rqrur(r(r)rr�s
zPyShell.close_debuggercCsX|jjrt�|jj|�}n
t�|�}|j�|�|��d|j|_	|�
�|��dS)Nz[DEBUG ON]
)r_r�rZstart_remote_debuggerrZDebuggerrr�rZr[r�rq)r?Zdbg_guir(r(r)rs�s
�
zPyShell.open_debuggercCs |jr
dnd}|�dd|�dS)N�disabledrr`z*tack*iewer)r�Zupdate_menu_state)r?�stater(r(r)�debug_menu_postcommand�szPyShell.debug_menu_postcommandcCs|��d|_dS)�Helper for ModifiedInterpreterTN)r	r�r�r(r(r)rD�szPyShell.beginexecutingcCsd|_d|_|��dS)ryFN)r�rGr�r�r(r(r)r�szPyShell.endexecutingcCsD|jr&tjddd|jd�}|dur&dS|��d|_d|_t�|�S)zExtend EditorWindow.close()zKill?z7Your program is still running!
 Do you want to kill it?�okrCF�cancelT)	r�rZaskokcancelrCr�rGrrr�)r?rr(r(r)r��s�z
PyShell.closecCsV|��tr|j��|jt_|jt_|j	t_
d|_d|_d|j_
d|_t�|�dS)zEExtend EditorWindow._close(), shut down debugger and execution serverN)rrr*r_r�rdr�r�rer�rfr�r�rGr^rjrr�r�r(r(r)r�s
zPyShell._closecCsdS)z8Override EditorWindow method: never remove the colorizerTr(r4r(r(r)�ispythonsourceszPyShell.ispythonsourcecCs|jSr=)�shell_titler�r(r(r)�short_titleszPyShell.short_titlezHType "help", "copyright", "credits" or "license()" for more information.cCs�|j�dd�|��tr:d}|j��}|sF|��dSnd}tjt	_|�
dt	jt	j|j
|f�|j��|��ddl}d|_d|_dS)	Nr�rbrSFz�==== No Subprocess ====

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

zPython %s on %s
%s
%srT)rCr�r	r*r_r�r�r�displayhookr�r!�version�platform�	COPYRIGHTZfocus_forcer��tkinterZ_support_default_rootZ
_default_root)r?Znosub�clientr�r(r(r)r�s&
�
z
PyShell.begincCs|js
dSd|_|j��dS�NT)�reading�_stop_readline_flagr��quitr�r(r(r)r�9szPyShell.stop_readlinecCs�|j}zd|_|j��W||_n||_0|jr:d|_dS|j�dd�}t|�dkrXd}|��|jrtd|_t	stt
�|jr�d|_d}|S)NTFrSr�r�rro)r�r��mainloopr�rC�getr�r	rGr*r�	endoffile)r?r7rr(r(r)�readline?s(zPyShell.readlinecCsdSr�r(r�r(r(r)�isattyVszPyShell.isattycCs�z|j�ddd�rWdSWnYn0|jsT|jsT|��|j�d�|��dSd|_d|_	|jr�|jj
r�|j��r�|j��n
|j�
�|jr�|j��dS)N�	sel.firstz!=�sel.lastzKeyboardInterrupt
rRFT)rCr�r�r�r	r_r!r�r�rGr�r�r�r�r�r�r�r(r(r)r^Ys&



zPyShell.cancel_callbackcCsf|jr|jsdS|j�ddd�r0|j�ddd�s4dS|jsL|��|��nd|_d|_|j�	�dS)Nr�z==rbr�FTrR)
r�r�rCr�r	r�rGr�r�r�r�r(r(r)r_os�

zPyShell.eof_callbackcCs0|jr"|j�dd�|j�d�n
|�|�dS)NrbrorR)r�rCrb�see�newline_and_indent_eventr�r(r(r)r]~s

zPyShell.linefeed_callbackcCs:|jr|jsdSz8|j�dd�}|rF|j�ddd�rF|�||�WdSWnYn0|j�ddd��rX|j�d	d�}|r�|j�dd|d
�r�|�|j�|d|d
�|�dS|j�d	d�}|r�|j�dd
|d�r�|�|j�|d|d
�|�dS|j�dd�}|�r>|j�|ddd��r>|�|j�|d
d�|�n|�|j�dd�|�dS|j�ddd��rx|j�dd�|j�dd�}|�r�|�	��s�|j�
dd�|j�ddd��r�|�|�dS|j�dd�|j�r�|j�dd�|j�
d�n
|�|�|j�d	dd�|j��|j�r.|j��n|��dS)Nr�r�z<=r�rRrbr��iomark linestartr�rrzinsert lineendz>=r�rgr�zend-1c linestartro)r�r�rCr�r��recallZ
tag_prevrangeZ
tag_nextranger��stripr�r�rbr�rZZupdate_idletasksr�r��runit)r?rf�sel�prev�next�indicesr�r(r(r)r\�sZ
�


zPyShell.enter_callbackc	CsLt�dd|�}t�dd|�}|�d�}|j��z�|j�ddd�|j�dd	�|j�d
d�}|���	d�r�|�
|�|j�d
d�}|j�d|d���t
|�d
k�rt�d|d��d�}t�d|��d�}|d
d�D]8}|�|�r�||t
|�d�}|j�dd|���q�W|j�d�|j��n|j�d�|j��0dS)Nz^\s*\nrSz\n\s*$ror�rjr�rbr�rg�:rrz	^([ \t]*))�re�subr3rCZundo_block_startrir�r��rstrip�endswithr�rbr�r��search�grouprtr�Zundo_block_stop)r?r�rfr{�prefixZorig_base_indentZnew_base_indentrr(r(r)r��s.



�zPyShell.recallcCs�|j�dd�}t|�}|dkr8||ddvr8|d}q|dkrX||ddkrX|d}|dkrz||ddvrz|d}qX|d|�}|j�|�dS)Nr�r�rrz 	ro)rCr�r�r_r1)r?rr�r(r(r)r��s

z
PyShell.runitcCs\|jjr|j��Sz
tjWn tjdd|jd�YdS0ddlm	}||j
|j�dS)NzNo stack tracez@There is no stack trace yet.
(sys.last_traceback is not defined)rr)�StackBrowser)r_r�r
r��last_tracebackrryrCZidlelib.stackviewerr�rxrG)r?rfr�r(r(r)r>�s

�zPyShell.open_stack_viewercCs|j�d�|j�d�dS)Nr�r�)rCr�r�r(r(r)rb�szPyShell.view_restart_markcCs|jjdd�dS)z&Callback for Run/Restart Shell Cntl-F6Tr�N)r_r�r�r(r(r)rcszPyShell.restart_shellcCs:|��|j�|j�|j�dd�|��|j��dS)Nrbr�)	r	r�r!r[rCr��set_line_and_columnrMZ
reset_undor�r(r(r)r�s
zPyShell.showpromptcCsP|jjj}t|ddd�}d�|�|��}|�d�s:|d7}|jj�	d|d�dS)NrNT)r��tabsizeZexpand_tabsror�r�)
r_r�r�rrKrQr�ZperZbottomrb)r?r6r��wrapperZwrapped_msgr(r(r)�show_warnings

zPyShell.show_warningcCsb|j�dd�}|jr |j�|�|j�d�dkr>|j�dd�|j�dd�|��|j��dS)Nr�r�zend-2cro)	rCr�rj�storerbr�r�ZctipZremove_calltip_window)r?r&r(r(r)r	szPyShell.resetoutputr(cCsXz0|j�dd�t�|||d�}|j�dd�Wn�Yn0|jrTd|_tsTt�|S)Nr��rightr�F)rCr�rr!rGr*r)r?r�r��countr(r(r)r!sz
PyShell.writecs:z|j�ddd�rWdSWnty.YdS0t���S)Nr�r�r�rv)rCr�r��superrPr���	__class__r(r)rP+s
zPyShell.rmenu_check_cutcs|j�ddd�rdSt���S)Nrbr�r�rv)rCr�r�rQr�r�r(r)rQ3szPyShell.rmenu_check_paste)N)N)N)N)N)N)N)r():r�r�r�rr}r�rr�rrVrr�Zallow_line_numbersZidlelib.historyrLrBrlr�r�rGr�rr�rorpr`rqrarrrsrxrDrr�r�r|r~r�r�r�r�r�r^r_r]r\r�r�r>rbrcr�r�r	r!rPrQ�
__classcell__r(r(r�r)r�Ish

�
C


�
	?




r�c
Cs2|jdkr.dD]}|�|dd|�|d��qdS)z6Make paste replace selection on x11.  See issue #5124.Zx11)�TextZEntryZSpinboxz	<<Paste>>z%catch {%W delete sel.first sel.last}
N)Z_windowingsystemZ
bind_class)rx�clsr(r(r)�
fix_x11_paste9s

��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
s\ddl}ddlm}ddlm}ddlm}td�dad}d}d}d}d}d}	z|�tj	dd�d�\}
}WnF|j
y�}z,td	|tftj
d
�t�d�WYd}~n
d}~00|
D]�\}
}|
dkr�|}d}|
d
kr�d}d}|
dkr�d}|
dk�rtj�t�t��|
dk�rd}|
dk�r6tdtj
d
�da|
dk�rj|}tj�|��rTntd|�t��d}|
dk�r|d}	d}|
dkr�|t_d}q�|�r�|ddk�r�tj��}d}tttj��D]}tj�tj|�tj|<�q�|�r
|ddk�r
dg|dd�t_	n�|�rdg|t_	n�|�r2|g|t_	n�|�r�d}g}|D]}|�tj�|���qD|D],}tj�|�}|tjv�rbtj�d|��qbn"t��}|tjv�r�tj�d|�tj ddddd�}|�p�|}|�p�|}t�r�|�s�t!�t"dd�a#t#�$�dd l%m&}|t#�tj�'tj�t(�d!��|�d"k�rRtj�'�d#�}t#j)|d$�nZ|�*��s�t+d%k�rpd&�d'}nd(�d)}��fd*d+�|D�}d,d+�|D�}t#j,dg|�R�t-t#�t.t#�t/t#�a0|�1t#t0�|�r|�s|�s|dd�D] }t0�2|�du�r�|�3|��q�|�st0�4�|�rTt0�5�}|�s6dS|�*��rZt0j6�rZ|j7�8�nt0j9}|�rh|�:�|	�r�tj;�<d-��p�tj;�<d.�}|�r�tj�|��r�|j=�>|�|�s�|�r�|j=�?d/tj	f�|�r�|j=�@|�n|�r4|j=�A|�|j=�>|�n8|�r4|�Bt#�}|�r|�C|�|�D�}|�r4|�C|�t0jE�rHt#�F��q4t#�G�td�dS)0Nr)�system)�testing)�macosxTFrzc:deihnr:st:zError: %s
%srr�r�z-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-t�-rSr�r�zeditor-on-startupr�)r�ZIdle)Z	classNamer	ZIconsZWindowszidle.ico)r�g333333!@z.png)�� �0�z.gif)r�r�r�cs"g|]}tj��d|�f��qS)z	idle_%d%s)rIrJrK)r��size��extZicondirr(r)r��s�zmain.<locals>.<listcomp>cSsg|]}tt|d��qS))Zmasterr)Z
PhotoImagerx)r��iconfiler(r(r)r��s�ZIDLESTARTUPZ
PYTHONSTARTUPzbif 1:
            import sys as _sys
            _sys.argv = %r
            del _sys
            
)H�getoptr�r�rr�r�r/r*r��argv�errorr
�	usage_msgr��exitr�r!rIrJr~r�r}r�r)r�r�r+r]�dirnamerb�getcwdrr�Z
NoDefaultRootrWrxrX�idlelib.runr
rK�__file__Z
wm_iconbitmapZisAquaTk�	TkVersionZwm_iconphotorr�r�rGZsetupApprrrh�newrH�dictr��lowerr^rs�environr�r_r$rr'r5ZtkVersionWarningr�ZpreferTabsPreferenceWarningZinversedictr�Zdestroy)r�r�r�r�Zenable_shellZenable_editr`�cmdZscriptZstartupZoptsrOr6�o�ar�Zpathxr&�dirZ
edit_startr
r�ZsizesZ	iconfilesZiconsrMZtkversionwarningZprefer_tabs_preference_warningr(r�r)r�zs$ 


�



�



��
��


r�F)NN)Rr�r�r�r��ImportErrorr
rrFr�ZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessr"r#rr�rWrxrXr�r
ryr0r
r2rIZos.pathrr�r�r��textwraprr�r�r(r,Zidlelib.colorizerrZidlelib.configrrrrZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZidlelib.undorr�r��eofr�r��	NameErrorr r*r+r/�
checkcacher9r:r�r�r�Z	RPCClientr�r�r�r�r�r�r�r(r(r(r)�<module>s��
�
�

�
?0s66


Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists