Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/idlelib/__pycache__/run.cpython-37.pyc

B

� fEO�@s@dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z
ddlZddlZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZdd	l
mZddlZddlZeejd
d��sx"dD]Zeee�ejd
e=q�Wdejd
_dZdAdd�ZdBdd�Zdadd�Z e d�e�!�Z"e"fdd�Z#da$da%da&dCdd�Z'dd�Z(dd�Z)dd �Z*d!d"�Z+d#d$�Z,d%d&�Z-d'd(�Z.d)d*�Z/d+Z0d,d-�Z1d.d/�Z2Gd0d1�d1ej3�Z4Gd2d3�d3ej5�Z6Gd4d5�d5e6�Z7Gd6d7�d7e6�Z8Gd8d9�d9ej9�Z:Gd:d;�d;e;�Z<e=d<k�r4dd=l>m'Z'e'd>d?d@�e d�dS)Dz� idlelib.run

Simplified, pyshell.ModifiedInterpreter spawns a subprocess with
f'''{sys.executable} -c "__import__('idlelib.run').run.main()"'''
'.run' is needed because __import__ returns idlelib, not idlelib.run.
�N)�autocomplete)�calltip)�
debugger_r)�
debugobj_r)�iomenu)�rpc)�stackviewerzidlelib.run�firstrun)ZsimpledialogZ
messagebox�fontZdialogZ
filedialogZcommondialogZttkztkinter.Fz	127.0.0.1cCsVd}|d||f7}|dkr(t�||�}|��}|r@|d|7}|d|j|f7}|S)zFormat warnings the IDLE way.z!
Warning (from warnings module):
z  File "%s", line %s
Nz    %s
z%s: %s
)�	linecache�getline�strip�__name__)�message�category�filename�lineno�line�s�r�0/opt/alt/python37/lib64/python3.7/idlelib/run.py�idle_formatwarning*srcCsB|dkrtj}y|�t|||||��Wntk
r<YnXdS)zuShow Idle-format warning after replacing warnings.showwarning.

    The only difference is the formatter called.
    N)�sys�stderr�writer�OSError)rrrr�filerrrr�idle_showwarning_subproc7srcCs0|rtdkr,tjatt_ntdk	r,tt_dadS)zFReplace warning.showwarning with idle_showwarning_subproc, or reverse.N)�_warnings_showwarning�warnings�showwarningr)Zcapturerrr�capture_warningsGsr!TcCs|�d�dS)z�Process any tk events that are ready to be dispatched if tkinter
    has been imported, a tcl interpreter has been created and tk has been
    loaded.�updateN)�eval)�tclrrr�handle_tk_eventsWsr%cCs�|ay$ttj�dkst�ttjd�}Wntdtjd�dStd�dgtjdd�<t	j
tdt|ffd	�}d|_
|���x2y�tr�y
t�Wntk
r�w�YnXytjjdd
d�}Wntjk
r�d}YnX|�r
|\}\}}}|||�}tj�||f�nt�Wq�tk
�r4t�r.daw�Yq�tk
�rRtd��Yq�t��\}	}
}yt�tj�|df�Wn&tj|	|
|tjd�t�YnXw�Yq�Xq�WdS)
afStart the Python execution server in a subprocess

    In the Python subprocess, RPCServer is instantiated with handlerclass
    MyHandler, which inherits register/unregister methods from RPCHandler via
    the mix-in class SocketIO.

    When the RPCServer 'server' is instantiated, the TCPServer initialization
    creates an instance of run.MyHandler and calls its handle() method.
    handle() instantiates a run.Executive object, passing it a reference to the
    MyHandler object.  That reference is saved as attribute rpchandler of the
    Executive instance.  The Executive methods have access to the reference and
    can pass it on to entities that they command
    (e.g. debugger_r.Debugger.start_debugger()).  The latter, in turn, can
    call MyHandler(SocketIO) register/unregister methods via the reference to
    register and unregister themselves.

    ����z/IDLE Subprocess: no IP port passed in sys.argv.)rNT�Z
SockThread)�target�name�argsg�������?)�blockZtimeoutF)�no_exitfunc�lenr�argv�AssertionError�int�print�
__stderr__r!�	threadingZThread�
manage_socket�	LOCALHOSTZdaemon�start�exit_now�exit�KeyboardInterruptrZ
request_queue�get�queueZEmptyZresponse_queueZputr%�quitting�
SystemExit�exc_info�print_exception�	traceback)Zdel_exitfuncZportZ
sockthread�request�seq�methodr+�kwargsZret�type�value�tbrrr�maines^




rIcCs�x�td�D]b}t�|�yt|t�}PWq
tk
rj}z$td|jddtj	d�|}Wdd}~XYq
Xq
Wtdtj	d�t
||�dadS|��dS)N�zIDLE Subprocess: OSError: r&z, retrying....)rz8IDLE Subprocess: Connection to IDLE GUI failed, exiting.T)
�range�time�sleep�MyRPCServer�	MyHandlerrr2r+rr3�show_socket_errorr8Zhandle_request)�address�iZserver�errZsocket_errorrrrr5�s



r5cCslddl}ddlm}|��}t|�|��|dd|d�d|d�d|j�d	|j�d
�	|d�|��dS)z(Display socket error from manage_socket.rN)�	showerrorzSubprocess Connection Errorz#IDLE's subprocess can't connect to �:r&z.
Fatal OSError #z: zz.
See the 'Startup failure' section of the IDLE doc, online at
https://docs.python.org/3/library/idle.html#startup-failure)�parent)	�tkinterZtkinter.messageboxrTZTk�fix_scalingZwithdraw�errno�strerrorZdestroy)rSrQrWrT�rootrrrrP�s(rPcsdddl}|��t�tj�t��\}}}}|\t_t_t_t	�����fdd���|||�dS)Nrc	s���t|��|j}|j}|dk	rNt|��krN�t|�||j�td�d�n8|dk	r�|js�t|��kr��t|�||j�td�d�|r�t�	|�}td�d�d}t
||�tj|�d�t�||�}x|D]}t|d�d�q�WdS)NzF
The above exception was the direct cause of the following exception:
)rzE
During handling of the above exception, another exception occurred:
z"Traceback (most recent call last):)zrun.pyzrpc.pyzthreading.pyzqueue.pyz
debugger_r.pyzbdb.pyr()�endr)
�add�id�__context__�	__cause__rF�
__traceback__r2�__suppress_context__rA�
extract_tb�cleanup_traceback�
print_list�format_exception_only)	�typ�excrH�context�causeZtbe�exclude�linesr)�efile�	print_exc�seenrrrn�s,



z"print_exception.<locals>.print_exc)
r�
checkcache�flush_stdoutrrr?�	last_type�
last_value�last_traceback�set)rrg�valrH�excinfor)rmrnrorr@�sr@c
Cs|dd�}x2|r>x"|D]}|dd�|�rPqWP|d=qWx2|rrx"|D]}|dd�|�rLPqLWP|d=qBWt|�dkr�|dd�|dd�<tdtjd�tjdj}xbtt|��D]R}||\}}}}	|dkr�d}|	s�|�	d	�r�|�
d
d||fi�}	||||	f||<q�WdS)zARemove excluded traces from beginning/end of tb; get cached linesNrr'z** IDLE Internal Exception: )r�exec�?z
-toplevel-z	<pyshell#rr)�countr.r2rrrZobjecttable�
rpchandlerrK�
startswithZ
remotecall)
rHrkZorig_tbZrpcfiler{rR�fnZlnZnmrrrrrd�s2



rdcCsdS)zXXX How to do this now?NrrrrrrqsrqcCs*trddl}|��td�t�d�dS)z�Exit subprocess, possibly after first clearing exit functions.

    If config-main.cfg/.def 'General' 'delete-exitfunc' is True, then any
    functions registered with atexit will be removed before exiting.
    (VPython support)

    rNF)r-�atexitZ_clearr!rr9)r~rrrr9s
r9cCsrddl}t|j�dd��}|dkrnxJ|j�|�D]:}|jj||dd�}t|d�}|dkr0td	|�|d<q0WdS)
zScale fonts on HiDPI displays.rN�tk�scalinggffffff�?T)r[r*�exists�sizeg�)	Ztkinter.font�floatrZcallr
�namesZFontr1�round)r[rWr�r*r
r�rrrrX*srXcCs2|jdk	r|jdnd}|t�t�|��|_dS)Nz

