o
    §ƒðj×�  ã                   @  sì   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„ deƒZeeƒdd„ ƒZ G dd„ deƒZ!ee!ƒd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                	   @  s¨  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
< �ddd„Z�ddd„Zdd„ Z	�ddd„Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zd(d)„ Zd*d+„ Zd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Zd4d5„ Zd6d7„ Zd8d9„ Zd:d;„ Zd<d=„ Zd>d?„ Z d@dA„ Z!dBdC„ Z"dDdE„ Z#dFdG„ Z$dHdI„ Z%dJdK„ Z&dLdM„ Z'dNdO„ Z(dPdQ„ Z)dRdS„ Z*dTdU„ Z+dVdW„ Z,dXdY„ Z-dZd[„ Z.d\d]„ Z/d^d_„ Z0d`da„ Z1dbdc„ Z2ddde„ Z3dfdg„ Z4dhdi„ Z5djdk„ Z6dldm„ Z7dndo„ Z8dpdq„ Z9drds„ Z:dtdu„ Z;dvdw„ Z<dxdy„ Z=dzd{„ Z>d|d}„ Z?d~d„ Z@d€d�„ ZAd‚dƒ„ ZBd„d…„ ZCd†d‡„ ZDdˆd‰„ ZEdŠd‹„ ZFdŒd�„ ZGdŽd�„ ZHd�d‘„ ZId’d“„ ZJd”d•„ ZKd–d—„ ZLd˜d™„ ZM�ddšd›„ZNdœd�„ ZOdždŸ„ ZPd d¡„ ZQd¢d£„ ZRd¤d¥„ ZSd¦d§„ ZTd¨d©„ ZUdªd«„ ZVd¬d­„ ZWd®d¯„ ZXd°d±„ ZYd²d³„ ZZd´dµ„ Z[d¶d·„ Z\d¸d¹„ Z]dºd»„ Z^d¼d½„ Z_d¾d¿„ Z`dÀdÁ„ ZadÂdÃ„ ZbdÄdÅ„ ZcdÆdÇ„ ZddÈdÉ„ ZedÊdË„ ZfdÌdÍ„ ZgdÎdÏ„ ZhdÐdÑ„ ZidÒdÓ„ ZjejZkejZldÔdÕ„ ZmdÖd×„ ZndØdÙ„ ZodÚdÛ„ ZpdÜdÝ„ ZqdÞdß„ Zrdàdá„ Zsdâdã„ Ztdädå„ Zudædç„ Zvdèdé„ Zwdêdë„ Zxdìdí„ Zydîdï„ Zzdðdñ„ Z{dòdó„ Z|dôdõ„ Z}död÷„ Z~dødù„ Zdúdû„ Z€düdý„ Z�dþdÿ„ Z‚�d �d„ Zƒ�d�d„ Z„�d�d„ Z…�d�d„ Z†�d�d	„ Z‡�d
�d„ Zˆ�d�d„ Z‰�d�d„ ZŠ�d�d„ Z‹�d�d„ ZŒ�d�d„ Z�dS (  Ú
StrPrinterÚ	_sympystrNÚautoFT)ÚorderÚ	full_precÚsympy_integersÚabbrevÚperm_cyclicÚminÚmaxÚdpszdict[str, Any]Ú_default_settingszdict[str, str]Ú_relationalsc                 C  s4   t |ƒ|k s|st |ƒ|krd|  |¡ S |  |¡S )Nú(%s))r   Ú_print)ÚselfÚitemÚlevelÚstrict© r)   ú”/tmp/claude-1000/-var-www-html-academy/3f42efd1-c2b7-4d08-9b05-30d86bb35479/scratchpad/piper/venv/lib/python3.10/site-packages/sympy/printing/str.pyÚparenthesize#   s   
zStrPrinter.parenthesizer   c                   s   |  ‡ ‡fdd„|D ƒ¡S )Nc                   ó   g | ]}ˆ  |ˆ ¡‘qS r)   ©r+   ©Ú.0r&   ©r'   r%   r)   r*   Ú
<listcomp>*   ó    z(StrPrinter.stringify.<locals>.<listcomp>)Újoin)r%   ÚargsÚsepr'   r)   r0   r*   Ú	stringify)   ó   zStrPrinter.stringifyc                 C  s(   t |tƒr|S t |tƒrt|ƒS t|ƒS ©N)Ú
isinstanceÚstrr   Úrepr©r%   Úexprr)   r)   r*   ÚemptyPrinter,   s
   

zStrPrinter.emptyPrinterc           	      C  s¬   | j ||d�}t|ƒ}g }|D ]4}|  |¡}| d¡r'|js'd}|dd … }nd}t|ƒ|k s2|jr<| |d| g¡ q| ||g¡ q| d¡}|dkrOd}|d |¡ S )	N©r   ú-r   ú+r#   r   Ú ú )Ú_as_ordered_termsr   r$   Ú
startswithÚis_AddÚextendÚpopr3   )	r%   r=   r   ÚtermsÚprecÚlÚtermÚtÚsignr)   r)   r*   Ú
_print_Add4   s    

zStrPrinter._print_Addc                 C  ó   dS )NÚTruer)   r<   r)   r)   r*   Ú_print_BooleanTrueI   ó   zStrPrinter._print_BooleanTruec                 C  rP   )NÚFalser)   r<   r)   r)   r*   Ú_print_BooleanFalseL   rS   zStrPrinter._print_BooleanFalsec                 C  s   d|   |jd td ¡ S )Nz~%sr   ÚNot)r+   r4   r   r<   r)   r)   r*   Ú
_print_NotO   r7   zStrPrinter._print_Notc                 C  sX   t |jƒ}t|ƒD ]\}}t|tƒr"|jjtju r"| 	d| 
|¡¡ q	|  |dtd ¡S )Nr   z & Ú
BitwiseAnd)Úlistr4   Ú	enumerater9   r   Ú	canonicalÚrhsr   ÚNegativeInfinityÚinsertrH   r6   r   )r%   r=   r4   ÚjÚir)   r)   r*   Ú
_print_AndR   s   

