a
    sh0\                     @   sN  d dl Z d dlZd dlZd dlmZ d dlmZmZmZ d dl	m
Z
mZ d dlmZ d dlmZmZmZmZ d dlmZmZmZmZmZmZmZmZmZmZ d dlmZ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-m.Z.m/Z/m0Z0m1Z1 d dl2m3Z3 d dl4m5Z5 d dl6m7Z8 d dl9m:Z: d dlm;Z; d dlm<Z< d dl=m>Z> e>dZ?ddhZ@ddhZAdhZBg ddfddZCdd ZDd d! ZEd"d# ZFd$d% ZGd&d' ZHd(d) ZId*d+ ZJd,d- ZKd.d/ ZLd0d1 ZMd2d3 ZNd4d5 ZOd6d7 ZPd8d9 ZQd:d; ZRd d<lSmTZT d=d> ZUd d?lVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZambZbmcZcmdZdmeZemfZfmgZgmhZhmiZimjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrmsZsmtZtmuZumvZvmwZwmxZxmyZymzZzm{Z{m|Z|m}Z}m~Z~mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ d@dA Zd dBlmZ d dClmZ d dDlmZmZ d dElmZmZmZmZ d dFlmZmZmZ dGdH Zd dIlmZ dJdK Zd dLlmZ dMdN Zd dOlmZmZ dPdQ Zd dRlmZ dSdT Zd dUlmZ d dVlmZ dWdX ZedYdZ Zed[d\ Zd d]lmZ d d^lmZ d d_lmZ d d`lmZ dadb Zdcdd Zededf Zdgdh Zdidj Zdkdl Zdmdn Zdodp Zdqdr Zdsdt Zd dulmZ d dvlmZmZ d dwlmZ d dxlmZmZ d dylmZ d dzlmZ d{d| Zed}d~ Zedd Zedd Zd dlmZ d dlmZ dd Zd dlmZ d dlmZ dd Zdd Zdd Zdd ZdS )    N)meter)XFAILraisesignore_warnings)AtomBasic)SingletonRegistry)StrDummySymbolWild)
EIpioozoonanIntegerRationalFloatAlgebraicNumber)EqualityGreaterThanLessThan
RelationalStrictGreaterThanStrictLessThan
Unequality)Add)Mul)Pow)
DerivativeFunctionFunctionClassLambdaWildFunction)Interval)	vectorize)gmpy)SymPyDeprecationWarning)S)symbols)import_modulecloudpickleZ_assumptionsZ_mhashZis_EmptySetZexpr_free_symbolsZ_sage_T c           	         s   t  tr(dD ]tt fdd qdtjtjddg}trJ|tg |D ]|v r\qNtrzt  t	rpqN }n.t
r }ntt }t }t|}t|t|ksJ |sqNfdd}| || || | qNd	S )
z2 Check that pickling and copying round-trips.
    )r      c                      s   t  S N)pickledumpsr.   )aprotocolr.   _/var/www/html/assistant/venv/lib/python3.9/site-packages/sympy/utilities/tests/test_pickling.py<lambda>8       zcheck.<locals>.<lambda>         c              	      s   |D ]}|t v rqq|tv r:t| |rt||sJ |q|tv sJ| v rtt, t| |t||kspJ |W d    q1 s0    Y  qt| |sqqt| |}t|dst||sJ |t|||ksJ dt|||f qd S )N__call__z%s != %s, protocol: %s)dont_check_attrsnot_equal_attrshasattrdeprecated_attrsr   r)   getattr)r3   bdiattr)
deprecatedr4   r.   r5   cS   s    

<


zcheck.<locals>.cN)
isinstancer   r   NotImplementedErrorcopydeepcopyr-   extendcallabletypeinspectismoduleloadsr2   r1   dirset)	r3   exclude
check_attrrE   	protocolsrA   Zd1Zd2rF   r.   )r3   rE   r4   r5   check2   s0    



rV   c                  C   s&   t t  tt ttfD ]} t|  qd S r0   )r   r   r   r*   rV   rF   r.   r.   r5   test_core_basicm   s    rX   c                   C   s   t td d S Nx)rV   r	   r.   r.   r.   r5   test_core_Strq   s    r[   c                  C   s6   t t dddttdddttdfD ]} t|  q$d S )NrZ   F)ZcommutativeZ_issue_3130)r
   r   r   rV   rW   r.   r.   r5   test_core_symbolt   s    r\   c                  C   sL   t dtddtdfD ]} t|  qtttdfD ]} t| dd q6d S )Nr8   r9   z1.2FrT   )r   r   r   rV   r   sqrtrW   r.   r.   r5   test_core_numbers}   s    
r_   c                  C   s   t dd } t|  d S )NrZ   g      ?)r   rV   )yr.   r.   r5   test_core_float_copy   s    ra   c                  C   sl   t d} t d}tt| |tt| |tt| |tt| |tt| |tt| |tt| |fD ]}t| qZd S )NrZ   r`   )	r   r   r   r   r   r   r   r   rV   )rZ   r`   rF   r.   r.   r5   test_core_relational   s    rb   c                  C   s(   t d} tt| dfD ]}t| qd S NrZ   r:   )r   r   rV   rZ   rF   r.   r.   r5   test_core_add   s    re   c                  C   s(   t d} tt| dfD ]}t| qd S rc   )r   r   rV   rd   r.   r.   r5   test_core_mul   s    rf   c                  C   s(   t d} tt| dfD ]}t| qd S rc   )r   r    rV   rd   r.   r.   r5   test_core_power   s    rg   c                  C   s.   t d} tt| ttttfD ]}t| qd S rY   )r   r!   r"   r#   r$   r%   rV   rZ   fr.   r.   r5   test_core_function   s
    rj   c                  C   s   t d} t|  d S )Nri   )r"   rV   )ri   r.   r.   r5   test_core_undefinedfunctions   s    rk   c                  C   s    t d} td}t||  d S )NZ_long_unique_name_1Z_long_unique_name_2)r   r"   rV   rh   r.   r.   r5   test_core_appliedundef   s    rl   c                  C   s    t t ddfD ]} t|  qd S )Nr   r8   )r&   rV   rW   r.   r.   r5   test_core_interval   s    rm   c                  C   s   t t dfD ]} t|  qd S )Nr   )r'   rV   rW   r.   r.   r5   test_core_multidimensional   s    rn   c                  C   s   g d} t j t jg}|dd | D 7 }tr8|dd g7 }tdtdtdtdd	ttttt t	t
tjtjtjtjtjtjfD ]}|D ]}|||u sJ qq~d S )
N)r   r/   r8   r9   r:   c                    s   g | ]  fd dqS )c                    s   t t |  S r0   )r1   rP   r2   rZ   protor.   r5   r6      r7   z,test_Singletons.<locals>.<listcomp>.<lambda>r.   ).0r.   rp   r5   
<listcomp>   s   z#test_Singletons.<locals>.<listcomp>c                 S   s   t t | S r0   )r-   rP   r2   ro   r.   r.   r5   r6      r7   z!test_Singletons.<locals>.<lambda>r   r/   r8   )rI   rJ   r-   r   r   r   r   r   r   r   r   r*   ZGoldenRatioZTribonacciConstantZ
EulerGammaZCatalanZEmptySetZIdentityFunction)rU   Zcopiersobjfuncr.   r.   r5   test_Singletons   s     rw   )	FreeGroupc                   C   s   t tddd d S )Nzx, y, zFr]   )rV   rx   r.   r.   r.   r5   test_free_group   s    ry   );	Piecewise
lowergammaacosh
chebyshevu
chebyshevtlnchebyshevt_rootlegendre	Heaviside	bernoullicothtanhassoc_legendresignargasin
DiracDeltarerfAbs
uppergammabinomialsinhcoscotacosacotgammabellhermiteharmonicLambertWzetalog	factorialasinhacothcoshdirichlet_etaEijkloggammaerfceilingim	fibonacci
tribonacci	conjugatetanchebyshevu_rootflooratanhr^   sinatanfflucasatan2	polygammaexpc               +   C   s  t ttttttttt	t
ttttttttttttttttttttttt t!t"t#t$t%t&t't(t)f+} t*t+t,t-t.t/t0t1t2t3t4f}t5d\}}}t6t7t8|||t9d|dk f|d |dkf|d dft:f}| D ]}t;| ||}t;| q|D ]}t;| |||}t;| q|D ]}t;| qd S )Nx,y,zr   rt   r8   r/   r9   T)<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   r   r   r   r{   r}   r~   r   r   r   r   r   r   r+   r   r   r   rz   r   rV   )Zone_varZtwo_varrZ   r`   zZothersclsrF   r.   r.   r5   test_functions   s0    
&


