ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/pyshell.cpython-36.opt-2.pyc

3

��2au��@s�ddlZyddlTWn*ek
r>edejd�ed��YnXejdkr�y ddlZdZej	d�j
e�Wneeefk
r�YnXddl
jZedkr�e�atj�dd	lmZet�ejd
detd�ed��dd
lmZddlZddlZddlZddlmZddlZddlZddlZddl 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;eja<d8dd�Z=da>dd�Z?e?d�dej@fd d!�ZAeAe_@Gd"d#�d#e.�ZBGd$d%�d%e1�ZCGd&d'�d'e'�ZDGd(d)�d)e9�ZEGd*d+�d+e4jF�ZGGd,d-�d-e�ZHGd.d/�d/e3�ZId0d1�ZJd2ZKd3d4�ZLeMd5k�r�ejNd5ejNd6<eL�e?d7�dS)9�N)�*zJ** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **)�file��win32Zshcoreg!@)�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�PseudoInputFile�PseudoOutputFile)�
UndoDelegatorz	127.0.0.1cCsP|dkrt}y&|jt|||||d��|jd�Wnttfk
rJYnXdS)N)�linez>>> )�warning_stream�writer�AttributeError�OSError)�message�category�filename�linenorr�r!�,/opt/alt/python36/lib64/python3.6/pyshell.py�idle_showwarningCsr#cCs0|rtdkr,tjatt_ntdk	r,tt_dadS)N)�_warnings_showwarning�warnings�showwarningr#)Zcapturer!r!r"�capture_warningsVsr'TcCs\tj}i}x:t|�D].}|dd�|dd�dkr|j|�||<qW||�|j|�dS)Nrz<>���)�	linecache�cache�list�pop�update)rZorig_checkcacher*�save�keyr!r!r"�extended_linecache_checkcacheesr0c@szeZdZdd�Zd&d'd(d)d*d+gZd,dd�Zdd�Zd-dd�Zd.dd�Zdd�Z	dd�Z
dd�Zd d!�Zd"d#�Z
d$d%�ZdS)/�PyShellEditorWindowcGs�g|_tj|f|��|jjd|j�|jjd|j�|jjd|jj�t	j
jtj
d�|_|jj|fdd�}|jj|�|jjr�|j�|j�dS)Nz<<set-breakpoint-here>>z<<clear-breakpoint-here>>z<<open-python-shell>>zbreakpoints.lstcSs|j�|�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�joinrZuserdir�breakpointPath�ioZfilename_change_hookZset_filename_change_hookrr2�color_breakpoint_text)r3�argsr4r!r!r"r6szPyShellEditorWindow.__init__�Cut�<<cut>>�rmenu_check_cut�Copy�<<copy>>�rmenu_check_copy�Paste�	<<paste>>�rmenu_check_pasteN�Set Breakpoint�<<set-breakpoint-here>>�Clear Breakpoint�<<clear-breakpoint-here>>TcCsD|jdkrdS|r(tj�}tj|d�}n
ddd�}|jjd|�dS)N�break�)�
foreground�
background�BREAK)rAr�CurrentTheme�GetHighlightr7Z
tag_config)r3Zcolor�themeZcfgr!r!r"rB�s

z)PyShellEditorWindow.color_breakpoint_textcCs�|j}|jj}|jdd|d|d�y|jj|�Wn tk
rX|jj|�YnXy|jj	j
j}|j||�WnYnXdS)NrUz%d.0r)
r7rAr�tag_addr5�index�
ValueError�appendr;�pyshell�interpr
r9)r3r r7r�debugr!r!r"�set_breakpoint�sz"PyShellEditorWindow.set_breakpointcCs>|j}|jj}|s|j�dStt|jd���}|j|�dS)N�insert)r7rAr�bell�int�floatrZr`)r3�eventr7rr r!r!r"r9�sz'PyShellEditorWindow.set_breakpoint_herecCs�|j}|jj}|s|j�dStt|jd���}y|jj|�WnYnX|j	ddd�y|j
jjj
}|j||�WnYnXdS)NrarUzinsert linestartzinsert lineend +1char)r7rArrbrcrdrZr5�remove�
tag_remover;r]r^r
r:)r3rer7rr r_r!r!r"r:�s"z)PyShellEditorWindow.clear_breakpoint_herec	Csd|jr`|j}|jj}|s$|j�dSg|_|jddt�y|jjj	j
}|j|�WnYnXdS)NrUz1.0)r5r7rArrbrgZENDr;r]r^r
�clear_file_breaks)r3r7rr_r!r!r"rh�sz%PyShellEditorWindow.clear_file_breakscCs|j}|jj}y$t|jd��}|j�}WdQRXWntk
rJg}YnXynt|jd��X}x$|D]}|j|d�sb|j|�qbW|j	�|j}|r�|j|dt
|�d�WdQRXWnVtk
�r}z8t|jdd��sd|j_
tjdd	t
|�|jd
�WYdd}~XnXdS)N�r�w�=�
�breakpoint_error_displayedFTz
IDLE Errorz$Unable to update breakpoint list:
%s)�titlerr)r5rAr�openr@�	readlinesr�
startswithr�update_breakpoints�str�getattr�rootrm�tkMessageBox�	showerrorr7)r3Zbreaksr�fp�linesZnew_filer�errr!r!r"�store_file_breaks�s.

