Hacked By AnonymousFox

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

3

� fxC�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddlm
Z
ddlmZddlmZddlmZddlmZddlmZddlZx"d8D]Zee
e�ejde=q�WdZd9dd�Zd:dd�Zdadd�Zed�e
j�Zefdd�Zdada da!d;dd�Z"dd�Z#d d!�Z$d"d#�Z%d$d%�Z&d&d'�Z'd(d)�Z(d*d+�Z)Gd,d-�d-ej*�Z+Gd.d/�d/ej,�Z-Gd0d1�d1e-�Z.Gd2d3�d3e-�Z/Gd4d5�d5ej0�Z1Gd6d7�d7e2�Z3ed�dS)<�N)�autocomplete)�calltip)�
debugger_r)�
debugobj_r)�iomenu)�rpc)�stackviewer�simpledialog�
messagebox�font�dialog�
filedialog�commondialog�ttkztkinter.z	127.0.0.1cCsVd}|d||f7}|dkr(tj||�}|j�}|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/python36/lib64/python3.6/idlelib/run.py�idle_formatwarningsrc
CsB|dkrtj}y|jt|||||��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_subproc,sr"cCs0|rtdkr,tjatt_ntdk	r,tt_dadS)zFReplace warning.showwarning with idle_showwarning_subproc, or reverse.N)�_warnings_showwarning�warnings�showwarningr")Zcapturerrr�capture_warnings<sr&TcCs|jd�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_eventsLsr*FcCs�|ay$ttj�dkst�ttjd�}Wntdtjd�dStd�dgtjdd�<t	j
tdt|ffd�}d|_
|j��x2y�tr�y
t�Wntk
r�w�YnXytjjdd	d
�}Wntjk
r�d}YnX|�r
|\}\}}}|||�}tjj||f�nt�Wq�tk
�r4t�r.daw�Yq�tk
�rRtd��Yq�tj�\}	}
}yt�tjj|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.)r!NT�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�mainZs^




rNcCs�x�td�D]b}tj|�yt|t�}PWq
tk
rj}z&td|jddtj	d�|}WYdd}~Xq
Xq
Wtdtj	d�t
||�dadS|j�dS)N�zIDLE Subprocess: OSError: r+z, retrying....)r!z8IDLE Subprocess: Connection to IDLE GUI failed, exiting.T)
�range�time�sleep�MyRPCServer�	MyHandlerr r7r/rr8�show_socket_errorr=Zhandle_request)�address�iZserver�errZsocket_errorrrrr:�s



r:c	Cspddl}ddlm}|j�}t|�|j�d|d�d|d�d|j�d|j�d	�	}|d
||d�|j�dS)z(Display socket error from manage_socket.rN)�	showerrorz#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-failurezIDLE Subprocess Error)�parent)	�tkinterZtkinter.messageboxrYZTk�fix_scalingZwithdraw�errno�strerrorZdestroy)rXrVr\rY�root�msgrrrrU�s*rUcsdddl}|j�t�tj�tj�\}}}}|\t_t_t_t	�����fdd���|||�dS)Nrc	s��jt|��|j}|j}|dk	rNt|��krN�t|�||j�td�d�n:|dk	r�|jr�t|��kr��t|�||j�td�d�|r�tj	|�}td�d�d
}t
||�tj|�d�tj||�}x|D]}t|d�d�q�WdS)NzF
The above exception was the direct cause of the following exception:
)r!zE
During handling of the above exception, another exception occurred:
z"Traceback (most recent call last):�run.py�rpc.py�threading.py�queue.py�
debugger_r.py�bdb.pyr,)�endr!)rbrcrdrerfrg)
�add�id�__context__�	__cause__rK�
__traceback__r7�__suppress_context__rF�
extract_tb�cleanup_traceback�
print_list�format_exception_only)	�typ�excrM�context�causeZtbe�exclude�linesr)�efile�	print_exc�seenrrrz�s.



