
    F\h              	         % S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKJ	r	J
r
  Sr\(       a  SSKJr  S\S	'    SS
KJr  SS jrSS jrS r\R,                  " SS5      \R,                  " SS5      \R.                  " S\R0                  5      \R2                  " 5       \\R,                  " SS5      S.rSS jrSS.     SS jjrg! \ a	    SS
KJr   Nf = f)zThis is an alternative to python_reader which tries to emulate
the CPython prompt as closely as possible, with the exception of
allowing multiline input and multiline history entries.
    )annotationsN   )_get_readermultiline_inputF)Anyz-tuple[type[Exception], ...] | type[Exception]_error)r   c                     [        5         g! [         ah  n [        R                  R	                  SS5      =n(       a  SU 3n[        [        U 5      =(       d    [        U 5      =(       d    S5      U-   s Sn A $ Sn A ff = f)zGReturns the error message if there is a problem initializing the state.TERM z; TERM=zunknown errorN)r   r   osenvirongetstrrepr)eterms     ./usr/lib/python3.13/_pyrepl/simple_interact.pycheckr   0   sn    @
 	  @::>>&"--4-TF#D3q67T!W784??@s   
 
A?AA:4A?:A?c                d    U R                  S5      n[        U5      nUS:  a  XS-
     S:X  a  U$ U $ )Nz 	r   r   
)rstriplen)textshortns      r   _strip_final_indentr   ;   s9     KKEE
A1u!e$K    c                 N    [        5       n U R                  R                  S5        g )Nclear_screen)r   scheduled_commandsappend)readers    r   _clear_screenr#   F   s    ]F
$$^4r   exitr   quit	copyright)r$   r%   r&   helpclearr'   c                d   [        U5      n U R                  USS5      nUS L $ ! [        [        [        4 av    UR                  SS9n[        U5      S:X  a   gUS   nUR                  S5      nUR                  5       S	:g  nUR                  S
5      (       + nU=(       d    U=(       a    Us $ f = f)Nz<stdin>singleT)keependsr   F) 	r   r   )
r   compileOverflowErrorSyntaxError
ValueError
splitlinesr   
startswithstripendswith)	consoleunicodetextsrccodelines	last_linewas_indented	not_empty
incompletes	            r   _more_linesrA   U   s    
k
*CsIx8 t| ;
3 	:-u:?"I	 ++K8OO%+	"++D11
)	9z9	:s   $ 3B/AB/.B/)future_flagsc               8  ^  SSK Jn  U" T R                  5        U(       a)  T R                  R                  =R
                  U-  sl        [        R                  " [        T 5      nSn[        R                  R                  S5      n[        [        S5      nU=(       a    UnSU 4S jjn   [        R                  R                  5         [!        [        SS5      n	[!        [        S	S
5      n
 [#        X9U
5      nU" U5      (       a  M_  SU S3nT R'                  [)        U5      USS9nU(       a   eUS-  nU(       a>  T RA                  S[        RJ                  " 5        S[        RL                  " 5        S35        M  ! [         a     Nf = f! [$         a     g f = f! [*         a    [-        5       nUR.                  UR0                  L a  UR3                  SS/45        [5        UR7                  5       5      Ul        SUl        UR=                  5         SUl        T RA                  S5        T RC                  5          GN[D         a%    T RA                  S5        T RC                  5          GN5[F         a    e   T RI                  5         T RC                  5          GNc= f)Nr   )_setupr   showrefcountgettotalrefcountc                :  > U R                  5       n U TR                  ;   d
  U [        ;  a  g[        5       nUR                  R                  5         [        U    n[        U5      (       a!  UR                  5          U" 5         S S S 5        gg! , (       d  f       g= f)NFT)r6   localsREPL_COMMANDSr   historypopcallablesuspend_history)	statementr"   commandr8   s      r   maybe_run_command<run_multiline_interactive_console.<locals>.maybe_run_commandy   sy    OO%	&)=*H	*G'')	 * *)s   :B
Bps1z>>> ps2z... z<python-input->r+   )filename_symbolzisearch-endr   TFz
KeyboardInterrupt
z
MemoryError
[z refs, z	 blocks]
)rN   r   returnbool)'readlinerD   rH   r0   compilerflags	functoolspartialrA   sys	_xoptionsr   hasattrstdoutflush	Exceptiongetattrr   EOFErrorpushr   KeyboardInterruptr   input_transisearch_transdo_cmdr   get_unicodeposdirtyrefreshin_bracketed_pastewriteresetbufferMemoryError
SystemExitshowtracebackrF   getallocatedblocks)r8   rB   rD   
more_linesinput_n_is_x_showrefcount_set_is_pydebug_buildshow_ref_countrP   rR   rS   rN   
input_namemorers   `              r   !run_multiline_interactive_consoler   h   s>   
 !
7>>  &&,6&"";8JG ]]..~>%78+A0AN %	"

  " #uf-C#uf-C+JSA	 !++)'!4J<< 3I >]e<fDO8qLG& MMC((*+ ,**,-Z9Q      ! 		"A}}/-"./(AEAGIIK#(A MM12! 	"MM+,! 		"!!#!sa   ,E= 
"F -F 9F .F =
F
F 	F

F 
FF FF BJ>*J++J)rX   r   )r   r   rX   r   )r8   code.InteractiveConsoler9   r   rX   rY   )r8   r   rB   intrX   None)__doc__
__future__r   _sitebuiltinsr]   r   r_   r;   rZ   r   r   TYPE_CHECKINGtypingr   __annotations__unix_consoler   ModuleNotFoundErrorwindows_consoler   r   r#   Quitter_Printerr&   _HelperrI   rA   r    r   r   <module>r      s   *
 #   	 
  2 	6 5($5 !!&"-!!&"-''S]]C!!#!!&"-, K$K K 
	Kw  ('(s   C CC