(z%PyShellEditorWindow.store_file_breakscCs�|jj�|jdkrdS|jj}|dkr,dStjj|j�r�t|jd��}|j	�}WdQRXxJ|D]B}|j
|d�r`t|t|�dd��}x|D]}|j
|�q�Wq`WdS)Nrirkr)r7r-rArr=r>�isfiler@rorprq�eval�lenr`)r3rrxryrZbreakpoint_linenumbersZbreakpoint_linenumberr!r!r"r2
s



z'PyShellEditorWindow.restore_file_breakscCs$|j}|jd�}|j|�}||_dS)NrU)r7Z
tag_ranges�ranges_to_linenumbersr5)r3r7�rangesZlinenumber_listr!r!r"rrs

z&PyShellEditorWindow.update_breakpointscCsjg}x`tdt|�d�D]L}tt||j��}tt||dj��}x||kr`|j|�|d7}qDWqW|S)Nr�r)�ranger~rcrd�stringr\)r3r�ryrZr �endr!r!r"r"s

z)PyShellEditorWindow.ranges_to_linenumberscCs|j�tj|�dS)N)rhr�_close)r3r!r!r"r�3szPyShellEditorWindow._close)rDrErF)rGrHrI)rJrKrL)NNN)rMrNN)rOrPN)T)N)N)�__name__�
__module__�__qualname__r6�rmenu_specsrBr`r9r:rhr{r2rrrr�r!r!r!r"r1|s"

	
*r1c@seZdZeZdZddd�ZdS)�PyShellFileListNcCs8|jr|jjj�nt|�|_|jr2|jj�s2dS|jS)N)r]�top�wakeup�PyShell�begin)r3rer!r!r"r<Bs

zPyShellFileList.open_shell)N)r�r�r�r1rr]r<r!r!r!r"r�9sr�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�ModifiedColorDelegatorcCstj|�|j�dS)N)rr6�LoadTagDefs)r3r!r!r"r6Ps
zModifiedColorDelegator.__init__cCs*|jddd�|jddd�tj|�dS)NZTODOz1.0�iomarkZSYNC)rgrYr�recolorize_main)r3r!r!r"r�Tsz&ModifiedColorDelegator.recolorize_maincCsJtj|�tj�}|jjddd�tj|d�tj|d�tj|d�d��dS)N)rTrS�stdout�stderr�console)�stdinr�r�r�)rr�rrV�tagdefsr-rW)r3rXr!r!r"r�Ys


z"ModifiedColorDelegator.LoadTagDefscCs"x|jD]}|j|dd�qWdS)Nr�r�)r�rg)r3�tagr!r!r"�removecolorscsz#ModifiedColorDelegator.removecolorsN)r�r�r�r6r�r�r�r!r!r!r"r�Ms
r�c@s eZdZddd�Zddd�ZdS)�ModifiedUndoDelegatorNc
CsLy"|jj|dd�r |jj�dSWntk
r6YnXtj||||�dS)N�<r�)�delegate�comparerb�TclErrorrra)r3rZ�chars�tagsr!r!r"raks
zModifiedUndoDelegator.insertcCsJy"|jj|dd�r |jj�dSWntk
r6YnXtj|||�dS)Nr�r�)r�r�rbr�r�delete)r3Zindex1Zindex2r!r!r"r�ts
zModifiedUndoDelegator.delete)N)N)r�r�r�rar�r!r!r!r"r�hs
	r�c@seZdZdd�ZdS)�MyRPCClientcCst�dS)N)�EOFError)r3r!r!r"�
handle_EOF�szMyRPCClient.handle_EOFN)r�r�r�r�r!r!r!r"r�~sr�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�ModifiedInterpretercCsH||_tjdj}tj||d�d|_d|_d|_t	|_
|jjj
|_dS)N�__main__)�localsF)�	tkconsole�sys�modules�__dict__rr6�save_warnings_filters�
restarting�subprocess_arglist�PORT�port�compile�compiler�flags�original_compiler_flags)r3r�r�r!r!r"r6�szModifiedInterpreter.__init__NcCs&|jdkr|j�|_tj|j�|_dS)N)r��build_subprocess_arglist�
subprocess�Popen�
rpcsubproc)r3r!r!r"�spawn_subprocess�s

z$ModifiedInterpreter.spawn_subprocesscCs^dd�tjD�}tjdddddd�}td	kr8d
|f}n
d|f}tjg|d|t|j�gS)
NcSsg|]}d|�qS)z-Wr!)�.0�sr!r!r"�
<listcomp>�sz@ModifiedInterpreter.build_subprocess_arglist.<locals>.<listcomp>�main�Generalzdelete-exitfuncF�bool)�default�typezidlelib.pyshellz&__import__('idlelib.run').run.main(%r)z__import__('run').main(%r)z-c)r��warnoptionsr�	GetOptionr��
executablersr�)r3rjZ	del_exitfZcommandr!r!r"r��s


z,ModifiedInterpreter.build_subprocess_arglistcCsZt|jf}xLtd�D]4}tj|�yt|�|_PWqtk
rFYqXqW|j�dS|jj	j
�d|_tdkr�|jj	jt
jt
jd�|j�|jj	jd�y|jj�Wnt
jk
r�|j�dSX|jjd|j�|jjd|jj�|jjd|jj�|jjd|jj�|jjd	|jj�|jjd
t�|jjd|�|jdd
�|j�|jS)N�rr�
r�r�r�r�r;r)r^T)�with_cwd)�HOSTr�r��timeZsleepr��rpccltr�display_port_binding_error�listening_sockZgetsocknamer�Z
setsockopt�socketZ
SOL_SOCKETZSO_REUSEADDRr�Z
settimeout�accept�timeout�display_no_subprocess_error�registerr�r�r�r�r;r)�
transfer_path�poll_subprocess)r3Zaddr�ir!r!r"�start_subprocess�s>




z$ModifiedInterpreter.start_subprocessFrRcCsT|jr|jSd|_|j�}|r<ytj|j�WnYnX|jj�|j�|j}|j}d|_|j	�y|jj
�Wntjk
r�|j
�dSX|j|d�|j�|jjdd�d|r�|nd}t|j�t|�dd	d
}|jdj||��|jjdd�|jjdd
�|�s"|j�|�r<tj|j�|j�|j|jj_d|_|jS)NTF)r�r�zend-1cz	RESTART: ZShell�r�rkz
{0} {1} {0}�restart�left) r�r��getdebuggerrZclose_subprocess_debugger�close�terminate_subprocessr��	executingr�r�r�r�r�r��
stop_readliner7r�rc�widthr~r�format�mark_set�mark_gravity�
showpromptZrestart_subprocess_debugger�load_breakpointsr�r�r�r�)r3r�rr_r�Z
was_executingr�Zhalfbarr!r!r"�restart_subprocess�sH
z&ModifiedInterpreter.restart_subprocesscCs|jjddfi�dS)N�execZinterrupt_the_server)r�Z
remotecall)r3r!r!r"Z__request_interruptsz'ModifiedInterpreter.__request_interruptcCstj|jd�j�dS)N)�target)�	threadingZThread�'_ModifiedInterpreter__request_interrupt�start)r3r!r!r"�interrupt_subprocesssz(ModifiedInterpreter.interrupt_subprocesscCs~|jdk	r|jjj|j�y|jjj�Wntk
r>YnXy|jj�Wntk
rbYnX|j�d|j_	d|_dS)NF)
�_afteridr�r7Zafter_cancelr�r�r�rr�r�)r3r!r!r"�kill_subprocesss
z#ModifiedInterpreter.kill_subprocesscCsLy|jj�Wntk
r"dSXy|jj�Wntk
rFdSXdS)N)r��killr�wait)r3r!r!r"r�sz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}|jtj�ntj}|jd|f�dS)NrRzRif 1:
        import sys as _sys
        _sys.path = %r
        del _sys
        
)�extendr�r>�
runcommand)r3r�r>r!r!r"r�#sz!ModifiedInterpreter.transfer_pathcCs6|j}|dkrdSy|j|jdd�}Wn2tttfk
rX|jjrHdSd}|j�YnX|�r|jj	�d|_|\}}|jj
}|dkr�|dk	r�tt|�|d�nH|dkr�|jj
d�r�|j�n*|dkr�d}t||tjd�t|||d�y|jj�Wntk
�rYnX|jj�s2|jjj|jj|j�|_dS)	Ng�������?)r�ZOK)rZ	EXCEPTIONz<<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__�endexecutingrr7�after�pollintervalr�r�)r3Zclt�responseZhowZwhatr��errmsgr!r!r"r�2s@


