Fix pylint 2.0 return-related violations

Aiming to support pylint 2.0 some functions and methods must have their
return statements updated in order to fix two new violations:

- `useless-return` (R1711):
  Useless return at end of function or method Emitted when a single
  "return" or "return None" statement is found at the end of function
  or method definition. This statement can safely be removed because
  Python will implicitly return None

- `inconsistent-return-statements` (R1710):
  Either all return statements in a function should return an
  expression, or none of them should. According to PEP8, if any return
  statement returns an expression, any return statements where no value
  is returned should explicitly state this as return None, and an
  explicit return statement should be present at the end of the
  function (if reachable)

Issue: https://pagure.io/freeipa/issue/7614

Signed-off-by: Armando Neto <abiagion@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Armando Neto authored and Christian Heimes committed 2018-07-11 10:11:38 +02:00
1 parent 9222a08c28
commit b4ad0d19a2
29 files changed
+56 -42

No files matched your search

+2 -3
View File
@@ -275,8 +275,6 @@ class Configurable(six.with_metaclass(abc.ABCMeta, object)):
def group(cls):
assert not hasattr(super(Configurable, cls), 'group')
return None
def __init__(self, **kwargs):
"""
Initialize the configurable.
@@ -339,7 +337,7 @@ class Configurable(six.with_metaclass(abc.ABCMeta, object)):
raise TypeError("{0} is not composite".format(self))
def _get_fallback(self):
return None
pass
@abc.abstractmethod
def _configure(self):
@@ -362,6 +360,7 @@ class Configurable(six.with_metaclass(abc.ABCMeta, object)):
self.validate()
if self.__state == _EXECUTE_PENDING:
return self.execute()
return None
def validate(self):
"""