Minor fixes to python scripts by pycodestyle

This commit is contained in:
Marcus Näslund 2018-04-19 15:02:15 +02:00 committed by Martin Hořeňovský
parent 64be2ad96c
commit 9e7c281e6e
9 changed files with 35 additions and 33 deletions

View file

@ -4,19 +4,20 @@ from __future__ import print_function
import os
from scriptCommon import catchPath
changedFiles = 0
def isSourceFile( path ):
return path.endswith( ".cpp" ) or path.endswith( ".h" ) or path.endswith( ".hpp" )
def fixAllFilesInDir( dir ):
changedFiles = 0
for f in os.listdir( dir ):
path = os.path.join( dir,f )
if os.path.isfile( path ):
if isSourceFile( path ):
fixFile( path )
if fixFile( path ):
changedFiles += 1
else:
fixAllFilesInDir( path )
return changedFiles
def fixFile( path ):
f = open( path, 'r' )
@ -41,8 +42,10 @@ def fixFile( path ):
f2.write( line )
f2.close()
os.remove( altPath )
return True
return False
fixAllFilesInDir(catchPath)
changedFiles = fixAllFilesInDir(catchPath)
if changedFiles > 0:
print( "Fixed " + str(changedFiles) + " file(s)" )
else: