Merge "Updated pylint rules"

This commit is contained in:
Jenkins 2017-01-24 19:37:53 +00:00 committed by Gerrit Code Review
commit f6973f5750
6 changed files with 17 additions and 19 deletions

View File

@ -16,8 +16,7 @@ extension-pkg-whitelist=
disable=all
enable=bad-indentation,bad-builtin,pointless-statement,bad-continuation, unidiomatic-typecheck,method-hidden,lost-exception,attribute-defined-outside-init,expression-not-assigned,anomalous-backslash-in-string,wildcard-import,unreachable,unused-variable
enable=bad-indentation,bad-builtin,pointless-statement,bad-continuation,unidiomatic-typecheck,method-hidden,lost-exception,attribute-defined-outside-init,expression-not-assigned,anomalous-backslash-in-string,wildcard-import,unreachable,unused-variable,blacklisted-name,logging-format-interpolation,cylic-import
[REPORTS]
output-format=text
reports=yes

View File

@ -34,8 +34,7 @@ def hash_it(data, hash_type="sha256"):
hash_obj.update(data.encode())
return hash_obj.hexdigest()
except (TypeError, AttributeError) as e:
LOG.error("Couldn't hash the data, exception raised, {},"
" returning default hash".format(e))
LOG.error("Couldn't hash the data, exception raised: %s", e)
return hash(data)
@ -51,7 +50,7 @@ def hmac_it(data, key, hash_type="sha256"):
h_digest = hmac.new(key.encode(), data.encode(), hash_obj)
return h_digest.hexdigest()
except (TypeError, AttributeError) as e:
LOG.error("Couldn't hash the data, exception raised, {}".format(e))
LOG.error("Couldn't hash the data, exception raised: %s", e)
def epoch_time(offset=0):
@ -59,8 +58,8 @@ def epoch_time(offset=0):
try:
return time.time() - offset
except TypeError as e:
LOG.error("Couldn't reduce offset, {}, from epoch time, ex {}.".format(
offset, e))
LOG.error("Couldn't reduce offset, %s, from epoch time, ex %s.",
offset, e)
return time.time()
@ -76,7 +75,7 @@ def base64_encode(data):
try:
data = base64.b64encode(data.encode())
except TypeError as e:
LOG.error("Couldn't encode data to base64, {}".format(e))
LOG.error("Couldn't encode data to base64: %s", e)
return data
@ -85,5 +84,5 @@ def url_encode(url):
try:
return six.moves.urllib.parse.quote_plus(url)
except TypeError as e:
LOG.error("Couldn't encode the URL, {}".format(e))
LOG.error("Couldn't encode the URL: %s", e)
return url

View File

@ -42,8 +42,8 @@ class BaseIdentityModel(object):
except Exception as serialization_exception:
self._log.error(
'Error occured during serialization of a data model into'
'the "{0}: \n{1}" format'.format(
format_type, serialization_exception))
'the "%s: \n%s" format',
format_type, serialization_exception)
self._log.exception(serialization_exception)
@classmethod

View File

@ -228,8 +228,8 @@ class Runner(object):
CONF.log_opt_values(LOG, logging.DEBUG)
if not file_path.endswith(".template"):
LOG.debug(
'file.......: {0} (SKIPPED - not a .template file)'.format(
file_path))
'file.......: %s (SKIPPED - not a .template file)',
file_path)
continue
test_names = [t for (t, _) in list_of_tests]
@ -340,15 +340,15 @@ class Runner(object):
test_cases = list(
test_class.get_test_cases(file_path, req_str))
if len(test_cases) > 0:
bar = cli.ProgressBar(
p_bar = cli.ProgressBar(
message=result_string, total_len=len(test_cases))
last_failures = result.stats["failures"]
last_errors = result.stats["errors"]
for test in test_cases:
if test:
cls.run_test(test, result)
bar.increment(1)
bar.print_bar()
p_bar.increment(1)
p_bar.print_bar()
failures = result.stats["failures"] - last_failures
errors = result.stats["errors"] - last_errors
total_tests = len(test_cases)

View File

@ -48,7 +48,7 @@ def get_user_home_root():
except OSError as e:
# Refer https://mail.python.org/pipermail/python-bugs-list/
# 2002-July/012691.html
LOG.error("Exception thrown in : {}".format(e))
LOG.error("Exception thrown in : %s", e)
user = pwd.getpwuid(os.getuid())[0]
home_path = "~{0}/{1}".format(user, FOLDER)
return expand_path(home_path)

View File

@ -137,8 +137,8 @@ def get(uri, cache_dir=None):
temp = tempfile.TemporaryFile(dir=os.path.abspath(user_base_dir))
temp.close()
except OSError:
LOG.error("Failed to write remote files to: {}".format(
os.path.abspath(user_base_dir)))
LOG.error("Failed to write remote files to: %s",
os.path.abspath(user_base_dir))
exit(1)
abs_path = download(uri, os.path.abspath(user_base_dir))
else: