katana/qstringarg.py
Ivailo Monev 19a5facae5 generic: add usefull scripts
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2016-01-28 00:02:33 +02:00

24 lines
646 B
Python
Executable file

#!/usr/bin/python2
# a script to check for possible optimization of QString formatter
# if you are going to apply changes make sure you do not mix types,
# the method has several overloads!
import os, re
regex = re.compile('\.arg\(')
for root, ldirs, lfiles in os.walk(os.getcwd()):
for sfile in lfiles:
sfull = '%s/%s' % (root, sfile)
if '/.git/' in sfull:
continue
printfile = False
with open(sfull, 'r') as f:
for sline in f.readlines():
if len(regex.findall(sline)) > 1:
printfile = True
break
if printfile:
print(sfull)