Fix pylint warnings inconsistent-return-statements

Add consistent return to all functions and methods that are covered by
tox -e pylint[23]. I haven't checked if return None is always a good
idea or if we should rather raise an error.

See: https://pagure.io/freeipa/issue/7326
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Christian Heimes
2017-12-15 17:00:04 +01:00
parent a7ae2dbc5f
commit 8cb756a229
14 changed files with 85 additions and 26 deletions

View File

@@ -368,17 +368,17 @@ class Env(object):
:param config_file: Path of the configuration file to load.
"""
if not path.isfile(config_file):
return
return None
parser = RawConfigParser()
try:
parser.read(config_file)
except ParsingError:
return
return None
if not parser.has_section(CONFIG_SECTION):
parser.add_section(CONFIG_SECTION)
items = parser.items(CONFIG_SECTION)
if len(items) == 0:
return (0, 0)
return 0, 0
i = 0
for (key, value) in items:
if key not in self:
@@ -386,7 +386,7 @@ class Env(object):
i += 1
if 'config_loaded' not in self: # we loaded at least 1 file
self['config_loaded'] = True
return (i, len(items))
return i, len(items)
def _join(self, key, *parts):
"""
@@ -401,6 +401,8 @@ class Env(object):
"""
if key in self and self[key] is not None:
return path.join(self[key], *parts)
else:
return None
def __doing(self, name):
if name in self.__done: