Hacked By AnonymousFox

Current Path : /proc/thread-self/root/proc/self/root/opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/opt/alt/python36/lib64/python3.6/idlelib/__pycache__/pyshell.cpython-36.pyc

3

� f���@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�Zwin32Zshcoreg!@)�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)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)�linez>>> )�warning_stream�writer�AttributeError�OSError)�message�category�filename�linenorr�r �4/opt/alt/python36/lib64/python3.6/idlelib/pyshell.py�idle_showwarningCsr"cCs0|rtdkr,tjatt_ntdk	r,tt_dadS)z>Replace warning.showwarning with idle_showwarning, or reverse.N)�_warnings_showwarning�warnings�showwarningr")Zcapturer r r!�capture_warningsVsr&TcCs\tj}i}x:t|�D].}|dd�|dd�dkr|j|�||<qW||�|j|�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.
    Nrz<>���)�	linecache�cache�list�pop�update)rZorig_checkcacher)�save�keyr r r!�extended_linecache_checkcacheesr/c@s~eZdZdZdd�Zd'd(d)d*d+d,gZd-dd�Zdd�Zd.dd�Zd/dd�Z	dd�Z
dd�Zdd �Zd!d"�Z
d#d$�Zd%d&�Zd
S)0�PyShellEditorWindowz6Regular text edit window in IDLE, supports breakpointscGs�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�joinrZuserdir�breakpointPath�ioZfilename_change_hookZset_filename_change_hookrr1�color_breakpoint_text)r2�argsr3r r r!r5s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)z,Turn colorizing of breakpoint text on or offN�break�)�
foreground�
background�BREAK)r@r�CurrentTheme�GetHighlightr6Z
tag_config)r2Zcolor�themeZcfgr r r!rA�s

z)PyShellEditorWindow.color_breakpoint_textcCs�|j}|jj}|jdd|d|d�y|jj|�Wn tk
rX|jj|�YnXy|jj	j
j}|j||�WnYnXdS)NrTz%d.0r)
r6r@r�tag_addr4�index�
ValueError�appendr:�pyshell�interprr8)r2rr6r�debugr r r!�set_breakpoint�sz"PyShellEditorWindow.set_breakpointcCs>|j}|jj}|s|j�dStt|jd���}|j|�dS)N�insert)r6r@r�bell�int�floatrYr_)r2�eventr6rrr r r!r8�sz'PyShellEditorWindow.set_breakpoint_herecCs�|j}|jj}|s|j�dStt|jd���}y|jj|�WnYnX|j	ddd�y|j
jjj
}|j||�WnYnXdS)Nr`rTzinsert linestartzinsert lineend +1char)r6r@rrarbrcrYr4�remove�
tag_remover:r\r]rr9)r2rdr6rrr^r r r!r9�s"z)PyShellEditorWindow.clear_breakpoint_herec	Csd|jr`|j}|jj}|s$|j�dSg|_|jddt�y|jjj	j
}|j|�WnYnXdS)NrTz1.0)r4r6r@rrarfZENDr:r\r]r�clear_file_breaks)r2r6rr^r r r!rg�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_
tjd	d
t
|�|jd�WYdd}~XnXdS)z#Save breakpoints when file is saved�rN�w�=�
�breakpoint_error_displayedFTz
IDLE Errorz$Unable to update breakpoint list:
%s)�titlerr)r4r@r�openr?�	readlinesr�
startswithr�update_breakpoints�str�getattr�rootrl�tkMessageBox�	showerrorr6)r2Zbreaksr�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)Nrhrjr)r6r,r@rr<r=�isfiler?rnrorp�eval�lenr_)r2rrwrxrZbreakpoint_linenumbersZbreakpoint_linenumberr r r!r1
s



z'PyShellEditorWindow.restore_file_breakscCs$|j}|jd�}|j|�}||_dS)z3Retrieves all the breakpoints in the current windowrTN)r6Z
tag_ranges�ranges_to_linenumbersr4)r2r6�rangesZlinenumber_listr r r!rqs

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

z)PyShellEditorWindow.ranges_to_linenumberscCs|j�tj|�dS)z7Extend base method - clear breaks when module is closedN)rgr�_close)r2r r r!r�3szPyShellEditorWindow._close)rCrDrE)rFrGrH)rIrJrK)NNN)rLrMN)rNrON)T)N)N)�__name__�
__module__�__qualname__�__doc__r5�rmenu_specsrAr_r8r9rgrzr1rqr~r�r r r r!r0|s$

	
*r0c@s"eZdZdZeZdZddd�ZdS)�PyShellFileListz8Extend base class: IDLE supports a shell and breakpointsNcCs8|jr|jjj�nt|�|_|jr2|jj�s2dS|jS)N)r\�top�wakeup�PyShell�begin)r2rdr r r!r;Bs

zPyShellFileList.open_shell)N)r�r�r�r�r0rr\r;r r r r!r�9sr�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�ModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfcCstj|�|j�dS)N)r
r5�LoadTagDefs)r2r r r!r5Ps
zModifiedColorDelegator.__init__cCs*|jddd�|jddd�tj|�dS)NZTODOz1.0�iomarkZSYNC)rfrXr
�recolorize_main)r2r r r!r�Tsz&ModifiedColorDelegator.recolorize_maincCsJtj|�tj�}|jjddd�tj|d�tj|d�tj|d�d��dS)N)rSrR�stdout�stderr�console)�stdinr�r�r�)r
r�rrU�tagdefsr,rV)r2rWr r r!r�Ys


z"ModifiedColorDelegator.LoadTagDefscCs"x|jD]}|j|dd�qWdS)Nr�r�)r�rf)r2�tagr r r!�removecolorscsz#ModifiedColorDelegator.removecolorsN)r�r�r�r�r5r�r�r�r r r r!r�Ms