€zStrPrinter._print_Andc                 C  ó   |   |jdtd ¡S )Nz | Ú	BitwiseOr©r6   r4   r   r<   r)   r)   r*   Ú	_print_OrZ   ó   zStrPrinter._print_Orc                 C  rb   )Nz ^ Ú
BitwiseXorrd   r<   r)   r)   r*   Ú
_print_Xor]   rf   zStrPrinter._print_Xorc                 C  s   d|   |j¡|  |jd¡f S )Nú%s(%s)ú, )r$   Úfunctionr6   Ú	argumentsr<   r)   r)   r*   Ú_print_AppliedPredicate`   s   ÿz"StrPrinter._print_AppliedPredicatec                   s*   ‡ fdd„|j D ƒ}|jjdd |¡  S )Nc                   ó   g | ]}ˆ   |¡‘qS r)   ©r$   )r/   Úo©r%   r)   r*   r1   e   ó    z+StrPrinter._print_Basic.<locals>.<listcomp>r#   rj   )r4   Ú	__class__Ú__name__r3   )r%   r=   rK   r)   rq   r*   Ú_print_Basicd   s   zStrPrinter._print_Basicc                 C  s(   |j jdkr|  |j d ¡ |  |j ¡S )N)r   r   )r   r   )ÚblocksÚshaper$   )r%   ÚBr)   r)   r*   Ú_print_BlockMatrixh   s   zStrPrinter._print_BlockMatrixc                 C  rP   )NÚCatalanr)   r<   r)   r)   r*   Ú_print_Catalanm   rS   zStrPrinter._print_Catalanc                 C  rP   )NÚzoor)   r<   r)   r)   r*   Ú_print_ComplexInfinityp   rS   z!StrPrinter._print_ComplexInfinityc                   sL   t ‡ fdd„|j|jfD ƒƒ}|jtju rd| S |ˆ  |j¡f7 }d| S )Nc                   rn   r)   ro   ©r/   r`   rq   r)   r*   r1   t   rr   z2StrPrinter._print_ConditionSet.<locals>.<listcomp>zConditionSet(%s, %s)zConditionSet(%s, %s, %s))ÚtupleÚsymÚ	conditionÚbase_setr   ÚUniversalSetr$   )r%   Úsr4   r)   rq   r*   Ú_print_ConditionSets   s
   zStrPrinter._print_ConditionSetc                   s8   |j }dd„ |jD ƒ}dd ‡ fdd„|g| D ƒ¡ S )Nc                 S  s$   g | ]}|d  d kr|d n|‘qS )r   r   r)   r~   r)   r)   r*   r1   |   s   $ z0StrPrinter._print_Derivative.<locals>.<listcomp>zDerivative(%s)rj   c                 3  ó   � | ]}ˆ   |¡V  qd S r8   ro   ©r/   Úargrq   r)   r*   Ú	<genexpr>}   ó   € z/StrPrinter._print_Derivative.<locals>.<genexpr>)r=   Úvariable_countr3   )r%   r=   ÚdexprÚdvarsr)   rq   r*   Ú_print_Derivativez   s   "zStrPrinter._print_Derivativec                 C  sR   t | ¡ td�}g }|D ]}d|  |¡|  || ¡f }| |¡ qdd |¡ S )N©Úkeyz%s: %sú{%s}rj   )ÚsortedÚkeysr   r$   Úappendr3   )r%   Údr“   Úitemsr�   r&   r)   r)   r*   Ú_print_dict   s   zStrPrinter._print_dictc                 C  ó
   |   |¡S r8   )r—   r<   r)   r)   r*   Ú_print_Dict‰   ó   
zStrPrinter._print_Dictc                 C  sV   t |dƒrd|  | ¡ ¡ S t |dƒr#d|  |j¡ d |  |j¡ S d|  |j¡ S )NÚ
as_booleanzDomain: Úsetz in z
Domain on )Úhasattrr$   r›   Úsymbolsrœ   )r%   r•   r)   r)   r*   Ú_print_RandomDomainŒ   s   


ÿzStrPrinter._print_RandomDomainc                 C  s
   d|j  S ©NÚ_©Únamer<   r)   r)   r*   Ú_print_Dummy•   rš   zStrPrinter._print_Dummyc                 C  rP   )NÚ
