
    
d*                         d Z ddlZddlmZ ddlZddlZddlmZ ddl	Z	ddl
mZ ddlmZmZ ej        d         dk    Ze	j        d         dk    Zd Zd	 Zd
 Zd Zd Zedk    r e             dS dS )z4
File used to start kernels for the IPython Console
    N)DottedObjectName)is_module_installed)MPL_BACKENDS_FROM_SPYDERINLINE_FIGURE_FORMATS26c                     t          j        t                    } t          j        |           }t          j        |d          }dt          j        v r-t          j                            d           dt          j        v -t          j        |           ddl	}	 t          j                            |           dS # t          $ r Y dS w xY w)z*Import our customizations into the kernel.	customize r   N)ospdirname__file__joinsyspathremovesite
addsitedirspydercustomize
ValueError)hereparentcustomize_dirr   s       <lib/python3.11/site-packages/spyder_kernels/console/start.pyimport_spydercustomizer       s    ;x  D[FHV[11M .. .. 	OM"""&&&&&   s   B8 8
CCc                 :    | d                     |           }nd}|S )zSympy configurationNzK
from sympy.interactive import init_session
init_session()
%matplotlib {0}
z;
from sympy.interactive import init_session
init_session()
)format)mpl_backendliness     r   sympy_configr    8   s1     F;	 	
 L    c                     ddl m}  ddlm}m} 	 t          j         |             d          } |ddg|          }n#   |            }Y nxY w |            }t          j        	                    d          dk    }|rd	|j
        _        d
|j        _        t          j        	                    d          dk    }t          s||j        _        d}|g|j        _        t          s|j        j                            d           t(          j        dd         dk    r|j        j                            d           t          j        	                    d          }	|	2|j        xj        d |	                    d          D             z  c_        |j        j                            d           |j        j                            d           ddddddd|j        _        d}
t3          d          rt          j        	                    d          }t          j        	                    d          }|dk    rF|Ct4          |         }
|
d k    r.t          j        	                    d!          }t6          }|||         |j        _        t          j        	                    d"          }|t;          |          |j        j        d#<   t;          t          j        	                    d$                    }t;          t          j        	                    d%                    }||||f|j        j        d&<   t          j        	                    d'          }|dk    rd(nd}|j        j                            d)|i           nd }
t          j        	                    d*          dk    }d+}|j        j                            |                     |
|                     t          j        	                    d,          dk    }|r.t3          d-          r|j        j                            d.           t          j        	                    d/          }t          j        	                    d0          }|dk    r"| t          j!        |          r||j        _"        t          j        	                    d1          }|tG          |          |j$        _%        d2|j$        _&        t          j        	                    d3          dk    }||j        _'        t          j        	                    d4          dk    }|r=t3          d5          r.tQ          |
          }|j        j                            |           d	|j        _)        |*                    |           |S )6z3Create a config object with IPython kernel options.r   )get_ipython_dir)Configload_pyconfig_filesprofile_defaultzipython_config.pyzipython_kernel_config.pySPY_TESTINGTrueFPlain
SPY_JEDI_Oz$import sys; sys.argv = ['']; del syszfimport builtins; builtins.runfile = builtins.spyder_runfile; del builtins.spyder_runfile; del builtins   )      zLimport sys; import pdb; sys.breakpointhook = pdb.set_trace; del sys; del pdbSPY_RUN_LINES_ONc                 6    g | ]}|                                 S  )strip).0xs     r   
<listcomp>z!kernel_config.<locals>.<listcomp>   s     7771QWWYY777r!   ;z-get_ipython().kernel._load_autoreload_magic()z&get_ipython().kernel._load_wurlitzer())g      @g      @H   
   g      ?white)figure.figsize
figure.dpiz	font.sizezfigure.subplot.bottomzfigure.facecolorzfigure.edgecolor
matplotlibSPY_PYLAB_OSPY_BACKEND_OinlineSPY_FORMAT_OSPY_RESOLUTION_Or:   SPY_WIDTH_OSPY_HEIGHT_Or9   SPY_BBOX_INCHES_Otightbbox_inchesSPY_AUTOLOAD_PYLAB_Oz1get_ipython().kernel._set_mpl_backend('{0}', {1})SPY_RUN_CYTHONCythonz%reload_ext CythonSPY_USE_FILE_OSPY_RUN_FILE_OSPY_AUTOCALL_Or   SPY_GREEDY_OSPY_SYMPY_Osympy)+IPython.core.applicationr#   traitlets.config.loaderr$   r%   r   r   osenvirongetHistoryAccessorenabledInteractiveShellxmodePY2IPCompleteruse_jediIPKernelApp
exec_linesappendr   version_infosplitInlineBackendrcr   r   r   figure_formatfloatprint_figure_kwargsupdater   existsfile_to_runintZMQInteractiveShellautocallbanner1greedyr    capture_fd_output_merge)r#   r$   r%   profile_pathcfgspy_cfgtestingjedi_o
clear_argvrun_lines_or   pylab_o	backend_oformat_oformatsresolution_owidth_oheight_obbox_inches_orE   autoload_pylab_ocommand
run_cython
use_file_o
run_file_o
autocall_ogreedy_osympy_or   s                                r   kernel_configr   I   s   888888CCCCCCCCx 1 13DEE!!#6#=#?".0 0fhh fhhG jnn]++v5G 0*/' &-G" Z^^L))V3F .'-$ 8J&0\G"  
&--8	
 	
 	
 !&&&--	
 	
 	
 *..!233K&&77 1 1# 6 6777	
&&
 "))79 9 9 "))02 2 2 % !%##   G K<(( *;*..//JNN?33	f!629=Kh&&:>>.99/':A(:KG)7  "z~~.@AA+=B$>& >&G),\:  
} = =>> !?!?@@&8+?BIBJBLG),-=> !#
/B C C)6&)@)@ggd%9@@"K02 2 2
 #K :>>*@AAVKE&--NN;(899	; 	; 	;  011V;J D)(33 D&--.BCCC  011J 011JV
 6:j!! 	9.8G+  011J/2:#, +-G' z~~n--7H!)G jnn]++v5G 5&w// 5[))&--e444 -2G) JJwJs	   +< A
c                 F   t                      }|                                 \  }}	 ddlm} n#  ddlm} Y nxY w|                                  t          ||dd                   |j                                        |                    |	                                 dS )z
    Spyder's variable explorer magic

    Used to generate plots, histograms and images of the variables displayed
    on it.
    r   Nr+   )
get_ipythonr_   guiqwt.pyplotpyplotmatplotlib.pyplotfiguregetattrkernel_get_current_namespaceshow)lineipfuncnamenamer   s        r   varexpr      s     
BZZ\\NHd+&&&&&&&+********
MMOOO!GFHQRRL!!")"B"B"D"DT"JKKK
KKMMMMMs   . 8c                     	 t           j                            t          j        t
                               n# t          $ r Y nw xY w	 t                                          d           n# t          $ r Y nw xY wd} d}t                       dt           j        v r-t           j                            d           dt           j        v -ddlm} ddlm}  G d d|          }|                                }||_        	 t#                      |_        n#  Y nxY w|                                 |j                            t,                     dd l}|j        |j        j        _        |                                 d S )	Nr   r   __main__r   )r[   )SpyderKernelc                   .    e Zd Zer ed          Zd ZdS )main.<locals>.SpyderKernelAppz-spyder_kernels.console.outstream.TTYOutStreamc                     dS )a  
            This method was added in IPykernel 5.3.1 and it replaces
            the debugger used by the kernel with a new class
            introduced in IPython 7.15 during kernel's initialization.
            Therefore, it doesn't allow us to use our debugger.
            Nr0   )selfs    r   init_pdbz&main.<locals>.SpyderKernelApp.init_pdb.  s	     Dr!   N)__name__
__module____qualname__IPYKERNEL_6r   outstream_classr   r0   r!   r   SpyderKernelAppr   (  sC         	A..?A AO	 	 	 	 	r!   r   )r   r   r   r   r   r   r   localspopKeyErrorr   ipykernel.kernelappr[   spyder_kernels.console.kernelr   instancekernel_classr   config
initializeshellregister_magic_functionr   pdbPdbInteractiveTBdebugger_clsstart)__doc__r   r[   r   r   r   r   s          r   mainr     s   H--....   Z       GH  .. .. 0/////::::::    +     %%''F&F%
 L((000
 JJJ.1gFL+ LLNNNNNs-   69 
AA
!A, ,
A98A9?D Dr   )r   rQ   os.pathr   r   r   r   	traitletsr   	ipykernelspyder_kernels.utils.miscr   spyder_kernels.utils.mplr   r   versionrX   __version__r   r   r    r   r   r   r   r0   r!   r   <module>r      s0   
 
			       



  & & & & & &     : 9 9 9 9 95 5 5 5 5 5 5 5 
k!n#A&#-  0  "n n nb  $> > >B zDFFFFF r!   