
    Xhׁ                    6   d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
mZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ d
dlmZmZ d
dlmZmZ ddlmZmZ  G d de          Z ee          d             Z  G d de          Z! ee!          d             Z"dS )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            	      p   e Zd ZU dZdddddddddZded<   i Zd	ed
<   ddZddZd Z	dd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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$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 ZMddS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 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZdS )
StrPrinter	_sympystrNautoFT)order	full_precsympy_integersabbrevperm_cyclicminmaxdpszdict[str, Any]_default_settingszdict[str, str]_relationalsc                    t          |          |k     s|s+t          |          |k    rd|                     |          z  S |                     |          S )N(%s))r   _print)selfitemlevelstricts       d/var/www/tools.fuzzalab.pt/emblema-extractor/venv/lib/python3.11/site-packages/sympy/printing/str.pyparenthesizezStrPrinter.parenthesize#   sU    tu$$v$:d;K;Ku;T;TDKK----;;t$$$    r   c                J     |                      fd|D                       S )Nc                <    g | ]}                     |          S  r-   ).0r)   r*   r(   s     r,   
<listcomp>z(StrPrinter.stringify.<locals>.<listcomp>*   s)    IIID**477IIIr.   )join)r(   argssepr*   s   `  `r,   	stringifyzStrPrinter.stringify)   s.    xxIIIIIDIIIJJJr.   c                    t          |t                    r|S t          |t                    rt          |          S t          |          S N)
isinstancestrr   reprr(   exprs     r,   emptyPrinterzStrPrinter.emptyPrinter,   sC    dC   	Ke$$ 	::t99r.   c                   |                      ||          }t          |          }g }|D ]}|                     |          }|                    d          r|j        sd}|dd          }nd}t          |          |k     s|j        r|                    |d|z  g           w|                    ||g           |                    d          }|dk    rd}|d                    |          z   S )	Nr   -r   +r&   r     )_as_ordered_termsr   r'   
startswithis_Addextendpopr5   )	r(   r?   r   termsprecltermtsigns	            r,   
_print_AddzStrPrinter._print_Add4   s   &&t5&99$ 
	$ 
	$DD!!A||C    abbE$$&&$+&$
+,,,,$####uuQxx3;;Dchhqkk!!r.   c                    dS )NTruer1   r>   s     r,   _print_BooleanTruezStrPrinter._print_BooleanTrueI   s    vr.   c                    dS )NFalser1   r>   s     r,   _print_BooleanFalsezStrPrinter._print_BooleanFalseL       wr.   c                `    d|                      |j        d         t          d                   z  S )Nz~%sr   Not)r-   r6   r   r>   s     r,   
_print_NotzStrPrinter._print_NotO   s(    t((1j6GHHIIr.   c                D   t          |j                  }t          |          D ][\  }}t          |t                    rA|j        j        t          j        u r)|	                    d|
                    |                     \|                     |dt          d                   S )Nr   z & 
BitwiseAnd)listr6   	enumerater;   r   	canonicalrhsr   NegativeInfinityinsertrK   r8   r   )r(   r?   r6   jis        r,   
_print_AndzStrPrinter._print_AndR   s    DIdOO 	, 	,DAq!Z(( ,KOq'999Atxx{{+++~~dE:l+CDDDr.   c                P    |                      |j        dt          d                   S )Nz | 	BitwiseOrr8   r6   r   r>   s     r,   	_print_OrzStrPrinter._print_OrZ   s    ~~di
;0GHHHr.   c                P    |                      |j        dt          d                   S )Nz ^ 
BitwiseXorrj   r>   s     r,   
_print_XorzStrPrinter._print_Xor]   s    ~~di
<0HIIIr.   c                t    |                      |j                  d|                     |j        d          dS N(, ))r'   functionr8   	argumentsr>   s     r,   _print_AppliedPredicatez"StrPrinter._print_AppliedPredicate`   s=    KK&&&&t~t(L(L(L(LN 	Nr.   c                t      fd|j         D             }|j        j        dd                    |          z  z   S )Nc                :    g | ]}                     |          S r1   r'   )r3   or(   s     r,   r4   z+StrPrinter._print_Basic.<locals>.<listcomp>e   s#    ///T[[^^///r.   r&   rr   )r6   	__class____name__r5   )r(   r?   rN   s   `  r,   _print_BasiczStrPrinter._print_Basicd   s=    ////TY///~&$))A,,)>>>r.   c                    |j         j        dk    r |                     |j         d                    |                     |j                   S )N)r   r   )r   r   )blocksshaper'   )r(   Bs     r,   _print_BlockMatrixzStrPrinter._print_BlockMatrixh   s=    8>V##KK'''{{18$$$r.   c                    dS )NCatalanr1   r>   s     r,   _print_CatalanzStrPrinter._print_Catalanm   s    yr.   c                    dS )Nzoor1   r>   s     r,   _print_ComplexInfinityz!StrPrinter._print_ComplexInfinityp       ur.   c                     t           fd|j        |j        fD                       }|j        t          j        u rd|z  S |                     |j                  fz  }d|z  S )Nc                :    g | ]}                     |          S r1   ry   r3   rf   r(   s     r,   r4   z2StrPrinter._print_ConditionSet.<locals>.<listcomp>t   s#    CCCdkk!nnCCCr.   zConditionSet(%s, %s)zConditionSet(%s, %s, %s))tuplesym	conditionbase_setr   UniversalSetr'   )r(   sr6   s   `  r,   _print_ConditionSetzStrPrinter._print_ConditionSets   sn    CCCCquak.BCCCDD:'')D00QZ((**)D00r.   c                     |j         }d |j        D             }dd                     fd|g|z   D                       z  S )Nc                :    g | ]}|d          d k    r|d         n|S )r   r   r1   )r3   rf   s     r,   r4   z0StrPrinter._print_Derivative.<locals>.<listcomp>|   s,    GGGa11GGGr.   zDerivative(%s)rr   c              3  B   K   | ]}                     |          V  d S r:   ry   r3   argr(   s     r,   	<genexpr>z/StrPrinter._print_Derivative.<locals>.<genexpr>}   s/      ,Y,Y#T[[-=-=,Y,Y,Y,Y,Y,Yr.   )r?   variable_countr5   )r(   r?   dexprdvarss   `   r,   _print_DerivativezStrPrinter._print_Derivativez   sS    	GG43FGGG$)),Y,Y,Y,Y%SX,Y,Y,Y"Z"ZZZr.   c                    t          |                                t                    }g }|D ]J}|                     |          d|                     ||                   }|                    |           Kdd                    |          z  S )Nkeyz: {%s}rr   )sortedkeysr   r'   appendr5   )r(   dr   itemsr   r)   s         r,   _print_dictzStrPrinter._print_dict   s    affhh$4555 	 	C#{{3////QsV1D1D1DEDLL		%((((r.   c                ,    |                      |          S r:   )r   r>   s     r,   _print_DictzStrPrinter._print_Dict       %%%r.   c                F   t          |d          r*d|                     |                                          z   S t          |d          r;d|                     |j                  z   dz   |                     |j                  z   S d|                     |j                  z   S )N
as_booleanzDomain: setz in z
Domain on )hasattrr'   r   symbolsr   )r(   r   s     r,   _print_RandomDomainzStrPrinter._print_RandomDomain   s    1l## 	9ALLNN ; ;;;Q 	9QY!7!77&@KK&&' (  $++ai"8"888r.   c                    d|j         z   S N_namer>   s     r,   _print_DummyzStrPrinter._print_Dummy   s    TYr.   c                    dS )N
EulerGammar1   r>   s     r,   _print_EulerGammazStrPrinter._print_EulerGamma   s    |r.   c                    dS )NEr1   r>   s     r,   _print_Exp1zStrPrinter._print_Exp1       sr.   c                t    d|                      |j                  d|                      |j                  dS rp   )r'   r?   condr>   s     r,   _print_ExprCondPairzStrPrinter._print_ExprCondPair   s7     ![[3333T[[5K5K5K5KLLr.   c                X    |j         j        d|                     |j        d          z  z   S Nr&   rr   )funcr|   r8   r6   r>   s     r,   _print_FunctionzStrPrinter._print_Function   s'    y!FT^^DIt-L-L$LLLr.   c                    dS )NGoldenRatior1   r>   s     r,   _print_GoldenRatiozStrPrinter._print_GoldenRatio   s    }r.   c                X    |j         j        d|                     |j        d          z  z   S r   )r   r|   r8   pargsr>   s     r,   _print_HeavisidezStrPrinter._print_Heaviside   s)     y!FT^^DJ-M-M$MMMr.   c                    dS )NTribonacciConstantr1   r>   s     r,   _print_TribonacciConstantz$StrPrinter._print_TribonacciConstant   s    ##r.   c                    dS NIr1   r>   s     r,   _print_ImaginaryUnitzStrPrinter._print_ImaginaryUnit   r   r.   c                    dS )Noor1   r>   s     r,   _print_InfinityzStrPrinter._print_Infinity       tr.   c                      fdd                     fd|j        D                       }d                     |j                  d|dS )Nc                    t          |           dk    r                    | d                   S                     | d         ft          | dd                    z             S Nr   r   lenr'   r   xabr(   s    r,   
_xab_tostrz.StrPrinter._print_Integral.<locals>._xab_tostr   S    3xx1}}{{3q6***{{CF9uSW~~#=>>>r.   rr   c                &    g | ]} |          S r1   r1   r3   rN   r   s     r,   r4   z.StrPrinter._print_Integral.<locals>.<listcomp>   !    :::zz!}}:::r.   z	Integral(rs   r5   limitsr'   rt   r(   r?   Lr   s   `  @r,   _print_IntegralzStrPrinter._print_Integral   sl    	? 	? 	? 	? 	?
 II::::dk:::;;%)[[%?%?%?%?CCr.   c                    d}|j         \  }}}}|j        r
|j        rd}n-|j        r|sd}n!|j        r|sd}n|s|sd}n|r|rd}n|rd}nd} |j        di |||dS )NzInterval{m}({a}, {b})rE   z.openz.Lopenz.Ropen)abmr1   )r6   is_infiniteformat)r(   rf   finr   r   rN   rr   s           r,   _print_IntervalzStrPrinter._print_Interval   s    &V
1a= 	Q] 	AA] 	1 	AA] 		1 		AA 	1 	AA 	1 	AA 	AAAsz55!!!44555r.   c                t    d|                      |j                  d|                      |j                  dS )NzAccumBounds(rr   rs   )r'   r    r!   )r(   rf   s     r,   _print_AccumulationBoundsz$StrPrinter._print_AccumulationBounds   s<     (,AE(:(:(:(:(,AE(:(:(:(:< 	<r.   c                T    d|                      |j        t          d                   z  S )Nz%s**(-1)r   r-   r   r   )r(   r   s     r,   _print_InversezStrPrinter._print_Inverse   s$    D--aeZ5FGGGGr.   c                    |j         }|j        }t          |          dk    r|d         j        r|d         }d|                     |          d|                     |          dS )Nr   r   zLambda(rr   rs   )r?   	signaturer   	is_symbolr'   )r(   objr?   sigs       r,   _print_LambdazStrPrinter._print_Lambda   sc    xms88q==SV-=a&C#';;s#3#3#3#3T[[5F5F5F5FGGr.   c                     t          |j        t                    }|j        j        dd                     fd|D                       z  z   S )Nr   r&   rr   c              3  B   K   | ]}                     |          V  d S r:   ry   r   s     r,   r   z.StrPrinter._print_LatticeOp.<locals>.<genexpr>   s/      6X6XCt{{37G7G6X6X6X6X6X6Xr.   )r   r6   r   r   r|   r5   r(   r?   r6   s   `  r,   _print_LatticeOpzStrPrinter._print_LatticeOp   sO    di%5666y!FTYY6X6X6X6XSW6X6X6X-X-X$XXXr.   c           
     l    |j         \  }}}}dt          t          | j        ||||f                    z  S )NzLimit(%s, %s, %s, dir='%s'))r6   r   mapr'   )r(   r?   ezz0dirs         r,   _print_LimitzStrPrinter._print_Limit   s9    	1b#,uSq!RQTo5V5V/W/WWWr.   c                4    d|                      |d          z  S )N[%s]rr   )r8   r>   s     r,   _print_listzStrPrinter._print_list   s    tT2222r.   c                ,    |                      |          S r:   )r  r>   s     r,   _print_ListzStrPrinter._print_List   r   r.   c                ,    |                     |           S r:   )_format_strr>   s     r,   _print_MatrixBasezStrPrinter._print_MatrixBase   r   r.   c                    |                      |j        t          d         d          d|                     |j                  d|                     |j                  dz   S )NAtomTr+   [rr   ])r-   parentr   r'   rf   re   r>   s     r,   _print_MatrixElementzStrPrinter._print_MatrixElement   s`      j.@ NNN KK////TV1D1D1D1DEF 	Fr.   c                      fd}                      |j        t          d         d          dz    ||j        |j        j                  z   dz    ||j        |j        j                  z   dz   S )Nc                    t          |           } | d         dk    r| d= | d         dk    rd| d<   | d         |k    rd| d<   d                    fd| D                       S )N   r   r   rE   :c              3  B   K   | ]}                     |          V  d S r:   ry   r   s     r,   r   zBStrPrinter._print_MatrixSlice.<locals>.strslice.<locals>.<genexpr>   s/      ;;#T[[--;;;;;;r.   )r_   r5   )xdimr(   s     r,   strslicez/StrPrinter._print_MatrixSlice.<locals>.strslice   su    QAtqyyaDtqyy!ts{{!88;;;;;;;<<<r.   r  Tr  r  rr   r  )r-   r  r   rowslicerowscolslicecols)r(   r?   r  s   `  r,   _print_MatrixSlicezStrPrinter._print_MatrixSlice   s    	= 	= 	= 	= 	= !!$+z&/A$!OORUU(899:<@A(899:<?@ 	Ar.   c                    |j         S r:   r   r>   s     r,   _print_DeferredVectorz StrPrinter._print_DeferredVector  
    yr.   c                
    t          |          |j        }|d         t          j        u s"t	          d |dd          D                       rt          |d d          \  }}t          |          D ]y\  }}|j        j        r	|j         }n9t          |j        j                  }|d          |d<   t          j        |          }|dz
  rt          |j        |d          n|j        ||<   zg }	|rP|d         j        sC|d                                         r)                     |                    d                    g}	|	 fd	|D             z   }