EulerGammar)   r<   r)   r)   r*   Ú_print_EulerGamma˜   rS   zStrPrinter._print_EulerGammac                 C  rP   )NÚEr)   r<   r)   r)   r*   Ú_print_Exp1›   rS   zStrPrinter._print_Exp1c                 C  ó   d|   |j¡|   |j¡f S )Nz(%s, %s))r$   r=   Úcondr<   r)   r)   r*   Ú_print_ExprCondPairž   ó   zStrPrinter._print_ExprCondPairc                 C  ó   |j jd|  |jd¡  S ©Nr#   rj   )Úfuncrt   r6   r4   r<   r)   r)   r*   Ú_print_Function¡   r7   zStrPrinter._print_Functionc                 C  rP   )NÚGoldenRatior)   r<   r)   r)   r*   Ú_print_GoldenRatio¤   rS   zStrPrinter._print_GoldenRatioc                 C  r­   r®   )r¯   rt   r6   Úpargsr<   r)   r)   r*   Ú_print_Heaviside§   s   zStrPrinter._print_Heavisidec                 C  rP   )NÚTribonacciConstantr)   r<   r)   r)   r*   Ú_print_TribonacciConstant¬   rS   z$StrPrinter._print_TribonacciConstantc                 C  rP   ©NÚIr)   r<   r)   r)   r*   Ú_print_ImaginaryUnit¯   rS   zStrPrinter._print_ImaginaryUnitc                 C  rP   )NÚoor)   r<   r)   r)   r*   Ú_print_Infinity²   rS   zStrPrinter._print_Infinityc                   ó:   ‡fdd„‰ d  ‡ fdd„|jD ƒ¡}dˆ |j¡|f S )Nc                   ó:   t | ƒdkrˆ  | d ¡S ˆ  | d ft| dd … ƒ ¡S ©Nr   r   ©Úlenr$   r   ©Úxabrq   r)   r*   Ú
_xab_tostr¶   ó    z.StrPrinter._print_Integral.<locals>._xab_tostrrj   c                   ó   g | ]}ˆ |ƒ‘qS r)   r)   ©r/   rK   ©rÃ   r)   r*   r1   »   ó    z.StrPrinter._print_Integral.<locals>.<listcomp>zIntegral(%s, %s)©r3   Úlimitsr$   rk   ©r%   r=   ÚLr)   ©rÃ   r%   r*   Ú_print_Integralµ   ó   zStrPrinter._print_Integralc                 C  s†   d}|j \}}}}|jr|jrd}n%|jr|sd}n|jr"|s"d}n|s)|s)d}n|r0|r0d}n|r5d}nd}|jdi |||dœ¤ŽS )NzInterval{m}({a}, {b})rB   z.openz.Lopenz.Ropen)ÚaÚbÚmr)   )r4   Úis_infiniteÚformat)r%   r`   ÚfinrÐ   rÑ   rK   ÚrrÒ   r)   r)   r*   Ú_print_Interval¾   s    

zStrPrinter._print_Intervalc                 C  r©   )NzAccumBounds(%s, %s))r$   r   r   )r%   r`   r)   r)   r*   Ú_print_AccumulationBoundsÑ   s   
ÿz$StrPrinter._print_AccumulationBoundsc                 C  ó   d|   |jtd ¡ S )Nz%s**(-1)r   ©r+   rˆ   r   )r%   r¸   r)   r)   r*   Ú_print_InverseÕ   ó   zStrPrinter._print_Inversec                 C  sB   |j }|j}t|ƒdkr|d jr|d }d|  |¡|  |¡f S )Nr   r   zLambda(%s, %s))r=   Ú	signaturerÀ   Ú	is_symbolr$   )r%   Úobjr=   Úsigr)   r)   r*   Ú_print_LambdaØ   s
   zStrPrinter._print_Lambdac                   s2   t |jtd�}|jjdd ‡ fdd„|D ƒ¡  S )Nr�   r#   rj   c                 3  r†   r8   ro   r‡   rq   r)   r*   r‰   á   rŠ   z.StrPrinter._print_LatticeOp.<locals>.<genexpr>)r’   r4   r   r¯   rt   r3   ©r%   r=   r4   r)   rq   r*   Ú_print_LatticeOpß   s   $zStrPrinter._print_LatticeOpc                 C  s*   |j \}}}}dtt| j||||fƒƒ S )NzLimit(%s, %s, %s, dir='%s'))r4   r   Úmapr$   )r%   r=   ÚeÚzÚz0Údirr)   r)   r*   Ú_print_Limitã   s   zStrPrinter._print_Limitc                 C  s   d|   |d¡ S )Nú[%s]rj   )r6   r<   r)   r)   r*   Ú_print_listè   ó   zStrPrinter._print_listc                 C  r˜   r8   )rë   r<   r)   r)   r*   Ú_print_Listë   rš   zStrPrinter._print_Listc                 C  s
   |  | ¡S r8   )Ú_format_strr<   r)   r)   r*   Ú_print_MatrixBaseî   rš   zStrPrinter._print_MatrixBasec                 C  s2   | j |jtd dd�d|  |j¡|  |j¡f  S )NÚAtomT©r(   z[%s, %s])r+   Úparentr   r$   r`   r_   r<   r)   r)   r*   Ú_print_MatrixElementñ   s   ÿzStrPrinter._print_MatrixElementc                   sN   ‡ fdd„}ˆ j |jtd dd�d ||j|jjƒ d ||j|jjƒ d S )	Nc                   sZ   t | ƒ} | d dkr| d= | d dkrd| d< | d |kr!d| d< d ‡ fdd„| D ƒ¡S )Né   r   r   rB   ú:c                 3  r†   r8   ro   r‡   rq   r)   r*   r‰   þ   rŠ   zBStrPrinter._print_MatrixSlice.<locals>.strslice.<locals>.<genexpr>)rY   r3   )ÚxÚdimrq   r)   r*   Ústrsliceö   s   z/StrPrinter._print_MatrixSlice.<locals>.strslicerð   Trñ   ú[rj   ú])r+   rò   r   ÚrowsliceÚrowsÚcolsliceÚcols)r%   r=   rø   r)   rq   r*   Ú_print_MatrixSliceõ   s   	ÿÿþþzStrPrinter._print_MatrixSlicec                 C  ó   |j S r8   r¢   r<   r)   r)   r*   Ú_print_DeferredVector  ó   z StrPrinter._print_DeferredVectorc                   sž  t |ƒ‰ |j}|d tju stdd„ |dd … D ƒƒrÈt|dd„ dd�\}}t|ƒD ]0\}}|jjr7|j }nt	|jjƒ}|d  |d< t
 |¡}|d rUt|j|d	d
�n|j||< q*g }	|rs|d jss|d  ¡ rsˆ | d¡¡g}	|	‡ ‡fdd„|D ƒ }
|
s„dg}
t|ƒdkrš|d  ¡ ršˆ | d¡¡g}	ng }	|	‡ ‡fdd„|D ƒ }d |
¡}d |¡}t|ƒdkr¾d||f S |rÆd||f S |S | ¡ \}}|dk rÛt| |ƒ}d}nd}g }g }g }ˆjdvrí| ¡ }nt
 |¡}dd„ }|D ]s}|j�r?t|tƒ�r?t|j ¡ d dk ƒ�r?|jtju�r| ||ƒ¡ qøt|jd jƒdk�r8t|jt
tfƒ�r8| |¡ | |j¡ qø|j�rf|tju�rf|j dk�rW| t!|j ƒ¡ |j"dk�re| t!|j"ƒ¡ qø| |¡ qø|�prtjg}‡ ‡fdd„|D ƒ}‡ ‡fdd„|D ƒ}|D ]}|j|v �r¡d|| #|j¡  || #|j¡< �q‰|�s­|d |¡ S t|ƒdk�rÁ|d |¡ d |d  S |d |¡ dd |¡  S )Nr   c                 s  s4   � | ]}t |tƒp|jotd d„ |jD ƒƒV  qdS )c                 s  s   � | ]}|j V  qd S r8   )Ú
is_Integer)r/   Úair)   r)   r*   r‰     s   € z2StrPrinter._print_Mul.<locals>.<genexpr>.<genexpr>N)r9   r	   Úis_PowÚallr4   ©r/   rÐ   r)   r)   r*   r‰     s   € 
þ
þz(StrPrinter._print_Mul.<locals>.<genexpr>r   c                 S  s    t | tƒot| j ¡ d dk ƒS ©Nr   )r9   r   ÚboolÚexpÚas_coeff_Mul)rö   r)   r)   r*   Ú<lambda>  s    z'StrPrinter._print_Mul.<locals>.<lambda>T)ÚbinaryF©Úevaluatec                   ó   g | ]
}ˆj |ˆ d d�‘qS ©Frñ   r-   r  ©rJ   r%   r)   r*   r1   $  ó    ÿz)StrPrinter._print_Mul.<locals>.<listcomp>Ú1c                   r  r  r-   r  r  r)   r*   r1   .  r  Ú*z%s/(%s)ú%s/%sr@   rB   )ÚoldÚnonec                 S  sv   |   ¡ \}}tt |¡ƒ}|d tju r|dd … }n|d  |d< t |¡}t| tƒr4| j	||dd�S | j	|dd�S )Nr   r   Fr  )
Úas_base_exprY   r   Ú	make_argsr   ÚNegativeOneÚ
_from_argsr9   r   r¯   )r`   rÑ   rå   Úeargsr)   r)   r*   ÚapowL  s   

z#StrPrinter._print_Mul.<locals>.apowc                   r  r  r-   ©r/   rö   r  r)   r*   r1   m  ó    c                   r  r  r-   r  r  r)   r*   r1   n  r   r#   ú/z/(%s))$r   r4   r   ÚOneÚanyr   rZ   r
  Ú	is_NumberrY   r   r  r   ÚbaserF   Úcould_extract_minus_signr$   rH   rÀ   r3   r  r
   r   Úas_ordered_factorsr  Úis_commutativer9   r	  r  r”   Úis_RationalÚInfinityÚpr   ÚqÚindex)r%   r=   r4   r•   Únr`   Údirå   ÚdargsÚpreÚnfactorsÚdfactorsÚcrN   rÐ   rÑ   Ú	pow_parenr  r&   Úa_strÚb_strr)   r  r*   Ú
_print_Mul  s    
ý

þ

$ÿÿ




ÿþÿ
€ €zStrPrinter._print_Mulc                   s|   ˆ   ¡ \}}d}|jr.| ¡ \}}|jr |jr t| |ƒ‰ d}n|jr.|jr.t| |ƒ‰ d}|d ‡ ‡fdd„ˆ jD ƒ¡ S )NrB   r@   r  c                   ó   g | ]
}ˆ  |tˆ ƒ¡‘qS r)   ©r+   r   r‡   ©r=   r%   r)   r*   r1   Š  r   z,StrPrinter._print_MatMul.<locals>.<listcomp>)Úas_coeff_mmulÚ	is_numberÚas_real_imagÚis_zeroÚis_negativer
   r3   r4   )r%   r=   r4  rÒ   rN   ÚreÚimr)   r;  r*   Ú_print_MatMul|  s   ÿzStrPrinter._print_MatMulc                 C  s   d  |j|  |j¡¡S )Nz{}.({}))rÔ   rk   r$   r=   r<   r)   r)   r*   Ú_print_ElementwiseApplyFunction�  s   
þz*StrPrinter._print_ElementwiseApplyFunctionc                 C  rP   )NÚnanr)   r<   r)   r)   r*   Ú
_print_NaN“  rS   zStrPrinter._print_NaNc                 C  rP   )Nz-oor)   r<   r)   r)   r*   Ú_print_NegativeInfinity–  rS   z"StrPrinter._print_NegativeInfinityc                 C  sh   |j rtdd„ |jD ƒƒr*t|j ƒdkrd|  |j¡ S d|  |jf|j  dd¡ S d|  |jdd¡ S )Nc                 s  s   � | ]}|t ju V  qd S r8   )r   ÚZero)r/   r+  r)   r)   r*   r‰   š  rŠ   z*StrPrinter._print_Order.<locals>.<genexpr>r   zO(%s)rj   r   )Ú	variablesr  ÚpointrÀ   r$   r=   r6   r4   r<   r)   r)   r*   Ú_print_Order™  s
   zStrPrinter._print_Orderc                 C  ó   |  ¡ S r8   ©Ú__str__r<   r)   r)   r*   Ú_print_Ordinal¢  ó   zStrPrinter._print_Ordinalc                 C  rL  r8   rM  r<   r)   r)   r*   Ú_print_Cycle¥  rP  zStrPrinter._print_Cyclec                 C  sZ  ddl m}m} ddlm} |j}|d ur"|d|› d�dddd	� n| j d
d¡}|rf|js0dS ||ƒ|jd ƒ 	¡ t
dƒd … }| d¡}|dks^d||d … vr^||d … |d |…  }| dd¡}|S | ¡ }|s�|jdk ryd|  |j¡ S d|  |j¡ S |  |jd |d d … ¡d|  |j¡  }|  |j¡ }	}
t
|ƒt
|
ƒk r©|}	d|	 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   rS  ú(ú,rB   é   zPermutation(%s)zPermutation([], size=%s)éÿÿÿÿz	, size=%s)Ú sympy.combinatorics.permutationsrR  rS  Úsympy.utilities.exceptionsrT  Úprint_cyclicÚ	_settingsÚgetÚsizeÚ__repr__rÀ   ÚrfindÚreplaceÚsupportr$   Ú
array_form)r%   r=   rR  rS  rT  r   r„   ÚlastÚtrimÚuseÚfullr)   r)   r*   Ú_print_Permutation¨  s@   þù
"

,zStrPrinter._print_Permutationc                 C  sJ   |j \}}}t|jƒdkr|d }|d }d|  |¡|  |¡|  |¡f S )Nr   r   zSubs(%s, %s, %s))r4   rÀ   rJ  r$   )r%   rß   r=   r  Únewr)   r)   r*   Ú_print_SubsÑ  s   ÿzStrPrinter._print_Subsc                 C  rL  r8   ro   r<   r)   r)   r*   Ú_print_TensorIndexÙ  rP  zStrPrinter._print_TensorIndexc                 C  rL  r8   ro   r<   r)   r)   r*   Ú_print_TensorHeadÜ  rP  zStrPrinter._print_TensorHeadc                 C  rL  r8   ro   r<   r)   r)   r*   Ú_print_Tensorß  rP  zStrPrinter._print_Tensorc                   s*   ˆ   ¡ \}}|d ‡ ‡fdd„|D ƒ¡ S )Nr  c                   r9  r)   r:  r‡   r;  r)   r*   r1   æ  r   z-StrPrinter._print_TensMul.<locals>.<listcomp>)Ú!_get_args_for_traditional_printerr3   )r%   r=   rN   r4   r)   r;  r*   Ú_print_TensMulâ  s   ÿzStrPrinter._print_TensMulc                 C  rL  r8   ro   r<   r)   r)   r*   Ú_print_TensAddé  rP  zStrPrinter._print_TensAddc                 C  ó   |   |j¡S r8   ©r$   r£   r<   r)   r)   r*   Ú_print_ArraySymbolì  ó   zStrPrinter._print_ArraySymbolc                   s2   dˆ   |jtd d¡d ‡ fdd„|jD ƒ¡f S )Nz%s[%s]ÚFuncTrj   c                   rn   r)   ro   r~   rq   r)   r*   r1   ñ  rr   z2StrPrinter._print_ArrayElement.<locals>.<listcomp>)r+   r£   r   r3   Úindicesr<   r)   rq   r*   Ú_print_ArrayElementï  s   *ÿzStrPrinter._print_ArrayElementc                   s"   ‡ fdd„|j D ƒ}dd |¡ S )Nc                   s   g | ]	}d ˆ   |¡ ‘qS )z    %sro   r  rq   r)   r*   r1   ô  s    z6StrPrinter._print_PermutationGroup.<locals>.<listcomp>zPermutationGroup([
%s])z,
)r4   r3   )r%   r=   r+  r)   rq   r*   Ú_print_PermutationGroupó  s   z"StrPrinter._print_PermutationGroupc                 C  rP   )NÚpir)   r<   r)   r)   r*   Ú	_print_Pi÷  rS   zStrPrinter._print_Pic                   ó4   dd  ‡ fdd„|jD ƒ¡ˆ  |j¡ˆ  |j¡f S )Nz+Polynomial ring in %s over %s with %s orderrj   c                 3  r†   r8   ro   )r/   Úrsrq   r)   r*   r‰   ü  rŠ   z-StrPrinter._print_PolyRing.<locals>.<genexpr>©r3   rž   r$   Údomainr   )r%   Úringr)   rq   r*   Ú_print_PolyRingú  ó
   ÿÿzStrPrinter._print_PolyRingc                   r  )Nz3Rational function field in %s over %s with %s orderrj   c                 3  r†   r8   ro   )r/   Úfsrq   r)   r*   r‰     rŠ   z.StrPrinter._print_FracField.<locals>.<genexpr>r�  ©r%   Úfieldr)   rq   r*   Ú_print_FracFieldÿ  r…  zStrPrinter._print_FracFieldc                 C  rL  r8   rM  )r%   Úelmr)   r)   r*   Ú_print_FreeGroupElement  rP  z"StrPrinter._print_FreeGroupElementc                 C  s   d|j |jf S )Nz(%s + %s*I))rö   Úy©r%   Úpolyr)   r)   r*   Ú_print_GaussianElement  rì   z!StrPrinter._print_GaussianElementc                 C  s   |  | tdd¡S )Nú%s**%sr  )r:   r   r�  r)   r)   r*   Ú_print_PolyElement
  rì   zStrPrinter._print_PolyElementc                 C  sN   |j dkr|  |j¡S | j|jtd dd�}| j|j td dd�}|d | S )Nr   r   Trñ   rð   r!  )Údenomr$   Únumerr+   r   )r%   Úfracr“  r’  r)   r)   r*   Ú_print_FracElement  s
   
zStrPrinter._print_FracElementc                   sD  t d d ‰ g ‡ ‡fdd„|jD ƒ}}| ¡ D ]ˆ\}}g }t|ƒD ]\}}|dkrA|dkr6| || ¡ q"| || d|  ¡ q"d |¡}|jr\|rVdˆ |¡ d	 }	n'ˆ |¡}	n!|rx|tj	u rk| 
d
|g¡ q|tju rx| 
d|g¡ qˆ |¡}	|s‚|	}
n|	d | }
|
 d¡r™| 
d|
dd … g¡ q| 
d
|
g¡ q|d dv r¸| d¡}|dkr¸d|d  |d< |jjd }ddlm} z
|d| ¡  7 }W n |yß   |d| ¡  7 }Y nw |d	7 }t|ƒD ]-\}}t|ƒdk�r|d d… dk�r|t|ƒd d … d	k�r|dt|ƒd … ||< qè|d |¡d |¡f S )Nrð   r   c                   r,   r)   r-   )r/   r„   ©Ú	ATOM_PRECr%   r)   r*   r1     r2   z*StrPrinter._print_Poly.<locals>.<listcomp>r   z**%dr  rY  ú)rA   r@   )r@   rA   z(%s, %s)ÚPolynomialErrorz, modulus=%sz, domain='%s'rô   rC   rj   )r   ÚgensrI   rZ   r”   r3   rF   r$   r   r"  rG   r  rE   rH   rs   rt   Úsympy.polys.polyerrorsr™  Úget_modulusÚ
get_domainrÀ   )r%   r=   rI   rš  ÚmonomÚcoeffÚs_monomr`   rå   Ús_coeffÚs_termÚmodifierrÔ   r™  r-  r&   r)   r–  r*   Ú_print_Poly  s\   €





ÿ:€zStrPrinter._print_Polyc                 C  rP   )Nrƒ   r)   )r%   r+  r)   r)   r*   Ú_print_UniversalSetW  rS   zStrPrinter._print_UniversalSetc                 C  s&   |j r|  | ¡  ¡ ¡S |  | ¡ ¡S r8   )Ú
is_aliasedr$   Úas_polyÚas_exprr<   r)   r)   r*   Ú_print_AlgebraicNumberZ  s   z!StrPrinter._print_AlgebraicNumberc                   s  t |ƒ}|jtju r|sdˆ  |j¡ S |jrI|j tju r1|s1dt‡ fdd„tj|jfD ƒƒ S |jtj u rIdˆ  tj¡ˆ j	|j|dd�f S ˆ j	|j|dd�}ˆ j
dkrw|jjrw|jjd	krw| d
¡rwdˆ j	|j|dd�|d	d… f S dˆ j	|j|dd�|f 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  r†   r8   ro   r‡   rq   r)   r*   r‰   �  rŠ   z(StrPrinter._print_Pow.<locals>.<genexpr>r  Frñ   Ú
_sympyreprr   z	(Rationalr�  r\  )r   r
  r   ÚHalfr$   r%  r(  r   r"  r+   Úprintmethodr)  r,  rE   )r%   r=   ÚrationalÚPRECrå   r)   rq   r*   Ú
_print_Pow`  s   &"ÿ
"zStrPrinter._print_Powc                 C  s   |   |jd ¡S r  ©r$   r4   r<   r)   r)   r*   Ú_print_UnevaluatedExpr�  rì   z!StrPrinter._print_UnevaluatedExprc                 C  s0   t |ƒ}d| j|j|dd�| j|j|dd�f S )Nr�  Frñ   )r   r+   r%  r
  )r%   r=   r®  r)   r)   r*   Ú_print_MatPow   s   ÿzStrPrinter._print_MatPowc                 C  s    | j  dd¡rd| S t|jƒS )Nr   FzS(%s))r`  ra  r:   r+  r<   r)   r)   r*   Ú_print_Integer¥  s   