r()�__doc__�textwrapZfill�dedent)Zfun�textZtemrrr�fixdoc6sr��cs|t�tj��fdd���t�dt�d��t�tj��fdd���t�dt�dt�d	��t�t��t��t_�t_d
S)z9Install wrappers to always add 30 to the recursion limit.cs^|rtd��y
|\}Wn(tk
r>tdt|��d���YnX|dksPtd����|t�S)Nz.setrecursionlimit() takes no keyword argumentsz0setrecursionlimit() takes exactly one argument (z given)rz/recursion limit must be greater or equal than 1)�	TypeError�
ValueErrorr.�__wrapped__�RECURSIONLIMIT_DELTA)r+rE�limit)�setrecursionlimitrrr�@s
z:install_recursionlimit_wrappers.<locals>.setrecursionlimitz#            This IDLE wrapper adds z7 to prevent possible
            uninterruptible loops.cs���tS)N)r�r�r)�getrecursionlimitrrr�Usz:install_recursionlimit_wrappers.<locals>.getrecursionlimitz(            This IDLE wrapper subtracts z# to compensate
            for the z" IDLE adds when setting the limit.N)�	functools�wrapsrr�r�r�r�rr)r�r�r�install_recursionlimit_wrappers<sr�cCsFttjdd�rBttjdd�rBtjjt_tjjt_t�t��t�dS)z�Uninstall the recursion limit wrappers from the sys module.

    IDLE only uses this for tests. Users can import run and call
    this to remove the wrapping.
    r�N)�getattrrr�r�r�r�rrrr�!uninstall_recursionlimit_wrappersds


r�c@seZdZdd�ZdS)rNcCs�y�Wn�tk
r�Yn�tk
r:dat��Yn�tj}td|d�td|d�tdt�	�j
|d�td||d�tdt|�|d�tj
|d�td|d�td	|d�dat��YnXd
S)zrOverride RPCServer method for IDLE

        Interrupt the MainThread and exit server if link is dropped.

        Tz)
----------------------------------------)rzUnhandled server exception!z
Thread: %szClient Address: z	Request: z#
*** Unrecoverable, server exiting!z(----------------------------------------N)r>�EOFErrorr8�thread�interrupt_mainrr3r2r4Zcurrent_threadr*�reprrArnr=)�selfrBZclient_addressZerfrrr�handle_errorus&zMyRPCServer.handle_errorN)r�
__module__�__qualname__r�rrrrrNssrNc@sBeZdZddd�Zedd��Zedd��Zed	d
��Zdd�Zd
S)�	StdioFile�utf-8�strictcCs||_||_||_||_dS)N)�shell�tags�	_encoding�_errors)r�r�r��encoding�errorsrrr�__init__�szStdioFile.__init__cCs|jS)N)r�)r�rrrr��szStdioFile.encodingcCs|jS)N)r�)r�rrrr��szStdioFile.errorscCs
d|jS)Nz<%s>)r�)r�rrrr*�szStdioFile.namecCsdS)NTr)r�rrr�isatty�szStdioFile.isattyN)r�r�)	rr�r�r��propertyr�r�r*r�rrrrr��s

r�c@seZdZdd�Zdd�ZdS)�
StdOutputFilecCsdS)NTr)r�rrr�writable�szStdOutputFile.writablecCs<|jrtd��t�||j|j��|j|j�}|j�||j	�S)Nzwrite to closed file)
�closedr��str�encoder�r��decoder�rr�)r�rrrrr�szStdOutputFile.writeN)rr�r�r�rrrrrr��sr�c@s4eZdZdZdd�Zddd�Zd
dd�Zd	d
�ZdS)�StdInputFiler(cCsdS)NTr)r�rrr�readable�szStdInputFile.readabler'cCs�|jrtd��|dkrd}nt|t�s8tdt|�j��|j}d|_|dkrlxb|j�	�}|s^P||7}qNWnDx(t
|�|kr�|j�	�}|s�P||7}qnW||d�|_|d|�}|S)Nzread from closed filer'zmust be int, not r(r)r�r��
isinstancer1r�rFr�_line_bufferr��readliner.)r�r��resultrrrr�read�s,


