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.opt-1.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�|ayttjd�}Wntdtjd�dStd�dgtjdd�<tjt	dt
|ffd�}d|_|���x0y�t
r�y
t�Wntk
r�wpYnXytjjdd	d
�}Wntjk
r�d}YnX|r�|\}\}}}|||�}tj�||f�nt�Wqptk
�r t�rda
wpYqptk
�r>td��Yqpt��\}	}
}yt�tj�|df�Wn&tj|	|
|tjd�t�YnXwpYqpXqpWdS)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�intr�argv�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\




rFcCs�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: �z, retrying....)rz8IDLE Subprocess: Connection to IDLE GUI failed, exiting.T)
�range�time�sleep�MyRPCServer�	MyHandlerrr/r*rr0�show_socket_errorr5Zhandle_request)�address�iZserver�errZsocket_errorrrrr2�s



r2cCslddl}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 �:rHz.
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.messageboxrRZTk�fix_scalingZwithdraw�errno�strerrorZdestroy)rQrOrUrR�rootrrrrN�s(rNcsdddl}|��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__rC�
__traceback__r/�__suppress_context__r>�
extract_tb�cleanup_traceback�
print_list�format_exception_only)	�typ�excrE�context�causeZtbe�exclude�linesr)�efile�	print_exc�seenrrrl�s,



z"print_exception.<locals>.print_exc)
r�
checkcache�flush_stdoutrrr<�	last_type�
last_value�last_traceback�set)rre�valrE�excinfor)rkrlrmrr=�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)�count�lenr/rrrZobjecttable�
rpchandlerrI�
startswithZ
remotecall)
rEriZorig_tbZrpcfilerzrP�fnZlnZnmrrrrrb�s2



rbcCsdS)zXXX How to do this now?NrrrrrrosrocCs*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!rr6)r}rrrr6s
r6cCsrddl}t|j�dd��}|dkrnxJ|j�|�D]:}|jj||dd�}t|d�}|dkr0td	|�|d<q0WdS)
zScale fonts on HiDPI displays.rN�tk�scalinggffffff�?T)rYr)�exists�sizeg�)	Ztkinter.font�floatr~Zcallr
�namesZFontr-�round)rYrUrr)r
r�rrrrV*srVcCs2|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�
ValueErrorry�__wrapped__�RECURSIONLIMIT_DELTA)r*rB�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)rLcCs�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;�EOFErrorr5�thread�interrupt_mainrr0r/r1Zcurrent_threadr)�reprr>rlr:)�selfr?Zclient_addressZerfrrr�handle_errorus&zMyRPCServer.handle_errorN)r�
__module__�__qualname__r�rrrrrLssrLc@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��
isinstancer-r�rCr�_line_bufferr��readlinery)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�
rH)r�r�r�r-r�rCrr�r�r�ry�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)
rMcCs�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 methodrv�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)rJrK)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�rrrrrM�srMc@sNeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	ddd�Z
dS)r�cCs&||_tj|_t��|_t��|_dS)N)rz�__main__�__dict__�localsrZCalltiprZAutoComplete)r�rzrrrr�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�
interruptablervr�r;r*r�rCr-r/r�rrr<r:r6r=rzr�Zgetvarr�Zopen_remote_stack_viewerro)r��code�eZobZjitrrr�runcodes(

&
zExecutive.runcodecCstrt��dS)N)r�r�r�)r�rrr�interrupt_the_server8szExecutive.interrupt_the_servercCst�|j|�S)N)rZstart_debuggerrz)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)rzZ
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�rzr��tb_frame�	f_globals�tb_nextrrprqrZ
StackTreeItemrZremote_object_tree_item)r�Z	flist_oidrertrEZflist�itemrrrrIs
zExecutive.stackviewer)N)rr�r�r�r�r�r�r�r�r�rrrrrr�sr�r�)rFzidlelib.idle_test.test_run�)�	verbosity)N)NN)F)?r�r��iorr9rr�rJr>�_threadr�r1rZidlelibrrrrrrrr�rU�hasattr�modules�mod�delattrr	r3rrrr!ZTclr$r%r5r:r�rFr2rNr=rbror6rVr�r�r�r�Z	RPCServerrL�
TextIOBaser�r�r�r�rM�objectr�rZunittestrrrr�<module>st







M$(!1-C


Hacked By AnonymousFox1.0, Coded By AnonymousFox