zStrPrinter._print_Integerc                 C  rP   )NÚIntegersr)   r<   r)   r)   r*   Ú_print_Integersª  rS   zStrPrinter._print_Integersc                 C  rP   )NÚNaturalsr)   r<   r)   r)   r*   Ú_print_Naturals­  rS   zStrPrinter._print_Naturalsc                 C  rP   )NÚ	Naturals0r)   r<   r)   r)   r*   Ú_print_Naturals0°  rS   zStrPrinter._print_Naturals0c                 C  rP   )NÚ	Rationalsr)   r<   r)   r)   r*   Ú_print_Rationals³  rS   zStrPrinter._print_Rationalsc                 C  rP   )NÚRealsr)   r<   r)   r)   r*   Ú_print_Reals¶  rS   zStrPrinter._print_Realsc                 C  rP   )NÚ	Complexesr)   r<   r)   r)   r*   Ú_print_Complexes¹  rS   zStrPrinter._print_Complexesc                 C  rP   )NÚEmptySetr)   r<   r)   r)   r*   Ú_print_EmptySet¼  rS   zStrPrinter._print_EmptySetc                 C  rP   )NÚEmptySequencer)   r<   r)   r)   r*   Ú_print_EmptySequence¿  rS   zStrPrinter._print_EmptySequencec                 C  ó   t |ƒS r8   ©r:   r<   r)   r)   r*   Ú
_print_intÂ  rP  zStrPrinter._print_intc                 C  rÄ  r8   rÅ  r<   r)   r)   r*   Ú
_print_mpzÅ  rP  zStrPrinter._print_mpzc                 C  sB   |j dkr
t|jƒS | j dd¡rd|j|j f S d|j|j f S )Nr   r   FzS(%s)/%sr  )r,  r:   r+  r`  ra  r<   r)   r)   r*   Ú_print_RationalÈ  s
   

zStrPrinter._print_Rationalc                 C  ó$   |j dkr
t|jƒS d|j|j f S )Nr   z%d/%d)r,  r:   r+  r<   r)   r)   r*   Ú_print_PythonRationalÐ  ó   

z StrPrinter._print_PythonRationalc                 C  rÉ  ©Nr   r  ©Údenominatorr:   Ú	numeratorr<   r)   r)   r*   Ú_print_FractionÖ  rË  zStrPrinter._print_Fractionc                 C  rÉ  rÌ  rÍ  r<   r)   r)   r*   Ú
_print_mpqÜ  rË  zStrPrinter._print_mpqc                 C  sú   |j }| j dd ¡}|d u r|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r9| jdk}d	| jv rC| jd	 nd }d
| jv rO| jd
 nd }t|j||||d�}| d¡rid|dd …  }n| d¡rvd|dd …  }| d¡}|S )Nr    r[  r   r   TFr   r   r   r   )Ústrip_zerosÚ	min_fixedÚ	max_fixedz-.0z-0.é   z.0z0.rô   rA   )	Ú_precr`  ra  r   Ú_print_levelÚmlib_to_strÚ_mpf_rE   Úremoveprefix)r%   r=   rJ   r    ÚstripÚlowÚhighÚrvr)   r)   r*   Ú_print_Floatâ  s&   



zStrPrinter._print_Floatc              	   C  s~   ddddddddd	œ}|j |v r"d
||j  |  |j¡|  |j¡f S d|  |jt|ƒ¡| j |j ¡p4|j |  |jt|ƒ¡f S )NÚEqÚNeÚ
AssignmentÚAddAugmentedAssignmentÚSubAugmentedAssignmentÚMulAugmentedAssignmentÚDivAugmentedAssignmentÚModAugmentedAssignment)z==z!=z:=z+=z-=z*=z/=z%=ú
%s(%s, %s)z%s %s %s)Úrel_opr$   Úlhsr\   r+   r   r"   ra  )r%   r=   Úcharmapr)   r)   r*   Ú_print_Relational÷  s"   ø

