Format: application/x-python-code
⬇ Download File (2.4 KB)
   1  o
   2  
   3  ��hl�@s|dZddlZddlZddlZddlmZddlmZddl	m
   4  Z
   5  ddlmZddl
   6  mZd	d
   7  �add�Zd
   8  d�Zdd�ZdS)aGlobal IPython app to support test running.
   9  
  10  We must start our own ipython object and heavily muck with it so that all the
  11  modifications IPython makes to system behavior don't send the doctest machinery
  12  into a fit.  This code should be considered a gross hack, but it gets the job
  13  done.
  14  �N)�Path�)�tools)�page)�io)�TerminalInteractiveShellcCst�S)N)�
  15  start_ipython�r	r	�Qc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/testing/globalipapp.py�get_ipythonsrcCs.t|j|ddd���dtjd�tj��dS)zFReplace the default system call with a capturing one for doctest.
  16      Fr)�split�depth�)�end�fileN)�print�	getoutput�rstrip�sys�stdout�flush)�self�cmdr	r	r
  17  �xsys"s rcCst|j�|�tjd�dS)zDPrint the traceback purely on stdout for doctest to capture it.
  18      )rN)rZ
  19  InteractiveTBZstb2textrr)r�etypeZevalueZstbr	r	r
  20  �_showtraceback+srcCs�ttd�rdSdt_tj}tj}tj�d�}t�	�}d|j
  21  _t
  22  j|d�}|j
  23  �t|jj��|j��t�t|�|_t�t|�|_|tjd<|t_|t_|}|ja|t_|t_tt_d	dd�}tjt_|t_|S)
  24  zMStart a global IPython shell, which we need for IPython-specific syntax.
  25      �already_calledNT�__main__)�configrcSs"t|t�r|�dd�}t|�dS)Nz
  26  text/plainr)�
  27  isinstance�dict�getr)Zstrng�startZscreen_linesZ	pager_cmdr	r	r
  28  �nopagejs
  29  zstart_ipython.<locals>.nopage)rrN) �hasattrrrr�displayhook�
  30  excepthook�modulesr!rZdefault_configrZ
  31  simple_prompt�instanceZ	tempfiles�appendrZHistoryManagerZ	hist_fileZbuiltin_trap�activate�types�
  32  MethodTyper�systemrr�builtin_mod�_ip�iprZ
  33  pager_pageZ	orig_page)Z_displayhook�_excepthook�_mainr�shellr/r#r	r	r
  34  r1s2
  35  
  36  
  37  
  38  r)�__doc__�builtinsr.rr+�pathlibrrrZIPython.corerZ
  39  IPython.utilsrZ!IPython.terminal.interactiveshellrrrrrr	r	r	r
  40  �<module>s