deprecated

sknano.core.meta.deprecated(since=None, message=None, name=None, alternative=None, pending=False, obj_type='function')[source] [edit on github][source]

Decorator to mark a function as deprecated.

Modified implementation of matplotlib’s matplotlib.cbook.deprecated function.

Parameters:
  • since (str, optional) – The release at which this API became deprecated.
  • message (str, optional) – Override the default deprecation message. The format specifier %(func)s may be used for the name of the function, and %(alternative)s may be used in the deprecation message to insert the name of an alternative to the deprecated function. %(obj_type)s may be used to insert a friendly name for the type of object being deprecated.
  • name (str, optional) –

    The name of the deprecated function; if not provided the name is automatically determined from the passed in function, though this is useful in the case of renamed functions, where the new function is just assigned to the name of the deprecated function. For example:

    >>> def new_function():
    

    ... >>> oldFunction = new_function

  • alternative (str, optional) – An alternative function that the user may use in place of the deprecated function. The deprecation warning will tell the user about this alternative if provided.
  • pending (bool, optional) – If True, uses a PendingDeprecationWarning instead of a DeprecationWarning.

Examples

Basic example:

>>> from sknano.core import deprecated
>>> @deprecated()

... def f(): ... pass ... >>> f() DeprecationWarning: The f function is deprecated.