z#ModifiedInterpreter.poll_subprocesscCs
||_dS)N)r
)r3r
r!r!r"�setdebuggerZszModifiedInterpreter.setdebuggercCs|jS)N)r
)r3r!r!r"r�]szModifiedInterpreter.getdebuggercCs|jjjd|j�dS)Ni,)r�r7r�r�)r3r!r!r"�open_remote_stack_viewer`s
z,ModifiedInterpreter.open_remote_stack_viewercCs�ddlm}|jjddd
i�}|dkr6|jjj�dS|j|j|�}ddlm	}m
}t|jj�}tj
�}tj|d�d}|||dd	�}	|	jjd
dd�||	jd|�}
|
j�dS)Nr)�
debugobj_rr�Zstackviewerr;)�ScrolledCanvas�TreeNodeZnormalrT)�bgZhighlightthicknessrZboth)�expand�fill)r;)�idlelibrr��remotequeuer�rurbZStubObjectTreeItemZidlelib.treerrZToplevelrrVrW�frame�packZcanvasr)r3rZoid�itemrrr�rXrTZscZnoder!r!r"r�msz'ModifiedInterpreter.remote_stack_viewerrcCs|j|�}|j||�dS)N)�stuffsource�execfile)r3�sourcerr!r!r"�
execsource�s
zModifiedInterpreter.execsourcecCs�|dkrFtj|��.}|j�}tr<dtjj|��d�|d}WdQRXyt||d�}WnHtt	fk
r�|j
j�td|j
j
d�tj||�|j
j�YnX|j|�dS)Nz__file__ = r'''z'''
z
del __file__r�zB*** Error in script or command!
Traceback (most recent call last):)r)�tokenizero�read�use_subprocessr=r>�abspathr��
OverflowError�SyntaxErrorr�r�r�r�r�showsyntaxerrorr��runcode)r3rrrx�coder!r!r"r�s&
zModifiedInterpreter.execfilec
Csd|j|�}d|_tjdd�|_tjdtd�ztj|||�S|jdk	r^|jtjdd�<d|_XdS)Nr�error)�actionr)	r
Zmorer%�filtersr��filterwarnings�
SyntaxWarningr�	runsource)r3rrr!r!r"r�s

zModifiedInterpreter.runsourcecCs>d|j}|jd|_|jd�}t|�dd||ftj|<|S)Nz<pyshell#%d>rrlr)�gid�splitr~r)r*)r3rrryr!r!r"r
�s


zModifiedInterpreter.stuffsourcecCs|jd|f�dS)Na(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
            
)r�)r3rr!r!r"�prepend_syspath�sz#ModifiedInterpreter.prepend_syspathcCs�|j}|j}|jddd�tj�\}}}t|dd�p:|p:d}t|dd�pJd}t|d	d�pZd
}	|	d
krl|d7}|dkr�d|	d}
nd|d|	df}
|j||
�|j�|jd
|�|j	�dS)Nr�z1.0r��msgrRz<no detail available>r r�offsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s
)
r�r7rgr��exc_infortZcolorize_syntax_errorr�rr�)r3rr�r7r��value�tbr#r r$�posr!r!r"r�s"z#ModifiedInterpreter.showsyntaxerrorcCs6|jj�|j�tj|�|jjd�r2|jj�dS)Nz<<toggle-jit-stack-viewer>>)r�r��checklinecacher�
showtracebackr��open_stack_viewer)r3r!r!r"r*�s


z!ModifiedInterpreter.showtracebackcCsBtj}x6t|j��D]&}|dd�|dd�dkr||=qWdS)Nrz<>r()r)r*r+�keys)r3�cr/r!r!r"r)�sz"ModifiedInterpreter.checklinecachecCs@|jjr|j�dS|jr0|jjdd|fi�nt||j�dS)Nrr�rr)r�r��display_executing_dialogr�r	r�r�)r3rr!r!r"r��szModifiedInterpreter.runcommandcCst|jjr|jj�|j�|jdk	r:|jtjdd�<d|_|j}�z�yV|jj	�|rx|j
dk	rx|j
jdd|fi�|_n |r�|j
||j�nt||j�Wn�tk
r�|jjs�tjddd|jjd�r̂q�|j�n�Ynbt�rtd|jjd�|j�|jj�n,|jj�r0d	|j_td
|jjd�n|j�YnXWdt�sny|jj�Wntk
�rlYnXXdS)Nr�rzExit?zDo you want to exit altogether?�yes)r�rz IDLE internal error in runcode())rFr�)r�r�r^r�r)r�r%rr
�beginexecutingr�Z
asyncqueuer�Zrunr�r��
SystemExitr�rvZaskyesnor7r*rr�r�r��canceledr)r3rr
r!r!r"r�sP





zModifiedInterpreter.runcodecCs|jjj|�S)N)r�r�r)r3r�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)rvrwr�r7)r3r!r!r"r�/sz.ModifiedInterpreter.display_port_binding_errorcCstjdd|jjd�dS)NzSubprocess Startup Errorz�IDLE's subprocess didn't make connection.  Either IDLE can't start a subprocess or personal firewall software is blocking the connection.)r)rvrwr�r7)r3r!r!r"r�:sz/ModifiedInterpreter.display_no_subprocess_errorcCstjdd|jjd�dS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.)r)rvrwr�r7)r3r!r!r"r.Bsz,ModifiedInterpreter.display_executing_dialog)FrR)F)N)N)&r�r�r�r6r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
rr�rr�r rrrr
r"rr*r)r�rrr�r�r.r!r!r!r"r��sF
+
-

&


1r�cs�eZdZde�dZeZeZdZd[d\d]d^d_gZ	e
jd`gZddlm
Z
dadd�Zdd�ZdZdZdZdZdZdZdd�Zdd�Zdbdd�Zdd �Zdcd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Z d/d0�Z!d1d2�Z"d3Z#d4d5�Z$d6d7�Z%d8d9�Z&d:d;�Z'ddd<d=�Z(d>d?�Z)d@dA�Z*dBdC�Z+dDdE�Z,dFdG�Z-dedHdI�Z.dfdJdK�Z/dgdLdM�Z0dNdO�Z1dPdQ�Z2dRdS�Z3ffdTdU�Z4�fdVdW�Z5�fdXdY�Z6�Z7S)hr�zPython z Shellr�_File�edit�_Editr_�_Debug�options�_Options�window�_Window�help�_Help�Squeeze�<<squeeze-current-text>>r)�HistoryNc	Cs�tr&|j}|dddkr&|jdd�t|�|_|dkrVt�}t|�|j�t|�}t	j
||dd�d|_d|_t
td�r�tjnd|_|jjd	�d|_|j|_|j}|jdd�|jd
|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�t�r8|jd|j�|jd|j�tj |_!tj"|_#tj$|_%ddl&m'}t(|d|j)�|_$t*|d|j)�|_ t*|d|j)�|_"t*|d|j)�|_+t�s�|j t_ |j"t_"|j$t_$yddl,}|j-|_.Wntj/t_"�YnX|j0|j�|_1d|_2dS)Nr�r�shell�She_llT��ps1z>>> rlr�char)�wrapz<<newline-and-indent>>z<<plain-newline-and-indent>>z<<interrupt-execution>>z<<end-of-file>>z<<open-stack-viewer>>z<<toggle-debugger>>z<<toggle-jit-stack-viewer>>z<<view-restart>>z<<restart-shell>>)�iomenur�r�r�r��2)r@rAr()3r�
menu_specsrar�r^�Tkr�withdrawr�rr6ZusetabsZindentwidth�hasattrr�rC�sys_ps1r!Zprompt_last_line�promptr7Z	configurer8�enter_callback�linefeed_callback�cancel_callback�eof_callbackr+�toggle_debugger�toggle_jit_stack_viewer�view_restart_mark�
restart_shellr��save_stdoutr��save_stderrr��
save_stdinrrFr�encodingrr��pydocZ
plainpagerZpagerr�r?�historyr�)r3r;�msrur7rFrZr!r!r"r6ds`
zPyShell.__init__cCstjdd�S)NT)Z
shell_only)rZ
GetExtensions)r3r!r!r"�get_standard_extension_names�sz$PyShell.get_standard_extension_namesFcCs|adS)N)r)r3�streamr!r!r"�set_warning_stream�szPyShell.set_warning_streamcCstS)N)r)r3r!r!r"�get_warning_stream�szPyShell.get_warning_streamcCsH|jr$tjdd|jd�|j�dS|jj�}|r<|j�n|j�dS)NzDon't debug nowz*You can only toggle the debugger when idle)rrQ)	r�rvrwr7�set_debugger_indicatorr^r��close_debugger�
open_debugger)r3re�dbr!r!r"rR�s


