# -*- coding: utf8 -*- """ SPARQL Wrapper Utils @authors: U{Ivan Herman}, U{Sergio Fernández}, U{Carlos Tejo Alonso} @organization: U{World Wide Web Consortium} and U{Foundation CTIC}. @license: U{W3C SOFTWARE NOTICE AND LICENSE} """ 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. @see: http://code.activestate.com/recipes/391367/ """ def newFunc(*args, **kwargs): warnings.warn("Call to deprecated function %s." % func.__name__, category=DeprecationWarning, stacklevel=2) return func(*args, **kwargs) newFunc.__name__ = func.__name__ newFunc.__doc__ = func.__doc__ newFunc.__dict__.update(func.__dict__) return newFunc