Various Python samples updated for Python 2/3 compatibility.
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
Utility for measuring python opencv API coverage by samples.
|
||||
'''
|
||||
|
||||
# Python 2/3 compatibility
|
||||
from __future__ import print_function
|
||||
|
||||
from glob import glob
|
||||
import cv2
|
||||
import re
|
||||
@@ -13,7 +16,7 @@ if __name__ == '__main__':
|
||||
|
||||
found = set()
|
||||
for fn in glob('*.py'):
|
||||
print ' --- ', fn
|
||||
print(' --- ', fn)
|
||||
code = open(fn).read()
|
||||
found |= set(re.findall('cv2?\.\w+', code))
|
||||
|
||||
@@ -23,4 +26,4 @@ if __name__ == '__main__':
|
||||
f.write('\n'.join(sorted(cv2_unused)))
|
||||
|
||||
r = 1.0 * len(cv2_used) / len(cv2_callable)
|
||||
print '\ncv2 api coverage: %d / %d (%.1f%%)' % ( len(cv2_used), len(cv2_callable), r*100 )
|
||||
print('\ncv2 api coverage: %d / %d (%.1f%%)' % ( len(cv2_used), len(cv2_callable), r*100 ))
|
||||
|
Reference in New Issue
Block a user