o
    8Va                     @   s  d Z ddlmZ eG dd deZeG dd deZeG dd deZeG d	d
 d
eZeG dd deZG dd deZ	eG dd deZ
eG dd deZeG dd deZeG dd deZeG dd deZeG dd deZeG dd deZeG dd deZeG dd  d eZeG d!d" d"eZeG d#d$ d$eZeG d%d& d&eZeG d'd( d(eZeG d)d* d*eZeG d+d, d,eZeG d-d. d.eZeG d/d0 d0eZeG d1d2 d2eZeG d3d4 d4eZeG d5d6 d6eZd7S )8z5Definitions of common exceptions for `polys` module.     )publicc                   @   s   e Zd ZdZdd ZdS )BasePolynomialErrorz.Base class for polynomial related exceptions. c                 G   s   t d)Nzabstract base class)NotImplementedError)selfargs r   8/usr/lib/python3/dist-packages/sympy/polys/polyerrors.pynew
   s   zBasePolynomialError.newN)__name__
__module____qualname____doc__r	   r   r   r   r   r      s    r   c                   @   s&   e Zd ZdddZdd Zdd ZdS )	ExactQuotientFailedNc                 C   s   |||| _ | _| _d S N)fgdom)r   r   r   r   r   r   r   __init__   s   zExactQuotientFailed.__init__c                 C   sN   ddl m} | jd u rd|| j|| jf S d|| j|| j|| jf S )Nr   )sstrz%s does not divide %sz%s does not divide %s in %s)Zsympy.printing.strr   r   r   r   )r   r   r   r   r   __str__   s   
 zExactQuotientFailed.__str__c                 C   s   |  ||| jS r   )	__class__r   )r   r   r   r   r   r   r	      s   zExactQuotientFailed.newr   )r
   r   r   r   r   r	   r   r   r   r   r      s    
r   c                   @      e Zd Zdd Zdd ZdS )PolynomialDivisionFailedc                 C      || _ || _|| _d S r   )r   r   domain)r   r   r   r   r   r   r   r   !      
z!PolynomialDivisionFailed.__init__c                 C   s6   | j jrd}n	| j jsd}nd}d| j| j| j |f S )NzYou may want to use a different simplification algorithm. Note that in general it's not possible to guarantee to detect zero in this domain.zYour working precision or tolerance of computations may be set improperly. Adjust those parameters of the coefficient domain and try again.zZero detection is guaranteed in this coefficient domain. This may indicate a bug in SymPy or the domain is user defined and doesn't implement zero detection properly.zcouldn't reduce degree in a polynomial division algorithm when dividing %s by %s. This can happen when it's not possible to detect zero in the coefficient domain. The domain of computation is %s. %s)r   Zis_EXZis_Exactr   r   )r   msgr   r   r   r   &   s   z PolynomialDivisionFailed.__str__Nr
   r   r   r   r   r   r   r   r   r          r   c                   @   r   )OperationNotSupportedc                 C   s   || _ || _d S r   )polyfunc)r   r    r!   r   r   r   r   <   s   
zOperationNotSupported.__init__c                 C   s   d| j | jjjjf S )Nz1`%s` operation not supported by %s representation)r!   r    Zrepr   r
   r   r   r   r   r   @   s   zOperationNotSupported.__str__Nr   r   r   r   r   r   9   s    r   c                   @      e Zd ZdS )HeuristicGCDFailedNr
   r   r   r   r   r   r   r$   C       r$   c                   @   r#   )ModularGCDFailedNr%   r   r   r   r   r'   G   s    r'   c                   @   r#   )HomomorphismFailedNr%   r   r   r   r   r(   J   r&   r(   c                   @   r#   )IsomorphismFailedNr%   r   r   r   r   r)   N   r&   r)   c                   @   r#   )ExtraneousFactorsNr%   r   r   r   r   r*   R   r&   r*   c                   @   r#   )EvaluationFailedNr%   r   r   r   r   r+   V   r&   r+   c                   @   r#   )RefinementFailedNr%   r   r   r   r   r,   Z   r&   r,   c                   @   r#   )CoercionFailedNr%   r   r   r   r   r-   ^   r&   r-   c                   @   r#   )NotInvertibleNr%   r   r   r   r   r.   b   r&   r.   c                   @   r#   )NotReversibleNr%   r   r   r   r   r/   f   r&   r/   c                   @   r#   )NotAlgebraicNr%   r   r   r   r   r0   j   r&   r0   c                   @   r#   )DomainErrorNr%   r   r   r   r   r1   n   r&   r1   c                   @   r#   )PolynomialErrorNr%   r   r   r   r   r2   r   r&   r2   c                   @   r#   )UnificationFailedNr%   r   r   r   r   r3   v   r&   r3   c                   @   r#   )GeneratorsErrorNr%   r   r   r   r   r4   z   r&   r4   c                   @   r#   )GeneratorsNeededNr%   r   r   r   r   r5   ~   r&   r5   c                   @   r   )ComputationFailedc                 C   r   r   )r!   nargsexc)r   r!   r7   r8   r   r   r   r      r   zComputationFailed.__init__c              	   C   s(   d| j dtt| jjd | j f S )Nz %s(%s) failed without generators, )r!   joinmapstrr8   exprsr7   r"   r   r   r   r      s   (zComputationFailed.__str__Nr   r   r   r   r   r6      r   r6   c                   @   r#   )UnivariatePolynomialErrorNr%   r   r   r   r   r>      r&   r>   c                   @   r#   )MultivariatePolynomialErrorNr%   r   r   r   r   r?      r&   r?   c                   @   s   e Zd ZdddZdd ZdS )PolificationFailedFc                 C   s>   |s|| _ || _|g| _|g| _n|| _|| _|| _|| _d S r   )origexprorigsr=   optseq)r   rD   rC   r=   rE   r   r   r   r      s   

zPolificationFailed.__init__c                 C   s*   | j s
dt| j S ddtt| j S )Nz$can't construct a polynomial from %sz#can't construct polynomials from %sr9   )rE   r<   rA   r:   r;   rC   r"   r   r   r   r      s   zPolificationFailed.__str__N)Fr   r   r   r   r   r@      s    
r@   c                   @   r#   )OptionErrorNr%   r   r   r   r   rF      r&   rF   c                   @   r#   )	FlagErrorNr%   r   r   r   r   rG      r&   rG   N)r   Zsympy.utilitiesr   	Exceptionr   r   r   r   r$   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r>   r?   r@   rF   rG   r   r   r   r   <module>   sj    	
