diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2009-06-29 16:53:18 +0200 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2009-06-29 16:53:18 +0200 |
commit | b85ce269cf16e68fcc5ae407b2582fd6b1b526ce (patch) | |
tree | 2ebd0f5be7979818675dab0676131734175f7db6 /deprecation.py | |
parent | 1fd66a3f81e81c8816c1cc761e42db07895c466c (diff) | |
download | logilab-common-b85ce269cf16e68fcc5ae407b2582fd6b1b526ce.tar.gz |
d-t-w
Diffstat (limited to 'deprecation.py')
-rw-r--r-- | deprecation.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/deprecation.py b/deprecation.py index b2250ab..0822f07 100644 --- a/deprecation.py +++ b/deprecation.py @@ -12,7 +12,7 @@ from warnings import warn class deprecated(type): """metaclass to print a warning on instantiation of a deprecated class""" - + def __call__(cls, *args, **kwargs): msg = getattr(cls, "__deprecation_warning__", "%s is deprecated" % cls.__name__) @@ -23,7 +23,7 @@ class deprecated(type): def class_renamed(old_name, new_class, message=None): """automatically creates a class which fires a DeprecationWarning when instantiated. - + >>> Set = class_renamed('Set', set, 'Set is now replaced by set') >>> s = Set() sample.py:57: DeprecationWarning: Set is now replaced by set @@ -64,7 +64,7 @@ def deprecated_function(new_func, message=None): """Creates a function which fires a DeprecationWarning when used. For example, if <bar> is deprecated in favour of <foo>: - + >>> bar = deprecated_function(foo, 'bar is deprecated') >>> bar() sample.py:57: DeprecationWarning: bar is deprecated |