U
    	-e[                     @   s2  d dl Z d dlZd dl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 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.m/Z/m0Z0 d dl1m2Z2 d dl3m4Z4 d dl5m6Z6 d dl7m8Z8 d dlm9Z9 d dlm:Z: d dl;m<Z< e<dZ=ddddddhZ>g dfddZ?dd Z@d d! ZAd"d# ZBd$d% ZCd&d' ZDd(d) ZEd*d+ ZFd,d- ZGd.d/ ZHd0d1 ZId2d3 ZJed4d5 ZKd6d7 ZLd8d9 ZMd:d; ZNd d<lOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZambZbmcZcmdZdmeZemfZfmgZgmhZhmiZimjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrmsZsmtZtmuZumvZvmwZwmxZxmyZymzZzm{Z{m|Z|m}Z}m~Z~mZmZmZmZmZmZmZmZmZmZmZmZ d=d> Zd d?lmZ d d@lmZ d dAlmZmZ d dBlmZmZmZmZ d dClmZmZmZ dDdE Zd dFlmZ dGdH Zd dIlmZ dJdK Zd dLlmZmZ dMdN Zd dOlmZ dPdQ Zd dRlmZ d dSlmZ dTdU ZedVdW ZedXdY Zd dZlmZ d d[lmZ d d\lmZ d d]lmZ d^d_ Zd`da Zedbdc Zddde Zdfdg Zdhdi Zdjdk Zdldm Zdndo Zdpdq Zd drlmZ d dslmZmZ d dtlmZ d dulmZmZ d dvlmZ d dwlmZ dxdy Zedzd{ Zed|d} Zed~d Zd dlmZ d dlmZ dd Zd dlmZ d dlmZ dd Zdd Zdd Zdd ZdS )    N)meter)XFAILraises)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)HAS_GMPY)SymPyDeprecationWarning)S)symbols)import_modulecloudpickleZ_assumptionsZ_mhashZis_EmptySetZexpr_free_symbolsZ_matZ_smatTc                    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 ]|kr\qNtrzt  t	rpqN }n.t
r }ntt }t }t|}t|t|kst|sqNfdd}| || || | qNd	S )
z2 Check that pickling and copying round-trips.
    )r      c                      s   t  S N)pickledumps aprotocolr1   d/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/sympy/utilities/tests/test_pickling.py<lambda>1       zcheck.<locals>.<lambda>         c                    sp   |D ]f}|t krqt| |sqt| |}t|dst||sDt|t|||kstdt||| f qd S )N__call__z%s != %s, protocol: %s)excluded_attrshasattrgetattrAssertionError)r3   bdiattr)r4   r1   r5   cL   s    


zcheck.<locals>.cN)
isinstancer   r   NotImplementedErrorcopydeepcopyr,   extendcallabletypeinspectismoduleloadsr0   r/   dirsetr?   )r3   exclude
check_attr	protocolsr@   Zd1Zd2rD   r1   r2   r5   check+   s0    



rT   c                  C   s&   t t  tt ttfD ]} t|  qd S r.   )r   r   r   r)   rT   rD   r1   r1   r5   test_core_basic_   s    rV   c                   C   s   t td d S Nx)rT   r   r1   r1   r1   r5   test_core_Strc   s    rY   c                  C   s6   t t dddttdddttdfD ]} t|  q$d S )NrX   F)ZcommutativeZ_issue_3130)r	   r
   r   rT   rU   r1   r1   r5   test_core_symbolf   s    
  rZ   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rR   )r   r   r   rT   r   sqrtrU   r1   r1   r5   test_core_numberso   s    
r]   c                  C   s   t dd } t|  d S )NrX   g      ?)r
   rT   )yr1   r1   r5   test_core_float_copyv   s    r_   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 )NrX   r^   )	r
   r   r   r   r   r   r   r   rT   )rX   r^   rD   r1   r1   r5   test_core_relational|   s           r`   c                  C   s(   t d} tt| dfD ]}t| qd S NrX   r:   )r
   r   rT   rX   rD   r1   r1   r5   test_core_add   s    rc   c                  C   s(   t d} tt| dfD ]}t| qd S ra   )r
   r   rT   rb   r1   r1   r5   test_core_mul   s    rd   c                  C   s(   t d} tt| dfD ]}t| qd S ra   )r
   r   rT   rb   r1   r1   r5   test_core_power   s    re   c                  C   s.   t d} tt| ttttfD ]}t| qd S rW   )r
   r    r!   r"   r#   r$   rT   )rX   fr1   r1   r5   test_core_function   s
    rg   c                  C   s.   t d} ttd}|t t| |d d S )Nrf      rQ   )r!   listrangeappendr,   rT   )rf   rQ   r1   r1   r5   test_core_undefinedfunctions   s    
rm   c                  C   s   t d} t|  d S )Nrf   )r!   rT   )rf   r1   r1   r5   !test_core_undefinedfunctions_fail   s    rn   c                  C   s    t t ddfD ]} t|  qd S )Nr   r8   )r%   rT   rU   r1   r1   r5   test_core_interval   s    ro   c                  C   s   t t dfD ]} t|  qd S )Nr   )r&   rT   rU   r1   r1   r5   test_core_multidimensional   s    rp   c                  C   s   dddddg} t j t jg}|dd | D 7 }tr>|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 ]}|||kstqqd S )Nr   r-   r8   r9   r:   c                    s   g | ]  fd dqS )c                    s   t t |  S r.   )r/   rN   r0   rX   protor1   r5   r6      r7   z,test_Singletons.<locals>.<listcomp>.<lambda>r1   ).0r1   rr   r5   
<listcomp>   s   z#test_Singletons.<locals>.<listcomp>c                 S   s   t t | S r.   )r,   rN   r0   rq   r1   r1   r5   r6      r7   z!test_Singletons.<locals>.<lambda>)rG   rH   r,   r   r   r   r   r   r   r   r   r)   ZGoldenRatioZTribonacciConstantZ
EulerGammaZCatalanZEmptySetZIdentityFunctionr?   )rS   Zcopiersobjfuncr1   r1   r5   test_Singletons   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   rv   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   rT   )Zone_varZtwo_varrX   r^   zZothersclsrD   r1   r1   r5   test_functions   sx                                        &


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:   rh   Fr[   )r   r   r   r   r   r   r   r   r   r   r   rT   )p1p2Zp3Zp4rD   r1   r1   r5   test_geometry   s8    



      
         
  
r   )Integralc                  C   s&   t d} tt| fD ]}t| qd S rW   )r
   r   rT   rb   r1   r1   r5   test_integrals  s    r   )Logicc                  C   s   t t dfD ]} t|  qd S Nr-   )r   rT   rU   r1   r1   r5   
test_logic  s    r   )MatrixSparseMatrixc                  C   s8   t t dddgttddgddggfD ]} t|  q&d S )Nr-   r8   r9   r:   )r   r   rT   rU   r1   r1   r5   test_matrices  s    *r   )Sievec                  C   s   t t  fD ]} t|  q
d S r.   )r   rT   rU   r1   r1   r5   test_ntheory  s    r   )Pauli)Unitc                  C   s"   t tttdfD ]} t|  qd S r   )r   r   r   rT   rU   r1   r1   r5   test_physics%  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   rT   )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   rD   r1   r1   r5   test_plotting-  sT    (                    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   rT   )r   r   r   r1   r1   r5   test_plotting2H  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   )PurePolyrX   )sympy.polys.polytoolsr   r
   r   rT   )r   rX   rD   r1   r1   r5   test_pickling_polys_polytoolse  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| q:||tdtdgtdtdgftfD ]}t| qr||tdtdgtdtdtdgtfD ]}t| qd S )Nr   )DMPDMFANPr-   r8   r9   )Zsympy.polys.polyclassesr   r   r   r   rT   r   )r   r   r   rD   r1   r1   r5   test_pickling_polys_polyclassest  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-   ri   F)rQ   rR   )Zsympy.polys.ringsr   r   r   rT   Zdtypeone)r   ringrD   r1   r1   r5   test_pickling_polys_rings~  s    r  c                   C   s   d S r.   r1   r1   r1   r1   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  rT   )r  rD   r1   r1   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rddlm} ddlm	} || fD ]}t|dd qv|| 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  rT   r'   Z#sympy.polys.domains.gmpyintegerringr  Z%sympy.polys.domains.gmpyrationalfieldr	  Z"sympy.polys.domains.algebraicfieldr
  Z$sympy.polys.domains.expressiondomainr  r   r\   )r  r  rD   r  r	  r
  r  r1   r1   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  rT   )r  r  r  r  rD   r1   r1   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-   r8   r9   )Zsympy.polys.monomialsr  r  r*   rT   )r  r  rX   r^   r   rD   r1   r1   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(  rT   )r  r  r  r  r  r  r  r  r  r  r   r!  r"  r#  r$  r%  r&  r'  r(  rD   r1   r1   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RootSumrX   r9   )Zsympy.polys.rootoftoolsr*  r+  r
   rT   r   )r*  r+  rX   rf   rD   r1   r1   r5   test_pickling_polys_rootoftoolsu  s    
r,  )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   )	r-  r.  r/  r0  r1  r2  r3  r4  rT   rU   r1   r1   r5   test_printing  s          r5  c                   C   s   t t  d S r.   )rT   r.  r1   r1   r1   r5   test_printing1  s    r6  c                   C   s   t t  d S r.   )rT   r/  r1   r1   r1   r5   test_printing2  s    r7  c                   C   s   t t  d S r.   )rT   r0  r1   r1   r1   r5   test_printing3  s    r8  )Limit)Orderc                  C   s:   t d} t d}tt| |dtt| fD ]}t| q(d S )NerX   r-   )r
   r9  r:  rT   )r;  rX   rD   r1   r1   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 )NrX   r8   r:   )r
   r=  r>  rT   rb   r1   r1   r5   test_concrete  s    (r?  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(   rT   )wr1   r1   r5   test_deprecation_warning  s    rB  c                   C   s    t t tjtjkstd S r.   )r/   rN   r0   r)   ZHalfr?   r1   r1   r1   r5   test_issue_18438  s    rC  c                  C   s   d} t | tdkstd S )Nsi   ^       sympy.core.powerPowsympy.core.numbersIntegerKR}bhHalf)R}bR}b.r8   )r/   rN   r\   r?   )datar1   r1   r5   !test_unpickle_from_older_versions  s    rE  )rL   rG   r/   Zsympy.physics.unitsr   Zsympy.testing.pytestr   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'   Zsympy.utilities.exceptionsr(   r)   r*   Zsympy.externalr+   r,   r<   rT   rV   rY   rZ   r]   r_   r`   rc   rd   re   rg   rm   rn   ro   rp   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)  r,  Zsympy.printing.latexr-  Zsympy.printing.mathmlr.  r/  Zsympy.printing.pretty.prettyr0  Z sympy.printing.pretty.stringpictr1  r2  Zsympy.printing.printerr3  Zsympy.printing.pythonr4  r5  r6  r7  r8  Zsympy.series.limitsr9  Zsympy.series.orderr:  r<  Zsympy.concrete.productsr=  Zsympy.concrete.summationsr>  r?  rB  rC  rE  r1   r1   r1   r5   <module>   s   0$
4	
	





<
a


