B
    [ื  ใ               @   s(  d Z ddlmZm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 d0d1 d1eZeG d2d3 d3eZeG d4d5 d5eZeG d6d7 d7eZ d8S )9z5Definitions of common exceptions for `polys` module. ้    )ฺprint_functionฺdivision)ฺ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d S )Nzabstract base class)ฺNotImplementedError)ฺselfฺargsฉ r	   ๚5lib/python3.7/site-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   sR   ddl m} | jd kr.d|| j|| jf S d|| j|| j|| jf S d 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 )N)ฺ	__class__r   )r   r   r   r	   r	   r
   r      s    zExactQuotientFailed.new)N)r   r   r   r   r   r   r	   r	   r	   r
   r      s   
r   c               @   s   e Zd Zdd Zdd ZdS )ฺPolynomialDivisionFailedc             C   s   || _ || _|| _d S )N)r   r   ฺdomain)r   r   r   r   r	   r	   r
   r   "   s    z!PolynomialDivisionFailed.__init__c             C   s6   | j jrd}n| j jsd}nd}d| j| j| j |f S )NzYou may want to use a different simplification algorithm. Note that in general it's not possible to guarantee to detect zero in this domain.zYour working precision or tolerance of computations may be set improperly. Adjust those parameters of the coefficient domain and try again.zฆZero 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.zฦcouldn'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      s   r   c               @   s   e Zd Zdd Zdd ZdS )ฺOperationNotSupportedc             C   s   || _ || _d S )N)ฺ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   A   s    zOperationNotSupported.__str__N)r   r   r   r   r   r	   r	   r	   r
   r   :   s   r   c               @   s   e Zd ZdS )ฺHeuristicGCDFailedN)r   r   r   r	   r	   r	   r
   r   D   s   r   c               @   s   e Zd ZdS )ฺModularGCDFailedN)r   r   r   r	   r	   r	   r
   r   H   s   r   c               @   s   e Zd ZdS )ฺHomomorphismFailedN)r   r   r   r	   r	   r	   r
   r    K   s   r    c               @   s   e Zd ZdS )ฺIsomorphismFailedN)r   r   r   r	   r	   r	   r
   r!   O   s   r!   c               @   s   e Zd ZdS )ฺExtraneousFactorsN)r   r   r   r	   r	   r	   r
   r"   S   s   r"   c               @   s   e Zd ZdS )ฺEvaluationFailedN)r   r   r   r	   r	   r	   r
   r#   W   s   r#   c               @   s   e Zd ZdS )ฺRefinementFailedN)r   r   r   r	   r	   r	   r
   r$   [   s   r$   c               @   s   e Zd ZdS )ฺCoercionFailedN)r   r   r   r	   r	   r	   r
   r%   _   s   r%   c               @   s   e Zd ZdS )ฺNotInvertibleN)r   r   r   r	   r	   r	   r
   r&   c   s   r&   c               @   s   e Zd ZdS )ฺNotReversibleN)r   r   r   r	   r	   r	   r
   r'   g   s   r'   c               @   s   e Zd ZdS )ฺNotAlgebraicN)r   r   r   r	   r	   r	   r
   r(   k   s   r(   c               @   s   e Zd ZdS )ฺDomainErrorN)r   r   r   r	   r	   r	   r
   r)   o   s   r)   c               @   s   e Zd ZdS )ฺPolynomialErrorN)r   r   r   r	   r	   r	   r
   r*   s   s   r*   c               @   s   e Zd ZdS )ฺUnificationFailedN)r   r   r   r	   r	   r	   r
   r+   w   s   r+   c               @   s   e Zd ZdS )ฺGeneratorsErrorN)r   r   r   r	   r	   r	   r
   r,   {   s   r,   c               @   s   e Zd ZdS )ฺGeneratorsNeededN)r   r   r   r	   r	   r	   r
   r-      s   r-   c               @   s   e Zd Zdd Zdd ZdS )ฺComputationFailedc             C   s   || _ || _|| _d S )N)r   ฺnargsฺexc)r   r   r/   r0   r	   r	   r
   r      s    zComputationFailed.__init__c          	   C   s(   d| j d tt| jjd | j กf S )Nz %s(%s) failed without generatorsz, )r   ฺjoinฺmapฺstrr0   ฺexprsr/   )r   r	   r	   r
   r      s    zComputationFailed.__str__N)r   r   r   r   r   r	   r	   r	   r
   r.      s   r.   c               @   s   e Zd ZdS )ฺUnivariatePolynomialErrorN)r   r   r   r	   r	   r	   r
   r5      s   r5   c               @   s   e Zd ZdS )ฺMultivariatePolynomialErrorN)r   r   r   r	   r	   r	   r
   r6      s   r6   c               @   s   e Zd ZdddZdd ZdS )ฺPolificationFailedFc             C   s>   |s"|| _ || _|g| _|g| _n|| _|| _|| _|| _d S )N)ฺorigฺexprฺorigsr4   ฺoptฺseq)r   r;   r:   r4   r<   r	   r	   r
   r      s    
zPolificationFailed.__init__c             C   s.   | j sdt| j S dd tt| jก S d S )Nz$can't construct a polynomial from %sz#can't construct polynomials from %sz, )r<   r3   r8   r1   r2   r:   )r   r	   r	   r
   r   ฆ   s    zPolificationFailed.__str__N)F)r   r   r   r   r   r	   r	   r	   r
   r7      s   
r7   c               @   s   e Zd ZdS )ฺOptionErrorN)r   r   r   r	   r	   r	   r
   r=   ฌ   s   r=   c               @   s   e Zd ZdS )ฺ	FlagErrorN)r   r   r   r	   r	   r	   r
   r>   ฐ   s   r>   N)!r   Z
__future__r   r   Zsympy.utilitiesr   ฺ	Exceptionr   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r5   r6   r7   r=   r>   r	   r	   r	   r
   ฺ<module>   sj   	