|
sd
g}
t%          |          dk    rD|d                                         r*                     |                    d                    g}	ng }	|	 fd|D             z   }d                    |
          }d                    |          }t%          |          dk    r|d|dS |r|d|S |S |                                \  }}|dk     rt+          | |          }d}nd}g }g }g } j        dvr|                                }nt          j        |          }d }|D ]}|j        rt5          |t                    rt7          |j                                        d         dk               r|j        t          j        ur|                     ||                     t%          |j        d         j                  dk    r6t5          |j        t          t          f          r|                    |           |                    |j                   |j        rt|t          j        urf|j         dk    r'|                    tC          |j                              |j"        dk    r'|                    tC          |j"                             p|                    |           |pt          j        g} fd|D             } fd|D             }|D ]I}|j        |v r>d||#                    |j                           z  ||#                    |j                  <   J|s|d                    |          z   S t%          |          dk    r$|d                    |          z   dz   |d         z   S |d                    |          z   dd                    |          z  z   S )Nr   c              3     K   | ]>}t          |t                    p$|j        ot          d  |j        D                       V  ?dS )c              3  $   K   | ]}|j         V  d S r:   )
is_Integer)r3   ais     r,   r   z2StrPrinter._print_Mul.<locals>.<genexpr>.<genexpr>  s$       @ @2 @ @ @ @ @ @r.   N)r;   r
   is_Powallr6   )r3   r   s     r,   r   z(StrPrinter._print_Mul.<locals>.<genexpr>  sk       ## ##  1f%% A@S @ @ @ @ @@@## ## ## ## ## ##r.   r   c                    t          | t                    o/t          | j                                        d         dk               S Nr   )r;   r   boolexpas_coeff_Mul)r  s    r,   <lambda>z'StrPrinter._print_Mul.<locals>.<lambda>  s9    1c""HtAE,>,>,@,@,Ca,G'H'H r.   T)binaryFevaluatec                @    g | ]}                     |d           S Fr  r2   r3   r   rM   r(   s     r,   r4   z)StrPrinter._print_Mul.<locals>.<listcomp>$  >        #//4/FF   r.   1c                @    g | ]}                     |d           S r6  r2   r7  s     r,   r4   z)StrPrinter._print_Mul.<locals>.<listcomp>.  r8  r.   *z/(rs   /rC   rE   )oldnonec                x   |                                  \  }}t          t          j        |                    }|d         t          j        u r|dd          }n|d          |d<   t          j        |          }t          | t                    r| 	                    ||d          S | 	                    |d          S )Nr   r   Fr3  )
as_base_expr_   r	   	make_argsr   NegativeOne
_from_argsr;   r   r   )rf   r   r  eargss       r,   apowz#StrPrinter._print_Mul.<locals>.apowL  s    ==??DAqq))**EQx1=((abb	!!H9au%%A!S!! 4vvaUv33366!e6,,,r.   c                @    g | ]}                     |d           S r6  r2   r3   r  rM   r(   s     r,   r4   z)StrPrinter._print_Mul.<locals>.<listcomp>m  .    EEEa""1d5"99EEEr.   c                @    g | ]}                     |d           S r6  r2   rG  s     r,   r4   z)StrPrinter._print_Mul.<locals>.<listcomp>n  rH  r.   r&   z/(%s))$r   r6   r   Oneanyr   r`   r/  	is_Numberr_   r	   rC  r   baserI   could_extract_minus_signr'   rK   r   r5   r0  r   r   as_ordered_factorsrA  is_commutativer;   r.  rB  r   is_RationalInfinitypr   qindex)r(   r?   r6   r   nrf   dir  dargsprenfactorsdfactorscrQ   r   r   	pow_parenrE  r)   a_strb_strrM   s   `                    @r,   
_print_MulzStrPrinter._print_Mul  s   $ y7aes ## ## abb## ## ##  #  #  I I  DAq #1 M M26# .AA --E %ayE!Hu--A:;a%Ls27A6666RW!C .1 .1)F)F)H)H .{{15588,,-        H !5 1vvzzad;;==z{{15588,,-        H ""A""A8}}q  $%AAqqq)) ("#!!QQ''H  ""1q55r1%%DDDD	:_,,**,,DD =&&D
	- 
	- 
	-  	 	D# tS))..003a788 81=00HHTT$ZZ((((DIaL-..!33&ty3*== 4 "((...HHTY''''! d!*&<&<6Q;;HHXdf--...6Q;;HHXdf--...L!%EEEEE1EEEEEEEE1EEE  	O 	ODyA~~,2U17749;M;M5N,Naggdi(() 	F#((5//))VVq[[#((5//)C/%(::#((5//)Gchhuoo,EEEr.   c                N                                     \  }}d}|j        rZ|                                \  }}|j        r|j        rt          | |          d}n!|j        r|j        rt          | |          d}|d                     fdj        D                       z   S )NrE   rC   r;  c                V    g | ]%}                     |t                              &S r1   r-   r   r3   r   r?   r(   s     r,   r4   z,StrPrinter._print_MatMul.<locals>.<listcomp>  s1    KKK#TsJt$4$455KKKr.   )as_coeff_mmul	is_numberas_real_imagis_zerois_negativer   r5   r6   )r(   r?   r\  r   rQ   reims   ``     r,   _print_MatMulzStrPrinter._print_MatMul|  s    !!##1; 	^^%%FBz bn "A2q))  "A2q))chhKKKKKKKK
 
 
 	