r   )GeometryEntity)Point)CircleEllipse)LineLinearEntityRaySegment)PolygonRegularPolygonTrianglec                  C   s   t dd} t dd}t dd}t dd}tt t | tt| dtt| ddtt| |tt| |tt| |tt| |tt| |||t	t	| ddt
t
| ||fD ]}t|dd qd S )	Nr/   r8   r9   r   r:      Fr]   )r   r   r   r   r   r   r   r   r   r   r   rV   )p1Zp2Zp3Zp4rF   r.   r.   r5   test_geometry   s    



r   )Integralc                  C   s&   t d} tt| fD ]}t| qd S rY   )r   r   rV   rd   r.   r.   r5   test_integrals  s    r   )Logicc                  C   s   t t dfD ]} t|  qd S Nr/   )r   rV   rW   r.   r.   r5   
test_logic  s    r   )MatrixSparseMatrixc                  C   s>   t t g dttddgddggfD ]} t| ddgd q$d S )	Nr/   r8   r9   r/   r8   r9   r:   Z_smatZ_matrE   )r   r   rV   rW   r.   r.   r5   test_matrices"  s    (r   )Sievec                  C   s   t t  fD ]} t|  q
d S r0   )r   rV   rW   r.   r.   r5   test_ntheory*  s    r   )Pauli)Unitc                  C   s"   t tttdfD ]} t|  qd S r   )r   r   r   rV   rW   r.   r.   r5   test_physics3  s    r   c                  C   s   ddl m} m} ddlm} ddlm}m} ddlm	}m
}m}m} ddlm}	 ddlm}
 ddlm} dd	lm} dd
lm} ddlm}m}m}m}m}m}m}m} ddl m!} ddl"m#} ddl$m%} | | dd||||||||||	|
||||||||||||||fD ]}t&| qd S )Nr   )ColorGradientColorScheme)ManagedWindow)Plot
ScreenShot)PlotAxesPlotAxesBasePlotAxesFramePlotAxesOrdinate)
PlotCamera)PlotController)	PlotCurve)PlotInterval)PlotMode)Cartesian2DCartesian3DCylindricalParametricCurve2DParametricCurve3DParametricSurfacePolar	Spherical)
PlotObject)PlotSurface)
PlotWindowg?g?)'&sympy.plotting.pygletplot.color_schemer   r   Z(sympy.plotting.pygletplot.managed_windowr   sympy.plotting.plotr   r   #sympy.plotting.pygletplot.plot_axesr   r   r   r   Z%sympy.plotting.pygletplot.plot_camerar   Z)sympy.plotting.pygletplot.plot_controllerr   Z$sympy.plotting.pygletplot.plot_curver   Z'sympy.plotting.pygletplot.plot_intervalr   Z#sympy.plotting.pygletplot.plot_moder   Z$sympy.plotting.pygletplot.plot_modesr   r   r   r   r   r   r   r   Z%sympy.plotting.pygletplot.plot_objectr   Z&sympy.plotting.pygletplot.plot_surfacer   Z%sympy.plotting.pygletplot.plot_windowr   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   rF   r.   r.   r5   test_plotting;  s,    (


r   c                  C   sN   ddl m}  ddlm} ddlm} t| d t|ddd t|  d S )	Nr   )r   )r   )r   rainbowr/   F)visible)r   r   r   r   r   r   rV   )r   r   r   r.   r.   r5   test_plotting2V  s    r   )ZZ)QQ)lex)Polyc                  C   sN   ddl m}  td}tt||fD ]}t| q"| | |fD ]}t| q<d S )Nr   )PurePolyrZ   )sympy.polys.polytoolsr   r   r   rV   )r   rZ   rF   r.   r.   r5   test_pickling_polys_polytoolss  s    
r   c                  C   s   ddl m} m}m} | | tdgtdgtdggtfD ]}t|dgd q:||tdtdgtdtdgftfD ]}t| qx||tdtdgtdtdtdgtfD ]}t| qd S )Nr   )DMPDMFANPr/   r8   r9   repr   )Zsympy.polys.polyclassesr   r   r   r   rV   r   )r   r   r   rF   r.   r.   r5   test_pickling_polys_polyclasses  s    *.
2r   c                  C   s^   ddl m}  | dtt}| |fD ]}t|ddgd q |j|jfD ]}t|ddgdd qBd S )Nr   )PolyRingr   r/   )rS   F)rS   rT   )Zsympy.polys.ringsr  r   r   rV   Zdtypeone)r  ringrF   r.   r.   r5   test_pickling_polys_rings  s    r  c                   C   s   d S r0   r.   r.   r.   r.   r5   test_pickling_polys_fields  s    r  c                  C   s,   ddl m}  | | ddfD ]}t| qd S )Nr   )PythonRationalr/      )Z"sympy.polys.domains.pythonrationalr  rV   )r  rF   r.   r.   r5   test_pickling_polys_elements  s    r  c                  C   s  ddl m}  ddlm} | |  fD ]}t|dd q"|| fD ]}t|dd q>td urddlm} ddlm	} || fD ]}t|dd qz|| fD ]}t|dd qddl
m} dd	lm} ||ttd
fD ]}t|dd q|| fD ]}t|dd qd S )Nr   )PythonIntegerRing)PythonRationalFieldFr]   )GMPYIntegerRing)GMPYRationalField)AlgebraicField)ExpressionDomainr9   )Z%sympy.polys.domains.pythonintegerringr	  Z'sympy.polys.domains.pythonrationalfieldr
  rV   _gmpyZ#sympy.polys.domains.gmpyintegerringr  Z%sympy.polys.domains.gmpyrationalfieldr  Z"sympy.polys.domains.algebraicfieldr  Z$sympy.polys.domains.expressiondomainr  r   r^   )r	  r
  rF   r  r  r  r  r.   r.   r5   test_pickling_polys_domains  s&    

