§
    OŠtjá;  ã                   ó–   — d Z ddlmZ ddlmZ ddlmZ ddlmZ dZ	dZ
dZdd„Zd„ Zd„ Zd„ Zdg d
d
fd„Zd„ Zdd	dddd
d
d
dddg fd„ZdS )z+Tools for setting up interactive sessions. é    )ÚGROUND_TYPES)Úversion_tuple)Úinit_printing)ÚARCHz–from sympy import *
x, y, z, t = symbols('x y z t')
k, m, n = symbols('k m n', integer=True)
f, g, h = symbols('f g h', cls=Function)
init_printing()
zjThese commands were executed:
%(source)s
Documentation can be found at https://docs.sympy.org/%(version)s
zÏCould not locate IPython. Having IPython installed is greatly recommended.
See http://ipython.scipy.org for more details. If you use Debian/Ubuntu,
just install the 'ipython' package and start isympy again.
TFNc                 ó:  — ddl m} ddl m} ddl}ddl}|rdS d|j        dd…         z  }| rd}nd	}d
t          z  g}	|                     d¦  «        }
|
�-|
                     ¦   «         dk    r|	 	                    d¦  «         |r|	 	                    d¦  «         |||t          d                     |	¦  «        f}d|z  }|€t          }d}|                     d¦  «        dd…         D ]}|s|dz  }Œ
|d|z   dz   z  }Œ|}d|v rd}nd|z  }|dt          ||dœz  z   z  }|S )z,Create a banner for an interactive session. r   )Ú__version__)ÚSYMPY_DEBUGNÚ z%d.%d.%dé   ÚIPythonÚPythonzground types: %sÚSYMPY_USE_CACHEÚnoz
cache: offzdebugging: onz, z,%s console for SymPy %s (Python %s-%s) (%s)
ú
éÿÿÿÿz>>> Údevz%s/)ÚsourceÚversion)Úsympyr   r	   ÚsysÚosÚversion_infor   ÚgetenvÚlowerÚappendr   ÚjoinÚpreexec_sourceÚsplitÚverbose_message)ÚipythonÚquietr   Úsympy_versionr	   r   r   Úpython_versionÚ
shell_nameÚinfoÚcacheÚargsÚmessageÚ_sourceÚlineÚdoc_versions                   úW/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/interactive/session.pyÚ_make_messager-      s¥  € à2Ð2Ð2Ð2Ð2Ð2Ø!Ð!Ð!Ð!Ð!Ð!à€J€J€JØ€I€I€Iàð Øˆrà #Ô"2°2°A°2Ô"6Ñ6€Nàð Øˆ
ˆ
àˆ
à¥Ñ-Ð.€Dà�IŠIÐ'Ñ(Ô(€EàÐ˜UŸ[š[™]œ]¨dÒ2Ð2Ø�Š�LÑ!Ô!Ð!àð %Ø�Š�OÑ$Ô$Ð$à�} nµd¸D¿IºIÀd¹O¼OÐK€DØ=ÀÑD€Gà€~Ýˆà€Gà—’˜TÑ"Ô" 3 B 3Ô'ð ,ð ,ˆØð 	,Ø�t‰OˆGˆGà�v ‘} tÑ+Ñ+ˆGˆGà€KØ�ÐÐØˆˆà˜kÑ)ˆàˆt•o°7Ø4?ð)Að )Añ Añ Añ A€Gð €Nó    c                 ó&  — ddl m}m}m}m}m} ddlm} d„ }g } | || ¦  «        j        ¦  «        }	|	D ]R\  }
}}}}|
|k    r- ||¦  «        r"| 	                    |df|df||f|dfg¦  «         Œ;| 
                    |
|f¦  «         ŒS ||¦  «        S )aw  
    Wrap integer literals with Integer.

    This is based on the decistmt example from
    https://docs.python.org/3/library/tokenize.html.

    Only integer literals are converted.  Float literals are left alone.

    Examples
    ========

    >>> from sympy import Integer # noqa: F401
    >>> from sympy.interactive.session import int_to_Integer
    >>> s = '1.2 + 1/2 - 0x12 + a1'
    >>> int_to_Integer(s)
    '1.2 +Integer (1 )/Integer (2 )-Integer (0x12 )+a1 '
    >>> s = 'print (1/2)'
    >>> int_to_Integer(s)
    'print (Integer (1 )/Integer (2 ))'
    >>> exec(s)
    0.5
    >>> exec(int_to_Integer(s))
    1/2
    r   )Úgenerate_tokensÚ
