� ��g��6�dZddlmZddlmZddlmZmZmZm Z m Z m Z ddl m Z ddlmZddlmZddlmZdd lmZd d lmZmZd d lmZmZdd lmZmZGd�de��Zee��d���Z Gd�de��Z!ee!��d���Z"dS)zI A Printer for generating readable representation of most SymPy classes. �)� annotations)�Any)�S�Rational�Pow�Basic�Mul�Number)� _keep_coeff)�Integer)� Relational)�default_sort_key)�sift�)� precedence� PRECEDENCE)�Printer�print_function)� prec_to_dps�to_strc�n�eZdZUdZdddddddd�Zded<iZd ed <d�d �Zd�d �Zd�Z d�d�Z d�Z d�Z d�Z d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Zd!�Zd"�Zd#�Zd$�Zd%�Z d&�Z!d'�Z"d(�Z#d)�Z$d*�Z%d+�Z&d,�Z'd-�Z(d.�Z)d/�Z*d0�Z+d1�Z,d2�Z-d3�Z.d4�Z/d5�Z0d6�Z1d7�Z2d8�Z3d9�Z4d:�Z5d;�Z6d<�Z7d=�Z8d>�Z9d?�Z:d@�Z;dA�Z<dB�Z=dC�Z>dD�Z?dE�Z@dF�ZAdG�ZBdH�ZCdI�ZDdJ�ZEdK�ZFdL�ZGdM�ZHdN�ZIdO�ZJdP�ZKdQ�ZLdR�ZMd�dS�ZNdT�ZOdU�ZPdV�ZQdW�ZRdX�ZSdY�ZTdZ�ZUd[�ZVd\�ZWd]�ZXd^�ZYd_�ZZd`�Z[da�Z\db�Z]dc�Z^dd�Z_de�Z`df�Zadg�Zbdh�Zcdi�Zddj�Zedk�Zfdl�Zgdm�Zhdn�Zido�ZjejZkejZldp�Zmdq�Zndr�Zods�Zpdt�Zqdu�Zrdv�Zsdw�Ztdx�Zudy�Zvdz�Zwd{�Zxd|�Zyd}�Zzd~�Z{d�Z|d��Z}d��Z~d��Zd��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�dS)�� StrPrinter� _sympystrN�autoFT)�order� full_prec�sympy_integers�abbrev� perm_cyclic�min�maxzdict[str, Any]�_default_settingszdict[str, str]� _relationalsc��t|��|ks|s+t|��|krd|�|��zS|�|��S)N�(%s))r�_print)�self�item�level�stricts �b/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/printing/str.py� parenthesizezStrPrinter.parenthesize"sU�� �t� � �u� $� $�v� $�:�d�;K�;K�u�;T�;T��D�K�K��-�-�-� -��;�;�t�$�$� $�rc�J���|���fd�|D����S)Nc�<��g|]}��|�����S��r,)�.0r(r)r's ��r+� <listcomp>z(StrPrinter.stringify.<locals>.<listcomp>)s)���I�I�I�D��*�*�4��7�7�I�I�Ir-)�join)r'�args�sepr)s` `r+� stringifyzStrPrinter.stringify(s.�����x�x�I�I�I�I�I�D�I�I�I�J�J�Jr-c��t|t��r|St|t��rt|��St|��S�N)� isinstance�strr�repr�r'�exprs r+� emptyPrinterzStrPrinter.emptyPrinter+sC�� �d�C� � � ��K� ��e� $� $� ���:�:� ��t�9�9� r-c���|�||���}t|��}g}|D]�}|�|��}|�d��r|js d}|dd�}nd}t|��|ks|jr|�|d|zg���w|�||g����|�d��}|dkrd}|d�|��zS) N�r�-r�+r%r�� )�_as_ordered_termsrr&� startswith�is_Add�extend�popr4) r'r>r�terms�prec�l�term�t�signs r+� _print_AddzStrPrinter._print_Add3s���&�&�t�5�&�9�9���$���� ��� $� $�D�� � �D�!�!�A��|�|�C� � � ��� ����a�b�b�E������$���$�&�&�$�+�&����$��� �+�,�,�,�,����$���#�#�#�#��u�u�Q�x�x�� �3�;�;��D��c�h�h�q�k�k�!�!r-c��dS)N�Truer0r=s r+�_print_BooleanTruezStrPrinter._print_BooleanTrueHs���vr-c��dS)N�Falser0r=s r+�_print_BooleanFalsezStrPrinter._print_BooleanFalseK����wr-c�`�d|�|jdtd��zS)Nz~%sr�Not)r,r5rr=s r+� _print_NotzStrPrinter._print_NotNs(���t�(�(���1��j��6G�H�H�I�Ir-c�D�t|j��}t|��D][\}}t|t��rA|jjtjur)|� d|� |�����\|� |dtd��S)Nrz & � BitwiseAnd) �listr5� enumerater:r � canonical�rhsr�NegativeInfinity�insertrJr7r)r'r>r5�j�is r+� _print_AndzStrPrinter._print_AndQs����D�I�����d�O�O� ,� ,�D�A�q��!�Z�(�(� ,��K�O�q�'9�9�9�� � �A�t�x�x��{�{�+�+�+���~�~�d�E�:�l�+C�D�D�Dr-c�P�|�|jdtd��S)Nz | � BitwiseOr�r7r5rr=s r+� _print_OrzStrPrinter._print_OrYs���~�~�d�i�� �;�0G�H�H�Hr-c�P�|�|jdtd��S)Nz ^ � BitwiseXorrir=s r+� _print_XorzStrPrinter._print_Xor\s���~�~�d�i�� �<�0H�I�I�Ir-c�t�|�|j���d|�|jd���d�S�N�(�, �))r&�functionr7� argumentsr=s r+�_print_AppliedPredicatez"StrPrinter._print_AppliedPredicate_s=�� �K�K�� � &� &� &� &����t�~�t�(L�(L�(L�(L�N� Nr-c�t���fd�|jD��}|jjdd�|��zzS)Nc�:��g|]}��|����Sr0�r&)r2�or's �r+r3z+StrPrinter._print_Basic.<locals>.<listcomp>ds#��� /� /� /��T�[�[��^�^� /� /� /r-r%rq)r5� __class__�__name__r4)r'r>rMs` r+� _print_BasiczStrPrinter._print_Basiccs=��� /� /� /� /�T�Y� /� /� /���~�&��$�)�)�A�,�,�)>�>�>r-c��|jjdkr |�|jd��|�|j��S)N)rr)rr)�blocks�shaper&)r'�Bs r+�_print_BlockMatrixzStrPrinter._print_BlockMatrixgs=�� �8�>�V� #� #� �K�K����� '� '� '��{�{�1�8�$�$�$r-c��dS)N�Catalanr0r=s r+�_print_CatalanzStrPrinter._print_Catalanls���yr-c��dS)N�zoor0r=s r+�_print_ComplexInfinityz!StrPrinter._print_ComplexInfinityo����ur-c����t�fd�|j|jfD����}|jtjurd|zS|��|j��fz }d|zS)Nc�:��g|]}��|����Sr0rx�r2rer's �r+r3z2StrPrinter._print_ConditionSet.<locals>.<listcomp>ss#���C�C�C��d�k�k�!�n�n�C�C�Cr-zConditionSet(%s, %s)zConditionSet(%s, %s, %s))�tuple�sym� condition�base_setr� UniversalSetr&)r'�sr5s` r+�_print_ConditionSetzStrPrinter._print_ConditionSetrsn����C�C�C�C�q�u�a�k�.B�C�C�C�D�D�� �:��� '� '�)�D�0� 0� ����Q�Z�(�(�*�*��)�D�0�0r-c���|j}d�|jD��}dd��fd�|g|zD����zS)Nc�:�g|]}|ddkr|dn|��S)rrr0)r2res r+r3z0StrPrinter._print_Derivative.<locals>.<listcomp>{s,��G�G�G�a��1������1����G�G�Gr-zDerivative(%s)rqc3�B�K�|]}��|��V��dSr9rx�r2�argr's �r+� <genexpr>z/StrPrinter._print_Derivative.<locals>.<genexpr>|s/�����,Y�,Y�#�T�[�[��-=�-=�,Y�,Y�,Y�,Y�,Y�,Yr-)r>�variable_countr4)r'r>�dexpr�dvarss` r+�_print_DerivativezStrPrinter._print_DerivativeysS���� ��G�G�4�3F�G�G�G���$�)�)�,Y�,Y�,Y�,Y�%��SX��,Y�,Y�,Y�"Z�"Z�Z�Zr-c� �t|���t���}g}|D]J}|�|���d|�||����}|�|���Kdd�|��zS)N��keyz: �{%s}rq)�sorted�keysrr&�appendr4)r'�dr��itemsr�r(s r+� _print_dictzStrPrinter._print_dict~s����a�f�f�h�h�$4�5�5�5����� � �C�#�{�{�3�/�/�/�/����Q�s�V�1D�1D�1D�E�D� �L�L�� � � � ��� � �%�(�(�(�(r-c�,�|�|��Sr9)r�r=s r+� _print_DictzStrPrinter._print_Dict��������%�%�%r-c�F�t|d��r*d|�|�����zSt|d��r;d|�|j��zdz|�|j��zSd|�|j��zS)N� as_booleanzDomain: �setz in z Domain on )�hasattrr&r��symbolsr�)r'r�s r+�_print_RandomDomainzStrPrinter._print_RandomDomain�s��� �1�l� #� #� 9��� � �A�L�L�N�N� ;� ;�;� ;� �Q�� � � 9�����Q�Y�!7�!7�7�&�@��K�K���&�&�'� (� �$�+�+�a�i�"8�"8�8� 8r-c��d|jzS�N�_��namer=s r+� _print_DummyzStrPrinter._print_Dummy�s���T�Y��r-c��dS)N� EulerGammar0r=s r+�_print_EulerGammazStrPrinter._print_EulerGamma�s���|r-c��dS)N�Er0r=s r+� _print_Exp1zStrPrinter._print_Exp1�����sr-c�t�d|�|j���d|�|j���d�Sro)r&r>�condr=s r+�_print_ExprCondPairzStrPrinter._print_ExprCondPair�s7���!�[�[���3�3�3�3�T�[�[���5K�5K�5K�5K�L�Lr-c�X�|jjd|�|jd��zzS�Nr%rq)�funcr{r7r5r=s r+�_print_FunctionzStrPrinter._print_Function�s'���y�!�F�T�^�^�D�I�t�-L�-L�$L�L�Lr-c��dS)N� GoldenRatior0r=s r+�_print_GoldenRatiozStrPrinter._print_GoldenRatio�s���}r-c�X�|jjd|�|jd��zzSr�)r�r{r7�pargsr=s r+�_print_HeavisidezStrPrinter._print_Heaviside�s)���y�!�F�T�^�^�D�J��-M�-M�$M�M�Mr-c��dS)N�TribonacciConstantr0r=s r+�_print_TribonacciConstantz$StrPrinter._print_TribonacciConstant�s��#�#r-c��dS�N�Ir0r=s r+�_print_ImaginaryUnitzStrPrinter._print_ImaginaryUnit�r�r-c��dS)N�oor0r=s r+�_print_InfinityzStrPrinter._print_Infinity�����tr-c�����fd��d��fd�|jD����}d��|j���d|�d�S)Nc����t|��dkr��|d��S��|dft|dd���z��S�Nrr��lenr&r���xabr's �r+� _xab_tostrz.StrPrinter._print_Integral.<locals>._xab_tostr��S����3�x�x�1�}�}��{�{�3�q�6�*�*�*��{�{�C��F�9�u�S����W�~�~�#=�>�>�>r-rqc�&��g|] }�|����Sr0r0�r2rMr�s �r+r3z.StrPrinter._print_Integral.<locals>.<listcomp>��!���:�:�:��z�z�!�}�}�:�:�:r-z Integral(rr�r4�limitsr&rs�r'r>�Lr�s` @r+�_print_IntegralzStrPrinter._print_Integral�sl���� ?� ?� ?� ?� ?� �I�I�:�:�:�:�d�k�:�:�:� ;� ;���%)�[�[���%?�%?�%?�%?����C�Cr-c��d}|j\}}}}|jr |jrd}n-|jr|sd}n!|jr|sd}n|s|sd}n|r|rd}n|rd}nd}|jdi|||d���S)NzInterval{m}({a}, {b})rDz.openz.Lopenz.Ropen)�a�b�mr0)r5� is_infinite�format)r're�finr�r�rM�rr�s r+�_print_IntervalzStrPrinter._print_Interval�s���&���V� ��1�a�� �=� �Q�]� ��A�A� �]� �1� ��A�A� �]� �1� ��A�A�� �1� ��A�A� � �1� ��A�A� � ��A�A��A��s�z�5�5�!�!�!�4�4�5�5�5r-c�t�d|�|j���d|�|j���d�S)Nz AccumBounds(rqrr)r&r r!)r'res r+�_print_AccumulationBoundsz$StrPrinter._print_AccumulationBounds�s<���(,� � �A�E�(:�(:�(:�(:�(,� � �A�E�(:�(:�(:�(:�<� <r-c�T�d|�|jtd��zS)Nz%s**(-1)r�r,r�r)r'r�s r+�_print_InversezStrPrinter._print_Inverse�s$���D�-�-�a�e�Z��5F�G�G�G�Gr-c���|j}|j}t|��dkr|djr|d}d|�|���d|�|���d�S)NrrzLambda(rqrr)r>� signaturer�� is_symbolr&)r'�objr>�sigs r+� _print_LambdazStrPrinter._print_Lambda�sc���x���m�� �s�8�8�q�=�=�S��V�-�=��a�&�C��#'�;�;�s�#3�#3�#3�#3�T�[�[��5F�5F�5F�5F�G�Gr-c���t|jt���}|jjdd��fd�|D����zzS)Nr�r%rqc3�B�K�|]}��|��V��dSr9rxr�s �r+r�z.StrPrinter._print_LatticeOp.<locals>.<genexpr>�s/�����6X�6X�C�t�{�{�3�7G�7G�6X�6X�6X�6X�6X�6Xr-)r�r5rr�r{r4�r'r>r5s` r+�_print_LatticeOpzStrPrinter._print_LatticeOp�sO����d�i�%5�6�6�6���y�!�F�T�Y�Y�6X�6X�6X�6X�SW�6X�6X�6X�-X�-X�$X�X�Xr-c �l�|j\}}}}dtt|j||||f����zS)NzLimit(%s, %s, %s, dir='%s'))r5r��mapr&)r'r>�e�z�z0�dirs r+� _print_LimitzStrPrinter._print_Limit�s9��� � ��1�b�#�,�u�S���q�!�R�QT�o�5V�5V�/W�/W�W�Wr-c�4�d|�|d��zS)N�[%s]rq)r7r=s r+� _print_listzStrPrinter._print_list�s������t�T�2�2�2�2r-c�,�|�|��Sr9)rr=s r+� _print_ListzStrPrinter._print_List�r�r-c�,�|�|��Sr9)� _format_strr=s r+�_print_MatrixBasezStrPrinter._print_MatrixBase�r�r-c���|�|jtdd���d|�|j���d|�|j���d�zS)N�AtomT�r*�[rq�])r,�parentrr&rerdr=s r+�_print_MatrixElementzStrPrinter._print_MatrixElement�s`��� � ���j��.@�� �N�N�N� �K�K���/�/�/�/����T�V�1D�1D�1D�1D�E�F� Fr-c�����fd�}��|jtdd���dz||j|jj��zdz||j|jj��zdzS)Nc����t|��}|ddkr|d=|ddkrd|d<|d|krd|d<d��fd�|D����S)N�rrrD�:c3�B�K�|]}��|��V��dSr9rxr�s �r+r�zBStrPrinter._print_MatrixSlice.<locals>.strslice.<locals>.<genexpr>�s/�����;�;�#�T�[�[��-�-�;�;�;�;�;�;r-)r^r4)�x�dimr's �r+�strslicez/StrPrinter._print_MatrixSlice.<locals>.strslice�su����Q���A���t�q�y�y��a�D���t�q�y�y���!����t�s�{�{���!���8�8�;�;�;�;��;�;�;�<�<� <r-rTrrrqr)r,rr�rowslice�rows�colslice�cols)r'r>rs` r+�_print_MatrixSlicezStrPrinter._print_MatrixSlice�s���� =� =� =� =� =��!�!�$�+�z�&�/A�$�!�O�O�RU�U������ �(8�9�9�:�<@�A������ �(8�9�9�:�<?�@� Ar-c��|jSr9r�r=s r+�_print_DeferredVectorz StrPrinter._print_DeferredVector� ���y�r-c� ���t|���|j}|dtjus"t d�|dd�D�����r�t |d�d���\}}t |��D]y\}}|jjr |j }n9t|jj��}|d |d<tj |��}|dz rt|j |d���n|j ||<�zg} |rP|djsC|d���r)��|�d����g} | ��fd �|D��z} | sd g} t%|��dkrD|d���r*��|�d����g} ng} | ��fd �|D��z} d �| ��}d �| ��}t%| ��dkr|�d |�d�S| r|�d|��S|S|���\} }| dkrt+| |��}d} nd} g}g}g}�jdvr|���}ntj|��}d�}|D�]�}|jr�t5|t��r�t7|j���ddk��r�|jtjur|�||������t%|jdj��dkr6t5|j ttf��r|�|��|�|j ����|jrt|tjurf|j dkr'|�tC|j ����|j"dkr'|�tC|j"������p|�|�����|p tjg}��fd�|D��}��fd�|D��}|D]I}|j |vr>d||�#|j ��z||�#|j ��<�J|s| d �|��zSt%|��dkr$| d �|��zdz|dzS| d �|��zdd �|��zzS)Nrc3�K�|]>}t|t��p$|jotd�|jD����V��?dS)c3�$K�|] }|jV�� dSr9)� is_Integer)r2�ais r+r�z2StrPrinter._print_Mul.<locals>.<genexpr>.<genexpr>s$���� @� @�2��� @� @� @� @� @� @r-N)r:r �is_Pow�allr5)r2r�s r+r�z(StrPrinter._print_Mul.<locals>.<genexpr>sk����##�##���1�f�%�%�A���@�S� @� @��� @� @� @�@�@�##�##�##�##�##�##r-rc��t|t��o/t|j���ddk��S�Nr)r:r�bool�exp� as_coeff_Mul)rs r+�<lambda>z'StrPrinter._print_Mul.<locals>.<lambda>s9���1�c�"�"�H�t�A�E�,>�,>�,@�,@��,C�a�,G�'H�'H�r-T)�binaryF��evaluatec�@��g|]}��|�d�����S�Frr1�r2r�rLr's ��r+r3z)StrPrinter._print_Mul.<locals>.<listcomp>#�>�������#�/�/��4��/�F�F���r-�1c�@��g|]}��|�d�����Sr5r1r6s ��r+r3z)StrPrinter._print_Mul.<locals>.<listcomp>-r7r-�*z/(rr�/rBrD)�old�nonec�x�|���\}}ttj|����}|dtjur |dd�}n |d |d<tj|��}t|t��r|� ||d���S|� |d���S)NrrFr2) � as_base_expr^r � make_argsr� NegativeOne� _from_argsr:rr�)rer�r�eargss r+�apowz#StrPrinter._print_Mul.<locals>.apowKs����=�=�?�?�D�A�q����q�)�)�*�*�E��Q�x�1�=�(�(��a�b�b� ���!�!�H�9��a����u�%�%�A��!�S�!�!� 4��v�v�a��U�v�3�3�3��6�6�!�e�6�,�,� ,r-c�@��g|]}��|�d�����Sr5r1�r2rrLr's ��r+r3z)StrPrinter._print_Mul.<locals>.<listcomp>l�.���E�E�E�a��"�"�1�d�5�"�9�9�E�E�Er-c�@��g|]}��|�d�����Sr5r1rFs ��r+r3z)StrPrinter._print_Mul.<locals>.<listcomp>mrGr-r%z/(%s))$rr5r�One�anyrr_r.� is_Numberr^r rBr�baserH�could_extract_minus_signr&rJr�r4r/r r�as_ordered_factorsr@�is_commutativer:r-rAr�� is_Rational�Infinity�pr�q�index)r'r>r5r��nre�dir�dargs�pre�nfactors�dfactors�crPr�r�� pow_parenrDr(�a_str�b_strrLs` @r+� _print_MulzStrPrinter._print_Muls������$���� �y�� ��7�a�e� � �s�##�##��a�b�b��##�##�##� #� #� ���I�I�����D�A�q�#�1��� M� M���2��6�#�.����A�A� ����-�-�E� %�a��y�E�!�H���u�-�-�A�:;�a�%�L�s�2�7�A��6�6�6�6�R�W��!����C�� .��1��� .��1��)F�)F�)H�)H� .��{�{�1�5�5��8�8�,�,�-�������������H�� !��5���1�v�v��z�z�a��d�;�;�=�=�z��{�{�1�5�5��8�8�,�,�-����������������H�����"�"�A�����"�"�A��8�}�}�q� � �$%�A�A�q�q�q�)�)�� (�"#�!�!�Q�Q�'�'��H�� � �"�"���1� �q�5�5���r�1�%�%�D��D�D��D� �� ��� � �:�_� ,� ,��*�*�,�,�D�D��=��&�&�D� -� -� -�� � �D��#� ��t�S�)�)� ����.�.�0�0��3�a�7�8�8� ��8�1�=�0�0��H�H�T�T�$�Z�Z�(�(�(�(��D�I�a�L�-�.�.�!�3�3�&�t�y�3��*�=�=�4�"�(�(��.�.�.��H�H�T�Y�'�'�'�'��!� �d�!�*�&<�&<��6�Q�;�;��H�H�X�d�f�-�-�.�.�.��6�Q�;�;��H�H�X�d�f�-�-�.�.�.���������� �L�!�%���E�E�E�E�E�1�E�E�E��E�E�E�E�E�1�E�E�E��� O� O�D��y�A�~�~�,2�U�1�7�7�4�9�;M�;M�5N�,N��a�g�g�d�i�(�(�)��� F��#�(�(�5�/�/�)� )� ��V�V�q�[�[��#�(�(�5�/�/�)�C�/�%��(�:� :��#�(�(�5�/�/�)�G�c�h�h�u�o�o�,E�E� Er-c�N�������\}}d}|jrZ|���\}}|jr|jrt | |���d}n!|jr|jrt | |���d}|d���fd��jD����zS)NrDrBr:c�V��g|]%}��|t�������&Sr0�r,r�r2r�r>r's ��r+r3z,StrPrinter._print_MatMul.<locals>.<listcomp>�s1��� K� K� K�#�T� � �s�J�t�$4�$4� 5� 5� K� K� Kr-)� as_coeff_mmul� is_number� as_real_imag�is_zero� is_negativer r4r5)r'r>r[r�rP�re�ims`` r+� _print_MatMulzStrPrinter._print_MatMul{s������!�!�#�#���1��� �;� ��^�^�%�%�F�B���z� �b�n� �"�A�2�q�)�)������� ��� �"�A�2�q�)�)�����c�h�h� K� K� K� K� K��� K� K� K� � � � r-c�h�d�|j|�|j����S)Nz{}.({}))r�rsr&r>r=s r+�_print_ElementwiseApplyFunctionz*StrPrinter._print_ElementwiseApplyFunction�s0����� �M� �K�K�� � "� "� � � r-c��dS)N�nanr0r=s r+� _print_NaNzStrPrinter._print_NaN�r�r-c��dS)Nz-oor0r=s r+�_print_NegativeInfinityz"StrPrinter._print_NegativeInfinity�r�r-c�D�|jrtd�|jD����r]t|j��dkrd|�|j��zSd|�|jf|jzdd��zSd|�|jdd��zS)Nc3�2K�|]}|tjuV��dSr9)r�Zero)r2rRs r+r�z*StrPrinter._print_Order.<locals>.<genexpr>�s(����$E�$E�Q�Q�!�&�[�$E�$E�$E�$E�$E�$Er-rzO(%s)rqr)� variablesr*�pointr�r&r>r7r5r=s r+� _print_OrderzStrPrinter._print_Order�s����~� @��$E�$E�$�*�$E�$E�$E�!E�!E� @��4�>�"�"�a�'�'�����T�Y�!7�!7�7�7������� �t�~�0M�t�UV�!W�!W�W�W��T�^�^�D�I�t�Q�?�?�?� ?r-c�*�|���Sr9��__str__r=s r+�_print_OrdinalzStrPrinter._print_Ordinal�����|�|�~�~�r-c�*�|���Sr9rzr=s r+� _print_CyclezStrPrinter._print_Cycle�r}r-c��ddlm}m}ddlm}|j}|�|d|�d�ddd� ��n|j�d d ��}|r�|jsd S||��|jd z ��� ��td��d�}|� d��}|dks!d||d�vr||d�|d|�z}|� dd��}|S|� ��}|sE|jdkrd|�|j��zSd|�|j��zS|�|jd|dd z���d|�|j��zz}|�|j��x} } t|��t| ��kr|} d| zS)Nr)� Permutation�Cycle)�sympy_deprecation_warningzw Setting Permutation.print_cyclic is deprecated. Instead use init_printing(perm_cyclic=z). z1.6z#deprecated-permutation-print_cyclic�)�deprecated_since_version�active_deprecations_target� stacklevelrTz()rr�rp�,rD�zPermutation(%s)zPermutation([], size=%s)�����z , size=%s)� sympy.combinatorics.permutationsr�r��sympy.utilities.exceptionsr�� print_cyclic� _settings�get�size�__repr__r��rfind�replace�supportr&� array_form) r'r>r�r�r�rr��last�trim�use�fulls r+�_print_PermutationzStrPrinter._print_Permutation�s��G�G�G�G�G�G�G�G�H�H�H�H�H�H�!�.� � � "� %� %��+6����*/�+P�� � � � � ��.�,�,�]�D�A�A�K� � +��9� ��t����d� � �D�I��M�*�*�3�3�5�5�c�'�l�l�m�m�D�A��7�7�3�<�<�D��1�9�9��A�d�e�e�H�!4�!4��d�e�e�H�q��$��x�'��� � �#�r�"�"�A��H�� � ���A�� K��9�q�=�=�,�t�{�{�4�?�/K�/K�K�K�1�D�K�K�� �4J�4J�J�J��;�;�t��z��"��� �z�:�;�;�k�D�K�K�X\�Xa�Lb�Lb�>b�b�D����T�_�5�5� 5�C�$��4�y�y�3�t�9�9�$�$���$�s�*� *r-c���|j\}}}t|j��dkr|d}|d}d|�|���d|�|���d|�|���d�S)NrrzSubs(rqrr)r5r�rwr&)r'r�r>r<�news r+� _print_SubszStrPrinter._print_Subs�s~������c�3� �s�y�>�>�Q� � ��a�&�C��a�&�C�� �K�K�� � � � �t�{�{�3�/�/�/�/����S�1A�1A�1A�1A�C� Cr-c�*�|���Sr9rxr=s r+�_print_TensorIndexzStrPrinter._print_TensorIndex�����{�{�}�}�r-c�*�|���Sr9rxr=s r+�_print_TensorHeadzStrPrinter._print_TensorHead�r�r-c�*�|���Sr9rxr=s r+� _print_TensorzStrPrinter._print_Tensor�r�r-c�~�������\}}|d���fd�|D����zS)Nr:c�V��g|]%}��|t�������&Sr0rbrcs ��r+r3z-StrPrinter._print_TensMul.<locals>.<listcomp>�s1��� F� F� F�#�T� � �s�J�t�$4�$4� 5� 5� F� F� Fr-)�!_get_args_for_traditional_printerr4)r'r>rPr5s`` r+�_print_TensMulzStrPrinter._print_TensMul�sP�����;�;�=�=� ��d��c�h�h� F� F� F� F� F�� F� F� F� � � � r-c�*�|���Sr9rxr=s r+�_print_TensAddzStrPrinter._print_TensAdd�r�r-c�6�|�|j��Sr9�r&r�r=s r+�_print_ArraySymbolzStrPrinter._print_ArraySymbol�s���{�{�4�9�%�%�%r-c�����|jtdd���dd��fd�|jD�����d�S)N�FuncTrrqc�:��g|]}��|����Sr0rxr�s �r+r3z2StrPrinter._print_ArrayElement.<locals>.<listcomp>�s%���Nt�Nt�Nt�bc�t�{�{�[\�~�~�Nt�Nt�Ntr-r)r,r�rr4�indicesr=s` r+�_print_ArrayElementzStrPrinter._print_ArrayElement�s^��� � � �d�i��F�);�T� B� B� B� B�D�I�I�Nt�Nt�Nt�Nt�gk�gs�Nt�Nt�Nt�Du�Du�Du�Du�w� wr-c�Z���fd�|jD��}dd�|��zS)Nc�@��g|]}d��|��z��S)z %srx)r2r�r's �r+r3z6StrPrinter._print_PermutationGroup.<locals>.<listcomp>�s(��� :� :� :�1�X�� � �A��� &� :� :� :r-zPermutationGroup([ %s])z, )r5r4)r'r>rRs` r+�_print_PermutationGroupz"StrPrinter._print_PermutationGroup�s3��� :� :� :� :�� � :� :� :��)�E�J�J�q�M�M�9�9r-c��dS)N�pir0r=s r+� _print_PizStrPrinter._print_Pi�r�r-c����dd��fd�|jD�����d��|j���d��|j���d�S)NzPolynomial ring in rqc3�B�K�|]}��|��V��dSr9rx)r2�rsr's �r+r�z-StrPrinter._print_PolyRing.<locals>.<genexpr>�s-�����?�?�B�� � �B���?�?�?�?�?�?r-� over � with � order�r4r�r&�domainr)r'�rings` r+�_print_PolyRingzStrPrinter._print_PolyRing�sh���� �Y�Y�?�?�?�?�$�,�?�?�?� @� @� @� @� �K�K�� � $� $� $� $�d�k�k�$�*�&=�&=�&=�&=�?� ?r-c����dd��fd�|jD�����d��|j���d��|j���d�S)NzRational function field in rqc3�B�K�|]}��|��V��dSr9rx)r2�fsr's �r+r�z.StrPrinter._print_FracField.<locals>.<genexpr>s-�����@�@�B�� � �B���@�@�@�@�@�@r-r�r�r�r��r'�fields` r+�_print_FracFieldzStrPrinter._print_FracField�sj���� �Y�Y�@�@�@�@�%�-�@�@�@� A� A� A� A� �K�K�� � %� %� %� %�t�{�{�5�;�'?�'?�'?�'?�A� Ar-c�*�|���Sr9rz)r'�elms r+�_print_FreeGroupElementz"StrPrinter._print_FreeGroupElements���{�{�}�}�r-c�(�d|j�d|j�d�S)Nrp� + z*I))r�y�r'�polys r+�_print_GaussianElementz!StrPrinter._print_GaussianElements��� $��������/�/r-c�<�|�|tdd��S)Nz%s**%sr:)r;rr�s r+�_print_PolyElementzStrPrinter._print_PolyElement s���x�x��j�(�C�8�8�8r-c���|jdkr|�|j��S|�|jtdd���}|�|jtdd���}|dz|zS)Nrr Trrr;)�denomr&�numerr,r)r'�fracr�r�s r+�_print_FracElementzStrPrinter._print_FracElement sr�� �:��?�?��;�;�t�z�*�*� *��%�%�d�j�*�U�2C�D�%�Q�Q�E��%�%�d�j�*�V�2D�T�%�R�R�E��3�;��&� &r-c����tddz �g��fd�|jD��}}|���D�]t\}}g}t|��D]N\}}|dkrC|dkr|�||���-|�||d|zz���Od�|��}|jr4|rd��|��zdz} nz��|��} nd|rM|tj ur|� d |g����|tj ur|� d |g������|��} |s| } n| dz|z} | � d ��r!|� d | dd�g����]|� d | g����v|dd vr)|� d��} | d krd |dz|d<|jjd z} dd lm}  | d|���zz } n%#| $r| d|���zz } YnwxYw| dz } t|��D]a\}}t)|��dkrI|dd�dkr;|t)|��dz d�dkr|dt)|��dz �||<�b| d�|��d�|��fzS)Nrrc�<��g|]}��|�����Sr0r1)r2r�� ATOM_PRECr's ��r+r3z*StrPrinter._print_Poly.<locals>.<listcomp>s)���P�P�P��D�-�-�a��;�;�P�P�Pr-rz**%dr:rprrrCrB)rBrCz(%s, %s)�PolynomialErrorz , modulus=%sz , domain='%s'rrErq)r�gensrKr_r�r4rHr&rrIrIrArGrJrzr{�sympy.polys.polyerrorsr�� get_modulus� get_domainr�)r'r>rKr��monom�coeff�s_monomrer�s_coeff�s_term�modifierr�r�rTr(r�s` @r+� _print_PolyzStrPrinter._print_Polys4�����v�&��*� ��P�P�P�P�P�T�Y�P�P�P�t�� �J�J�L�L�% ,�% ,�L�E�5��G�!�%�(�(� =� =���1��q�5�5��A�v�v����t�A�w�/�/�/�/����t�A�w��!��';�<�<�<���h�h�w�'�'�G��|� -��1�!�D�K�K��$6�$6�6��<�G�G�"�k�k�%�0�0�G�G��!����~�~�� � �c�7�^�4�4�4� ��� �-�-�� � �c�7�^�4�4�4� ��+�+�e�,�,��� 1� ��� �3���0��� � ��%�%� ,�� � �c�6�!�"�"�:�.�/�/�/�/�� � �c�6�]�+�+�+�+� ��8�z� !� !��y�y��|�|�H��3�����q��>��a����(�9�4��:�:�:�:�:�:� :� �n�t�'7�'7�'9�'9�9� 9�F�F��� :� :� :� �o����(9�(9�9� 9�F�F�F� :���� �#� ��$�T�?�?� 4� 4�K�E�4��4�y�y�1�}�}�$�r��r�(�c�/�/�d�3�t�9�9�q�=�>�>�6J�c�6Q�6Q�"�1�S��Y�Y��]�?�3��U� ������%���$�)�)�D�/�/�:�:�:s�<H�H9�8H9c��dS)Nr�r0)r'rRs r+�_print_UniversalSetzStrPrinter._print_UniversalSetVs���~r-c���|jr9|�|��������S|�|�����Sr9)� is_aliasedr&�as_poly�as_exprr=s r+�_print_AlgebraicNumberz!StrPrinter._print_AlgebraicNumberYsL�� �?� /��;�;�t�|�|�~�~�5�5�7�7�8�8� 8��;�;�t�|�|�~�~�.�.� .r-c���t|��}|jtjur|sd��|j��zS|jr�|j tjur1|s/dt�fd�tj|jfD����zS|jtj ur?��tj���d�� |j|d�����S�� |j|d���}�j dkr[|jj rO|jj dkr?|� d ��r*�� |j|d����d |dd ���S�� |j|d����d |��S) a$Printing helper function for ``Pow`` Parameters ========== rational : bool, optional If ``True``, it will not attempt printing ``sqrt(x)`` or ``x**S.Half`` as ``sqrt``, and will use ``x**(1/2)`` instead. See examples for additional details Examples ======== >>> from sympy import sqrt, StrPrinter >>> from sympy.abc import x How ``rational`` keyword works with ``sqrt``: >>> printer = StrPrinter() >>> printer._print_Pow(sqrt(x), rational=True) 'x**(1/2)' >>> printer._print_Pow(sqrt(x), rational=False) 'sqrt(x)' >>> printer._print_Pow(1/sqrt(x), rational=True) 'x**(-1/2)' >>> printer._print_Pow(1/sqrt(x), rational=False) '1/sqrt(x)' Notes ===== ``sqrt(x)`` is canonicalized as ``Pow(x, S.Half)`` in SymPy, so there is no need of defining a separate printer for ``sqrt``. Instead, it should be handled here as well. zsqrt(%s)z %s/sqrt(%s)c3�B�K�|]}��|��V��dSr9rxr�s �r+r�z(StrPrinter._print_Pow.<locals>.<genexpr>�s/�����-]�-]�3�d�k�k�#�.>�.>�-]�-]�-]�-]�-]�-]r-r;Fr� _sympyreprrz (Rational�**r�)rr.r�Halfr&rLrOr�rIr,� printmethodrPrSrG)r'r>�rational�PRECrs` r+� _print_PowzStrPrinter._print_Pow_s����L�$���� �8�q�v� � �h� ��� � �D�I� 6� 6�6� 6� � � T���y�A�F�"�"�8�"�%�u�-]�-]�-]�-]�1�5�RV�R[�J\�-]�-]�-]�'^�'^�^�^��x�A�E�6�!�!�"&�+�+�a�e�"4�"4�"4�"4�"&�"3�"3�D�I�t�E�"3�"R�"R�"R�T�T� � � �d�h��U� � ;� ;�� � �|� +� +���0D� +����WX����|�|�K�(�(� ^�#'�#4�#4�T�Y��U�#4�#S�#S�#S�#S�UV�WX�Y[�W[�U\�U\�]�]��,�,�T�Y��U�,�K�K�K�K�Q�Q�O�Or-c�B�|�|jd��Sr,�r&r5r=s r+�_print_UnevaluatedExprz!StrPrinter._print_UnevaluatedExpr�s���{�{�4�9�Q�<�(�(�(r-c��t|��}|�|j|d����d|�|j|d�����S)NFrr�)rr,rLr.)r'r>r�s r+� _print_MatPowzStrPrinter._print_MatPow�sX���$�����,�,�T�Y��U�,�K�K�K�K��*�*�4�8�T�%�*�H�H�H�J� Jr-c�j�|j�dd��rd|zSt|j��S)NrFzS(%s))r�r�r;rRr=s r+�_print_IntegerzStrPrinter._print_Integer�s6�� �>� � �.�� 6� 6� $��d�#� #��4�6�{�{�r-c��dS)N�Integersr0r=s r+�_print_IntegerszStrPrinter._print_Integers�����zr-c��dS)N�Naturalsr0r=s r+�_print_NaturalszStrPrinter._print_Naturals�rr-c��dS)N� Naturals0r0r=s r+�_print_Naturals0zStrPrinter._print_Naturals0�����{r-c��dS)N� Rationalsr0r=s r+�_print_RationalszStrPrinter._print_Rationals�r r-c��dS)N�Realsr0r=s r+� _print_RealszStrPrinter._print_Reals�rXr-c��dS)N� Complexesr0r=s r+�_print_ComplexeszStrPrinter._print_Complexes�r r-c��dS)N�EmptySetr0r=s r+�_print_EmptySetzStrPrinter._print_EmptySet�rr-c��dS)N� EmptySequencer0r=s r+�_print_EmptySequencezStrPrinter._print_EmptySequence�s���r-c� �t|��Sr9�r;r=s r+� _print_intzStrPrinter._print_int�����4�y�y�r-c� �t|��Sr9rr=s r+� _print_mpzzStrPrinter._print_mpz�rr-c��|jdkrt|j��S|j�dd��rd|j�d|j��S|j�d|j��S)NrrFzS(z)/r;)rSr;rRr�r�r=s r+�_print_RationalzStrPrinter._print_Rational�se�� �6�Q�;�;��t�v�;�;� ��~�!�!�"2�E�:�:� 5� 5�%)�V�V�V�T�V�V�4�4�"�f�f�f�d�f�f�-� -r-c�b�|jdkrt|j��Sd|j|jfzS)Nrz%d/%d)rSr;rRr=s r+�_print_PythonRationalz StrPrinter._print_PythonRational�s/�� �6�Q�;�;��t�v�;�;� ��d�f�d�f�-�-� -r-c�b�|jdkrt|j��S|j�d|j��S�Nrr;�� denominatorr;� numeratorr=s r+�_print_FractionzStrPrinter._print_Fraction��7�� � �q� � ��t�~�&�&� &�"�n�n�n�d�.>�.>�?� ?r-c�b�|jdkrt|j��S|j�d|j��Sr$r%r=s r+� _print_mpqzStrPrinter._print_mpq�r)r-c�(�|j}|dkrd}nt|j��}|jddurd}n.|jddurd}n|jddkr |jdk}d|jvr |jdnd}d |jvr |jd nd}t |j||||� ��}|�d ��rd |d d�z}n"|�d��r d|dd�z}|�d��r |dd�}|S)Nr�rrTFrrr r!)� strip_zeros� min_fixed� max_fixedz-.0z-0.�z.0z0.rrC)�_precrr�� _print_level� mlib_to_str�_mpf_rG)r'r>rL�dps�strip�low�high�rvs r+� _print_FloatzStrPrinter._print_Float�s@���z�� �!�8�8��C�C��d�j�)�)�C� �>�+� &�$� .� .��E�E� �^�K� (�E� 1� 1��E�E� �^�K� (�F� 2� 2��%��)�E�',���'>�'>�d�n�U�#�#�D��(-���(?�(?�t�~�e�$�$�T�� ���S�e�s�VZ� [� [� [�� �=�=�� � � ���A�B�B���B�B� �]�]�4� � � ���1�2�2���B� �=�=�� � � ��A�B�B��B�� r-c ��ddddddddd �}|j|vrF||j�d |�|j���d |�|j���d �S|�|jt |�����d |j�|j��p|j�d |�|jt |������S)N�Eq�Ne� Assignment�AddAugmentedAssignment�SubAugmentedAssignment�MulAugmentedAssignment�DivAugmentedAssignment�ModAugmentedAssignment)z==z!=z:=z+=z-=z*=z/=z%=rprqrrrE)�rel_opr&�lhsrar,rr#r�)r'r>�charmaps r+�_print_RelationalzStrPrinter._print_Relational�s������*�*�*�*�*�  �  �� �;�'� !� !�#*�4�;�#7�#7�#7����T�X�9N�9N�9N�9N�#'�;�;�t�x�#8�#8�#8�#8�:� :�"�.�.�t�x��D�9I�9I�J�J�J�J��,�0�0���=�=�L���L�L��,�,�T�X�z�$�7G�7G�H�H�H�J� Jr-c�N�d|�|jd���|jfzS)NzCRootOf(%s, %d)�lexrA)rQr>rTr=s r+�_print_ComplexRootOfzStrPrinter._print_ComplexRootOfs-�� �D�O�O�D�I�e�O�$L�$L�$(�J�$0�0� 0r-c���|�|jd���g}|jtjur-|�|�|j����dd�|��zS)NrIrAz RootSum(%s)rq)rQr>�funr�IdentityFunctionr�r&r4r�s r+�_print_RootSumzStrPrinter._print_RootSumsa������ ���7�7�8�� �8�1�-� -� -� �K�K�� � �D�H�-�-� .� .� .��t�y�y����.�.r-c�\����jj}��fd��jD��}dd�|��z}�fd��jD��}d���j��z}d���j��z}|g|z||gz}|�dd�|���d�S) Nc�H��g|]}��|�j�����S)rA)rQr)r2r��basisr's ��r+r3z3StrPrinter._print_GroebnerBasis.<locals>.<listcomp>s+���P�P�P�S�����E�K��8�8�P�P�Pr-rrqc�:��g|]}��|����Sr0rx)r2�genr's �r+r3z3StrPrinter._print_GroebnerBasis.<locals>.<listcomp> s%���9�9�9�c����S�!�!�9�9�9r-z domain='%s'z order='%s'rprr)rzr{�exprsr4r�r&r�r)r'rQ�clsrTr�r�rr5s`` r+�_print_GroebnerBasiszStrPrinter._print_GroebnerBasiss������o�&��P�P�P�P�P�E�K�P�P�P������5�)�)�)��9�9�9�9�U�Z�9�9�9������U�\�!:�!:�:���t�{�{�5�;�7�7�7���w��~����/���3�3�� � �$�����0�0r-c���t|t���}d��fd�|D����}|sdSd|zS)Nr�rqc3�B�K�|]}��|��V��dSr9rx�r2r(r's �r+r�z(StrPrinter._print_set.<locals>.<genexpr>+�/�����=�=�t����T�*�*�=�=�=�=�=�=r-zset()r�)r�rr4�r'r�r�r5s` r+� _print_setzStrPrinter._print_set(sS����q�.�/�/�/���y�y�=�=�=�=�u�=�=�=�=�=��� ��7���}�r-c� ���ddlm�t|t���}d��fd�|D����}t �fd�|D����rd�|��Sd�|��S) Nr)� FiniteSetr�rqc3�B�K�|]}��|��V��dSr9rxrYs �r+r�z.StrPrinter._print_FiniteSet.<locals>.<genexpr>4rZr-c3�B�K�|]}|����V��dSr9)�has)r2r(r^s �r+r�z.StrPrinter._print_FiniteSet.<locals>.<genexpr>5s/�����5�5�t�t�x�x� �"�"�5�5�5�5�5�5r-z FiniteSet({})z{{{}}})�sympy.sets.setsr^r�rr4rJr�)r'r�r�r5r^s` @r+�_print_FiniteSetzStrPrinter._print_FiniteSet0s�����-�-�-�-�-�-��q�.�/�/�/���y�y�=�=�=�=�u�=�=�=�=�=�� �5�5�5�5�u�5�5�5� 5� 5� 0�"�)�)�$�/�/� /����t�$�$�$r-c���t|t���}d��fd�|D����}d�|��S)Nr�rqc3�B�K�|]}��|��V��dSr9rxr�s �r+r�z.StrPrinter._print_Partition.<locals>.<genexpr><s/�����;�;�c����S�)�)�;�;�;�;�;�;r-z Partition({}))r�rr4r�r[s` r+�_print_PartitionzStrPrinter._print_Partition9sP����q�.�/�/�/���y�y�;�;�;�;�U�;�;�;�;�;���%�%�d�+�+�+r-c�:�|sdSd|�|��zS)Nz frozenset()z frozenset(%s))r\�r'r�s r+�_print_frozensetzStrPrinter._print_frozenset?s&��� !� �=������!3�!3�3�3r-c�����fd��d��fd�|jD����}d��|j���d|�d�S)Nc����t|��dkr��|d��S��|dft|dd���z��Sr�r�r�s �r+r�z)StrPrinter._print_Sum.<locals>._xab_tostrEr�r-rqc�&��g|] }�|����Sr0r0r�s �r+r3z)StrPrinter._print_Sum.<locals>.<listcomp>Jr�r-zSum(rrr�r�s` @r+� _print_SumzStrPrinter._print_SumDsl���� ?� ?� ?� ?� ?� �I�I�:�:�:�:�d�k�:�:�:� ;� ;��� $� � �D�M� :� :� :� :�A�A�A�>�>r-c��|jSr9r�r=s r+� _print_SymbolzStrPrinter._print_SymbolMr#r-c��dSr�r0r=s r+�_print_IdentityzStrPrinter._print_IdentityRr�r-c��dS)N�0r0r=s r+�_print_ZeroMatrixzStrPrinter._print_ZeroMatrixUr�r-c��dS)Nr8r0r=s r+�_print_OneMatrixzStrPrinter._print_OneMatrixXr�r-c��d|jzS)NzQ.%sr�r=s r+�_print_PredicatezStrPrinter._print_Predicate[s���� �!�!r-c� �t|��Sr9rr=s r+� _print_strzStrPrinter._print_str^rr-c��t|��dkrd|�|d��zSd|�|d��zS)Nrz(%s,)rr%rq)r�r&r7r=s r+� _print_tuplezStrPrinter._print_tupleasE�� �t�9�9��>�>��T�[�[��a��1�1�1� 1��D�N�N�4��6�6�6� 6r-c�,�|�|��Sr9)r|r=s r+� _print_TuplezStrPrinter._print_Tuplegs��� � ��&�&�&r-c�T�d|�|jtd��zS)Nz%s.Trr�)r'�Ts r+�_print_TransposezStrPrinter._print_Transposejs$����)�)�!�%��E�1B�C�C�C�Cr-c�t�d|�|j���d|�|j���d�S)NzUniform(rqrr)r&r�r�r=s r+�_print_UniformzStrPrinter._print_Uniformms7���$(�K�K���$7�$7�$7�$7����T�V�9L�9L�9L�9L�M�Mr-c�`�|j�dd��r d|jzSd|jzS)NrFz%s)r�r�rr�r=s r+�_print_QuantityzStrPrinter._print_Quantityps6�� �>� � �h�� .� .� &��$�+�%� %��d�i��r-c����fd�|jD��}|dgd�t|dd�d��D��z}d�|��S)Nc�V��g|]%}��|tdd�����&S)r Tr)r,rr�s �r+r3z0StrPrinter._print_Quaternion.<locals>.<listcomp>vs3��� U� U� U�a�T� � �q�*�U�"3�D� � A� A� U� U� Ur-rc�$�g|] \}}|dz|z��S)r:r0)r2rerds r+r3z0StrPrinter._print_Quaternion.<locals>.<listcomp>ws$��<�<�<�$�!�Q�a��e�A�g�<�<�<r-r�ijkr�)r5�zipr4)r'r>r�r�s` r+�_print_QuaternionzStrPrinter._print_Quaternionus_��� U� U� U� U�4�9� U� U� U�� �q�T�F�<�<�#�a����e�U�*;�*;�<�<�<� <���z�z�!�}�}�r-c� �t|��Sr9rr=s r+�_print_DimensionzStrPrinter._print_Dimensionzrr-c��|jdzSr�r�r=s r+� _print_WildzStrPrinter._print_Wild}����y�3��r-c��|jdzSr�r�r=s r+�_print_WildFunctionzStrPrinter._print_WildFunction�r�r-c��|jSr9r�r=s r+�_print_WildDotzStrPrinter._print_WildDot�r#r-c��|jSr9r�r=s r+�_print_WildPluszStrPrinter._print_WildPlus�r#r-c��|jSr9r�r=s r+�_print_WildStarzStrPrinter._print_WildStar�r#r-c��|j�dd��rdS|�td����S)NrFzS(0)r)r�r�r�r r=s r+� _print_ZerozStrPrinter._print_Zero�s<�� �>� � �.�� 6� 6� ��6��"�"�7�1�:�:�.�.�.r-c��|jj}|�|�����}|�|j��}|�d|�d|�d�Sro)rzr{r&�to_list�dom)r'rRrU�repr�s r+� _print_DMPzStrPrinter._print_DMP�sQ���k�"���k�k�!�)�)�+�+�&�&���k�k�!�%� � ��"�s�s�C�C�C����-�-r-c���|jj}|�|j��}|�|j��}|�|j��}|�d|�d|�d|�d�Sro)rzr{r&�num�denr�)r'r>rUr�r�r�s r+� _print_DMFzStrPrinter._print_DMF�sd���n�%���k�k�$�(�#�#���k�k�$�(�#�#���k�k�$�(�#�#��#&�3�3����S�S�S�#�#�#�6�6r-c��d|jzS)Nz Object("%s")r�)r'r�s r+� _print_ObjectzStrPrinter._print_Object�s�����(�(r-c��d|jzS)NzIdentityMorphism(%s))r��r'�morphisms r+�_print_IdentityMorphismz"StrPrinter._print_IdentityMorphism�s��%���7�7r-c�8�d|j�d|j�d|j�d�S)NzNamedMorphism(rqz, "z"))r��codomainr�r�s r+�_print_NamedMorphismzStrPrinter._print_NamedMorphism�s,��������!2�!2�!2�H�M�M�M�C� Cr-c��d|jzS)NzCategory("%s")r�)r'�categorys r+�_print_CategoryzStrPrinter._print_Category�s���(�-�/�/r-c��|jjSr9r�)r'�manifolds r+�_print_ManifoldzStrPrinter._print_Manifold�s ���}�!�!r-c��|jjSr9r�)r'�patchs r+� _print_PatchzStrPrinter._print_Patch�s ���z��r-c��|jjSr9r�)r'�coordss r+�_print_CoordSystemzStrPrinter._print_CoordSystem�s ���{��r-c�:�|jj|jjSr9�� _coord_sysr��_indexr�r�s r+�_print_BaseScalarFieldz!StrPrinter._print_BaseScalarField�s����'�� �5�:�:r-c�@�d|jj|jjzS)Nze_%sr�r�s r+�_print_BaseVectorFieldz!StrPrinter._print_BaseVectorField�s����(�0���>�C�C�Cr-c��|j}t|d��rd|jj|jjzSd|�|��zS)Nr�zd%szd(%s))� _form_fieldr�r�r�r�r�r&)r'�diffr�s r+�_print_DifferentialzStrPrinter._print_Differential�sN��� �� �5�,� '� '� 0��5�+�3�E�L�A�F�F� F��T�[�[��/�/�/� /r-c�N�d�d|�|jd���d�S)N�Trrprrrr�r=s r+� _print_TrzStrPrinter._print_Tr�s)���4�4����T�Y�q�\�!:�!:�!:�!:�;�;r-c�6�|�|j��Sr9r�rhs r+� _print_StrzStrPrinter._print_Str�s���{�{�1�6�"�"�"r-c��|j}|�|���d|�|j���d|�|j���d�Sro)rsr&rEra)r'r>�rels r+�_print_AppliedBinaryRelationz'StrPrinter._print_AppliedBinaryRelation�sV���m��#�{�{�3�/�/�/�/�#�{�{�4�8�4�4�4�4�#�{�{�4�8�4�4�4�4�6� 6r-)F)rr9)�r{� __module__� __qualname__r�r"�__annotations__r#r,r7r?rQrTrWr[rfrjrmrur|r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr r rr r"r_rkrmrprrrxr|rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr rrrrrrr r"r(r+r:rGrJrNrVr\rcrfrirmro�_print_MatrixSymbol�_print_RandomSymbolrqrtrvrxrzr|r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r0r-r+rrs���������K��������)�)������$&�L�%�%�%�%�%�%�%�%� K�K�K�K����"�"�"�"�*������J�J�J�E�E�E�I�I�I�J�J�J�N�N�N�?�?�?�%�%�%� ������1�1�1�[�[�[� )�)�)�&�&�&�9�9�9����������M�M�M�M�M�M����N�N�N� $�$�$�������D�D�D�6�6�6�&<�<�<�H�H�H�H�H�H�Y�Y�Y�X�X�X� 3�3�3�&�&�&�&�&�&�F�F�F� A� A� A����tF�tF�tF�l � � �" � � � ������@�@�@�������'+�'+�'+�RC�C�C���������� � � ����&�&�&�w�w�w�:�:�:����?�?�?� A�A�A� ���0�0�0�9�9�9�'�'�'�@;�@;�@;�D���/�/�/� ;P�;P�;P�;P�z)�)�)�J�J�J� ��� ������������������������������.�.�.�.�.�.� @�@�@� @�@�@� ���0J�J�J�*0�0�0�/�/�/� 1� 1� 1����%�%�%�,�,�,� 4�4�4� ?�?�?����'��'�����������"�"�"����7�7�7� '�'�'�D�D�D�N�N�N� � � � ��� ������������������/�/�/� .�.�.�7�7�7�)�)�)�8�8�8�C�C�C�0�0�0�"�"�"���� � � �;�;�;�D�D�D�0�0�0�<�<�<�#�#�#�6�6�6�6�6r-rc �N�t|��}|�|��}|S)abReturns the expression as a string. For large expressions where speed is a concern, use the setting order='none'. If abbrev=True setting is used then units are printed in abbreviated form. Examples ======== >>> from sympy import symbols, Eq, sstr >>> a, b = symbols('a b') >>> sstr(Eq(a + b, 0)) 'Eq(a + b, 0)' )r�doprint�r>�settingsrRr�s r+�sstrr��s%��" �8���A� � � �$���A� �Hr-c��eZdZdZd�Zd�ZdS)�StrReprPrinterz(internal) -- see sstrreprc� �t|��Sr9)r<rhs r+rzzStrReprPrinter._print_str�s ���A�w�w�r-c�V�|jj�d|�|j���d�S)Nrprr)rzr{r&r�rhs r+r�zStrReprPrinter._print_Str�s,���;�/�/�/����Q�V�1D�1D�1D�1D�E�Er-N)r{r�r��__doc__rzr�r0r-r+r�r��s=������$�$����F�F�F�F�Fr-r�c �N�t|��}|�|��}|S)z�return expr in mixed str/repr form i.e. strings are returned in repr form with quotes, and everything else is returned in str form. This function could be useful for hooking into sys.displayhook )r�r�r�s r+�sstrreprr��s%�� �x� � �A� � � �$���A� �Hr-N)#r�� __future__r�typingr� sympy.corerrrrr r �sympy.core.mulr �sympy.core.numbersr �sympy.core.relationalr �sympy.core.sortingr�sympy.utilities.iterablesrrr�printerrr� mpmath.libmprrr3rr�r�r�r0r-r+�<module>r�s�����#�"�"�"�"�"�������;�;�;�;�;�;�;�;�;�;�;�;�;�;�;�;�&�&�&�&�&�&�&�&�&�&�&�&�,�,�,�,�,�,�/�/�/�/�/�/�*�*�*�*�*�*�.�.�.�.�.�.�.�.�,�,�,�,�,�,�,�,�;�;�;�;�;�;�;�;�z6�z6�z6�z6�z6��z6�z6�z6�z�� ��� � ��� �,F�F�F�F�F�Z�F�F�F������  �  � ��  �  �  r-
Memory