r�c@s$eZdZdZddd�Zddd�ZdS)	�ModifiedUndoDelegatorz;Extend base class: forbid insert/delete before the I/O markNc
CsLy"|jj|dd�r |jj�dSWntk
r6YnXtj||||�dS)N�<r�)�delegate�comparera�TclErrorrr`)r2rY�chars�tagsr r r!r`ks
zModifiedUndoDelegator.insertcCsJy"|jj|dd�r |jj�dSWntk
r6YnXtj|||�dS)Nr�r�)r�r�rar�r�delete)r2Zindex1Zindex2r r r!r�ts
zModifiedUndoDelegator.delete)N)N)r�r�r�r�r`r�r r r r!r�hs
	r�c@seZdZdd�ZdS)�MyRPCClientcCst�dS)z0Override the base class - just re-raise EOFErrorN)�EOFError)r2r 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__rr5�save_warnings_filters�
restarting�subprocess_arglist�PORT�port�compile�compiler�flags�original_compiler_flags)r2r�r�r r r!r5�szModifiedInterpreter.__init__NcCs&|jdkr|j�|_tj|j�|_dS)N)r��build_subprocess_arglist�
subprocess�Popen�
rpcsubproc)r2r r r!�spawn_subprocess�s

z$ModifiedInterpreter.spawn_subprocesscCsp|jdkstd��dd�tjD�}tjddddd	d
�}tdkrJd|f}n
d
|f}tjg|d|t|j�gS)Nrz/Socket should have been assigned a port number.cSsg|]}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��AssertionErrorr��warnoptionsr�	GetOptionr��
executablerr)r2riZ	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)r2Zaddr�ir r r!�start_subprocess�s>




z$ModifiedInterpreter.start_subprocessFrQcCsT|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�rjz
{0} {1} {0}�restart�left) r�r��getdebuggerr
Zclose_subprocess_debugger�close�terminate_subprocessr��	executingr�r�r�r�r�r��
stop_readliner6r�rb�widthr}r�format�mark_set�mark_gravity�
showpromptZrestart_subprocess_debugger�load_breakpointsr�r�r�r�)r2r�rr^r�Z
was_executingr�Zhalfbarr r r!�restart_subprocess�sH
z&ModifiedInterpreter.restart_subprocesscCs|jjddfi�dS)N�execZinterrupt_the_server)r�Z
remotecall)r2r r r!Z__request_interruptsz'ModifiedInterpreter.__request_interruptcCstj|jd�j�dS)N)�target)�	threadingZThread�'_ModifiedInterpreter__request_interrupt�start)r2r 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�r6Zafter_cancelr�r�r�rr�r�)r2r r r!�kill_subprocesss
z#ModifiedInterpreter.kill_subprocesscCsLy|jj�Wntk
r"dSXy|jj�Wntk
rFdSXdS)z"Make sure subprocess is terminatedN)r��killr�wait)r2r r r!r�sz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}|jtj�ntj}|jd|f�dS)NrQzRif 1:
        import sys as _sys
        _sys.path = %r
        del _sys
        
)�extendr�r=�
runcommand)r2r�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__�endexecutingrr6�after�pollintervalr�r�)r2Zclt�responseZhowZwhatr��errmsgr r r!r�2s@


z#ModifiedInterpreter.poll_subprocesscCs
||_dS)N)r)r2rr r r!�setdebuggerZszModifiedInterpreter.setdebuggercCs|jS)N)r)r2r r r!r�]szModifiedInterpreter.getdebuggercCs|jjjd|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�r6r�r�)r2r 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�TreeNodeZnormalrS)ZbgZhighlightthicknessrZboth)�expandZfill)r:)�idlelibrr��remotequeuer�rtraZStubObjectTreeItemZidlelib.treerrZToplevelrrUrV�frameZpackZcanvasr)r2rZoid�itemrrr�rWrSZscZnoder r r!r�msz'ModifiedInterpreter.remote_stack_viewerrcCs|j|�}|j||�dS)z1Like runsource() but assumes complete exec sourceN)�stuffsource�execfile)r2�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)zExecute an existing fileNz__file__ = r'''z'''
z
del __file__r�zB*** Error in script or command!
Traceback (most recent call last):)r)�tokenizern�read�use_subprocessr<r=�abspathr��
OverflowError�SyntaxErrorr�r�r�r�r�showsyntaxerrorr��runcode)r2rr
rw�coder r r!r�s&
zModifiedInterpreter.execfilec
Csr|j|�}d|_tjdd�|_tjdtd�t|t�s<t	�zt
j|||�S|jdk	rl|jtjdd�<d|_XdS)zBExtend base class method: Stuff the source in the line cache firstrN�error)�actionr)rZmorer$�filtersr��filterwarnings�
SyntaxWarning�
isinstancerrr�r�	runsource)r2r
rr r r!r�s
	
zModifiedInterpreter.runsourcecCs>d|j}|jd|_|jd�}t|�dd||ftj|<|S)z"Stuff source in the filename cachez<pyshell#%d>rrkr)�gid�splitr}r(r))r2r
rrxr r r!r�s


zModifiedInterpreter.stuffsourcecCs|jd|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�)r2rr 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)z�Override Interactive Interpreter method: Use Colorizing

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

        r�z1.0r��msgrQz<no detail available>rr�offsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s
N)
r�r6rfr��exc_inforsZcolorize_syntax_errorr�rr�)r2rr�r6r��value�tbr"rr#�posr r r!r�s"z#ModifiedInterpreter.showsyntaxerrorcCs6|jj�|j�tj|�|jjd�r2|jj�dS)z1Extend base class method to reset output properlyz<<toggle-jit-stack-viewer>>N)r�r��checklinecacher�
showtracebackr��open_stack_viewer)r2r r r!r)�s


z!ModifiedInterpreter.showtracebackcCsBtj}x6t|j��D]&}|dd�|dd�dkr||=qWdS)Nrz<>r')r(r)r*�keys)r2�cr.r r r!r(�sz"ModifiedInterpreter.checklinecachecCs@|jjr|j�dS|jr0|jjdd|fi�nt||j�dS)z*Run the code without invoking the debuggerrr�rr)r�r��display_executing_dialogr�rr�r�)r2rr 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)zOverride base class methodNr�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�ruZaskyesnor6r)rr�r�r��canceledr)r2rrr r r!r�sP





zModifiedInterpreter.runcodecCs|jjj|�S)zOverride base class method)r�r�r)r2r�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)rurvr�r6)r2r 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)rurvr�r6)r2r 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)rurvr�r6)r2r r r!r-Bsz,ModifiedInterpreter.display_executing_dialog)FrQ)F)N)N)&r�r�r�r5r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�rr�rrrrrr!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>>> rkr�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?r@r')3r�
menu_specsr`r�r]�Tkr�withdrawr�rr5ZusetabsZindentwidth�hasattrr�rB�sys_ps1r Zprompt_last_line�promptr6Z	configurer7�enter_callback�linefeed_callback�cancel_callback�eof_callbackr*�toggle_debugger�toggle_jit_stack_viewer�view_restart_mark�
restart_shellr��save_stdoutr��save_stderrr��
save_stdinrrEr�encodingrr��pydocZ
plainpagerZpagerr�r>�historyr�)r2r:Zmsrtr6rErYr r r!r5ds`
zPyShell.__init__cCstjdd�S)NT)Z
shell_only)rZ
GetExtensions)r2r r r!�get_standard_extension_names�sz$PyShell.get_standard_extension_namesFcCs|adS)N)r)r2�streamr r r!�set_warning_stream�szPyShell.set_warning_streamcCstS)N)r)r2r 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)rrP)	r�rurvr6�set_debugger_indicatorr]r��close_debugger�
open_debugger)r2rd�dbr r r!rQ�s


zPyShell.toggle_debuggercCs|jj�}|jd|�dS)Nz<<toggle-debugger>>)r]r�Zsetvar)r2rbr r r!r_�s
zPyShell.set_debugger_indicatorcCsdS)Nr )r2rdr r r!rR�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�r
Zclose_remote_debuggerr�r�rrKrLr�r_)r2rbr r r!r`�s
zPyShell.close_debuggercCsX|jjrtj|jj|�}n
tj|�}|jj|�|j�d|j|_	|j
�|j�dS)Nz[DEBUG ON]
)r]r�r
Zstart_remote_debuggerrZDebuggerrr�rKrLr�r_)r2Zdbg_guir r r!ra�s

