cmdutils: Bail out if instance is given but function takes no self.
This commit is contained in:
parent
319ea242da
commit
cd8d137dd6
@ -224,6 +224,9 @@ class register: # pylint: disable=invalid-name
|
||||
if 'self' in signature.parameters and self.instance is None:
|
||||
raise TypeError("{} is a class method, but instance was not "
|
||||
"given!".format(self.name[0]))
|
||||
elif 'self' not in signature.parameters and self.instance is not None:
|
||||
raise TypeError("{} is not a class method, but instance was "
|
||||
"given!".format(self.name[0]))
|
||||
has_count = 'count' in signature.parameters
|
||||
doc = inspect.getdoc(self.func)
|
||||
if doc is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user