z"print_exception.<locals>.print_exc)
r�
checkcache�flush_stdoutrrrD�	last_type�
last_value�last_traceback�set)rrs�valrMZexcinfor)ryrzr{rrE�srEc
Cs|dd�}x2|r>x"|D]}|ddj|�rPqWP|d=qWx2|rrx"|D]}|ddj|�rLPqLWP|d
=qBWt|�dkr�|dd�|dd�<tdtjd�tjdj}xftt|��D]V}||\}}}}	|dkr�d}|	o�|j	d	��r|j
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#rrr1r1)�countr3r7rrrZobjecttable�
rpchandlerrP�
startswithZ
remotecall)
rMrwZorig_tbZrpcfiler�rW�fn�lnZnmrrrrrp�s2



rpcCsdS)zXXX How to do this now?Nrrrrrr}sr}cCs*trddl}|j�td�tjd�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)r2�atexitZ_clearr&rr>)r�rrrr>s
r>cCsrddl}t|jjdd��}|dkrnxJ|jj|�D]:}|jj||dd�}t|d�}|dkr0td
|�|d<q0WdS)zScale fonts on HiDPI displays.rN�tk�scalinggffffff�?T)r`r.�exists�sizeg�?g�)	Ztkinter.font�floatr�Zcallr�namesZFontr6�round)r`r\r�r.rr�rrrr]sr]c@seZdZdd�ZdS)rScCs�y�Wn�tk
r�Yn�tk
r:datj�Yn�tj}tddd|d�td|d�tdtj	�j
|d�td||d�td	t|�|d�tj
|d�td
|d�tdd|d�datj�YnXdS)zrOverride RPCServer method for IDLE

        Interrupt the MainThread and exit server if link is dropped.

        T�
�-�()r!zUnhandled server exception!z
Thread: %szClient Address: z	Request: z#
*** Unrecoverable, server exiting!N)rC�EOFErrorr=�thread�interrupt_mainrr8r7r9Zcurrent_threadr.�reprrFrzrB)�selfrGZclient_addressZerfrrr�handle_error+s&zMyRPCServer.handle_errorN)r�
__module__�__qualname__r�rrrrrS)srSc@s6eZdZd
dd�Zedd��Zedd��Zdd	�ZdS)�
PseudoFileNcCs||_||_||_dS)N)�shell�tags�	_encoding)r�r�r��encodingrrr�__init__LszPseudoFile.__init__cCs|jS)N)r�)r�rrrr�QszPseudoFile.encodingcCs
d|jS)Nz<%s>)r�)r�rrrr.UszPseudoFile.namecCsdS)NTr)r�rrr�isattyYszPseudoFile.isatty)N)rr�r�r��propertyr�r.r�rrrrr�Js
r�c@seZdZdd�Zdd�ZdS)�PseudoOutputFilecCsdS)NTr)r�rrr�writable_szPseudoOutputFile.writablecCsP|jrtd��t|�tk	r@t|t�s6tdt|�j��tj|�}|jj	||j
�S)Nzwrite to closed filezmust be str, not )�closed�
ValueErrorrK�str�
isinstance�	TypeErrorr�__str__r�rr�)r�rrrrrbs

zPseudoOutputFile.writeN)rr�r�r�rrrrrr�]sr�c@s:eZdZd
dd�Zdd�Zddd�Zdd	d
�Zdd�ZdS)�PseudoInputFileNcCstj||||�d|_dS)Nr,)r�r��_line_buffer)r�r�r�r�rrrr�oszPseudoInputFile.__init__cCsdS)NTr)r�rrr�readablesszPseudoInputFile.readabler+cCs�|jrtd��|dkrd}nt|t�s8tdt|�j��|j}d|_|dkrlxb|jj	�}|s^P||7}qNWnDx(t
|�|kr�|jj	�}|s�P||7}qnW||d�|_|d|�}|S)Nzread from closed filer+zmust be int, not r,rr1)r�r�r�r6r�rKrr�r��readliner3)r�r��resultrrrr�readvs,


zPseudoInputFile.readcCs�|jrtd��|dkrd}nt|t�s8tdt|�j��|jpF|jj	�}|dkrXt
|�}|jdd|�}|dkrv|d}||d�|_|d|�S)Nzread from closed filer+zmust be int, not rr�r1)r�r�r�r6r�rKrr�r�r�r3�find)r�r�rZeolrrrr��s
zPseudoInputFile.readlinecCs|jj�dS)N)r��close)r�rrrr��szPseudoInputFile.close)Nr1)r1r1)r1)rr�r�r�r�r�r�r�rrrrr�ms



r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rTcCs�t|�}|jd|�|jd�|_t|jdtj�t_t	|jdtj�t_
t	|jdtj�t_tj
t_
ddl}|j|_tj|_|jd�|_tjj|dd	d
�dS)zOverride base methodr��console�stdin�stdoutrrN�interpg�������?)Zmyseq�wait)�	Executive�register�get_remote_proxyr�r�rr�rr�r�r�rr�displayhook�pydocZ
plainpagerZpagerZ_keep_stdinr��
RPCHandlerZgetresponse)r�Z	executiver�rrr�handle�s


zMyHandler.handlecCstjd�dS)z>override SocketIO method - wait for MainThread to shut us down�
N)rQrR)r�rrr�exithook�szMyHandler.exithookcCsdatj�dS)zEOverride SocketIO method - terminate wait on callback and exit threadTN)rBr�r�)r�rrr�EOFhook�szMyHandler.EOFhookcCsdatj�dS)zinterrupt awakened threadTN)rBr�r�)r�rrr�decode_interrupthook�szMyHandler.decode_interrupthookN)rr�r�r�r�r�r�rrrrrT�srTc@sNeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	ddd�Z
dS)r�cCs&||_tj|_tj�|_tj�|_dS)N)r��__main__�__dict__�localsrZCalltiprZAutoComplete)r�r�rrrr��s
zExecutive.__init__cCs�y&d|_dazt||j�WddaXWnVtk
r:YnJtj�|_trTt�t	�|j
jjd�}|rx|j
j
j�YnXt�dS)NTFz<<toggle-jit-stack-viewer>>)�usr_exc_info�
interruptabler�r�rCrrDrBr>rEr�r�Zgetvarr�Zopen_remote_stack_viewerr})r��codeZjitrrr�runcode�s"

zExecutive.runcodecCstrtj�dS)N)r�r�r�)r�rrr�interrupt_the_server�szExecutive.interrupt_the_servercCstj|j|�S)N)rZstart_debuggerr�)r�Zgui_adap_oidrrr�start_the_debugger�szExecutive.start_the_debuggercCs|jj|�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|jj|�S)N)rZ	fetch_tip)r�r.rrr�get_the_calltip�szExecutive.get_the_calltipcCs|jj||�S)N)rZfetch_completions)r�Zwhat�moderrr�get_the_completion_list�sz!Executive.get_the_completion_listNcCsr|jr|j\}}}ndSd}|dk	r0|jj|�}x|rN|jjddkrN|j}q2W|t_|t_t	j
||�}tj|�S)Nrr�run)rr�)
r�r�r��tb_frame�	f_globals�tb_nextrr~rrZ
StackTreeItemrZremote_object_tree_item)r�Z	flist_oidrsr�rMZflist�itemrrrr�s
zExecutive.stackviewer)N)rr�r�r�r�r�r�r�r�r�rrrrrr��sr�)r	r
rrr
rr)N)NN)F)4�iorrArrQrF�_threadr�r9r$r\Zidlelibrrrrrrrr��mod�delattr�modulesr;rr"r#r&ZTclr)r*r=rBr�rNr:rUrErpr}r>r]Z	RPCServerrS�
TextIOBaser�r�r�r�rT�objectr�rrrr�<module>s`






M$!4+A

Hacked By AnonymousFox1.0, Coded By AnonymousFox