a DOg~)@sddlZddlZddlmZmZgdZGdddZGdddeZddd Ze d krddl Z e Z e j d d d de ZejsejjrdZndZeedS)N)CommandCompilercompile_command)InteractiveInterpreterInteractiveConsoleinteractrc@sBeZdZdddZdddZdd Zdd d Zd d ZddZdS)rNcCs$|durddd}||_t|_dS)NZ __console__)__name____doc__)localsrcompile)selfr r )/opt/alt/python39/lib64/python3.9/code.py__init__s  zInteractiveInterpreter.__init__singlec CsRz||||}Wn$tttfy6||YdS0|durDdS||dS)NFT)r OverflowError SyntaxError ValueErrorshowsyntaxerrorruncode)r sourcefilenameZsymbolcoder r r runsource&s  z InteractiveInterpreter.runsourcecCs<zt||jWn&ty$Yn|Yn0dSN)execr SystemExit showtraceback)r rr r r rMs  zInteractiveInterpreter.runcodec Cst\}}}|t_|t_|t_|rn|turnz|j\}\}}}} WntyTYn0t||||| f}|t_tjtj urt ||} | d | nt|||dS)N)sysexc_info last_type last_valuelast_tracebackrargsr excepthook__excepthook__ tracebackformat_exception_onlywritejoin) r rtypevaluetbmsgZdummy_filenamelinenooffsetlinelinesr r r r`s     z&InteractiveInterpreter.showsyntaxerrorcCst\t_t_}}|t_zXt|d|d|j}tjtj urT| d |nt|d|d|Wd}}n d}}0dS)Nrr) rr r!r"r#r'format_exceptiontb_nextr%r&r)r*)r Zlast_tbZeir2r r r rs z$InteractiveInterpreter.showtracebackcCstj|dSr)rstderrr))r datar r r r)szInteractiveInterpreter.write)N)rr)N) r __module__ __qualname__rrrrrr)r r r r rs   ' #rc@s:eZdZdddZddZdddZd d Zdd d ZdS)rN cCst||||_|dSr)rrr resetbuffer)r r rr r r rs zInteractiveConsole.__init__cCs g|_dSr)buffer)r r r r r;szInteractiveConsole.resetbuffercCsJz tjWnty"dt_Yn0z tjWntyFdt_Yn0d}|durt|dtjtj||jjfn|r|dt |d}zT|rtj}ntj}z| |}Wn$t y|dYWqYn 0| |}Wqt y |d|d}Yq0q|dur.|d |jjn|d krF|d|dS) Nz>>> z... zFType "help", "copyright", "credits" or "license" for more information.zPython %s on %s %s (%s) z%s r z KeyboardInterrupt znow exiting %s... r)rZps1AttributeErrorZps2r)versionplatform __class__rstr raw_inputEOFErrorpushKeyboardInterruptr;)r bannerexitmsgZcprtmorepromptr1r r r rsH             zInteractiveConsole.interactcCs6|j|d|j}|||j}|s2||S)Nr=)r<appendr*rrr;)r r1rrIr r r rEs   zInteractiveConsole.pushrcCst|Sr)input)r rJr r r rCs zInteractiveConsole.raw_input)Nr:)NN)r)rr8r9rr;rrErCr r r r rs   6rcCsHt|}|dur||_n z ddl}Wnty6Yn0|||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