Commit 7fc548e9 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

ht.WithDesc: Work around pylint warning

Explicitely defining “__call__” silences a pylint warning when wrapped
type check functions are used directly. I had no idea pylint is this
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent b795a775
......@@ -45,6 +45,29 @@ def Parens(text):
return "(%s)" % text
class _DescWrapper(object):
__slots__ = [
def __init__(self, text, fn):
"""Initializes this class.
@param text: Description
@param fn: Wrapped function
self._text = text
self._fn = fn
def __call__(self, *args):
return self._fn(*args)
def __str__(self):
return self._text
def WithDesc(text):
"""Builds wrapper class with description text.
......@@ -55,21 +78,7 @@ def WithDesc(text):
assert text[0] == text[0].upper()
class wrapper(object): # pylint: disable-msg=C0103
__slots__ = ["__call__"]
def __init__(self, fn):
"""Initializes this class.
@param fn: Wrapped function
self.__call__ = fn
def __str__(self):
return text
return wrapper
return compat.partial(_DescWrapper, text)
def CombinationDesc(op, args, fn):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment