1234567891011121314151617181920 |
- # -*- coding: utf-8 -*-
- # Copyright (C) 2015-2016 Peter Magnusson <peter@birchroad.net>
- """Decorators used in the module"""
- import warnings
- def deprecated(func):
- """This is a decorator which can be used to mark functions
- as deprecated. It will result in a warning being emmitted
- when the function is used."""
- def new_func(*args, **kwargs):
- """whatever"""
- warnings.warn("Call to deprecated function %s." % func.__name__,
- category=DeprecationWarning)
- return func(*args, **kwargs)
- new_func.__name__ = func.__name__
- new_func.__doc__ = func.__doc__
- new_func.__dict__.update(func.__dict__)
- return new_func
|