r.   c                h    d                     |j        |                     |j                            S )Nz{}.({}))r   rt   r'   r?   r>   s     r,   _print_ElementwiseApplyFunctionz*StrPrinter._print_ElementwiseApplyFunction  s0    MKK	""
 
 	
r.   c                    dS )Nnanr1   r>   s     r,   
_print_NaNzStrPrinter._print_NaN  r   r.   c                    dS )Nz-oor1   r>   s     r,   _print_NegativeInfinityz"StrPrinter._print_NegativeInfinity  r   r.   c                D   |j         rt          d |j        D                       r]t          |j                   dk    rd|                     |j                  z  S d|                     |j        f|j         z   dd          z  S d|                     |j        dd          z  S )Nc              3  2   K   | ]}|t           j        u V  d S r:   )r   Zero)r3   rS  s     r,   r   z*StrPrinter._print_Order.<locals>.<genexpr>  s(      $E$EQQ!&[$E$E$E$E$E$Er.   r   zO(%s)rr   r   )	variablesr+  pointr   r'   r?   r8   r6   r>   s     r,   _print_OrderzStrPrinter._print_Order  s    ~ 	@$E$E$*$E$E$E!E!E 	@4>""a''TY!7!777t~0MtUV!W!WWWT^^DItQ????r.   c                *    |                                 S r:   __str__r>   s     r,   _print_OrdinalzStrPrinter._print_Ordinal      ||~~r.   c                *    |                                 S r:   r{  r>   s     r,   _print_CyclezStrPrinter._print_Cycle  r~  r.   c                   ddl m}m} ddlm} |j        }| |d| dddd	           n| j                            d
d          }|r|j        sdS   ||          |j        dz
            	                                t          d          d          }|                    d          }|dk    s!d||d          vr||d          |d |         z   }|                    dd          }|S |                                }|sE|j        dk     rd|                     |j                  z  S d|                     |j                  z  S |                     |j        d |d         dz                      d|                     |j                  z  z   }|                     |j                  x}	}
t          |          t          |
          k     r|}	d|	z  S )Nr   )PermutationCycle)sympy_deprecation_warningzw
                Setting Permutation.print_cyclic is deprecated. Instead use
                init_printing(perm_cyclic=z).
                z1.6z#deprecated-permutation-print_cyclic   )deprecated_since_versionactive_deprecations_target
stacklevelr   Tz()r   r  rq   ,rE      zPermutation(%s)zPermutation([], 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  r   r   lasttrimusefulls              r,   _print_PermutationzStrPrinter._print_Permutation  s   GGGGGGGGHHHHHH!."%%+6   */+P     .,,]DAAK 	+9 t dDIM**3355c'llmmDA773<<D199AdeeH!4!4deeHq$x'		#r""AHA K9q==,t{{4?/K/KKK1DKK	4J4JJJ;;tz"	z:;;kDKKX\XaLbLb>bbDT_555C$4yy3t99$$$s**r.   c                    |j         \  }}}t          |j                  dk    r|d         }|d         }d|                     |          d|                     |          d|                     |          dS )Nr   r   zSubs(rr   rs   )r6   r   rx  r'   )r(   r   r?   r=  news        r,   _print_SubszStrPrinter._print_Subs  s~    c3sy>>Qa&Ca&CKKt{{3////S1A1A1A1AC 	Cr.   c                *    |                                 S r:   ry   r>   s     r,   _print_TensorIndexzStrPrinter._print_TensorIndex      {{}}r.   c                *    |                                 S r:   ry   r>   s     r,   _print_TensorHeadzStrPrinter._print_TensorHead  r  r.   c                *    |                                 S r:   ry   r>   s     r,   _print_TensorzStrPrinter._print_Tensor  r  r.   c                ~                                      \  }}|d                     fd|D                       z   S )Nr;  c                V    g | ]%}                     |t                              &S r1   rc  rd  s     r,   r4   z-StrPrinter._print_TensMul.<locals>.<listcomp>  s1    FFF#TsJt$4$455FFFr.   )!_get_args_for_traditional_printerr5   )r(   r?   rQ   r6   s   ``  r,   _print_TensMulzStrPrinter._print_TensMul  sP    ;;==
dchhFFFFFFFF
 
 
 	