zPyShell.toggle_debuggercCs|jj�}|jd|�dS)Nz<<toggle-debugger>>)r^r�Zsetvar)r3rdr!r!r"ra�s
zPyShell.set_debugger_indicatorcCsdS)Nr!)r3rer!r!r"rS�szPyShell.toggle_jit_stack_viewercCsh|jj�}|r\|jjd�|j�|jjr8tj|jj�|j�|jj	d�|j
|_|j�|j
�dS)Nz[DEBUG OFF]
)r^r�rr�r�rZclose_remote_debuggerr�r�rrLrMr�ra)r3rdr!r!r"rb�s
zPyShell.close_debuggercCsX|jjrtj|jj|�}n
tj|�}|jj|�|j�d|j|_	|j
�|j�dS)Nz[DEBUG ON]
)r^r�rZstart_remote_debuggerr
ZDebuggerrr�rLrMr�ra)r3Zdbg_guir!r!r"rc�s

zPyShell.open_debuggercCs|j�d|_dS)Nr)r�r�)r3r!r!r"r0�szPyShell.beginexecutingcCsd|_d|_|j�dS)Nr)r�r2r�)r3r!r!r"r��szPyShell.endexecutingcCsD|jr&tjddd|jd�}|dkr&dS|j�d|_d|_tj|�S)NzKill?z7Your program is still running!
 Do you want to kill it?�ok)r�rFZcancelT)	r�rvZaskokcancelr7r�r2r�rr�)r3r�r!r!r"r��s
z
PyShell.closecCsV|j�tr|jj�|jt_|jt_|j	t_
d|_d|_d|j_
d|_tj|�dS)N)rbrr^r�rVr�r�rWr�rXr�r�r;r]r[rr�)r3r!r!r"r��s
zPyShell._closecCsdS)NTr!)r3rr!r!r"�ispythonsource	szPyShell.ispythonsourcecCs|jS)N)�shell_title)r3r!r!r"�short_title
szPyShell.short_titlezHType "help", "copyright", "credits" or "license()" for more information.cCs�|jjdd�|j�tr:d}|jj�}|sF|j�dSnd}tjt	_|j
d	t	jt	j|j
|f�|jj�|j�d
dl}d|_dS)Nr�rarRFz==== No Subprocess ====

z9WARNING: Running IDLE without a Subprocess is deprecated
z;and will be removed in a later version. See Help/IDLE Help
zfor details.

zPython %s on %s
%s
%srTzR==== No Subprocess ====

WARNING: Running IDLE without a Subprocess is deprecated
z�==== No Subprocess ====

WARNING: Running IDLE without a Subprocess is deprecated
and will be removed in a later version. See Help/IDLE Help
z�==== No Subprocess ====

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

)r7r�r�rr^r�r�r�displayhookr�r�version�platform�	COPYRIGHTZfocus_forcer��tkinterZ
_default_root)r3ZnosubZclientrmr!r!r"r�s$

z
PyShell.begincCs|js
dSd|_|jj�dS)NT)�reading�_stop_readline_flagr��quit)r3r!r!r"r�+szPyShell.stop_readlinecCs�|j}zd|_|jj�Wd||_X|jr4d|_dS|jjdd�}t|�dkrRd}|j�|jrnd|_t	snt
�|jr~d|_d}|S)NrFrRr�zend-1crrl)rnr��mainloopror7�getr~r�r2rr��	endoffile)r3r.rr!r!r"�readline1s(zPyShell.readlinecCsdS)NTr!)r3r!r!r"�isattyHszPyShell.isattyc
Cs�y|jjddd�rdSWnYnX|jp0|jsR|j�|jjd�|j�dSd|_d|_	|jr�|jj
r�|jj�r�|jj�n
|jj
�|jr�|jj�dS)Nz	sel.firstz!=zsel.lastzKeyboardInterrupt
rQrr)r7r�r�rnr�r^rr�rsr2r�r�r�r�r�rp)r3rer!r!r"rPKs&


zPyShell.cancel_callbackcCsh|jr|jrdS|jjddd�o0|jjddd�s6dS|jsN|j�|j�nd|_d|_|jj	�dS)Nr�z==razend-1crrrQ)
r�rnr7r�r�r�r2rsr�rp)r3rer!r!r"rQas

zPyShell.eof_callbackcCs0|jr"|jjdd�|jjd�n
|j|�dS)NrarlrQ)rnr7ra�see�newline_and_indent_event)r3rer!r!r"rOps

