o ?Og~)@s ddlZddlZddlmZmZgdZGdddZGdddeZddd Ze d krSddl Z e Z e j d d d de ZejsHejjrKdZndZeedSdS)N)CommandCompilercompile_command)InteractiveInterpreterInteractiveConsoleinteractrc@sDeZdZ dddZdddZdd Zdd d Zd d ZddZdS)rNcCs& |dur ddd}||_t|_dS)NZ __console__)__name____doc__)localsrcompile)selfr r +/opt/alt/python310/lib64/python3.10/code.py__init__s   zInteractiveInterpreter.__init__singlec CsT z ||||}Wntttfy||YdSw|dur#dS||dS)NFT)r OverflowError SyntaxError ValueErrorshowsyntaxerrorruncode)r sourcefilenameZsymbolcoder r r runsource&s  z InteractiveInterpreter.runsourcecCs8 z t||jWdSty|YdSN)execr SystemExit showtraceback)r rr r r rMs  zInteractiveInterpreter.runcodec Cs t\}}}|t_|t_|t_|r8|tur8z |j\}\}}}} Wn ty+Yn wt||||| f}|t_tjtj urNt ||} | d | dSt|||dS)N)sysexc_info last_type last_valuelast_tracebackrargsr excepthook__excepthook__ tracebackformat_exception_onlywritejoin) r rtypevaluetbmsgZdummy_filenamelinenooffsetlinelinesr r r r`s"     z&InteractiveInterpreter.showsyntaxerrorcCs t\t_t_}}|t_z4t|d|d|j}tjtj ur+| d |nt|d|d|Wd}}dSWd}}dSd}}w)Nrr) rr r!r"r#r'format_exceptiontb_nextr%r&r)r*)r Zlast_tbZeir2r r r rs  z$InteractiveInterpreter.showtracebackcCs tj|dSr)rstderrr))r datar r r r)szInteractiveInterpreter.writer)rr) r __module__ __qualname__rrrrrr)r r r r rs  ' # rc@s<eZdZ dddZddZdddZd d Zdd d ZdS)rN cCs t||||_|dSr)rrr resetbuffer)r r rr r r rs  zInteractiveConsole.__init__cCs g|_dSr)buffer)r r r r r;s zInteractiveConsole.resetbuffercCsH ztjWn tydt_YnwztjWn ty$dt_Ynwd}|dur;|dtjtj||jjfn |rF|dt |d} z'|rPtj}ntj}z| |}Wnt yi|dYWnw| |}Wnt y|d |d}YnwqI|dur|d |jjdS|d kr|d|dSdS) Nz>>> z... zFType "help", "copyright", "credits" or "license" for more information.zPython %s on %s %s (%s) z%s rr3 z KeyboardInterrupt znow exiting %s... r)rZps1AttributeErrorZps2r)versionplatform __class__rstr raw_inputEOFErrorpushKeyboardInterruptr;)r bannerexitmsgZcprtmorepromptr1r r r rsX           zInteractiveConsole.interactcCs8 |j|d|j}|||j}|s||S)Nr=)r<appendr*rrr;)r r1rrIr r r rEs zInteractiveConsole.pushrcCs t|Sr)input)r rJr r r rCs zInteractiveConsole.raw_input)Nr:)NN)r)rr8r9rr;rrErCr r r r rs  6rcCsJ t|}|dur ||_nzddl}Wn tyYnw|||dS)Nr)rrCreadline ImportErrorr)rGZreadfuncZlocalrHZconsolerMr r r rs  r__main__z-q store_truez*don't print version and copyright messages)actionhelpr)NNNN)rr'Zcodeoprr__all__rrrrargparseArgumentParserparser add_argument parse_argsr$qflagsquietrGr r r r s* t