Update code quality print statements changes

This commit is contained in:
kuldeep.k@cisinlabs.com 2021-09-29 17:12:29 +05:30
parent fbe9f1024a
commit 32312ff419
No known key found for this signature in database
GPG Key ID: AF4FB299BF7C7C2A

View File

@ -46,13 +46,13 @@ def print_results(results, top, verbose, details):
"""Print an item with the appropriate verbosity / detail""" """Print an item with the appropriate verbosity / detail"""
if verbose and results: if verbose and results:
print ''.join( print(''.join(
[ [
os.linesep, os.linesep,
'total pycodestyle flake8 pylint path_to_file', 'total pycodestyle flake8 pylint path_to_file',
os.linesep, os.linesep,
] ]
) ))
for item in sort_and_slice(results, top): for item in sort_and_slice(results, top):
@ -66,23 +66,23 @@ def print_results(results, top, verbose, details):
) )
else: else:
line = item['path_to_file'] line = item['path_to_file']
print line print(line)
if details: if details:
print "pycodestyle:" print("pycodestyle:")
for detail in flatten(item['pycodestyle_violations']): for detail in flatten(item['pycodestyle_violations']):
print detail print(detail)
print print()
print "flake8:" print("flake8:")
for detail in flatten(item['flake8_violations']): for detail in flatten(item['flake8_violations']):
print detail print(detail)
print print()
print "pylint:" print("pylint:")
for detail in flatten(item['pylint_violations']): for detail in flatten(item['pylint_violations']):
print detail print(detail)
print print()
def sort_and_slice(results, top): def sort_and_slice(results, top):
@ -107,7 +107,7 @@ def generate_file_list(filename):
if filename: if filename:
filename = os.path.abspath(filename) filename = os.path.abspath(filename)
if not os.path.exists(filename): if not os.path.exists(filename):
print "Bad filename, specify a Python file" print("Bad filename, specify a Python file")
sys.exit(1) sys.exit(1)
else: else:
file_list = [filename] file_list = [filename]
@ -303,7 +303,7 @@ def push_docs(path=None):
) )
result = run('ln -sf {0} {1}'.format(WEB_ROOT, VERSION_ROOT)) result = run('ln -sf {0} {1}'.format(WEB_ROOT, VERSION_ROOT))
if result.return_code: if result.return_code:
print 'Linking the new release failed' print('Linking the new release failed')
# More assumptions # More assumptions
sudo('systemctl restart apache2') sudo('systemctl restart apache2')