untokenizeÚNUMBERÚNAMEÚOP)ÚStringIOc                 ój   — d| v s,d|                       ¦   «         v sd|                       ¦   «         v rdS dS )z]
        Returns true if string value num (with token NUMBER) represents an integer.
        ú.ÚjÚeFT)r   )Únums    r,   Ú_is_intzint_to_Integer.<locals>._is_intq   s;   € ð
 �#ˆ:ˆ:˜ §	¢	¡¤Ð+Ð+¨s°c·i²i±k´kÐ/AÐ/AØ�5Øˆtr.   ÚIntegerú(ú))Útokenizer0   r1   r2   r3   r4   Úior5   ÚreadlineÚextendr   )Úsr0   r1   r2   r3   r4   r5   r;   ÚresultÚgÚtoknumÚtokvalÚ_s                r,   Úint_to_IntegerrI   U   s  € ð2 GÐFÐFÐFÐFÐFÐFÐFÐFÐFÐFÐFÐFÐFØÐÐÐÐÐðð ð ð €FØˆ˜˜ ™œÔ,Ñ-Ô-€AØ#$ð 	,ð 	,Ñˆ�˜˜1˜aØ�VÒÐ  ¨¡¤ÐØ�MŠMØ�yÐ!Ø�S�	Ø˜Ð Ø�S�	ð	ñ ô ð ð ð �MŠM˜6 6Ð*Ñ+Ô+Ð+Ð+Øˆ:�fÑÔÐr.   c                 ó:   ‡‡— ddl Š| j        Šˆˆfd„}|| _        dS )zM
    Allow IPython to automatically convert integer literals to Integer.
    r   Nc                 óˆ   •— 	 ‰                      | ¦  «         t          | ¦  «        } n# t          $ r Y nw xY w ‰| g|¢R i |¤ŽS ©N)ÚparserI   ÚSyntaxError)Úcellr'   ÚkwargsÚastÚold_run_cells      €€r,   Úmy_run_cellz7enable_automatic_int_sympification.<locals>.my_run_cell�   sn   ø€ ð
	(ð �IŠI�d‰OŒOˆOõ " $Ñ'Ô'ˆDˆDøõ ð 	ð 	ð 	ØˆDð	øøøð ˆ|˜DÐ2 4Ð2Ð2Ð2¨6Ð2Ð2Ð2s   ƒ( ¨
5´5)rQ   Úrun_cell)ÚshellrS   rQ   rR   s     @@r,   Ú"enable_automatic_int_sympificationrV   ‰   sA   øø€ ð €J€J€JØ”>€Lð3ð 3ð 3ð 3ð 3ð 3ð !€E„N€N€Nr.   c                 ó~   ‡— ddl }|                     d¦  «        Šdˆfd„	}|                      t          f|¦  «         dS )z?Allow IPython to automatically create symbols (``isympy -a``). r   Nz8name '(?P<symbol>[A-Za-z_][A-Za-z0-9_]*)' is not definedc                 óþ  •— |t           u �r<|j        �r4|j        j        �s'‰                     t          |¦  «        ¦  «        }|��|                      dd|                     d¦  «        iz  d¬¦  «         	 | j        d         d         }|                      |d¬¦  «         	 |                      d|                     d¦  «        z  d¬¦  «         dS # t          t          f$ r Y nw xY w	 |                      d|                     d¦  «        z  d¬¦  «         n2# |                      d|                     d¦  «        z  d¬¦  «         w xY w| j	         
                    ||||¬	¦  «        }|                      |||¦  «         dS )
zJHandle :exc:`NameError` exception and allow injection of missing symbols. Nz!%(symbol)s = Symbol('%(symbol)s')ÚsymbolF)Ústore_historyÚInr   zdel %s)Ú	tb_offset)Ú	NameErrorÚtb_nextÚmatchÚstrrT   ÚgroupÚuser_nsÚKeyErrorÚ
IndexErrorÚInteractiveTBÚstructured_tracebackÚ_showtraceback)	ÚselfÚetypeÚvalueÚtbr\   r_   ÚcodeÚstbÚre_nameerrors	           €r,   Ú_handlerz*enable_automatic_symbols.<locals>._handlerÌ   sÉ  ø€ à•IÐÑ "¤*Ñ°R´ZÔ5GÑØ ×&Ò&¥s¨5¡z¤zÑ2Ô2ˆEàÑ à—’ÐAØ'¨¯ª°XÑ)>Ô)>Ð?ñ@ØOTð ñ Vô Vð Vð	7Øœ<¨Ô-¨bÔ1�Dð —M’M $°e�MÑ<Ô<Ð<Øà—M’M (¨U¯[ª[¸Ñ-BÔ-BÑ"BØ05ð "ñ 7ô 7ð 7ð 7ð 7øõ !¥*Ð-ð ð ð Ø�DðøøøØð
 —M’M (¨U¯[ª[¸Ñ-BÔ-BÑ"BØ05ð "ñ 7ô 7ð 7ð 7ø�D—M’M (¨U¯[ª[¸Ñ-BÔ-BÑ"BØ05ð "ñ 7ô 7ð 7ð 7øøøð Ô ×5Ò5Ø�5˜"¨	ð 6ñ 3ô 3ˆà×Ò˜E 5¨#Ñ.Ô.Ð.Ð.Ð.s*   Á6C Â	D ÃC$Ã!D Ã#C$Ã$D Ä/ErL   )ÚreÚcompileÚset_custom_excr]   )rU   rp   ro   rn   s      @r,   Úenable_automatic_symbolsrs   ¡   se   ø€ ðN €I€I€IØ—:’:ØBñDô D€Lð/ð /ð /ð /ð /ð /ð2 
×Ò�)˜ xÑ0Ô0Ð0Ð0Ð0r.   c                 ó”  — ddl }t          |j        ¦  «        t          d¦  «        k    r�| sit          |j        ¦  «        t          d¦  «        k    rddlm} nddlm} |                     ¦   «         }d|_        |                     |¦  «         |j	        } |rt          | ¦  «         |rt          | ¦  «         | S ddlm}  ||¦  «        S )zConstruct new IPython session. r   Nú0.11z1.0)ÚipappF)Úmake_IPython)r   r   r   ÚIPython.terminalrv   ÚIPython.frontend.terminalÚTerminalIPythonAppÚdisplay_bannerÚ
initializerU   rs   rV   ÚIPython.Shellrw   )rU   ÚargvÚauto_symbolsÚauto_int_to_Integerr   rv   Úapprw   s           r,   Úinit_ipython_sessionr‚   è   sÿ   € à€N€N€Nå�WÔ(Ñ)Ô)­]¸6Ñ-BÔ-BÒBÐBØð 	õ
 ˜WÔ0Ñ1Ô1µ]À5Ñ5IÔ5IÒIÐIØ2Ð2Ð2Ð2Ð2Ð2Ð2à;Ð;Ð;Ð;Ð;Ð;Ø×*Ò*Ñ,Ô,ˆCð "'ˆCÔØ�NŠN˜4Ñ Ô Ð à”IˆEàð 	,Ý$ UÑ+Ô+Ð+Øð 	6Ý.¨uÑ5Ô5Ð5àˆà.Ð.Ð.Ð.Ð.Ð.Øˆ|˜DÑ!Ô!Ð!r.   c                  óD   ‡— ddl mŠ  G ˆfd„d‰¦  «        }  | ¦   «         S )zConstruct new Python session. r   ©ÚInteractiveConsolec                   ó   •— e Zd ZdZˆ fd„ZdS )ú)init_python_session.<locals>.SymPyConsolez.An interactive console with readline support. c                 óÞ  •— i }‰                      | |¬¦  «         	 dd l}dd l}dd l}dd l}|                     |                     |¦  «        j        ¦  «         |                     d¦  «         t          |d¦  «        r^|j
                             d¦  «        }	 |                     |¦  «         n# t          $ r Y nw xY w|                     |j        |¦  «         d S d S # t           $ r Y d S w xY w)N)Úlocalsr   ztab: completeÚread_history_filez~/.sympy-history)Ú__init__ÚrlcompleterrA   r   ÚatexitÚset_completerÚ	CompleterÚcompleteÚparse_and_bindÚhasattrÚpathÚ
