From 0cb0fee339883adeb93f787b5cc19e5293463c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Mon, 11 Mar 2013 23:21:52 +0100 Subject: [PATCH] Remove duplicate code for alternative function --- skimage/_shared/utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/skimage/_shared/utils.py b/skimage/_shared/utils.py index 6518f40b..102d4214 100644 --- a/skimage/_shared/utils.py +++ b/skimage/_shared/utils.py @@ -25,9 +25,12 @@ class deprecated(object): def __call__(self, func): - msg = 'Call to deprecated function `%s`.' % func.__name__ + alt_msg = '' if self.alt_func is not None: - msg += ' Use `%s` instead.' % self.alt_func + alt_msg = ' Use `%s` instead.' % self.alt_func + + msg = 'Call to deprecated function `%s`.' % func.__name__ + msg += alt_msg @functools.wraps(func) def wrapped(*args, **kwargs): @@ -41,10 +44,7 @@ class deprecated(object): return func(*args, **kwargs) # modify doc string to display deprecation warning - doc = 'Deprecated function.' - if self.alt_func is not None: - doc += ' Use `%s` instead.' % self.alt_func - + doc = 'Deprecated function.' + alt_msg if wrapped.__doc__ is None: wrapped.__doc__ = doc else: