U e5d �@sJddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z Gdd�dej �Z Gdd�dej�Zedk�rFe��Ze�e�d eiZd D]Ze�eee<q�e ee�Zdad az ddlZWnek r�YnXe�Zd e_e��z e��Wn6e k �r>t�r6t�!��s6t�"�d aYq�Yq�X�qFq�dS) �N�)�futurescs$eZdZ�fdd�Zdd�Z�ZS)�AsyncIOInteractiveConsolecs*t��|�|jjjtjO_||_dS)N)�super�__init__�compileZcompiler�flags�astZPyCF_ALLOW_TOP_LEVEL_AWAIT�loop)�self�localsr �� __class__��(/usr/lib64/python3.8/asyncio/__main__.pyrs z"AsyncIOInteractiveConsole.__init__csttj������fdd�}t�|�z ���WStk rD�Yn,tk rntrb�� d�n�� �YnXdS)Nc sdadat���j�}z |�}Wnztk r6�Ynftk rj}zda��|�WY�dSd}~XYn2tk r�}z��|�WY�dSd}~XYnXt � |�s��� |�dSz�j � |�at�t��Wn.tk �r�}z��|�W5d}~XYnXdS)NFT)� repl_future�repl_future_interrupted�types� FunctionTyper � SystemExit�KeyboardInterruptZ set_exception� BaseException�inspectZ iscoroutineZ set_resultr Z create_taskrZ _chain_future)�func�coroZex�exc��codeZfuturer rr�callbacks,      z3AsyncIOInteractiveConsole.runcode..callbackz KeyboardInterrupt ) � concurrentrZFuturer �call_soon_threadsafe�resultrrr�writeZ showtraceback)r rrrrr�runcodes    z!AsyncIOInteractiveConsole.runcode)�__name__� __module__� __qualname__rr#� __classcell__rrr rrs rc@seZdZdd�ZdS)� REPLThreadc CsZz6dtj�dtj�dt tdd��d �}t j |d d �W5tjddtd�t�tj�XdS) N�ignorez ^coroutine .* was never awaited$)�message�categoryz asyncio REPL z on zy Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. Zps1z>>> zimport asynciozexiting asyncio REPL...)�bannerZexitmsg) �warnings�filterwarnings�RuntimeWarningr r �stop�sys�version�platform�getattr�consoleZinteract)r r,rrr�runFs"�� �zREPLThread.runN)r$r%r&r6rrrrr(Dsr(�__main__�asyncio>� __builtins__�__spec__r$�__file__� __loader__� __package__FT)#r r8rZconcurrent.futuresrrr1Z threadingrr-�rZInteractiveConsolerZThreadr(r$Znew_event_loopr Zset_event_loopZ repl_locals�keyr r5rr�readline� ImportErrorZ repl_threadZdaemon�startZ run_foreverrZdoneZcancelrrrr�sF 6