Use Python 3 style print function.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
|
||||
BASE_PATH = 'mayan/apps'
|
||||
@@ -7,7 +9,7 @@ BASE_PATH = 'mayan/apps'
|
||||
|
||||
def print_views_summary(module_filename):
|
||||
with open(module_filename) as file_object:
|
||||
print ' module:', module_filename
|
||||
print(' module:', module_filename)
|
||||
count_class_based_views = 0
|
||||
count_function_based_views = 0
|
||||
for line in file_object:
|
||||
@@ -17,20 +19,20 @@ def print_views_summary(module_filename):
|
||||
if line.startswith('def') and 'request' in line:
|
||||
count_function_based_views += 1
|
||||
|
||||
print ' class based views: {}'.format(count_class_based_views)
|
||||
print ' function based views: {}'.format(count_function_based_views)
|
||||
print(' class based views: {}'.format(count_class_based_views))
|
||||
print(' function based views: {}'.format(count_function_based_views))
|
||||
return count_class_based_views, count_function_based_views
|
||||
|
||||
|
||||
def print_tests_summary(module_filename):
|
||||
with open(module_filename) as file_object:
|
||||
print ' module:', module_filename
|
||||
print(' module:', module_filename)
|
||||
count_tests = 0
|
||||
for line in file_object:
|
||||
if line.startswith(' def test'):
|
||||
count_tests += 1
|
||||
|
||||
print ' tests: {}'.format(count_tests)
|
||||
print(' tests: {}'.format(count_tests))
|
||||
return count_tests
|
||||
|
||||
|
||||
@@ -47,10 +49,10 @@ if __name__ == '__main__':
|
||||
for app_name in sorted(os.listdir(BASE_PATH)):
|
||||
if app_name != '__init__.py':
|
||||
count_totals['Apps'] += 1
|
||||
print '\n\nApp name: {}'.format(app_name)
|
||||
print('\n\nApp name: {}'.format(app_name))
|
||||
app_path = os.path.join(BASE_PATH, app_name)
|
||||
|
||||
print '\n Views'
|
||||
print('\n Views')
|
||||
try:
|
||||
module_filename = os.path.join(app_path, 'views.py')
|
||||
count_class_based_views, count_function_based_views = print_views_summary(module_filename=module_filename)
|
||||
@@ -69,9 +71,9 @@ if __name__ == '__main__':
|
||||
count_totals['Function based views'] += count_function_based_views
|
||||
except OSError:
|
||||
# No views directory, skip app
|
||||
print ' No views'
|
||||
print(' No views')
|
||||
|
||||
print '\n API Views'
|
||||
print('\n API Views')
|
||||
try:
|
||||
module_filename = os.path.join(app_path, 'api_views.py')
|
||||
count_class_based_views, count_function_based_views = print_views_summary(module_filename=module_filename)
|
||||
@@ -80,9 +82,9 @@ if __name__ == '__main__':
|
||||
|
||||
except IOError:
|
||||
# No API views directory, skip app
|
||||
print ' No API views'
|
||||
print(' No API views')
|
||||
|
||||
print '\n Tests'
|
||||
print('\n Tests')
|
||||
module_path = os.path.join(app_path, 'tests')
|
||||
try:
|
||||
for module_name in os.listdir(module_path):
|
||||
@@ -94,10 +96,10 @@ if __name__ == '__main__':
|
||||
|
||||
except OSError:
|
||||
# No tests directory, skip app
|
||||
print ' No tests'
|
||||
print(' No tests')
|
||||
|
||||
print '-' * 10
|
||||
print('-' * 10)
|
||||
|
||||
print 'Totals:'
|
||||
print('Totals:')
|
||||
for key, value in count_totals.items():
|
||||
print ' {}: {}'.format(key, value)
|
||||
print(' {}: {}'.format(key, value))
|
||||
|
||||
Reference in New Issue
Block a user