From 97b43c78cec183510ed1fece989dfacffc35e0d1 Mon Sep 17 00:00:00 2001 From: "Albert ARIBAUD (3ADEV)" Date: Tue, 5 Jan 2016 13:28:42 +0100 Subject: [PATCH] Run all Python code through autopep8 Run all Python code through autopep8 as follows: autopep8 -ri --ignore=E261,E262,E302 --max-line-length 1000 . E261 or E262 would cause spaces after a comment's hash sign to be squashed. Since some of the comments in cppcheck's Python code have space-indented code examples, not ignoring E261 or E262 would wreck the formatting of those examples. E302 prevents autopep8 from adding some blank lines. setting --max-line-width ensures no line will be wrapped. --- tools/daca2-addons.py | 4 ++-- tools/daca2-download.py | 4 ++-- tools/daca2.py | 4 ++-- tools/matchcompiler.py | 2 +- tools/rundaca2.py | 6 ++---- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tools/daca2-addons.py b/tools/daca2-addons.py index 12fdbb635..3b0967884 100644 --- a/tools/daca2-addons.py +++ b/tools/daca2-addons.py @@ -89,14 +89,14 @@ def removeAllExceptResults(): shutil.rmtree(filename, onerror=handleRemoveReadonly) elif filename != 'results.txt': os.remove(filename) - except WindowsError, err: + except WindowsError as err: time.sleep(30) if count == 0: print('Failed to cleanup files/folders') print(err) sys.exit(1) continue - except OSError, err: + except OSError as err: time.sleep(30) if count == 0: print('Failed to cleanup files/folders') diff --git a/tools/daca2-download.py b/tools/daca2-download.py index 3802c3f38..d5838834b 100644 --- a/tools/daca2-download.py +++ b/tools/daca2-download.py @@ -90,14 +90,14 @@ def removeAll(): shutil.rmtree(filename, onerror=handleRemoveReadonly) else: os.remove(filename) - except WindowsError, err: + except WindowsError as err: time.sleep(30) if count == 0: print('Failed to cleanup files/folders') print(err) sys.exit(1) continue - except OSError, err: + except OSError as err: time.sleep(30) if count == 0: print('Failed to cleanup files/folders') diff --git a/tools/daca2.py b/tools/daca2.py index 920dd7833..3113a525d 100644 --- a/tools/daca2.py +++ b/tools/daca2.py @@ -89,14 +89,14 @@ def removeAllExceptResults(): shutil.rmtree(filename, onerror=handleRemoveReadonly) elif filename != 'results.txt': os.remove(filename) - except WindowsError, err: + except WindowsError as err: time.sleep(30) if count == 0: print('Failed to cleanup files/folders') print(err) sys.exit(1) continue - except OSError, err: + except OSError as err: time.sleep(30) if count == 0: print('Failed to cleanup files/folders') diff --git a/tools/matchcompiler.py b/tools/matchcompiler.py index 8f692b804..9b2dc346c 100755 --- a/tools/matchcompiler.py +++ b/tools/matchcompiler.py @@ -84,7 +84,7 @@ class MatchCompiler: if tok == '%any%': return 'true' elif tok == '%assign%': - return 'tok->isAssignmentOp()' + return 'tok->isAssignmentOp()' elif tok == '%bool%': return 'tok->isBoolean()' elif tok == '%char%': diff --git a/tools/rundaca2.py b/tools/rundaca2.py index e250565a8..66f084cbb 100644 --- a/tools/rundaca2.py +++ b/tools/rundaca2.py @@ -59,14 +59,12 @@ def daca2(foldernum): # run cppcheck addons subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2/' + folder)]) subprocess.call(['nice', '--adjustment=19', 'python', os.path.expanduser('~/cppcheck/tools/daca2-addons.py'), folder, '--rev=' + rev]) - upload(os.path.expanduser('~/daca2/'+folder+'/results.txt'), 'evidente/addons-'+folder+'.txt') + upload(os.path.expanduser('~/daca2/' + folder + '/results.txt'), 'evidente/addons-' + folder + '.txt') subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2/lib' + folder)]) subprocess.call(['nice', '--adjustment=19', 'python', os.path.expanduser('~/cppcheck/tools/daca2-addons.py'), 'lib' + folder, '--rev=' + rev]) - upload(os.path.expanduser('~/daca2/lib'+folder+'/results.txt'), 'evidente/addons-lib'+folder+'.txt') + upload(os.path.expanduser('~/daca2/lib' + folder + '/results.txt'), 'evidente/addons-lib' + folder + '.txt') foldernum = 0 while True: daca2(foldernum) foldernum = foldernum + 1 - -