� ��g-���dZddlmZddlmZddlmZddlmZddl m Z m Z ddl mZmZGd �d e��Zee��d ���Zd S) z� A Printer for generating executable code. The most important function here is srepr that returns a string so that the relation eval(srepr(expr))=expr holds in an appropriate environment. �)� annotations)�Any)� AppliedUndef)�Mul)�repr_dps�to_str�)�Printer�print_functionc�j�eZdZUdZddd�Zded<d�Zd�Zd<d �Zd �Z 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<d$�Z#d%�Z$d&�Z%d'�Z&d(�Z'd)�Z(d*�Z)d+�Z*d,�Z+d-�Z,d.�Z-d/�Z.d0�Z/d1�Z0d2�Z1d3�Z2d4�Z3d5�Z4d6�Z5d7�Z6d8�Z7d9�Z8d:�Z9d;�Z:dS)=� ReprPrinter� _sympyreprNT)�order� perm_cycliczdict[str, Any]�_default_settingsc�F��|��fd�|D����S)zG Prints each item in `args` and joins them with `sep`. c�:��g|]}��|����S���doprint)�.0�item�selfs ��c/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/printing/repr.py� <listcomp>z'ReprPrinter.reprify.<locals>.<listcomp>s%���=�=�=�����d�+�+�=�=�=�)�join)r�args�seps` r�reprifyzReprPrinter.reprifys,����x�x�=�=�=�=��=�=�=�>�>�>rc���t|t��r|St|d��r|���St|d��rnt|jd��rYg}|jD]*}|�|�|�����+|jjdd� |��zzSt|d��r#t|d��rd|j �d |j�d �St|��S) z' The fallback printer. � __srepr__r�__iter__�(%s)�, � __module__�__name__z<'�.z'>) � isinstance�str�hasattrr"r�append�_print� __class__r'rr&)r�expr�l�os r� emptyPrinterzReprPrinter.emptyPrinter s�� �d�C� � � ��K� �T�;� '� '� ��>�>�#�#� #� �T�6� "� "� �w�t�y�*�'E�'E� ��A��Y� )� )��������Q���(�(�(�(��>�*�V�d�i�i��l�l�-B�B� B� �T�<� (� (� �W�T�:�-F�-F� � �"&�/�/�/�4�=�=�=�A� A��t�9�9� rc��|�||���}t|j|��}t|��j}|dd�|��zzS)N)rr$r%)�_as_ordered_terms�mapr-�typer'r�rr/rr�clsnames r� _print_AddzReprPrinter._print_Add2sS���%�%�d�%�%�8�8���4�;��%�%���t�*�*�%����$�)�)�D�/�/�1�1�1rc�*�|���S�N)�__repr__�rr/s r� _print_CyclezReprPrinter._print_Cycle8s���}�}���rc� �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}d|zS|� ��}|s,|jdkrdt|j��zSd|jzSt|jd|dd z���d|jzz}t|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 Permutation()r rA�(�,z Permutation%s�zPermutation(%s)zPermutation([], size=%s)�����z , size=%s)� sympy.combinatorics.permutationsr@rA�sympy.utilities.exceptionsrB� print_cyclic� _settings�get�sizer<�len�rfind�supportr*� array_form) rr/r@rArBr�s�last�trim�use�fulls r�_print_PermutationzReprPrinter._print_Permutation;s���G�G�G�G�G�G�G�G�H�H�H�H�H�H�!�.� � � "� %� %��+6����*/�+P�� � � � � ��.�,�,�]�D�A�A�K� � +��9� '�&�����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�'��"�A�%� %�� � ���A�� >��9�q�=�=�,�s�4�?�/C�/C�C�C�1�D�I�=�=��t��z��"��� �z�2�3�3�k�D�I�6M�M�D��T�_�-�-� -�C�$��4�y�y�3�t�9�9�$�$���$�s�*� *rc�����|j��}|dd��fd�|jD����zz }|S)Nr$r%c�:��g|]}��|����Sr�r-�r�ars �rrz/ReprPrinter._print_Function.<locals>.<listcomp>es#��� C� C� C�A����Q��� C� C� Cr)r-�funcrr�rr/�rs` r�_print_FunctionzReprPrinter._print_FunctioncsM��� �K�K�� � "� "�� �V�d�i�i� C� C� C� C��� C� C� C�D�D� D�D���rc�����|j��}|dd��fd�|jD����zz }|S)Nr$r%c�:��g|]}��|����Srr]r^s �rrz0ReprPrinter._print_Heaviside.<locals>.<listcomp>ls#��� D� D� D�A����Q��� D� D� Dr)r-r`r�pargsras` r�_print_HeavisidezReprPrinter._print_HeavisidehsO��� �K�K�� � "� "�� �V�d�i�i� D� D� D� D��� D� D� D�E�E� E�E���rc�N�t|t��r d|jzS|jS)Nz Function(%r))� issubclassrr'r=s r�_print_FunctionClassz ReprPrinter._print_FunctionClassos)�� �d�L� )� )� !�!�T�]�3� 3��=� rc��dS)NzRational(1, 2)rr=s r� _print_HalfzReprPrinter._print_Halfus���rc� �t|��Sr;�r*r=s r�_print_RationalConstantz#ReprPrinter._print_RationalConstantx����4�y�y�rc� �t|��Sr;rnr=s r�_print_AtomicExprzReprPrinter._print_AtomicExpr{rprc� �t|��Sr;rnr=s r�_print_NumberSymbolzReprPrinter._print_NumberSymbol~rprc��d|jzS)Nz Integer(%i))�pr=s r�_print_IntegerzReprPrinter._print_Integer�s���t�v�%�%rc��dS)N� Complexesrr=s r�_print_ComplexeszReprPrinter._print_Complexes�����{rc��dS)N�Integersrr=s r�_print_IntegerszReprPrinter._print_Integers�����zrc��dS)N�Naturalsrr=s r�_print_NaturalszReprPrinter._print_Naturals�rrc��dS)N� Naturals0rr=s r�_print_Naturals0zReprPrinter._print_Naturals0�r{rc��dS)N� Rationalsrr=s r�_print_RationalszReprPrinter._print_Rationals�r{rc��dS)N�Realsrr=s r� _print_RealszReprPrinter._print_Reals�����wrc��dS)N�EmptySetrr=s r�_print_EmptySetzReprPrinter._print_EmptySet�rrc��dS)N� UniversalSetrr=s r�_print_UniversalSetzReprPrinter._print_UniversalSet�s���~rc��dS)N� EmptySequencerr=s r�_print_EmptySequencez ReprPrinter._print_EmptySequence�s���rc�4�d|�|d��zS)Nz[%s]r%�r r=s r� _print_listzReprPrinter._print_list�s���� � �T�4�0�0�0�0rc�x��d}�fd�|���D��}d|�|��zS)Nr%c�p��g|]2\}}��|���d��|������3S)z: r)r�key�valuers �rrz+ReprPrinter._print_dict.<locals>.<listcomp>�sD���g�g�g�J�C�QV�� � �S� 1� 1� 1� 1�4�<�<��3F�3F�3F�G�g�g�gr�{%s})�itemsr)rr/r�dict_kvss` r� _print_dictzReprPrinter._print_dict�sE�����g�g�g�g�Z^�Zd�Zd�Zf�Zf�g�g�g�������*�*�*�*rc�<�|sdSd|�|d��zS)Nzset()r�r%r�r=s r� _print_setzReprPrinter._print_set�s(��� ��7��� � �T�4�0�0�0�0rc ��|jdk|jdkz r[|jj�d|�|j���d|�|j���d|�g���d�Sg}t |j��D]Q}|�g��t |j��D]%}|d�|||f���&�R|jj�d|�|���d�S)NrrGr%�)rJ)�rows�colsr.r'r-�ranger,)rr/r0�i�js r�_print_MatrixBasezReprPrinter._print_MatrixBase�s�� �I��N�t�y�A�~� .� 8�'+�~�'>�'>�'>�'+�{�{�4�9�'=�'=�'=�'=�'+�{�{�4�9�'=�'=�'=�'=�'+�{�{�2�����8� 8� ���t�y�!�!� )� )�A� �H�H�R�L�L�L��4�9�%�%� )� )���"�� � �T�!�Q�$�Z�(�(�(�(� )��>�2�2�2�D�K�K��N�N�N�N�C�Crc��dS)N�truerr=s r�_print_BooleanTruezReprPrinter._print_BooleanTrue�s���vrc��dS)N�falserr=s r�_print_BooleanFalsezReprPrinter._print_BooleanFalse�r�rc��dS)N�nanrr=s r� _print_NaNzReprPrinter._print_NaN�s���urc���|jdvr|���}ntj|��}t |j|��}t |��j}|dd�|��zzS)N)�old�noner$r%) r�as_ordered_factorsr� make_argsr5r-r6r'rr7s r� _print_MulzReprPrinter._print_Mul�sl�� �:�_� ,� ,��*�*�,�,�D�D��=��&�&�D��4�;��%�%���t�*�*�%����$�)�)�D�/�/�1�1�1rc�t�d|�|j���d|�|j���d�S)Nz Rational(r%r�)r-rv�qr=s r�_print_RationalzReprPrinter._print_Rational�s7���%)�[�[���%8�%8�%8�%8�$�+�+�d�f�:M�:M�:M�:M�N�Nrc�:�d|jj|j|jfzS)Nz %s(%d, %d))r.r'rvr�r=s r�_print_PythonRationalz!ReprPrinter._print_PythonRational�s���t�~�6�����G�G�Grc�t�d|�|j���d|�|j���d�S)Nz Fraction(r%r�)r-� numerator� denominatorr=s r�_print_FractionzReprPrinter._print_Fraction�s8���%)�[�[���%@�%@�%@�%@�$�+�+�d�N^�B_�B_�B_�B_�`�`rc�~�t|jt|j����}d|jj||jfzS)Nz%s('%s', precision=%i))� mlib_to_str�_mpf_r�_precr.r'ras r� _print_FloatzReprPrinter._print_Float�s6�� �� �H�T�Z�$8�$8� 9� 9��'�4�>�+B�A�t�z�*R�R�Rrc ���d|�|j���d|�|j���d|�|j���d|�|j���d� S)NzSum2(z, (r%z)))r-�fr�r_�br=s r� _print_Sum2zReprPrinter._print_Sum2�sj���+/�;�;�t�v�+>�+>�+>�+>�� � �D�F�@S�@S�@S�@S�+/�;�;�t�v�+>�+>�+>�+>�� � �D�F�@S�@S�@S�@S�U� Urc�V�|jj�d|�|j���d�S�NrGr�)r.r'r-�name)rrUs r� _print_StrzReprPrinter._print_Str�s,���;�/�/�/����Q�V�1D�1D�1D�1D�E�Erc�N�|j}|jr |j|d<|ikr*|jj�d|�|j���d�Sd�|���D��}|jj�d|�|j���dd�|���d�S)N� dummy_indexrGr�c�"�g|] \}}|�d|���� S��=r�r�k�vs rrz-ReprPrinter._print_Symbol.<locals>.<listcomp>��'��;�;�;���A�q�q�q�!�!�$�;�;�;rr%) �_assumptions_orig�is_Dummyr�r.r'r-r�r�r�rr/�d�attrs r� _print_SymbolzReprPrinter._print_Symbol�s��� � "�� �=� 0�#�/�A�m� � ��7�7�#�~�6�6�6�� � �D�I�8N�8N�8N�8N�O� O�;�;������;�;�;�D�#'�>�#:�#:�#:�#'�;�;�t�y�#9�#9�#9�#9�4�9�9�T�?�?�?�?�L� Lrc ��|jj}|ikrE|jj�d|�|j���d|�|j���d�Sd�|���D��}|jj�d|�|j���d|�|j���dd�|���d�S)NrGr%r�c�"�g|] \}}|�d|���� Sr�rr�s rrz7ReprPrinter._print_CoordinateSymbol.<locals>.<listcomp>�r�r) � _assumptions� generatorr.r'r-� coord_sys�indexr�rr�s r�_print_CoordinateSymbolz#ReprPrinter._print_CoordinateSymbol�s��� � � '�� ��7�7���'�'�'�� � �D�N�+�+�+�+�� � �D�J�'�'�'�'�� � <�;������;�;�;�D���'�'�'�� � �D�N�+�+�+�+�� � �D�J�'�'�'�'�� � �$����� � rc��d|jzS)NzQ.%s)r�r=s r�_print_PredicatezReprPrinter._print_Predicates���� �!�!rc�\�|j}|jj�d|�|d���d�S�NrGr%r�)�_argsr.r'r )rr/rs r�_print_AppliedPredicatez#ReprPrinter._print_AppliedPredicates3���z���>�2�2�2�D�L�L��t�4L�4L�4L�4L�M�Mrc� �t|��Sr;)�reprr=s r� _print_strzReprPrinter._print_str s���D�z�z�rc��t|��dkrd|�|d��zSd|�|d��zS)Nr z(%s,)rr$r%)rQr-r r=s r� _print_tuplezReprPrinter._print_tuple sE�� �t�9�9��>�>��T�[�[��a��1�1�1� 1��D�L�L��t�4�4�4� 4rc�0�|jj�d|j�d�S)Nz('z'))r.r'r�r=s r�_print_WildFunctionzReprPrinter._print_WildFunctions��!�^�4�4�4�d�i�i�i�@�@rc��|jj�d|�|j���d|�|������d�Sr�)r.r'r-�root�coeffsr=s r�_print_AlgebraicNumberz"ReprPrinter._print_AlgebraicNumbersO��#�~�6�6�6� �K�K�� � "� "� "� "�D�K�K�� � � � �$>�$>�$>�$>�@� @rc ���|jj�d|�|j���d|�|j���d|�|j���d�Sr��r.r'r-�symbols�domainr)r�rings r�_print_PolyRingzReprPrinter._print_PolyRings_��#'�>�#:�#:�#:� �K�K�� � %� %� %� %�t�{�{�4�;�'?�'?�'?�'?����T�Z�AX�AX�AX�AX�Z� Zrc ���|jj�d|�|j���d|�|j���d|�|j���d�Sr�r�)r�fields r�_print_FracFieldzReprPrinter._print_FracFields_��#(�?�#;�#;�#;� �K�K�� � &� &� &� &�� � �E�L�(A�(A�(A�(A�4�;�;�u�{�C[�C[�C[�C[�]� ]rc��t|�����}|�|jjd���|jj�d|�|j���d|�|���d�S�NT)r��reverserGr%r�)�list�terms�sortr�rr.r'r-)r�polyrs r�_print_PolyElementzReprPrinter._print_PolyElement!ss���T�Z�Z�\�\�"�"�� � � �t�y��� �5�5�5�#�~�6�6�6�� � �D�I�8N�8N�8N�8N�PT�P[�P[�\a�Pb�Pb�Pb�Pb�c�crc���t|j�����}|�|jjd���t|j�����}|�|jjd���|�|��}|�|��}|jj �d|�|j���d|�d|�d�Sr) r�numerrrr�r�denomr-r.r')r�frac� numer_terms� denom_termsr r s r�_print_FracElementzReprPrinter._print_FracElement&s����4�:�+�+�-�-�.�.� ����T�Z�-�t��<�<�<��4�:�+�+�-�-�.�.� ����T�Z�-�t��<�<�<�� � �K�(�(��� � �K�(�(��#'�>�#:�#:�#:�D�K�K�� �<S�<S�<S�<S�UZ�UZ�UZ�\a�\a�\a�b�brc�^�|jj}|�|j��}|�d|�d�Sr�)r.r'r-r�)rr��clsr�s r�_print_FractionFieldz ReprPrinter._print_FractionField/s3����'��� � �F�L�)�)���3�3����&�&rc��|jj}|�|j��}d�t |j|j����}t|j��}||j krd|z}nd}|�d|�d|�|�d�S)Nr%z, order=�rGr�) r.r'r-r�rr5�gensr*r� default_order)rr�r�domrr�orderstrs r�_print_PolynomialRingBasez%ReprPrinter._print_PolynomialRingBase4s����n�%���k�k�$�+�&�&���y�y��T�[�$�)�4�4�5�5���D�J���� �D�&� &� &�!�E�)�H�H��H�!$���c�c�c�4�4����:�:rc��|jj}|�|�����}|�|j��}|�d|�d|�d�Sr�)r.r'r-�to_listr)rrvr�reprs r� _print_DMPzReprPrinter._print_DMP?sQ���k�"���k�k�!�)�)�+�+�&�&���k�k�!�%� � ��"�s�s�C�C�C����-�-rc�0�dt|j��zS)NzFiniteExtension(%s))r*�modulus)r�exts r�_print_MonogenicFiniteExtensionz+ReprPrinter._print_MonogenicFiniteExtensionEs��%�s�3�;�'7�'7�7�7rc�|�|�|j��}|�|j��}d|�d|�d�S)NzExtElem(r%r�)r-rr)rr�rrs r�_print_ExtensionElementz#ReprPrinter._print_ExtensionElementJs=���k�k�!�%� � ���k�k�!�%� � ���$'�C�C����-�-rr;);r'r&� __qualname__� printmethodr�__annotations__r r2r9r>rZrcrgrjrlrorrrtrwrzr~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�r�r�r�r�rrrrrr r"rrrr r s���������K���)�)������ ?�?�?� ���$2�2�2�2� ���&+�&+�&+�P��� ���!�!�!�  � � ����������&�&�&����������������������������1�1�1�+�+�+� 1�1�1� D� D� D���������� 2� 2� 2� 2�O�O�O�H�H�H�a�a�a�S�S�S�U�U�U�F�F�F� L� L� L����$"�"�"�N�N�N� ���5�5�5� A�A�A�@�@�@�Z�Z�Z�]�]�]�d�d�d� c�c�c�'�'�'� ;� ;� ;�.�.�.� 8�8�8� .�.�.�.�.rr c �F�t|���|��S)zreturn expr in repr form)r r)r/�settingss r�sreprr(Os �� �x� � � (� (�� .� .�.rN)�__doc__� __future__r�typingr�sympy.core.functionr�sympy.core.mulr� mpmath.libmprrr��printerr r r r(rrr�<module>r0s�����#�"�"�"�"�"�������,�,�,�,�,�,�������8�8�8�8�8�8�8�8�,�,�,�,�,�,�,�,�{.�{.�{.�{.�{.�'�{.�{.�{.�z �� ���/�/���/�/�/r
Memory