o
    Rh                     @  s   d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlm	Z	 d dl
Z
d dlZd dlZd dlmZ eG dd de	Zdd
dZdddZdS )    )annotationsN)InteractiveConsole)finalc                      s*   e Zd Zdd fddZdd
dZ  ZS )TrioInteractiveConsoleNrepl_localsdict[str, object] | NonereturnNonec                   s&   t  j|d | jj jtjO  _d S )N)locals)super__init__compilecompilerflagsastPyCF_ALLOW_TOP_LEVEL_AWAIT)selfr   	__class__ L/home/air/sanwanet/backup_V2/venv/lib/python3.10/site-packages/trio/_repl.pyr      s   zTrioInteractiveConsole.__init__codetypes.CodeTypec                 C  s   t || j}t|rtjtj	|}ntj
tj|}t|tjrQt|jtr,|jt|j|jt_t_|jjt_tjdkrE|jt_ttjtjtj d S d S )N)      )typesFunctionTyper
   inspectiscoroutinefunctiontriofrom_threadrunoutcomeacapturerun_synccapture
isinstanceErrorerror
SystemExittypesys	last_type
last_value__traceback__last_tracebackversion_infolast_exc
excepthook)r   r   funcresultr   r   r   runcode   s   


zTrioInteractiveConsole.runcode)N)r   r   r   r	   )r   r   r   r	   )__name__
__module____qualname__r   r5   __classcell__r   r   r   r   r      s    r   consoler   r	   c                   sf   dt j dt j dtt dd d}ztj| j|I d H  W tj	ddt
d	 d S tj	ddt
d	 w )
Nz
trio REPL z on zv
Use "await" directly instead of "trio.run()".
Type "help", "copyright", "credits" or "license" for more information.
ps1z>>> zimport trioignorez ^coroutine .* was never awaited$)messagecategory)r+   versionplatformgetattrr   	to_threadr$   interactwarningsfilterwarningsRuntimeWarning)r:   bannerr   r   r   run_repl6   s    
rH   original_localsdict[str, object]c                 C  sh   t t dd l}W d    n1 sw   Y  dti}dD ]}| | ||< qt|}tt| d S )Nr   r   >   __file__r6   __spec__
__loader____package____builtins__)
contextlibsuppressImportErrorreadliner   r   r!   rH   )rI   rS   r   keyr:   r   r   r   mainH   s   
rU   )r:   r   r   r	   )rI   rJ   r   r	   )
__future__r   r   rP   r   r+   r   rD   r   r   r"   r   trio.lowlevel
trio._utilr   r   rH   rU   r   r   r   r   <module>   s     
#