/usr/lib/python3/dist-packages/pylxd/deprecation.py is in python3-pylxd 2.2.6-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import warnings
warnings.simplefilter('once', DeprecationWarning)
class deprecated(): # pragma: no cover
"""A decorator for warning about deprecation warnings.
The decorator takes an optional message argument. This message can
be used to direct the user to a new API or specify when it will
be removed.
"""
DEFAULT_MESSAGE = '{} is deprecated and will be removed soon.'
def __init__(self, message=None):
self.message = message
def __call__(self, f):
def wrapped(*args, **kwargs):
if self.message is None:
self.message = self.DEFAULT_MESSAGE.format(
f.__name__)
warnings.warn(self.message, DeprecationWarning)
return f(*args, **kwargs)
return wrapped
|