Ë
    7^(há;  ã                   ó”   — 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y)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yd|j
                  dd z  }| rd}nd	}d
t        z  g}	|j                  d«      }
|
�$|
j                  «       dk(  r|	j                  d«       |r|	j                  d«       |||t        dj                  |	«      f}d|z  }|€t        }d}|j                  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/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/interactive/session.pyÚ_make_messager-      s<  € å2Ý!ãÛáØà #×"2Ñ"2°2°AÐ"6Ñ6€NáØ‰
àˆ
à¤Ñ-Ð.€Dà�I‰IÐ'Ó(€EàÐ˜UŸ[™[›]¨dÒ2Ø�‰�LÔ!áØ�‰�OÔ$à�} n´d¸D¿I¹IÀd»OÐK€DØ=ÀÑD€Gà€~Üˆà€Gà—‘˜TÓ" 3 BÐ'ò ,ˆÙØ�t‰O‰Gà�v ‘} tÑ+Ñ+‰Gð	,ð  €KØ�ÑØ‰à˜kÑ)ˆàˆt”o°7Ø4?ñ)Añ Añ Añ A€Gð €Nó    c                 ó
  — ddl m}m}m}m}m} ddlm} d„ }g } | || «      j                  «      }	|	D ]F  \  }
}}}}|
|k(  r& ||«      r|j                  |df|df||f|dfg«       Œ4|j                  |
|f«       ŒH  ||«      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                 óV   — d| v s$d| j                  «       v sd| j                  «       v ryy)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Ñ/AØØr.   Ú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Ù™ ›×,Ñ,Ó-€AØ#$ò 	,Ñˆ�˜˜1˜aØ�VÒ¡¨¤Ø�M‰MØ�yÐ!Ø�S�	Ø˜Ð Ø�S�	ð	õ ð �M‰M˜6 6Ð*Õ+ð	,ñ �fÓÐr.   c                 óB   ‡‡— ddl Š| j                  Šˆˆfd„}|| _        y)zM
    Allow IPython to automatically convert integer literals to Integer.
    r   Nc                 ót   •— 	 ‰j                  | «       t        | «      }  ‰| g|¢­i |¤ŽS # t        $ r Y Œw xY w©N)ÚparserI   ÚSyntaxError)Úcellr'   ÚkwargsÚastÚold_run_cells      €€r,   Úmy_run_cellz7enable_automatic_int_sympification.<locals>.my_run_cell�   sJ   ø€ ð
	(ð �I‰I�dŒOô " $Ó'ˆDÙ˜DÐ2 4Ò2¨6Ñ2Ð2øô	 ò 	Ùð	ús   ƒ+ «	7¶7)rQ   Úrun_cell)ÚshellrS   rQ   rR   s     @@r,   Ú"enable_automatic_int_sympificationrV   ‰   s   ù€ ó Ø—>‘>€Lõ3ð !€E…Nr.   c                 ój   ‡— ddl }|j                  d«      Šdˆfd„	}| j                  t        f|«       y)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                  r¦|j                  j                  s�‰j                  t        |«      «      }|�t| j	                  dd|j                  d«      iz  d¬«       	 | j                  d   d   }| j	                  |d¬«       	 | j	                  d|j                  d«      z  d¬«       y| j                  j                  ||||¬	«      }| j                  |||«       y# t        t        f$ r Y nw xY w	 | j	                  d|j                  d«      z  d¬«       Œo# | j	                  d|j                  d«      z  d¬«       w xY w)
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Ì   sV  ø€ à”IÑ "§*¢*°R·Z±Z×5GÒ5GØ ×&Ñ&¤s¨5£zÓ2ˆEàÐ à—‘ÐAØ'¨¯©°XÓ)>Ð?ñ@ØOTð ô Vð	7ØŸ<™<¨Ñ-¨bÑ1�Dð —M‘M $°e�MÔ<Øà—M‘M (¨U¯[©[¸Ó-BÑ"BØ05ð "õ 7ð × Ñ ×5Ñ5Ø�5˜"¨	ð 6ó 3ˆà×Ñ˜E 5¨#Õ.øô !¤*Ð-ò ÙðúØð
 —M‘M (¨U¯[©[¸Ó-BÑ"BØ05ð "õ 7ø�D—M‘M (¨U¯[©[¸Ó-BÑ"BØ05ð "õ 7ús*   Á0C/ ÂD+ Ã/DÃ>D+ Ä DÄD+ Ä+'ErL   )ÚreÚcompileÚset_custom_excr]   )rU   rp   ro   rn   s      @r,   Úenable_automatic_symbolsrs   ¡   s4   ø€ óN Ø—:‘:ØBóD€Lõ/ð2 
×Ñœ)˜ xÕ0r.   c                 óh  — ddl }t        |j                  «      t        d«      k\  r€| sbt        |j                  «      t        d«      k\  rddlm} nddlm} |j                  «       }d|_        |j                  |«       |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–   € ãä�W×(Ñ(Ó)¬]¸6Ó-BÒBÙô
 ˜W×0Ñ0Ó1´]À5Ó5IÒIÞ2å;Ø×*Ñ*Ó,ˆCð "'ˆCÔØ�N‰N˜4Ô à—I‘IˆEáÜ$ UÔ+ÙÜ.¨uÔ5àˆå.Ù˜DÓ!Ð!r.   c                  ó8   ‡— 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y)ú)init_python_session.<locals>.SymPyConsolez.An interactive console with readline support. c                 ó°  •— i }‰j                  | |¬«       	 dd l}dd l}dd l}dd l}|j                  |j                  |«      j                  «       |j                  d«       t        |d«      rJ|j                  j                  d«      }	 |j                  |«       |j                  |j                  |«       y y # t        $ r Y Œ)w xY w# t         $ r Y y 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×'PÑ'PÔQØ×'Ñ'¨Ô8ä˜8Ð%8Ô9Ø Ÿg™g×0Ñ0Ð1CÓD�GðØ ×2Ñ2°7Ô;ð —O‘O H×$?Ñ$?ÀÕIð :øô
 #ò Ùðûô ò Ùðús#   ˜C	 ÂB: Â:	CÃCÃ		CÃCN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r‹   r„   s   €r,   ÚSymPyConsoler‡     s   ø„ Ù<õ	Jr.   rŸ   )rl   r…   )rŸ   r…   s    @r,   Úinit_python_sessionr    	  s   ø€ å'öJÐ)ô Jñ8 ‹>Ðr.   c           
      ó’  ‡— ddl }d}| dur"	 ddl}	 ddlm}  |«       Št        ‰«      }| €|} | du rt        «       Š‰j                  }n\t        ‰|||¬«      Št        j                  «      t        d«      k\  rdˆfd