ÿþzStrPrinter._print_Relationalc                 C  s   d| j |jdd�|jf S )NzCRootOf(%s, %d)Úlexr?   )rO   r=   r-  r<   r)   r)   r*   Ú_print_ComplexRootOf  s   ÿzStrPrinter._print_ComplexRootOfc                 C  s>   | j |jdd�g}|jtjur| |  |j¡¡ dd |¡ S )Nrí  r?   zRootSum(%s)rj   )rO   r=   Úfunr   ÚIdentityFunctionr”   r$   r3   râ   r)   r)   r*   Ú_print_RootSum  s   zStrPrinter._print_RootSumc                   s„   ˆ j j}‡ ‡fdd„ˆ jD ƒ}dd |¡ }‡fdd„ˆ jD ƒ}dˆ ˆ j¡ }dˆ ˆ j¡ }|g| ||g }d|d |¡f S )	Nc                   s   g | ]
}ˆj |ˆ jd �‘qS )r?   )rO   r   r‡   ©Úbasisr%   r)   r*   r1     r   z3StrPrinter._print_GroebnerBasis.<locals>.<listcomp>rê   rj   c                   rn   r)   ro   )r/   Úgenrq   r)   r*   r1     rr   zdomain='%s'z
order='%s'ri   )rs   rt   Úexprsr3   rš  r$   r‚  r   )r%   ró  Úclsrõ  rš  r‚  r   r4   r)   rò  r*   Ú_print_GroebnerBasis  s   zStrPrinter._print_GroebnerBasisc                   s4   t |td�}d ‡ fdd„|D ƒ¡}|sdS d| S )Nr�   rj   c                 3  r†   r8   ro   r.   rq   r)   r*   r‰   )  rŠ   z(StrPrinter._print_set.<locals>.<genexpr>zset()r‘   )r’   r   r3   ©r%   r„   r–   r4   r)   rq   r*   Ú
_print_set&  s
   zStrPrinter._print_setc                   sZ   ddl m‰  t|td�}d ‡fdd„|D ƒ¡}t‡ fdd„|D ƒƒr(d |¡S d	 |¡S )
Nr   ©Ú	FiniteSetr�   rj   c                 3  r†   r8   ro   r.   rq   r)   r*   r‰   2  rŠ   z.StrPrinter._print_FiniteSet.<locals>.<genexpr>c                 3  s   � | ]}|  ˆ ¡V  qd S r8   )Úhasr.   rú  r)   r*   r‰   3  rŠ   zFiniteSet({})z{{{}}})Úsympy.sets.setsrû  r’   r   r3   r#  rÔ   rø  r)   )rû  r%   r*   Ú_print_FiniteSet.  s   

zStrPrinter._print_FiniteSetc                   s.   t |td�}d ‡ fdd„|D ƒ¡}d |¡S )Nr�   rj   c                 3  r†   r8   ro   r‡   rq   r)   r*   r‰   :  rŠ   z.StrPrinter._print_Partition.<locals>.<genexpr>zPartition({}))r’   r   r3   rÔ   rø  r)   rq   r*   Ú_print_Partition7  s   
zStrPrinter._print_Partitionc                 C  s   |sdS d|   |¡ S )Nzfrozenset()zfrozenset(%s))rù  ©r%   r„   r)   r)   r*   Ú_print_frozenset=  s   zStrPrinter._print_frozensetc                   r¼   )Nc                   r½   r¾   r¿   rÁ   rq   r)   r*   rÃ   C  rÄ   z)StrPrinter._print_Sum.<locals>._xab_tostrrj   c                   rÅ   r)   r)   rÆ   rÇ   r)   r*   r1   H  rÈ   z)StrPrinter._print_Sum.<locals>.<listcomp>zSum(%s, %s)rÉ   rË   r)   rÍ   r*   Ú
_print_SumB  rÏ   zStrPrinter._print_Sumc                 C  r   r8   r¢   r<   r)   r)   r*   Ú_print_SymbolK  r  zStrPrinter._print_Symbolc                 C  rP   r·   r)   r<   r)   r)   r*   Ú_print_IdentityP  rS   zStrPrinter._print_Identityc                 C  rP   )NÚ0r)   r<   r)   r)   r*   Ú_print_ZeroMatrixS  rS   zStrPrinter._print_ZeroMatrixc                 C  rP   )Nr  r)   r<   r)   r)   r*   Ú_print_OneMatrixV  rS   zStrPrinter._print_OneMatrixc                 C  ó
   d|j  S )NzQ.%sr¢   r<   r)   r)   r*   Ú_print_PredicateY  rš   zStrPrinter._print_Predicatec                 C  rÄ  r8   rÅ  r<   r)   r)   r*   Ú
_print_str\  rP  zStrPrinter._print_strc                 C  s.   t |ƒdkrd|  |d ¡ S d|  |d¡ S )Nr   z(%s,)r   r#   rj   )rÀ   r$   r6   r<   r)   r)   r*   Ú_print_tuple_  s   zStrPrinter._print_tuplec                 C  r˜   r8   )r  r<   r)   r)   r*   Ú_print_Tuplee  rš   zStrPrinter._print_Tuplec                 C  rÙ   )Nz%s.Tr   rÚ   )r%   ÚTr)   r)   r*   Ú_print_Transposeh  rÜ   zStrPrinter._print_Transposec                 C  r©   )NzUniform(%s, %s))r$   rÐ   rÑ   r<   r)   r)   r*   Ú_print_Uniformk  r¬   zStrPrinter._print_Uniformc                 C  s"   | j  dd¡rd|j S d|j S )Nr   Fz%s)r`  ra  r   r£   r<   r)   r)   r*   Ú_print_Quantityn  s   