r.   c                *    |                                 S r:   ry   r>   s     r,   _print_TensAddzStrPrinter._print_TensAdd  r  r.   c                6    |                      |j                  S r:   r'   r   r>   s     r,   _print_ArraySymbolzStrPrinter._print_ArraySymbol  s    {{49%%%r.   c                                           |j        t          d         d          dd                     fd|j        D                       dS )NFuncTr  rr   c                :    g | ]}                     |          S r1   ry   r   s     r,   r4   z2StrPrinter._print_ArrayElement.<locals>.<listcomp>  s%    NtNtNtbct{{[\~~NtNtNtr.   r  )r-   r   r   r5   indicesr>   s   ` r,   _print_ArrayElementzStrPrinter._print_ArrayElement  s^    diF);TBBBBDIINtNtNtNtgkgsNtNtNtDuDuDuDuw 	wr.   c                Z      fd|j         D             }dd                    |          z  S )Nc                @    g | ]}d                      |          z  S )z    %sry   )r3   r   r(   s     r,   r4   z6StrPrinter._print_PermutationGroup.<locals>.<listcomp>  s(    :::1XA&:::r.   zPermutationGroup([
%s])z,
)r6   r5   )r(   r?   rS  s   `  r,   _print_PermutationGroupz"StrPrinter._print_PermutationGroup  s3    ::::	:::)EJJqMM99r.   c                    dS )Npir1   r>   s     r,   	_print_PizStrPrinter._print_Pi  r   r.   c                     dd                      fd|j        D                       d                     |j                  d                     |j                  dS )NzPolynomial ring in rr   c              3  B   K   | ]}                     |          V  d S r:   ry   )r3   rsr(   s     r,   r   z-StrPrinter._print_PolyRing.<locals>.<genexpr>  s-      ??BB??????r.    over  with  orderr5   r   r'   domainr   )r(   rings   ` r,   _print_PolyRingzStrPrinter._print_PolyRing  sh     YY????$,???@@@@KK$$$$dkk$*&=&=&=&=? 	?r.   c                     dd                      fd|j        D                       d                     |j                  d                     |j                  dS )NzRational function field in rr   c              3  B   K   | ]}                     |          V  d S r:   ry   )r3   fsr(   s     r,   r   z.StrPrinter._print_FracField.<locals>.<genexpr>  s-      @@BB@@@@@@r.   r  r  r  r  r(   fields   ` r,   _print_FracFieldzStrPrinter._print_FracField  sj     YY@@@@%-@@@AAAAKK%%%%t{{5;'?'?'?'?A 	Ar.   c                *    |                                 S r:   r{  )r(   elms     r,   _print_FreeGroupElementz"StrPrinter._print_FreeGroupElement  s    {{}}r.   c                (    d|j         d|j        dS )Nrq    + z*I))r  yr(   polys     r,   _print_GaussianElementz!StrPrinter._print_GaussianElement  s      $//r.   c                <    |                     | t          dd          S )Nz%s**%sr;  )r<   r   r  s     r,   _print_PolyElementzStrPrinter._print_PolyElement
  s    xxj(C888r.   c                    |j         dk    r|                     |j                  S |                     |j        t          d         d          }|                     |j         t          d         d          }|dz   |z   S )Nr   r	   Tr  r  r<  )denomr'   numerr-   r   )r(   fracr  r  s       r,   _print_FracElementzStrPrinter._print_FracElement  sr    :??;;tz***%%dj*U2CD%QQE%%dj*V2DT%RRE3;&&r.   c                    t           d         dz
  g  fd|j        D             }}|                                D ]t\  }}g }t          |          D ]N\  }}|dk    rC|dk    r|                    ||                    -|                    ||         d|z  z              Od                    |          }|j        r4|rd                     |          z   dz   }	nz                     |          }	nd|rM|t          j	        u r|
                    d	|g           |t          j        u r|
                    d
|g                                |          }	|s|	}
n|	dz   |z   }
|
                    d
          r!|
                    d
|
dd          g           ]|
                    d	|
g           v|d         dv r)|                    d          }|d
k    rd
|d         z   |d<   |j        j        dz   }ddlm} 	 |d|                                z  z  }n%# |$ r |d|                                z  z  }Y nw xY w|dz  }t          |          D ]a\  }}t)          |          dk    rI|d d         dk    r;|t)          |          dz
  d          dk    r|dt)          |          dz
           ||<   b|d                    |          d                    |          fz  S )Nr  r   c                <    g | ]}                     |          S r1   r2   )r3   r   	ATOM_PRECr(   s     r,   r4   z*StrPrinter._print_Poly.<locals>.<listcomp>  s)    PPPD--a;;PPPr.   r   z**%dr;  rq   rs   rD   rC   )rC   rD   z(%s, %s)PolynomialErrorz, modulus=%sz, domain='%s'r  rF   rr   )r   gensrL   r`   r   r5   rI   r'   r   rJ  rJ   rB  rH   rK   r{   r|   sympy.polys.polyerrorsr  get_modulus
get_domainr   )r(   r?   rL   r  monomcoeffs_monomrf   r  s_coeffs_termmodifierr   r  rU  r)   r  s   `               @r,   _print_PolyzStrPrinter._print_Poly  s4   v&*	PPPPPTYPPPt JJLL %	, %	,LE5G!%(( = =1q55AvvtAw////tAw!';<<<hhw''G| - 1!DKK$6$66<GG"kk%00GG !~~c7^444 --c7^444 ++e,, 1  30  %% ,c6!"":.////c6]++++8z!!yy||H3q>a(94::::::	:nt'7'7'9'999FF 	: 	: 	:o(9(999FFF	: 	#$T?? 	4 	4KE44yy1}}$rr(c//d3t99q=>>6Jc6Q6Q"1SYY]?3U%$))D//:::s   <H H98H9c                    dS )Nr   r1   )r(   rS  s     r,   _print_UniversalSetzStrPrinter._print_UniversalSetW  s    ~r.   c                    |j         r9|                     |                                                                          S |                     |                                          S r:   )
is_aliasedr'   as_polyas_exprr>   s     r,   _print_AlgebraicNumberz!StrPrinter._print_AlgebraicNumberZ  sL    ? 	/;;t||~~5577888;;t||~~...r.   c                    t          |          }|j        t          j        u r|sd                     |j                  z  S |j        r|j         t          j        u r1|s/dt           fdt          j        |j        fD                       z  S |j        t          j         u r?                     t          j                  d 	                    |j        |d          S  	                    |j        |d          } j
        dk    r[|j        j        rO|j        j        dk    r?|                    d	          r* 	                    |j        |d          d
|dd         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.
        zsqrt(%s)z%s/sqrt(%s)c              3  B   K   | ]}                     |          V  d S r:   ry   r   s     r,   r   z(StrPrinter._print_Pow.<locals>.<genexpr>  s/      -]-]3dkk#.>.>-]-]-]-]-]-]r.   r<  Fr  
_sympyreprr   z	(Rational**r  )r   r/  r   Halfr'   rM  rP  r   rJ  r-   printmethodrQ  rT  rH   )r(   r?   rationalPRECr  s   `    r,   
_print_PowzStrPrinter._print_Pow`  s   L $8qvhDI 6 666 	TyAF""8" %u-]-]-]-]15RVR[J\-]-]-]'^'^^^xAE6!!"&++ae"4"4"4"4"&"3"3DItE"3"R"R"RT T dhU;;|++0D+WX ||K(( ^#'#4#4TYU#4#S#S#S#SUVWXY[W[U\U\]],,TYU,KKKKQQOOr.   c                B    |                      |j        d                   S r-  r'   r6   r>   s     r,   _print_UnevaluatedExprz!StrPrinter._print_UnevaluatedExpr  s    {{49Q<(((r.   c                    t          |          }|                     |j        |d          d|                     |j        |d          S )NFr  r  )r   r-   rM  r/  )r(   r?   r  s      r,   _print_MatPowzStrPrinter._print_MatPow  sX    $,,TYU,KKKK**48T%*HHHJ 	Jr.   c                j    | j                             dd          rd|z  S t          |j                  S )Nr   FzS(%s))r  r  r<   rS  r>   s     r,   _print_IntegerzStrPrinter._print_Integer  s6    >.66 	$d##46{{r.   c                    dS )NIntegersr1   r>   s     r,   _print_IntegerszStrPrinter._print_Integers      zr.   c                    dS )NNaturalsr1   r>   s     r,   _print_NaturalszStrPrinter._print_Naturals  r  r.   c                    dS )N	Naturals0r1   r>   s     r,   _print_Naturals0zStrPrinter._print_Naturals0      {r.   c                    dS )N	Rationalsr1   r>   s     r,   _print_RationalszStrPrinter._print_Rationals  r
  r.   c                    dS )NRealsr1   r>   s     r,   _print_RealszStrPrinter._print_Reals  rY   r.   c                    dS )N	Complexesr1   r>   s     r,   _print_ComplexeszStrPrinter._print_Complexes  r
  r.   c                    dS )NEmptySetr1   r>   s     r,   _print_EmptySetzStrPrinter._print_EmptySet  r  r.   c                    dS )NEmptySequencer1   r>   s     r,   _print_EmptySequencezStrPrinter._print_EmptySequence  s    r.   c                     t          |          S r:   r<   r>   s     r,   
_print_intzStrPrinter._print_int      4yyr.   c                     t          |          S r:   r  r>   s     r,   
_print_mpzzStrPrinter._print_mpz  r  r.   c                    |j         dk    rt          |j                  S | j                            dd          rd|j        d|j         S |j        d|j         S )Nr   r   FzS(z)/r<  )rT  r<   rS  r  r  r>   s     r,   _print_RationalzStrPrinter._print_Rational  se    6Q;;tv;;~!!"2E:: 5 5%)VVVTVV44"fffdff--r.   c                b    |j         dk    rt          |j                  S d|j        |j         fz  S )Nr   z%d/%d)rT  r<   rS  r>   s     r,   _print_PythonRationalz StrPrinter._print_PythonRational  s/    6Q;;tv;;dfdf---r.   c                b    |j         dk    rt          |j                  S |j        d|j         S Nr   r<  denominatorr<   	numeratorr>   s     r,   _print_FractionzStrPrinter._print_Fraction  7    q  t~&&&"nnnd.>.>??r.   c                b    |j         dk    rt          |j                  S |j        d|j         S r%  r&  r>   s     r,   
_print_mpqzStrPrinter._print_mpq  r*  r.   c                L   |j         }| j                            dd           }||dk     rdnt          |j                   }| j        d         du rd}n.| j        d         du rd}n| j        d         dk    r| j        dk    }d	| j        v r| j        d	         nd }d
| j        v r| j        d
         nd }t          |j        ||||          }|                    d          rd|dd          z   }n"|                    d          rd|dd          z   }|                    d          }|S )Nr"   r  r   r   TFr   r   r    r!   )strip_zeros	min_fixed	max_fixedz-.0z-0.   z.0z0.r  rD   )	_precr  r  r   _print_levelmlib_to_str_mpf_rH   removeprefix)r(   r?   rM   r"   striplowhighrvs           r,   _print_FloatzStrPrinter._print_Float  sH   zn  --;axx!![%<%<C>+&$..EE^K(E11EE^K(F22%)E','>'>dnU##D(-(?(?t~e$$TSesVZ[[[== 	ABBBB]]4   	122B__S!!	r.   c           
        ddddddddd	}|j         |v rF||j                  d
|                     |j                  d|                     |j                  dS |                     |j        t          |                    d| j                            |j                   p|j         d|                     |j        t          |                    S )NEqNe
AssignmentAddAugmentedAssignmentSubAugmentedAssignmentMulAugmentedAssignmentDivAugmentedAssignmentModAugmentedAssignment)z==z!=z:=z+=z-=z*=z/=z%=rq   rr   rs   rF   )rel_opr'   lhsrb   r-   r   r$   r  )r(   r?   charmaps      r,   _print_RelationalzStrPrinter._print_Relational  s     *****	
 	
 ;'!!#*4;#7#7#7TX9N9N9N9N#';;tx#8#8#8#8: : "..txD9I9IJJJJ,00==LLL,,TXz$7G7GHHHJ 	Jr.   c                N    d|                      |j        d          |j        fz  S )NzCRootOf(%s, %d)lexrB   )rR   r?   rU  r>   s     r,   _print_ComplexRootOfzStrPrinter._print_ComplexRootOf  s-     DOODIeO$L$L$(J$0 0 	0r.   c                    |                      |j        d          g}|j        t          j        ur-|                    |                     |j                             dd                    |          z  S )NrJ  rB   zRootSum(%s)rr   )rR   r?   funr   IdentityFunctionr   r'   r5   r   s      r,   _print_RootSumzStrPrinter._print_RootSum  sa    	77881---KKDH--...tyy..r.   c                \    j         j        } fdj        D             }dd                    |          z  } fdj        D             }d                     j                  z  }d                     j                  z  }|g|z   ||gz   }|dd                    |          dS )	Nc                H    g | ]}                     |j                   S )rB   )rR   r   )r3   r   basisr(   s     r,   r4   z3StrPrinter._print_GroebnerBasis.<locals>.<listcomp>  s+    PPPSEK88PPPr.   r  rr   c                :    g | ]}                     |          S r1   ry   )r3   genr(   s     r,   r4   z3StrPrinter._print_GroebnerBasis.<locals>.<listcomp>  s%    999cS!!999r.   zdomain='%s'z
order='%s'rq   rs   )r{   r|   exprsr5   r  r'   r  r   )r(   rR  clsrU  r  r  r   r6   s   ``      r,   _print_GroebnerBasiszStrPrinter._print_GroebnerBasis  s    o&PPPPPEKPPP5)))9999UZ999U\!:!::t{{5;777w~/33		$00r.   c                     t          |t                    }d                     fd|D                       }|sdS d|z  S )Nr   rr   c              3  B   K   | ]}                     |          V  d S r:   ry   r3   r)   r(   s     r,   r   z(StrPrinter._print_set.<locals>.<genexpr>)  /      ==tT**======r.   zset()r   )r   r   r5   r(   r   r   r6   s   `   r,   
_print_setzStrPrinter._print_set&  sS    q.///yy====u===== 	7}r.   c                
    ddl m t          |t                    }d                     fd|D                       }t          fd|D                       rd                    |          S d                    |          S )	Nr   )	FiniteSetr   rr   c              3  B   K   | ]}                     |          V  d S r:   ry   rZ  s     r,   r   z.StrPrinter._print_FiniteSet.<locals>.<genexpr>2  r[  r.   c              3  B   K   | ]}|                               V  d S r:   )has)r3   r)   r_  s     r,   r   z.StrPrinter._print_FiniteSet.<locals>.<genexpr>3  s/      55ttxx	""555555r.   zFiniteSet({})z{{{}}})sympy.sets.setsr_  r   r   r5   rK  r   )r(   r   r   r6   r_  s   `   @r,   _print_FiniteSetzStrPrinter._print_FiniteSet.  s    ------q.///yy====u=====5555u55555 	0"))$///t$$$r.   c                     t          |t                    }d                     fd|D                       }d                    |          S )Nr   rr   c              3  B   K   | ]}                     |          V  d S r:   ry   r   s     r,   r   z.StrPrinter._print_Partition.<locals>.<genexpr>:  s/      ;;cS));;;;;;r.   zPartition({}))r   r   r5   r   r\  s   `   r,   _print_PartitionzStrPrinter._print_Partition7  sP    q.///yy;;;;U;;;;;%%d+++r.   c                :    |sdS d|                      |          z  S )Nzfrozenset()zfrozenset(%s))r]  r(   r   s     r,   _print_frozensetzStrPrinter._print_frozenset=  s&     	! =!3!333r.   c                      fdd                     fd|j        D                       }d                     |j                  d|dS )Nc                    t          |           dk    r                    | d                   S                     | d         ft          | dd                    z             S r   r   r   s    r,   r   z)StrPrinter._print_Sum.<locals>._xab_tostrC  r   r.   rr   c                &    g | ]} |          S r1   r1   r   s     r,   r4   z)StrPrinter._print_Sum.<locals>.<listcomp>H  r   r.   zSum(rs   r   r   s   `  @r,   
_print_SumzStrPrinter._print_SumB  sl    	? 	? 	? 	? 	?
 II::::dk:::;; $DM : : : :AAA>>r.   c                    |j         S r:   r   r>   s     r,   _print_SymbolzStrPrinter._print_SymbolK  r$  r.   c                    dS r   r1   r>   s     r,   _print_IdentityzStrPrinter._print_IdentityP  r   r.   c                    dS )N0r1   r>   s     r,   _print_ZeroMatrixzStrPrinter._print_ZeroMatrixS  r   r.   c                    dS )Nr9  r1   r>   s     r,   _print_OneMatrixzStrPrinter._print_OneMatrixV  r   r.   c                    d|j         z  S )NzQ.%sr   r>   s     r,   _print_PredicatezStrPrinter._print_PredicateY  s    	!!r.   c                     t          |          S r:   r  r>   s     r,   