r  c                  C   s   ddl m} m}m}m} | |  fD ]}t| q"|| fD ]}t| q:|| fD ]}t| qR|||  fD ]}t| qnd S )Nr   )LexOrderGradedLexOrderReversedGradedLexOrderInverseOrder)sympy.polys.orderingsr  r  r  r  rV   )r  r  r  r  rF   r.   r.   r5   test_pickling_polys_orderings   s    


	r  c                  C   s^   ddl m} m} td\}}}| | dfD ]}t| q*||d|||ffD ]}t| qLd S )Nr   )MonomialOpsMonomialr   r9   r   )Zsympy.polys.monomialsr  r  r+   rV   )r  r  rZ   r`   r   rF   r.   r.   r5   test_pickling_polys_monomials  s    
r  c                  C   s8  ddl m} m}m}m}m}m}m}m}m	}m
}	m}
m}m}m}m}m}m}m}m} | |  fD ]}t| q^|| fD ]}t| qv|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q |	|	 fD ]}t| q:|
|
 fD ]}t| qT|| fD ]}t| qn|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q|| fD ]}t| q
|| fD ]}t| q$d S )Nr   )HeuristicGCDFailedHomomorphismFailedIsomorphismFailedExtraneousFactorsEvaluationFailedRefinementFailedCoercionFailedNotInvertibleNotReversibleNotAlgebraicDomainErrorPolynomialErrorUnificationFailedGeneratorsErrorGeneratorsNeededUnivariatePolynomialErrorMultivariatePolynomialErrorOptionError	FlagError)Zsympy.polys.polyerrorsr  r  r  r  r  r  r   r!  r"  r#  r$  r%  r&  r'  r(  r)  r*  r+  r,  rV   )r  r  r  r  r  r  r   r!  r"  r#  r$  r%  r&  r'  r(  r)  r*  r+  r,  rF   r.   r.   r5   test_pickling_polys_errors"  sN    T






r-  c                  C   sd   ddl m} m} td}|d | d }| | |dfD ]}t| q6|||tfD ]}t| qRd S )Nr   )CRootOfRootSumrZ   r9   )Zsympy.polys.rootoftoolsr.  r/  r   rV   r   )r.  r/  rZ   ri   rF   r.   r.   r5   test_pickling_polys_rootoftools  s    
r0  )LatexPrinter)MathMLContentPrinterMathMLPresentationPrinter)PrettyPrinter)
prettyForm
stringPict)Printer)PythonPrinterc                  C   s8   t t  ttttttdtt tt fD ]} t|  q&d S )Nr3   )	r1  r2  r3  r4  r5  r6  r7  r8  rV   rW   r.   r.   r5   test_printing  s    r9  c                   C   s   t t  d S r0   )rV   r2  r.   r.   r.   r5   test_printing1  s    r:  c                   C   s   t t  d S r0   )rV   r3  r.   r.   r.   r5   test_printing2  s    r;  c                   C   s   t t  d S r0   )rV   r4  r.   r.   r.   r5   test_printing3  s    r<  )Limit)Orderc                  C   s:   t d} t d}tt| |dtt| fD ]}t| q(d S )NerZ   r/   )r   r=  r>  rV   )r?  rZ   rF   r.   r.   r5   test_series  s    r@  )Product)Sumc                  C   s>   t d} tt| | ddftt| | ddffD ]}t| q,d S )NrZ   r8   r:   )r   rA  rB  rV   rd   r.   r.   r5   test_concrete  s    (rC  c                  C   s   t dddd} t|  d S )Nmessagez1.0zactive-deprecations)Zdeprecated_since_versionZactive_deprecations_target)r)   rV   )wr.   r.   r5   test_deprecation_warning  s    rF  c                   C   s    t t tjtjksJ d S r0   )r1   rP   r2   r*   ZHalfr.   r.   r.   r5   test_issue_18438  s    rG  c                  C   s   d} t | tdksJ d S )Nsi   ^       sympy.core.powerPowsympy.core.numbersIntegerKR}bhHalf)R}bR}b.r8   )r1   rP   r^   )datar.   r.   r5   !test_unpickle_from_older_versions  s    rI  )rN   rI   r1   Zsympy.physics.unitsr   Zsympy.testing.pytestr   r   r   Zsympy.core.basicr   r   Zsympy.core.singletonr   Zsympy.core.symbolr	   r
   r   r   Zsympy.core.numbersr   r   r   r   r   r   r   r   r   r   Zsympy.core.relationalr   r   r   r   r   r   r   Zsympy.core.addr   Zsympy.core.mulr   Zsympy.core.powerr    Zsympy.core.functionr!   r"   r#   r$   r%   Zsympy.sets.setsr&   Zsympy.core.multidimensionalr'   Zsympy.external.gmpyr(   r  Zsympy.utilities.exceptionsr)   r*   r+   Zsympy.externalr,   r-   r=   r?   r<   rV   rX   r[   r\   r_   ra   rb   re   rf   rg   rj   rk   rl   rm   rn   rw   Zsympy.combinatorics.free_groupsrx   ry   Zsympy.functionsrz   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   r   r   r   r   r   r   r   r   r   r^   r   r   r   r   r   r   r   r   Zsympy.geometry.entityr   Zsympy.geometry.pointr   Zsympy.geometry.ellipser   r   Zsympy.geometry.liner   r   r   r   Zsympy.geometry.polygonr   r   r   r   Zsympy.integrals.integralsr   r   Zsympy.core.logicr   r   Zsympy.matricesr   r   r   Zsympy.ntheory.generater   r   Zsympy.physics.paulialgebrar   r   r   r   r   Zsympy.polys.domains.integerringr   Z!sympy.polys.domains.rationalfieldr   r  r   r   r   r   r   r  r  r  r  r  r  r-  r0  Zsympy.printing.latexr1  Zsympy.printing.mathmlr2  r3  Zsympy.printing.pretty.prettyr4  Z sympy.printing.pretty.stringpictr5  r6  Zsympy.printing.printerr7  Zsympy.printing.pythonr8  r9  r:  r;  r<  Zsympy.series.limitsr=  Zsympy.series.orderr>  r@  Zsympy.concrete.productsrA  Zsympy.concrete.summationsrB  rC  rF  rG  rI  r.   r.   r.   r5   <module>   s   0$;	





<
a