zStrPrinter._print_Quantityc                   sD   ‡ fdd„|j D ƒ}|d gdd„ t|dd … dƒD ƒ }d |¡S )Nc                   s    g | ]}ˆ j |td  dd�‘qS )r   Trñ   )r+   r   r~   rq   r)   r*   r1   t  s     z0StrPrinter._print_Quaternion.<locals>.<listcomp>r   c                 S  s   g | ]
\}}|d  | ‘qS )r  r)   )r/   r`   r_   r)   r)   r*   r1   u  r   r   Úijkz + )r4   Úzipr3   )r%   r=   r„   rÐ   r)   rq   r*   Ú_print_Quaternions  s   &
zStrPrinter._print_Quaternionc                 C  rÄ  r8   rÅ  r<   r)   r)   r*   Ú_print_Dimensionx  rP  zStrPrinter._print_Dimensionc                 C  ó
   |j d S r    r¢   r<   r)   r)   r*   Ú_print_Wild{  rš   zStrPrinter._print_Wildc                 C  r  r    r¢   r<   r)   r)   r*   Ú_print_WildFunction~  rš   zStrPrinter._print_WildFunctionc                 C  r   r8   r¢   r<   r)   r)   r*   Ú_print_WildDot�  r  zStrPrinter._print_WildDotc                 C  r   r8   r¢   r<   r)   r)   r*   Ú_print_WildPlus„  r  zStrPrinter._print_WildPlusc                 C  r   r8   r¢   r<   r)   r)   r*   Ú_print_WildStar‡  r  zStrPrinter._print_WildStarc                 C  s    | j  dd¡r	dS |  tdƒ¡S )Nr   FzS(0)r   )r`  ra  r³  r   r<   r)   r)   r*   Ú_print_ZeroŠ  s   zStrPrinter._print_Zeroc                 C  s0   |j j}|  | ¡ ¡}|  |j¡}d|||f S ©Nrè  )rs   rt   r$   Úto_listÚdom)r%   r+  rö  Úrepr  r)   r)   r*   Ú
_print_DMP�  s   zStrPrinter._print_DMPc                 C  s<   |j j}|  |j¡}|  |j¡}|  |j¡}d||||f S )Nz%s(%s, %s, %s))rs   rt   r$   ÚnumÚdenr  )r%   r=   rö  r!  r"  r  r)   r)   r*   Ú
_print_DMF–  s
   zStrPrinter._print_DMFc                 C  r  )NzObject("%s")r¢   )r%   rß   r)   r)   r*   Ú_print_Objectž  rš   zStrPrinter._print_Objectc                 C  r  )NzIdentityMorphism(%s))r‚  ©r%   Úmorphismr)   r)   r*   Ú_print_IdentityMorphism¡  rš   z"StrPrinter._print_IdentityMorphismc                 C  s   d|j |j|jf S )NzNamedMorphism(%s, %s, "%s"))r‚  Úcodomainr£   r%  r)   r)   r*   Ú_print_NamedMorphism¤  s   ÿzStrPrinter._print_NamedMorphismc                 C  r  )NzCategory("%s")r¢   )r%   Úcategoryr)   r)   r*   Ú_print_Category¨  rš   zStrPrinter._print_Categoryc                 C  ó   |j j S r8   r¢   )r%   Úmanifoldr)   r)   r*   Ú_print_Manifold«  rP  zStrPrinter._print_Manifoldc                 C  r,  r8   r¢   )r%   Úpatchr)   r)   r*   Ú_print_Patch®  rP  zStrPrinter._print_Patchc                 C  r,  r8   r¢   )r%   Úcoordsr)   r)   r*   Ú_print_CoordSystem±  rP  zStrPrinter._print_CoordSystemc                 C  s   |j j|j jS r8   ©Ú
_coord_sysrž   Ú_indexr£   r‡  r)   r)   r*   Ú_print_BaseScalarField´  rì   z!StrPrinter._print_BaseScalarFieldc                 C  s   d|j j|j j S )Nze_%sr3  r‡  r)   r)   r*   Ú_print_BaseVectorField·  rf   z!StrPrinter._print_BaseVectorFieldc                 C  s2   |j }t|dƒrd|jj|j j S d|  |¡ S )Nr4  zd%szd(%s))Ú_form_fieldr�   r4  rž   r5  r£   r$   )r%   Údiffrˆ  r)   r)   r*   Ú_print_Differentialº  s   
zStrPrinter._print_Differentialc                 C  s   dd|   |jd ¡f S )Nri   ÚTrr   r°  r<   r)   r)   r*   Ú	_print_TrÁ  ó   zStrPrinter._print_Trc                 C  ru  r8   rv  r   r)   r)   r*   Ú
_print_StrÅ  rx  zStrPrinter._print_Strc                 C  s*   |j }d|  |¡|  |j¡|  |j¡f S r  )rk   r$   rê  r\   )r%   r=   Úrelr)   r)   r*   Ú_print_AppliedBinaryRelationÈ  s
   


þz'StrPrinter._print_AppliedBinaryRelation)F)r   r8   )Žrt   Ú
__module__Ú__qualname__r¬  r!   Ú__annotations__r"   r+   r6   r>   rO   rR   rU   rW   ra   re   rh   rm   ru   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  r8  rC  rD  rF  rG  rK  rO  rQ  rl  rn  ro  rp  rq  rs  rt  rw  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  Ú_print_MatrixSymbolÚ_print_RandomSymbolr  r  r  r	  r
  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r#  r$  r'  r)  r+  r.  r0  r2  r6  r7  r:  r<  r>  r@  r)   r)   r)   r*   r      s&  
 ø
		v	)B=		r   c                 K  ó   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=   Úsettingsr+  r„   r)   r)   r*   ÚsstrÏ  s   
rJ  c                   @  s    e Zd ZdZdd„ Zdd„ ZdS )ÚStrReprPrinterz(internal) -- see sstrreprc                 C  rÄ  r8   )r;   r   r)   r)   r*   r
  é  rP  zStrReprPrinter._print_strc                 C  s   d|j j|  |j¡f S )Nri   )rs   rt   r$   r£   r   r)   r)   r*   r>  ì  r=  zStrReprPrinter._print_StrN)rt   rA  rB  Ú__doc__r
  r>  r)   r)   r)   r*   rK  æ  s    rK  c                 K  rF  )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
    )rK  rG  rH  r)   r)   r*   Ússtrreprð  s   

rM  N)#rL  Ú
__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   rØ  r   rJ  rK  rM  r)   r)   r)   r*   Ú<module>   s2            B