expanduserrŠ   ÚOSErrorÚregisterÚwrite_history_fileÚImportError)rh   Ú	ns_localsrŒ   rA   r   r�   Úhistoryr…   s          €r,   r‹   z2init_python_session.<locals>.SymPyConsole.__init__  s>  ø€ ØˆIØ×'Ò'¨°YÐ'Ñ?Ô?Ð?ðJØ"Ð"Ð"Ð"Ø���ð �	�	�	Ø���à×&Ò& {×'<Ò'<¸YÑ'GÔ'GÔ'PÑQÔQÐQØ×'Ò'¨Ñ8Ô8Ð8å˜8Ð%8Ñ9Ô9ð JØ œg×0Ò0Ð1CÑDÔD�GðØ ×2Ò2°7Ñ;Ô;Ð;Ð;øÝ"ð ð ð Ø˜ðøøøð —O’O HÔ$?ÀÑIÔIÐIÐIÐIðJð Jøõ ð ð ð Ø��ðøøøs#   œC ÂB/ Â/
B<Â;B<Ã
C,Ã+C,N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r‹   r„   s   €r,   ÚSymPyConsoler‡     s;   ø€ € € € € Ø<Ð<ð	Jð 	Jð 	Jð 	Jð 	Jð 	Jð 	Jr.   rŸ   )rl   r…   )rŸ   r…   s    @r,   Úinit_python_sessionr    	  sb   ø€ à'Ð'Ð'Ð'Ð'Ð'ðJð Jð Jð Jð Jð Jð JÐ)ñ Jô Jð Jð8 ˆ<‰>Œ>Ðr.   c           
      ó  ‡— ddl }d}| dura	 ddl}	 ddlm}  |¦   «         Šn7# t          $ r dŠY n)w xY w# t          $ r | du rt	          d¦  «        ‚dŠY nw xY wt          ‰¦  «        }| €|} | du rt          ¦   «         Š‰j        }ntt          ‰|||¬¦  «        Št          |j
        ¦  «        t          d¦  «        k    r3dˆfd
„	‰_        	 ‰                     d¬¦  «         n# t          $ r Y nw xY w|s‰j        }|r6| r%t          |j
        ¦  «        t          d¦  «        k     rt	          d¦  «        ‚|r6| r%t          |j
        ¦  «        t          d¦  «        k     rt	          d¦  «        ‚t          }‰                     |d	¬¦  «         t!          ||||‰||	|
¬¦  «         t#          | ||¦  «        }|s0t%          |¦  «          |¦   «          |                     d¦  «         dS t%          |¦  «         ddl}|                     d„ ¦  «         dS )u”  
    Initialize an embedded IPython or Python session. The IPython session is
    initiated with the --pylab option, without the numpy imports, so that
    matplotlib plotting can be interactive.

    Parameters
    ==========

    pretty_print: boolean
        If True, use pretty_print to stringify;
        if False, use sstrrepr to stringify.
    order: string or None
        There are a few different settings for this parameter:
        lex (default), which is lexographic order;
        grlex, which is graded lexographic order;
        grevlex, which is reversed graded lexographic order;
        old, which is used for compatibility reasons and for long expressions;
        None, which sets it to lex.
    use_unicode: boolean or None
        If True, use unicode characters;
        if False, do not use unicode characters.
    use_latex: boolean or None
        If True, use latex rendering if IPython GUI's;
        if False, do not use latex rendering.
    quiet: boolean
        If True, init_session will not print messages regarding its status;
        if False, init_session will print messages regarding its status.
    auto_symbols: boolean
        If True, IPython will automatically create symbols for you.
        If False, it will not.
        The default is False.
    auto_int_to_Integer: boolean
        If True, IPython will automatically wrap int literals with Integer, so
        that things like 1/2 give Rational(1, 2).
        If False, it will not.
        The default is False.
    ipython: boolean or None
        If True, printing will initialize for an IPython console;
        if False, printing will initialize for a normal console;
        The default is None, which automatically determines whether we are in
        an ipython instance or not.
    str_printer: function, optional, default=None
        A custom string printer function. This should mimic
        sympy.printing.sstrrepr().
    pretty_printer: function, optional, default=None
        A custom pretty printer. This should mimic sympy.printing.pretty().
    latex_printer: function, optional, default=None
        A custom LaTeX printer. This should mimic sympy.printing.latex()
        This should mimic sympy.printing.latex().
    argv: list of arguments for IPython
        See sympy.bin.isympy for options that can be used to initialize IPython.

    See Also
    ========

    sympy.interactive.printing.init_printing: for examples and the rest of the parameters.


    Examples
    ========

    >>> from sympy import init_session, Symbol, sin, sqrt
    >>> sin(x) #doctest: +SKIP
    NameError: name 'x' is not defined
    >>> init_session() #doctest: +SKIP
    >>> sin(x) #doctest: +SKIP
    sin(x)
    >>> sqrt(5) #doctest: +SKIP
      ___
    \/ 5
    >>> init_session(pretty_print=False) #doctest: +SKIP
    >>> sqrt(5) #doctest: +SKIP
    sqrt(5)
    >>> y + x + y**2 + x**2 #doctest: +SKIP
    x**2 + x + y**2 + y
    >>> init_session(order='grlex') #doctest: +SKIP
    >>> y + x + y**2 + x**2 #doctest: +SKIP
    x**2 + y**2 + x + y
    >>> init_session(order='grevlex') #doctest: +SKIP
    >>> y * x**2 + x * y**2 #doctest: +SKIP
    x**2*y + x*y**2
    >>> init_session(order='old') #doctest: +SKIP
    >>> x**2 + y**2 + x + y #doctest: +SKIP
    x + y + x**2 + y**2
    >>> theta = Symbol('theta') #doctest: +SKIP
    >>> theta #doctest: +SKIP
    theta
    >>> init_session(use_unicode=True) #doctest: +SKIP
    >>> theta # doctest: +SKIP
    Î¸
    r   NF)Úget_ipythonTz'IPython is not available on this system)r~   r   r€   ru   Úexecc                 ó0   •— ‰                      | d¦  «        S )NF)rT   )ÚsrcrY   Úips     €r,   ú<lambda>zinit_session.<locals>.<lambda>«  s   ø€ °b·k²kÀ#ÀuÑ6MÔ6M€ r.   )Ú
import_allzKautomatic construction of symbols is possible only in IPython 0.11 or abovezQautomatic int to Integer transformation is possible only in IPython 0.11 or above)rY   )Úpretty_printÚorderÚuse_unicodeÚ	use_latexr¦   Ústr_printerÚpretty_printerÚlatex_printerzExiting ...c                  ó    — t          d¦  «        S )NzExiting ...
)Úprint© r.   r,   r§   zinit_session.<locals>.<lambda>Ï  s   € ¥ oÑ 6Ô 6€ r.   )r£   )r   r   r¢   r˜   ÚRuntimeErrorÚboolr    Úinteractr‚   r   r   Ú	runsourceÚenable_pylabÚ	ExceptionÚmainloopr   r   r-   r±   Úexitr�   r–   )r    r©   rª   r«   r¬   r!   r   r€   r­   r®   r¯   r~   r   Ú
in_ipythonr   r¢   r¹   Ú_preexec_sourcer(   r�   r¦   s                       @r,   Úinit_sessionr½   ,  sÉ  ø€ ð~ €J€J€Jà€Jà�eÐÐð	ØˆNˆNˆNðØ/Ð/Ð/Ð/Ð/Ð/Ø �[‘]”]��øÝð ð ð Ø���ðøøøøõ ð 	ð 	ð 	Ø˜$ˆˆÝ"Ð#LÑMÔMÐMØˆBˆBˆBð	øøøõ ˜"‘X”Xˆ
Øˆ?Ø ˆGà�%ÐÐÝ Ñ"Ô"ˆØ”;ˆˆå! "¨4¸lØ6IðKñ Kô Kˆõ ˜Ô,Ñ-Ô-µ¸vÑ1FÔ1FÒFÐFð NÐMÐMÐMÐMˆBŒLðØ—’¨5�Ñ1Ô1Ð1Ð1øÝð ð ð ð
 �ðøøøð ð 	#Ø”{ˆHàð j˜Wð j­°gÔ6IÑ(JÔ(JÍ]Ð[aÑMbÔMbÒ(bÐ(bÝÐhÑiÔiÐiØð p Gð p­}¸WÔ=PÑ/QÔ/QÕTaÐbhÑTiÔTiÒ/iÐ/iÝÐnÑoÔoÐoå$€Oà‡L‚L�¨€LÑ0Ô0Ð0Ý˜|°5Ø)°YÀ2Ø)¸.Ø -ð/ñ /ô /ð /õ
 ˜G U¨OÑ<Ô<€Gàð 8Ýˆg‰ŒˆØˆ‰
Œ
ˆ
Ø�Š�ÑÔÐÐÐåˆg‰ŒˆØˆˆˆØ�ŠÐ6Ð6Ñ7Ô7Ð7Ð7Ð7s-   �5 ’# £2±2µAÁAÃC" Ã"
C/Ã.C/)TFN)rž   Úsympy.external.gmpyr   Úsympy.external.importtoolsr   Úsympy.interactive.printingr   Úsympy.utilities.miscr   r   r   Ú
no_ipythonr-   rI   rV   rs   r‚   r    r½   r²   r.   r,   ú<module>rÃ      s"  ðØ 1Ð 1à ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4à 4Ð 4Ð 4Ð 4Ð 4Ð 4à %Ð %Ð %Ð %Ð %Ð %ð€ð€ð€
ð3ð 3ð 3ð 3ðl1ð 1ð 1ðh!ð !ð !ð0D1ð D1ð D1ðN  $¨"¸5ÐV[ð "ð "ð "ð "ðB ð  ð  ðF ¨D¸Ø!¨T¸ÈUØ%*¸ÈTØ#¨"ðc8ð c8ð c8ð c8ð c8ð c8r.   