
    =Og~)                     B   	 d dl Z d dlZd dlmZmZ g dZ G d d          Z G d de          ZddZe	d	k    rdd dl
Z
 e
j                    Ze                    d
dd           e                                Zej        se j        j        rdZndZ ee           dS dS )    N)CommandCompilercompile_command)InteractiveInterpreterInteractiveConsoleinteractr   c                   :    e Zd Z	 d
dZddZd Zd
dZd Zd	 ZdS )r   Nc                 J    	 |dd d}|| _         t                      | _        d S )N__console__)__name____doc__)localsr   compile)selfr   s     /usr/lib64/python3.11/code.py__init__zInteractiveInterpreter.__init__   s3    	 >"/DAAF&((    <input>singlec                     	 	 |                      |||          }n3# t          t          t          f$ r |                     |           Y dS w xY w|dS |                     |           dS )NFT)r   OverflowErrorSyntaxError
ValueErrorshowsyntaxerrorruncode)r   sourcefilenamesymbolcodes        r   	runsourcez InteractiveInterpreter.runsource&   s    	.	<<&99DD{J7 	 	 	  ***55	
 <4 	Tus    ,A
Ac                     	 	 t          || j                   d S # t          $ r   |                                  Y d S xY wN)execr   
SystemExitshowtraceback)r   r   s     r   r   zInteractiveInterpreter.runcodeM   s]    
		!t{##### 	 	 		!      s     =c                    	 t          j                    \  }}}|t           _        |t           _        |t           _        |rJ|t
          u rA	 |j        \  }\  }}}}	t          |||||	f          }|t           _        n# t          $ r Y nw xY wt           j        t           j	        u r?t          j        ||          }
|                     d                    |
                     d S t          j        |||           d S )N )sysexc_info	last_type
last_valuelast_tracebackr   argsr   
excepthook__excepthook__	tracebackformat_exception_onlywritejoin)r   r   typevaluetbmsgdummy_filenamelinenooffsetlineliness              r   r   z&InteractiveInterpreter.showsyntaxerror`   s   
	 ,..eR 
	'++'>Cj;;nffd $C(FFD)IJJ!&     >S///3D%@@EJJrwwu~~&&&&& N4+++++s   	A9 9
BBc                    	 t          j                    x\  t           _        t           _        }}|t           _        	 t          j        |d         |d         |j                  }t           j        t           j	        u r)| 
                    d                    |                     n"t          j        |d         |d         |           d x}}d S # d x}}w xY w)Nr      r&   )r'   r(   r)   r*   r+   r/   format_exceptiontb_nextr-   r.   r1   r2   )r   last_tbeir;   s       r   r$   z$InteractiveInterpreter.showtraceback   s    	 7:lnnD.s~w$		 .r!ubeW_MME~!333

2775>>**** r!ubeW555Gbbb4Gbs   B
C Cc                 F    	 t           j                            |           d S r!   )r'   stderrr1   )r   datas     r   r1   zInteractiveInterpreter.write   s%    	 	
r   r!   )r   r   )	r   
__module____qualname__r   r   r   r   r$   r1    r   r   r   r      s        ) ) ) )% % % %N! ! !&!, !, !, !,F     *    r   r   c                   4    e Zd Z	 d	dZd Zd
dZd ZddZdS )r   N	<console>c                 t    	 t                               | |           || _        |                                  d S r!   )r   r   r   resetbuffer)r   r   r   s      r   r   zInteractiveConsole.__init__   s>    	 	''f555 r   c                     	 g | _         d S r!   )buffer)r   s    r   rK   zInteractiveConsole.resetbuffer   s    %r   c                 n   	 	 t           j         n# t          $ r dt           _        Y nw xY w	 t           j         n# t          $ r dt           _        Y nw xY wd}|A|                     dt           j        dt           j        d|d| j        j        d	           n'|r%|                     d	t          |          z             d
}	 	 |rt           j        }nt           j        }	 | 
                    |          }|                     |          }n%# t          $ r |                     d           Y nAw xY wn;# t          $ r. |                     d           |                                  d
}Y nw xY w|$|                     d| j        j        z             d S |dk    r|                     d	|z             d S d S )Nz>>> z... zFType "help", "copyright", "credits" or "license" for more information.zPython z on 
z
(z)
z%s
r   r=   z
KeyboardInterrupt
znow exiting %s...
r&   )r'   ps1AttributeErrorps2r1   versionplatform	__class__r   str	raw_inputpushEOFErrorKeyboardInterruptrK   )r   bannerexitmsgcprtmorepromptr:   s          r   r   zInteractiveConsole.interact   s   		GGG 	 	 	CGGG		GGG 	 	 	CGGG	W>JJJS\\\444///1 2 2 2 2  	-JJvF+,,,	 % WFF WF+>>&11D
  99T??DD	     JJt$$$E $   

2333  """	" ?JJ,t~/FFGGGGG]]JJv'((((( ]sQ    )): AAD3 "D 7D3 D/,D3 .D//D3 35E+*E+c                     	 | j                             |           d                    | j                   }|                     || j                  }|s|                                  |S )NrO   )rM   appendr2   r   r   rK   )r   r:   r   r^   s       r   rX   zInteractiveConsole.push   sf    	 	4   4;''~~fdm44 	r   r&   c                 "    	 t          |          S r!   )input)r   r_   s     r   rW   zInteractiveConsole.raw_input  s    		 V}}r   )NrI   )NN)r&   )r   rE   rF   r   rK   r   rX   rW   rG   r   r   r   r      st             4) 4) 4) 4)l  *     r   r   c                     	 t          |          }|||_        n	 dd l}n# t          $ r Y nw xY w|                    | |           d S )Nr   )r   rW   readlineImportErrorr   )r[   readfunclocalr\   consolere   s         r   r   r     ss     !''G$	OOOO 	 	 	D	VW%%%%%s   ! 
..__main__z-q
store_truez*don't print version and copyright messages)actionhelpr&   )NNNN)r'   r/   codeopr   r   __all__r   r   r   r   argparseArgumentParserparseradd_argument
parse_argsr,   qflagsquietr[   rG   r   r   <module>rx      s`   


     3 3 3 3 3 3 3 3  P P P P P P P Pfp p p p p/ p p ph& & & &4 zOOO$X$&&F
\H  J J JDv  HV r   