„	‰_        	 ‰j                  d¬«       |s‰j                  }|r.| r!t        j                  «      t        d«      k  rt	        d«      ‚|r.| r!t        j                  «      t        d«      k  rt	        d«      ‚t        }‰j                  |d	¬«       t!        ||||‰||	|
¬«       t#        | ||«      }|s$t%        |«        «        |j'                  d«       yt%        |«       ddl}|j+                  d„ «       y# t        $ r dŠY �Œuw xY w# t        $ r | du rt	        d«      ‚dŠY �Œ–w xY w# t        $ r Y �Œ.w xY w)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                 ó(   •— ‰j                  | d«      S )NF)rT   )ÚsrcrY   Úips     €r,   ú<lambda>zinit_session.<locals>.<lambda>«  s   ø€ °b·k±kÀ#ÀuÓ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€ 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à�eÑð	ÛðÝ/Ù “]�ô ˜"“Xˆ
Øˆ?Ø ˆGà�%ÑÜ Ó"ˆØ—;‘;‰ä! "¨4¸lØ6IôKˆô ˜×,Ñ,Ó-´¸vÓ1FÒFô NˆBŒLðØ—‘¨5�Ô1ñ Ø—{‘{ˆHá™W¬°g×6IÑ6IÓ(JÌ]Ð[aÓMbÒ(bÜÐhÓiÐiÙ¡G¬}¸W×=PÑ=PÓ/QÔTaÐbhÓTiÒ/iÜÐnÓoÐoä$€Oà‡L�L�¨€LÔ0Ü˜|°5Ø)°YÀ2Ø)¸.Ø -õ/ô
 ˜G U¨OÓ<€GáÜˆgŒÙŒ
Ø�‰�ÕäˆgŒÛØ�‰Ñ6Õ7øôk ò Ø“ðûô ò 	Ø˜$‰Ü"Ð#LÓMÐMØ‹Bð	ûô< ò ò
 ðús4   �F ’F ÂF9 ÆFÆFÆF6Æ5F6Æ9	GÇG)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å ,Ý 4å 4å %ð€ð€ð€
ó3òl1òh!ò0D1ðN  $¨"¸5ÐV[ó "òB ðF ¨D¸Ø!¨T¸ÈUØ%*¸ÈTØ#¨"ôc8r.   