_print_strzStrPrinter._print_str\  r  r.   c                    t          |          dk    rd|                     |d                   z  S d|                     |d          z  S )Nr   z(%s,)r   r&   rr   )r   r'   r8   r>   s     r,   _print_tuplezStrPrinter._print_tuple_  sE    t99>>T[[a1111DNN46666r.   c                ,    |                      |          S r:   )r}  r>   s     r,   _print_TuplezStrPrinter._print_Tuplee  s      &&&r.   c                T    d|                      |j        t          d                   z  S )Nz%s.Tr   r   )r(   Ts     r,   _print_TransposezStrPrinter._print_Transposeh  s$    ))!%E1BCCCCr.   c                t    d|                      |j                  d|                      |j                  dS )NzUniform(rr   rs   )r'   r   r   r>   s     r,   _print_UniformzStrPrinter._print_Uniformk  s7     $(KK$7$7$7$7TV9L9L9L9LMMr.   c                `    | j                             dd          r
d|j        z  S d|j        z  S )Nr   Fz%s)r  r  r   r   r>   s     r,   _print_QuantityzStrPrinter._print_Quantityn  s6    >h.. 	&$+%%dir.   c                      fd|j         D             }|d         gd t          |dd          d          D             z   }d                    |          S )Nc                V    g | ]%}                     |t          d          d          &S )r	   Tr  )r-   r   r   s     r,   r4   z0StrPrinter._print_Quaternion.<locals>.<listcomp>t  s3    UUUaTq*U"3DAAUUUr.   r   c                $    g | ]\  }}|d z   |z   S )r;  r1   )r3   rf   re   s      r,   r4   z0StrPrinter._print_Quaternion.<locals>.<listcomp>u  s$    <<<$!QaeAg<<<r.   r   ijkr  )r6   zipr5   )r(   r?   r   r   s   `   r,   _print_QuaternionzStrPrinter._print_Quaternions  s_    UUUU49UUUqTF<<#aeU*;*;<<<<zz!}}r.   c                     t          |          S r:   r  r>   s     r,   _print_DimensionzStrPrinter._print_Dimensionx  r  r.   c                    |j         dz   S r   r   r>   s     r,   _print_WildzStrPrinter._print_Wild{      y3r.   c                    |j         dz   S r   r   r>   s     r,   _print_WildFunctionzStrPrinter._print_WildFunction~  r  r.   c                    |j         S r:   r   r>   s     r,   _print_WildDotzStrPrinter._print_WildDot  r$  r.   c                    |j         S r:   r   r>   s     r,   _print_WildPluszStrPrinter._print_WildPlus  r$  r.   c                    |j         S r:   r   r>   s     r,   _print_WildStarzStrPrinter._print_WildStar  r$  r.   c                    | j                             dd          rdS |                     t          d                    S )Nr   FzS(0)r   )r  r  r  r   r>   s     r,   _print_ZerozStrPrinter._print_Zero  s<    >.66 	6""71::...r.   c                    |j         j        }|                     |                                          }|                     |j                  }|d|d|dS rp   )r{   r|   r'   to_listdom)r(   rS  rV  repr  s        r,   
_print_DMPzStrPrinter._print_DMP  sQ    k"kk!))++&&kk!%  "ssCCC--r.   c                    |j         j        }|                     |j                  }|                     |j                  }|                     |j                  }|d|d|d|dS rp   )r{   r|   r'   numdenr  )r(   r?   rV  r  r  r  s         r,   
_print_DMFzStrPrinter._print_DMF  sd    n%kk$(##kk$(##kk$(###&33SSS###66r.   c                    d|j         z  S )NzObject("%s")r   )r(   r   s     r,   _print_ObjectzStrPrinter._print_Object  s    ((r.   c                    d|j         z  S )NzIdentityMorphism(%s))r  r(   morphisms     r,   _print_IdentityMorphismz"StrPrinter._print_IdentityMorphism  s    %77r.   c                8    d|j         d|j        d|j        dS )NzNamedMorphism(rr   z, "z"))r  codomainr   r  s     r,   _print_NamedMorphismzStrPrinter._print_NamedMorphism  s,     !2!2!2HMMMC 	Cr.   c                    d|j         z  S )NzCategory("%s")r   )r(   categorys     r,   _print_CategoryzStrPrinter._print_Category  s    (-//r.   c                    |j         j         S r:   r   )r(   manifolds     r,   _print_ManifoldzStrPrinter._print_Manifold  s    }!!r.   c                    |j         j         S r:   r   )r(   patchs     r,   _print_PatchzStrPrinter._print_Patch  s    zr.   c                    |j         j         S r:   r   )r(   coordss     r,   _print_CoordSystemzStrPrinter._print_CoordSystem  s    {r.   c                :    |j         j        |j                 j        S r:   
_coord_sysr   _indexr   r  s     r,   _print_BaseScalarFieldz!StrPrinter._print_BaseScalarField  s    '5::r.   c                @    d|j         j        |j                 j        z  S )Nze_%sr  r  s     r,   _print_BaseVectorFieldz!StrPrinter._print_BaseVectorField  s    (0>CCCr.   c                    |j         }t          |d          rd|j        j        |j                 j        z  S d|                     |          z  S )Nr  zd%szd(%s))_form_fieldr   r  r   r  r   r'   )r(   diffr  s      r,   _print_DifferentialzStrPrinter._print_Differential  sN     5,'' 	05+3ELAFFFT[[////r.   c                N    dd|                      |j        d                   dS )NTrrq   r   rs   r  r>   s     r,   	_print_TrzStrPrinter._print_Tr  s)    44TYq\!:!:!:!:;;r.   c                6    |                      |j                  S r:   r  ri  s     r,   
_print_StrzStrPrinter._print_Str  s    {{16"""r.   c                    |j         }|                     |          d|                     |j                  d|                     |j                  dS rp   )rt   r'   rF  rb   )r(   r?   rels      r,   _print_AppliedBinaryRelationz'StrPrinter._print_AppliedBinaryRelation  sV    m#{{3////#{{484444#{{4844446 	6r.   )F)r   r:   )r|   
__module____qualname__r  r#   __annotations__r$   r-   r8   r@   rR   rU   rX   r\   rg   rk   rn   rv   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!  r#  r`  rl  rn  rq  rs  ry  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  r  r  r  r  r  r!  r#  r)  r,  r;  rH  rK  rO  rW  r]  rd  rg  rj  rn  rp  _print_MatrixSymbol_print_RandomSymbolrr  ru  rw  ry  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  r1   r.   r,   r   r      s        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  tF tF tFl
 
 
"
 
 
    @ @ @    '+ '+ '+RC C C      
 
 
  & & &w w w: : :  ? ? ?
A A A
  0 0 09 9 9' ' '@; @; @;D  / / /;P ;P ;P ;Pz) ) )J J J
  
                    . . .. . .@ @ @@ @ @  *J 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.   r   c                N    t          |          }|                    |           }|S )ab  Returns 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?   settingsrS  r   s       r,   sstrr    s%    " 	8A			$AHr.   c                      e Zd ZdZd Zd ZdS )StrReprPrinterz(internal) -- see sstrreprc                     t          |          S r:   )r=   ri  s     r,   r{  zStrReprPrinter._print_str  s    Awwr.   c                V    |j         j        d|                     |j                  dS )Nrq   rs   )r{   r|   r'   r   ri  s     r,   r  zStrReprPrinter._print_Str  s,    ;///QV1D1D1D1DEEr.   N)r|   r  r  __doc__r{  r  r1   r.   r,   r  r    s=        $$  F F F F Fr.   r  c                N    t          |          }|                    |           }|S )zreturn 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.corer   r   r   r   r	   r
   sympy.core.mulr   sympy.core.numbersr   sympy.core.relationalr   sympy.core.sortingr   sympy.utilities.iterablesr   r   r   printerr   r   mpmath.libmpr   r   r4  r   r  r  r  r1   r.   r,   <module>r     s    # " " " " "       ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; & & & & & & & & & & & & , , , , , , / / / / / / * * * * * * . . . . . . . . , , , , , , , , ; ; ; ; ; ; ; ;x6 x6 x6 x6 x6 x6 x6 x6v 
  ,F F F F FZ F F F      r.   