Revision afd2fac5a595b966a2722cfbc9d49948b07d2948 authored by Aaron Smith on 03 November 2022, 13:26:31 UTC, committed by GitHub on 03 November 2022, 13:26:31 UTC
* First pass at Python 3.11 support

* Update 'whats new'

* Update build_requirements for different python versions

* Fix docs

* Empty commit for CI

* Use lowest supported numpy (==) for building instead of max compatible (~=)

* Make min numpy 1.21.3

* Use lowest supported version of scipy when building

* More scipy hackery

* https://github.com/scipy/scipy/blob/26a77da3a4ca126a943a331c1aa6ef3915b0d501/pyproject.toml#L41

* More scipy hackery

* Typos

* More typos
1 parent f999f87
Raw File
decorators.py
# -*- coding: utf-8 -*-

import functools
import warnings

__all__ = ['deprecated']


def deprecated(use_instead, notes=None):
    """Mark functions as deprecated.

    This decorator will result in a warning being emitted when the decorated
    function is used.

    Parameters
    ----------
    use_instead : str
        The name of the function to use instead.

    notes : str, optional (default=None)
        Additional notes to add to the warning message.
    """
    if notes is None:
        notes = ""
    else:
        notes = " " + notes

    def wrapped_func(func):
        @functools.wraps(func)
        def _inner(*args, **kwargs):
            warnings.simplefilter('always', DeprecationWarning)  # un-filter
            msg = ("{0} is deprecated and will be removed in a future "
                   "release of pmdarima. Use {1} instead.{2}"
                   .format(func.__name__, use_instead, notes))

            warnings.warn(
                msg,
                category=DeprecationWarning,
                stacklevel=2)
            warnings.simplefilter('default', DeprecationWarning)  # re-filter
            return func(*args, **kwargs)
        return _inner
    return wrapped_func
back to top