o
    8Va                     @   s8   d Z ddlZddlmZ G dd deZede dS )z(
General SymPy exceptions and warnings.
    N)
filldedentc                   @   s0   e Zd ZdZ		d
ddZdd Zddd	ZdS )SymPyDeprecationWarningaB  A warning for deprecated features of SymPy.

    This class is expected to be used with the warnings.warn function (note
    that one has to explicitly turn on deprecation warnings):

    >>> import warnings
    >>> from sympy.utilities.exceptions import SymPyDeprecationWarning
    >>> warnings.simplefilter(
    ...     "always", SymPyDeprecationWarning)
    >>> warnings.warn(
    ...     SymPyDeprecationWarning(feature="Old deprecated thing",
    ...     issue=1065, deprecated_since_version="1.0")) #doctest:+SKIP
    __main__:3: SymPyDeprecationWarning:

    Old deprecated thing has been deprecated since SymPy 1.0. See
    https://github.com/sympy/sympy/issues/1065 for more info.

    >>> SymPyDeprecationWarning(feature="Old deprecated thing",
    ... issue=1065, deprecated_since_version="1.1").warn() #doctest:+SKIP
    __main__:1: SymPyDeprecationWarning:

    Old deprecated thing has been deprecated since SymPy 1.1.
    See https://github.com/sympy/sympy/issues/1065 for more info.

    Three arguments to this class are required: ``feature``, ``issue`` and
    ``deprecated_since_version``.

    The ``issue`` flag should be an integer referencing for a "Deprecation
    Removal" issue in the SymPy issue tracker. See
    https://github.com/sympy/sympy/wiki/Deprecating-policy.

    >>> SymPyDeprecationWarning(
    ...    feature="Old feature",
    ...    useinstead="new feature",
    ...    issue=5241,
    ...    deprecated_since_version="1.1")
    Old feature has been deprecated since SymPy 1.1. Use new feature
    instead. See https://github.com/sympy/sympy/issues/5241 for more info.

    Every formal deprecation should have an associated issue in the GitHub
    issue tracker.  All such issues should have the DeprecationRemoval
    tag.

    Additionally, each formal deprecation should mark the first release for
    which it was deprecated.  Use the ``deprecated_since_version`` flag for
    this.

    >>> SymPyDeprecationWarning(
    ...    feature="Old feature",
    ...    useinstead="new feature",
    ...    deprecated_since_version="0.7.2",
    ...    issue=1065)
    Old feature has been deprecated since SymPy 0.7.2. Use new feature
    instead. See https://github.com/sympy/sympy/issues/1065 for more info.

    To provide additional information, create an instance of this
    class in this way:

    >>> SymPyDeprecationWarning(
    ...     feature="Such and such",
    ...     last_supported_version="1.2.3",
    ...     useinstead="this other feature",
    ...     issue=1065,
    ...     deprecated_since_version="1.1")
    Such and such has been deprecated since SymPy 1.1. It will be last
    supported in SymPy version 1.2.3. Use this other feature instead. See
    https://github.com/sympy/sympy/issues/1065 for more info.

    Note that the text in ``feature`` begins a sentence, so if it begins with
    a plain English word, the first letter of that word should be capitalized.

    Either (or both) of the arguments ``last_supported_version`` and
    ``useinstead`` can be omitted. In this case the corresponding sentence
    will not be shown:

    >>> SymPyDeprecationWarning(feature="Such and such",
    ...     useinstead="this other feature", issue=1065,
    ...     deprecated_since_version="1.1")
    Such and such has been deprecated since SymPy 1.1. Use this other
    feature instead. See https://github.com/sympy/sympy/issues/1065 for
    more info.

    You can still provide the argument value.  If it is a string, it
    will be appended to the end of the message:

    >>> SymPyDeprecationWarning(
    ...     feature="Such and such",
    ...     useinstead="this other feature",
    ...     value="Contact the developers for further information.",
    ...     issue=1065,
    ...     deprecated_since_version="1.1")
    Such and such has been deprecated since SymPy 1.1. Use this other
    feature instead. See https://github.com/sympy/sympy/issues/1065 for
    more info.  Contact the developers for further information.

    If, however, the argument value does not hold a string, a string
    representation of the object will be appended to the message:

    >>> SymPyDeprecationWarning(
    ...     feature="Such and such",
    ...     useinstead="this other feature",
    ...     value=[1,2,3],
    ...     issue=1065,
    ...     deprecated_since_version="1.1")
    Such and such has been deprecated since SymPy 1.1. Use this other
    feature instead. See https://github.com/sympy/sympy/issues/1065 for
    more info.  ([1, 2, 3])

    Note that it may be necessary to go back through all the deprecations
    before a release to make sure that the version number is correct.  So just
    use what you believe will be the next release number (this usually means
    bumping the minor number by one).

    To mark a function as deprecated, you can use the decorator
    @deprecated.

    See Also
    ========
    sympy.core.decorators.deprecated

    Nc                 C   s   ||||||f| _ d| _|std|stdd||f | _|r*|  jd| 7  _|r5|  jd| 7  _|s;td|  jd| 7  _|rVt|tsQd	t| }d
| }nd}|  j|7  _d S )N z7feature is required argument of SymPyDeprecationWarningzJdeprecated_since_version is a required argument of SymPyDeprecationWarningz'%s has been deprecated since SymPy %s. z/It will be last supported in SymPy version %s. zUse %s instead. zThe issue argument of SymPyDeprecationWarning is required.
This should be a separate issue with the "Deprecation Removal" label. See
https://github.com/sympy/sympy/wiki/Deprecating-policy.z<See https://github.com/sympy/sympy/issues/%d for more info. z(%s) )argsfullMessage
ValueError
isinstancestrrepr)selfvalueZfeatureZlast_supported_versionZ
useinsteadZissueZdeprecated_since_version r   </usr/lib/python3/dist-packages/sympy/utilities/exceptions.py__init__   s8   

z SymPyDeprecationWarning.__init__c                 C   s   dt | j S )Nz
%s
)r   r   )r   r   r   r   __str__   s   zSymPyDeprecationWarning.__str__   c                 C   s   t j| |d d S )N)
stacklevel)warningswarn)r   r   r   r   r   r      s   zSymPyDeprecationWarning.warn)NNNNNN)r   )__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   
   s    z
+r   once)r   r   Zsympy.utilities.miscr   DeprecationWarningr   simplefilterr   r   r   r   <module>   s     1