zPyShell.open_debuggercCs|j�d|_dS)zHelper for ModifiedInterpreterrN)r�r�)r2r r r!r/�szPyShell.beginexecutingcCsd|_d|_|j�dS)zHelper for ModifiedInterpreterrN)r�r1r�)r2r r r!r��szPyShell.endexecutingcCsD|jr&tjddd|jd�}|dkr&dS|j�d|_d|_tj|�S)zExtend EditorWindow.close()zKill?z7Your program is still running!
 Do you want to kill it?�ok)r�rFZcancelT)	r�ruZaskokcancelr6r�r1r�rr�)r2r�r r r!r��s
z
PyShell.closecCsV|j�tr|jj�|jt_|jt_|j	t_
d|_d|_d|j_
d|_tj|�dS)zEExtend EditorWindow._close(), shut down debugger and execution serverN)r`rr]r�rUr�r�rVr�rWr�r�r:r\rZrr�)r2r r r!r��s
zPyShell._closecCsdS)z8Override EditorWindow method: never remove the colorizerTr )r2rr r r!�ispythonsource	szPyShell.ispythonsourcecCs|jS)N)�shell_title)r2r 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�r`rQFz==== 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.

)r6r�r�rr]r�r�r�displayhookr�r�version�platform�	COPYRIGHTZfocus_forcer��tkinterZ
_default_root)r2ZnosubZclientrkr r r!r�s$

z
PyShell.begincCs|js
dSd|_|jj�dS)NT)�reading�_stop_readline_flagr��quit)r2r r r!r�+szPyShell.stop_readlinecCs�|j}zd|_|jj�Wd||_X|jr4d|_dS|jjdd�}t|�dkrRd}|j�|jrnd|_t	snt
�|jr~d|_d}|S)NrFrQr�zend-1crrk)rlr��mainlooprmr6�getr}r�r1rr��	endoffile)r2r-rr r r!�readline1s(zPyShell.readlinecCsdS)NTr )r2r 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
rPrr)r6r�r�rlr�r]rr�rqr1r�r�r�r�r�rn)r2rdr r r!rOKs&


zPyShell.cancel_callbackcCsh|jr|jrdS|jjddd�o0|jjddd�s6dS|jsN|j�|j�nd|_d|_|jj	�dS)Nr�z==r`zend-1crrrP)
r�rlr6r�r�r�r1rqr�rn)r2rdr r r!rPas

zPyShell.eof_callbackcCs0|jr"|jjdd�|jjd�n
|j|�dS)Nr`rkrP)rlr6r`�see�newline_and_indent_event)r2rdr r r!rNps

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�rPr`r�ziomark linestartr�rrzinsert lineendz>=r�zinsert linestartzend-1czend-1c linestartrk)r�rlr6rpr��recallZ
tag_prevrangeZ
tag_nextranger��stripr�rur`rtrXZupdate_idletasksr�rn�runit)r2rd�sel�prev�next�indicesr�r r r!rMysX


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*\nrQz\n\s*$rkryz1.0r�r`zend-1czinsert linestart�:rrz	^([ \t]*))�re�subr r6Zundo_block_startrfr�rp�rstrip�endswithrur`rwr}�search�grouprprtZundo_block_stop)r2r�rdrx�prefixZorig_base_indentZnew_base_indentrr r r!rv�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 	rk)r6rpr}r]r)r2rr�r r r!rx�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_tracebackrurvr6Zidlelib.stackviewerr�rtr:)r2rdr�r r r!r*�s


zPyShell.open_stack_viewercCs|jjd�|jjd�dS)Nr�r�)r6rt)r2rdr r r!rS�szPyShell.view_restart_markcCs|jjdd�dS)z&Callback for Run/Restart Shell Cntl-F6T)r�N)r]r�)r2rdr r r!rT�szPyShell.restart_shellcCs:|j�|jj|j�|jjdd�|j�|jj�dS)Nr`zend-1c)	r�r�rrLr6r��set_line_and_columnr@Z
reset_undo)r2r r r!r��s
zPyShell.showpromptcCsP|jjj}t|ddd�}dj|j|��}|jd�s:|d7}|jjj	d|d�dS)NrAT)r��tabsizeZexpand_tabsrkziomark linestartr�)
r]r�r�r	r>rDr�ZperZbottomr`)r2r"r��wrapperZwrapped_msgr r r!�show_warning�s

zPyShell.show_warningcCsX|jjdd�}|jr |jj|�|jjd�dkr>|jjdd�|jjdd�|j�dS)Nr�zend-1czend-2crk)r6rprZZstorer`r�r�)r2r
r 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)
rrrr}�max�	enumerate�UnicodeEncodeErrorr6r�rrr1rr�)r2r�r�r�rC�countr r r!rs"z
PyShell.writecs8y|jjddd�rdSWntk
r,dSXt�j�S)Nz	sel.firstr�r��disabled)r6r�r��superrE)r2)�	__class__r r!rE&szPyShell.rmenu_check_cutcs|jjddd�rdSt�j�S)Nr`r�r�r�)r6r�r�rK)r2)r�r r!rK.szPyShell.rmenu_check_paste)rr2)r3r4)r^r5)r6r7)r8r9)r:r;)r<r=)N)N)N)N)N)N)N)8r�r�r�rrer�r
r�rrGrr�Zidlelib.historyr>r5r[rlr�r1rqr�rmr]r^rQr_rRr`rar/r�r�r�rdrfrjr�r�rrrsrOrPrNrMrvrxr*rSrTr�r�r�rrErK�
__classcell__r r )r�r!r�Jsj
<



	?


	r�cCs6|jdkr2x&dD]}|j|dd|j|d��qWdS)	z6Make paste replace selection on x11.  See issue #5124.Zx11�Text�Entry�Spinboxz	<<Paste>>z%catch {%W delete sel.first sel.last}
N)r�r�r�)Z_windowingsystemZ
bind_class)rt�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�-rQr�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
PhotoImagert)r��iconfiler r r!r��sZIDLESTARTUPZ
PYTHONSTARTUPzbif 1:
            import sys as _sys
            _sys.argv = %r
            del _sys
            
)r�r�r�)T)H�getoptrir�rr�r�r&rr��argvrr��	usage_msgr��exitr�rr<r=r{r�rer�rr�r}rr[�dirnamer`�getcwdrr�Z
NoDefaultRootrHrtrI�idlelib.runrr>�__file__Z
wm_iconbitmap�	TkVersionZwm_iconphotorr�r�r:ZsetupApprnre�newr;ZisAquaTk�dictr��lowerr\ra�environrpr]rr�rr!ZtkVersionWarningr�ZpreferTabsPreferenceWarningZinversedictroZdestroy)r�r�r�r�Zenable_shellZenable_editr^�cmdZscriptZstartupZoptsrBr"�o�ar�Zpathxr�dirZ
edit_startrr�Z	iconfilesZiconsr?ZtkversionwarningZprefer_tabs_preference_warningr )r�r�r!r�us
















r�r�r\F)NN)Or�rk�ImportErrorr�r�r0riZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessrrZtkinter.messageboxZ
messageboxrur�rHrtrIr�rrvrrr(r<Zos.pathrr~r�r��textwrapr	r�r�rr$Zidlelib.colorizerr
Zidlelib.configrrrr
Zidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZidlelib.undorr�r�rr"r#r&�
checkcacher/r0r�r�r�Z	RPCClientr�r�r�r�r�r�r�r�r r r r!�<module>s�




>Hm?1


Hacked By AnonymousFox1.0, Coded By AnonymousFox