zPyShell.linefeed_callbackcCs<|jr|jrdSy6|jjdd�}|rF|jjddd�rF|j||�dSWnYnX|jjddd��rX|jjd	d�}|r�|jjdd|d
�r�|j|jj|d|d
�|�dS|jjd	d�}|r�|jjdd
|d�r�|j|jj|d|d
�|�dS|jjdd�}|�r>|jj|ddd��r>|j|jj|d
d�|�n|j|jjdd�|�dS|jjddd��rx|jjdd�|jjdd�}|�r�|j	��r�|jj
dd�|jjddd��r�|j|�dS|jjdd�|j�r�|jjdd�|jj
d�n
|j|�|jjd	dd�|jj�|j�r0|jj�n|j�dS)Nz	sel.firstzsel.lastz<=r�rQrar�ziomark linestartr�rrzinsert lineendz>=r�zinsert linestartzend-1czend-1c linestartrl)r�rnr7rrr��recallZ
tag_prevrangeZ
tag_nextranger��stripr�rwrarvrYZupdate_idletasksr�rp�runit)r3re�sel�prev�next�indicesr�r!r!r"rNysX


zPyShell.enter_callbackcCs<tjdd|�}tjdd|�}|jd�}|jj�z�|jjddd�|jjdd	�|jjd
d�}|j�j	d�r�|j
|�|jjd
d�}|jjd|dj��t
|�d
k�rtjd|d�jd�}tjd|�jd�}xJ|d
d�D]:}|j|��r||t
|�d�}|jjdd|j��q�WWd|jjd�|jj�XdS)Nz^\s*\nrRz\n\s*$rlr{z1.0r�razend-1czinsert linestart�:rrz	^([ \t]*))�re�subr!r7Zundo_block_startrgr�rr�rstrip�endswithrwraryr~�search�grouprqrvZundo_block_stop)r3r�rery�prefixZorig_base_indentZnew_base_indentrr!r!r"rx�s*


zPyShell.recallcCs�|jjdd�}t|�}x$|dkr:||ddkr:|d}qW|dkr\||ddkr\|d}x$|dkr�||ddkr�|d}q^W|d|�}|jj|�dS)Nr�zend-1crrz 	rl)r7rrr~r^r)r3rr�r!r!r"rz�sz
PyShell.runitcCsX|jjr|jj�Sy
tjWntjdd|jd�dSddlm	}||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_tracebackrvrwr7Zidlelib.stackviewerr�rur;)r3rer�r!r!r"r+�s


zPyShell.open_stack_viewercCs|jjd�|jjd�dS)Nr�r�)r7rv)r3rer!r!r"rT�szPyShell.view_restart_markcCs|jjdd�dS)NT)r�)r^r�)r3rer!r!r"rU�szPyShell.restart_shellcCs:|j�|jj|j�|jjdd�|j�|jj�dS)Nrazend-1c)	r�r�rrMr7r��set_line_and_columnrAZ
reset_undo)r3r!r!r"r��s
zPyShell.showpromptcCsP|jjj}t|ddd�}dj|j|��}|jd�s:|d7}|jjj	d|d�dS)NrBT)r��tabsize�expand_tabsrlziomark linestartr�)
r^r�r�r
r?rEr�ZperZbottomra)r3r#r��wrapperZwrapped_msgr!r!r"�show_warning�s