zStdInputFile.readcCs�|jrtd��|dkrd}nt|t�s8tdt|�j��|jpF|j�	�}|dkrXt
|�}|�dd|�}|dkrv|d}||d�|_|d|�S)Nzread from closed filer'zmust be int, not r�
r&)r�r�r�r1r�rFrr�r�r�r.�find)r�r�rZeolrrrr��s
zStdInputFile.readlinecCs|j��dS)N)r��close)r�rrrr��szStdInputFile.closeN)r')r')rr�r�r�r�r�r�r�rrrrr��s


r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rOcCs�t|�}|�d|�|�d�|_t|jdtjtj�t_	t
|jdtjtj�t_t
|jdtjd�t_t
jt_ddl}|j|_tj	|_t�|�d	�|_t
jj|dd
d�dS)zOverride base methodrx�console�stdin�stdoutr�backslashreplacerN�interpg�������?)Zmyseq�wait)�	Executive�register�get_remote_proxyr�r�rr�r�rr�r�r�rr�displayhook�pydocZ
plainpagerZpagerZ_keep_stdinr�r��
RPCHandlerZgetresponse)r�Z	executiver�rrr�handle�s zMyHandler.handlecCst�d�dS)z>override SocketIO method - wait for MainThread to shut us down�
N)rLrM)r�rrr�exithookszMyHandler.exithookcCsdat��dS)zEOverride SocketIO method - terminate wait on callback and exit threadTN)r=r�r�)r�rrr�EOFhook	szMyHandler.EOFhookcCsdat��dS)zinterrupt awakened threadTN)r=r�r�)r�rrr�decode_interrupthookszMyHandler.decode_interrupthookN)rr�r�r�r�r�r�rrrrrO�srOc@sNeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	ddd�Z
dS)r�cCs&||_tj|_t��|_t��|_dS)N)r{�__main__�__dict__�localsrZCalltiprZAutoComplete)r�r{rrrr�s
zExecutive.__init__c
Cs�y&d|_dazt||j�WddaXWn�tk
r�}z<|jrp|jd}t|td�tf�spt	dt
|�tjd�Wdd}~XYnJt�
�|_tr�t�t�|jj�d�}|r�|jj��YnXt�dS)NTFrzSystemExit: )rz<<toggle-jit-stack-viewer>>)�usr_exc_info�
interruptablerxr�r>r+r�rFr1r2r�rrr?r=r9r@r{r�Zgetvarr�Zopen_remote_stack_viewerrq)r��code�eZobZjitrrr�runcodes(

&
zExecutive.runcodecCstrt��dS)N)r�r�r�)r�rrr�interrupt_the_server8szExecutive.interrupt_the_servercCst�|j|�S)N)rZstart_debuggerr{)r�Zgui_adap_oidrrr�start_the_debugger<szExecutive.start_the_debuggercCs|j�|�dS)zDUnregister the Idb Adapter.  Link objects and Idb then subject to GCN)r{Z
unregister)r�Zidb_adap_oidrrr�stop_the_debugger?szExecutive.stop_the_debuggercCs|j�|�S)N)rZ	fetch_tip)r�r*rrr�get_the_calltipCszExecutive.get_the_calltipcCs|j�||�S)N)rZfetch_completions)r�Zwhat�moderrr�get_the_completion_listFsz!Executive.get_the_completion_listNcCsr|jr|j\}}}ndSd}|dk	r0|j�|�}x|rN|jjddkrN|j}q2W|t_|t_t	�
||�}t�|�S)Nr)r�run)
r�r{r��tb_frame�	f_globals�tb_nextrrrrsrZ
StackTreeItemrZremote_object_tree_item)r�Z	flist_oidrgrvrHZflist�itemrrrrIs
zExecutive.stackviewer)N)rr�r�r�r�r�r�r�r�r�rrrrrr�sr�r�)rIzidlelib.idle_test.test_run�)�	verbosity)N)NN)F)?r�r��iorr<rr�rLrA�_threadr�r4rZidlelibrrrrrrrr�rW�hasattr�modules�mod�delattrr	r6rrrr!ZTclr$r%r8r=r�rIr5rPr@rdrqr9rXr�r�r�r�Z	RPCServerrN�
TextIOBaser�r�r�r�rO�objectr�rZunittestrrrr�<module>st







M$(!1-C


Hacked By AnonymousFox1.0, Coded By AnonymousFox