zPyShell.show_warningcCsX|jjdd�}|jr |jj|�|jjd�dkr>|jjdd�|jjdd�|j�dS)Nr�zend-1czend-2crl)r7rrr[�storerar�r�)r3rr!r!r"r�szPyShell.resetoutputcCs�t|t�rRt|�rRt|�dkrRxt|�D]\}}|dkr(Pq(Wtd|||dd��y0|jjdd�tj	|||d�}|jjdd�Wn�YnX|j
r�d|_
ts�t�|S)	Nu￿zUCS-2rz%Non-BMP character not supported in Tkr��rightr�r)
�
isinstancersr~�max�	enumerate�UnicodeEncodeErrorr7r�rrr2rr�)r3r�r�r�rD�countr!r!r"rs"z
PyShell.writecs8y|jjddd�rdSWntk
r,dSXt�j�S)Nz	sel.firstr�r��disabled)r7r�r��superrF)r3)�	__class__r!r"rF&szPyShell.rmenu_check_cutcs|jjddd�rdSt�j�S)Nrar�r�r�)r7r�r�rL)r3)r�r!r"rL.szPyShell.rmenu_check_paste)rr3)r4r5)r_r6)r7r8)r9r:)r;r<)r=r>)N)N)N)N)N)N)N)8r�r�r�r	rgr�rr�rrHrr�Zidlelib.historyr?r6r]rnr�r2rsr�ror_r`rRrarSrbrcr0r�r�r�rfrhrlr�r�rtrurPrQrOrNrxrzr+rTrUr�r�r�rrFrL�
__classcell__r!r!)r�r"r�Jsj
<



	?


	r�cCs6|jdkr2x&dD]}|j|dd|j|d��qWdS)NZx11�Text�Entry�Spinboxz	<<Paste>>z%catch {%W delete sel.first sel.last}
)r�r�r�)Z_windowingsystemZ
bind_class)ru�clsr!r!r"�
fix_x11_paste4s

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].
cs\ddl}ddlm}ddlm}ddlm}td�dad}d}d}d}d}d}	y|jtj	dd�d�\}
}WnD|j
k
r�}z&td	|tftj
d
�tjd�WYdd}~XnXx�|
D]�\}
}|
dkr�|}d}|
d
kr�d}d}|
dkr�d}|
dk�rtjjt�tj�|
dk�rd}|
dk�r6tdtj
d
�da|
dk�rj|}tjj|��rTntd|�tj�d}|
dk�r|d}	d}|
dkr�|t_d}q�W|�r�|ddk�r�tjj�}d}x0tttj��D]}tjjtj|�tj|<�q�W|�r|ddk�rdg|dd�t_	n�|�r$dg|t_	n�|�r8|g|t_	n�|�r�d}g}x |D]}|jtjj|���qLWxX|D],}tjj|�}|tjk�rntjjd|��qnWn"tj�}|tjk�r�tjjd|�tj ddddd�}|�p�|}|�p�|}t�r�|�r�t!�t"dd�a#t#j$�dd l%m&}|t#�tjj'tjjt(�d!��|�d"k�rbtjj'�d#�}t#j)|d$�nBt*d%k�rpd&nd'���fd(d)�d1D�}d-d)�|D�}t#j+d2|��t,t#�t-t#�t.t#�a/|j0t#t/�|�r|�p�|�sx0|dd�D] }t/j1|�dk�r�|j2|��q�W|�st/j3�|�rPt/j4�}|�s2dS|j5��rVt/j6�rV|j7j8�nt/j9}|�rd|j:�|	�r�tj;j<d.��p�tj;j<d/�}|�r�tjj|��r�|j=j>|�|�s�|�r�|j=j?d0tj	f�|�r�|j=j@|�n|�r0|j=jA|�|j=j>|�n8|�r0|jBt#�}|�r|jC|�|jD�}|�r0|jC|�xt/jE�rFt#jF��q2Wt#jG�td�dS)3Nr)�system)�testing)�macosxTFrzc:deihnr:st:zError: %s
%s)rr�z-cz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-t�-rRr�r�zeditor-on-startupr�)r�ZIdle)Z	className)rZIconsZWindowszidle.ico)r�g333333!@z.pngz.gifcs"g|]}tjj�d|�f��qS)z	idle_%d%s)r=r>r?)r��size)�ext�icondirr!r"r��szmain.<locals>.<listcomp>�� �0cSsg|]}tt|d��qS))Zmasterr)Z
PhotoImageru)r��iconfiler!r!r"r��sZIDLESTARTUPZ
PYTHONSTARTUPzbif 1:
            import sys as _sys
            _sys.argv = %r
            del _sys
            
)r�r�r�)T)H�getoptrkr�rr�r�r'rr��argvrr��	usage_msgr��exitr�rr=r>r|r�rgr�rr�r~rr\�dirnamera�getcwdrr�Z
NoDefaultRootrIrurJ�idlelib.runrr?�__file__Z
wm_iconbitmap�	TkVersionZwm_iconphotorr�r�r;ZsetupApprorf�newr<ZisAquaTk�dictr��lowerr]rc�environrrr^rr�rr"ZtkVersionWarningr�ZpreferTabsPreferenceWarningZinversedictrqZdestroy)r�r�r�r�Zenable_shellZenable_editr_�cmdZscriptZstartupZoptsrCr#�o�ar�Zpathxr�dirZ
edit_startrr�Z	iconfilesZiconsr@ZtkversionwarningZprefer_tabs_preference_warningr!)r�r�r"r�us
















r�r�r]F)NN)Or�rm�ImportErrorr�r�r1rkZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessrrZtkinter.messageboxZ
messageboxrvr�rIrurJr�rrwrrr)r=Zos.pathr	r�r�r��textwrapr
r�r�rr%Zidlelib.colorizerrZidlelib.configrrr
rZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZidlelib.undorr�r�rr#r$r'�
checkcacher0r1r�r�r�Z	RPCClientr�r�r�r�r�r�r�r�r!r!r!r"�<module>s�




>Hm?1


Zerion Mini Shell 1.0