diff options
author | Domenic Denicola <d@domenic.me> | 2014-12-01 15:46:34 -0500 |
---|---|---|
committer | Domenic Denicola <d@domenic.me> | 2014-12-01 15:52:19 -0500 |
commit | dd243a757c695c3000f27e2c71ed41964cb33119 (patch) | |
tree | fd1f1bc6596d7dd58288a60ff663c448613e48f3 /tools/misc | |
parent | bbeafbd3c6082e4d30e76b5867f12b5458c4e9e8 (diff) | |
download | qtdeclarative-testsuites-dd243a757c695c3000f27e2c71ed41964cb33119.tar.gz |
Remove trailing whitespace from the Python
Diffstat (limited to 'tools/misc')
-rw-r--r-- | tools/misc/FindTestCaseIssues.py | 18 | ||||
-rw-r--r-- | tools/misc/FixLicenseHeader.py | 28 | ||||
-rw-r--r-- | tools/misc/FixPathsAndIds.py | 20 | ||||
-rw-r--r-- | tools/misc/FixTestCasePlacement.py | 26 | ||||
-rw-r--r-- | tools/misc/InvalidTestDetector.py | 14 |
5 files changed, 53 insertions, 53 deletions
diff --git a/tools/misc/FindTestCaseIssues.py b/tools/misc/FindTestCaseIssues.py index e89a0f2b1..c23248c5a 100644 --- a/tools/misc/FindTestCaseIssues.py +++ b/tools/misc/FindTestCaseIssues.py @@ -1,7 +1,7 @@ -# Copyright (c) 2012 Ecma International. All rights reserved. +# Copyright (c) 2012 Ecma International. All rights reserved. # Ecma International makes this code available under the terms and conditions set -# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the -# "Use Terms"). Any redistribution of this code must retain the above +# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +# "Use Terms"). Any redistribution of this code must retain the above # copyright and this notice and otherwise comply with the Use Terms. #--Imports--------------------------------------------------------------------- @@ -34,7 +34,7 @@ def getAllJSFiles(dirName): def handleFile(filePath): with open(filePath, "r") as f: origLines = f.readlines() - + testCase = False runTestCaseCalled = False for line in origLines: @@ -42,15 +42,15 @@ def handleFile(filePath): testCase = True if runTestCaseRe.search(line)!=None: runTestCaseCalled = True - + if testCase==True and runTestCaseCalled==True: pass #print "testcase TEST:", filePath elif testCase==False and runTestCaseCalled==False: pass #print "GLOBAL TEST:", filePath else: print "ERROR:", filePath - - + + #--Main------------------------------------------------------------------------ if __name__=="__main__": @@ -61,8 +61,8 @@ if __name__=="__main__": if not os.path.exists(ARGS.tpath): print "Cannot examine tests in '%s' when it doesn't exist!" % ARGS.tpath sys.exit(1) - + ALL_JS_FILES = getAllJSFiles(ARGS.tpath) for fileName in ALL_JS_FILES: handleFile(fileName) - print "Done!"
\ No newline at end of file + print "Done!" diff --git a/tools/misc/FixLicenseHeader.py b/tools/misc/FixLicenseHeader.py index f5124c300..372a66743 100644 --- a/tools/misc/FixLicenseHeader.py +++ b/tools/misc/FixLicenseHeader.py @@ -1,7 +1,7 @@ -# Copyright (c) 2012 Ecma International. All rights reserved. +# Copyright (c) 2012 Ecma International. All rights reserved. # Ecma International makes this code available under the terms and conditions set -# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the -# "Use Terms"). Any redistribution of this code must retain the above +# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +# "Use Terms"). Any redistribution of this code must retain the above # copyright and this notice and otherwise comply with the Use Terms. #--Imports--------------------------------------------------------------------- @@ -12,10 +12,10 @@ import re import codecs #--Globals--------------------------------------------------------------------- -ECMA_LICENSE = '''/// Copyright (c) 2012 Ecma International. All rights reserved. +ECMA_LICENSE = '''/// Copyright (c) 2012 Ecma International. All rights reserved. /// Ecma International makes this code available under the terms and conditions set -/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the -/// "Use Terms"). Any redistribution of this code must retain the above +/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +/// "Use Terms"). Any redistribution of this code must retain the above /// copyright and this notice and otherwise comply with the Use Terms. ''' @@ -50,12 +50,12 @@ def handleFile(filePath): ''' with open(filePath, "rb") as f: origLines = f.readlines() - + #See if it's already there if NEW_LICENSE_FIRST_LINE.search(origLines[0])!=None: #print "\talready there:\t", filePath return - #TODO: Google employee needs to remove this elif + #TODO: Google employee needs to remove this elif # and fix the next elif clause elif GOOGLE_RE.search(filePath)!=None: if DEBUG: @@ -65,13 +65,13 @@ def handleFile(filePath): errMsg = "\tno idea which license should be used for:\t" + filePath raise Exception(errMsg) return - + with codecs.open(filePath,'r','utf8') as f: bomPresent = f.read(2).startswith(u"\ufeff") if bomPresent: print "\tnon-ASCII file detected. Please modify by hand:", filePath return - + with open(filePath, "wb") as f: if DEBUG: print "\tmodified:\t", filePath @@ -80,14 +80,14 @@ def handleFile(filePath): # print "\tBOM was detected for:", filePath # f.write(u"\ufeff") f.write(ECMA_LICENSE) - + writeIt = False for line in origLines: if writeIt: f.write(line) elif OLD_LICENSE_LAST_LINE.search(line)!=None: writeIt = True - + if not writeIt: print "\tError - didn't find end of the original license:\t", filePath @@ -100,8 +100,8 @@ if __name__=="__main__": if not os.path.exists(ARGS.tpath): print "Cannot fix tests in '%s' when it doesn't exist!" % ARGS.tpath sys.exit(1) - + ALL_JS_FILES = getAllJSFiles(ARGS.tpath) for fileName in ALL_JS_FILES: handleFile(fileName) - print "Done!"
\ No newline at end of file + print "Done!" diff --git a/tools/misc/FixPathsAndIds.py b/tools/misc/FixPathsAndIds.py index 81302de69..d9cb6a058 100644 --- a/tools/misc/FixPathsAndIds.py +++ b/tools/misc/FixPathsAndIds.py @@ -1,7 +1,7 @@ -# Copyright (c) 2012 Ecma International. All rights reserved. +# Copyright (c) 2012 Ecma International. All rights reserved. # Ecma International makes this code available under the terms and conditions set -# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the -# "Use Terms"). Any redistribution of this code must retain the above +# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +# "Use Terms"). Any redistribution of this code must retain the above # copyright and this notice and otherwise comply with the Use Terms. #--Imports--------------------------------------------------------------------- @@ -34,15 +34,15 @@ def handleFile(filePath, partialPath): global PRE_PATH tempPath = filePath.replace(partialPath + os.path.sep, "", 1) tempPath = tempPath.replace(os.path.sep, "/") - + with open(filePath, "rb") as f: origLines = f.readlines() - + with open(filePath, "wb") as f: pathHit = False #testHit = False #descriptHit = False - + for line in origLines: #TODO? #if (not testHit) and re.match("^$", line)!=None: @@ -56,8 +56,8 @@ def handleFile(filePath, partialPath): if line.endswith("\r\n"): lineEnding = "\r\n" pathHit = True - line = re.sub(r"@path\s+[^$]+$", #"\"[^\"]*\"", - r"@path %s%s" % (PRE_PATH + tempPath, lineEnding), + line = re.sub(r"@path\s+[^$]+$", #"\"[^\"]*\"", + r"@path %s%s" % (PRE_PATH + tempPath, lineEnding), line) #TODO? #elif (not descriptHit) and re.search("description\s*:\s*\"", line)!=None: @@ -74,8 +74,8 @@ if __name__=="__main__": if not os.path.exists(ARGS.tpath): print "Cannot fix tests in '%s' when it doesn't exist!" % ARGS.tpath sys.exit(1) - + ALL_JS_FILES = getAllJSFiles(ARGS.tpath) for fileName in ALL_JS_FILES: handleFile(fileName, ARGS.tpath) - print "Done!"
\ No newline at end of file + print "Done!" diff --git a/tools/misc/FixTestCasePlacement.py b/tools/misc/FixTestCasePlacement.py index 570a8de11..d95b17471 100644 --- a/tools/misc/FixTestCasePlacement.py +++ b/tools/misc/FixTestCasePlacement.py @@ -1,7 +1,7 @@ -# Copyright (c) 2012 Ecma International. All rights reserved. +# Copyright (c) 2012 Ecma International. All rights reserved. # Ecma International makes this code available under the terms and conditions set -# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the -# "Use Terms"). Any redistribution of this code must retain the above +# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +# "Use Terms"). Any redistribution of this code must retain the above # copyright and this notice and otherwise comply with the Use Terms. #--Imports--------------------------------------------------------------------- @@ -32,20 +32,20 @@ def getAllJSFiles(dirName): #------------------------------------------------------------------------------ def handleFile(filePath, partialPath): global PRE_PATH - + tempPath = filePath.replace(partialPath + os.path.sep, "", 1) tempPath = tempPath.replace(os.path.sep, "/") tempId = tempPath.rsplit("/", 1)[1][:-3] - + with open(filePath, "r") as f: origLines = f.readlines() - + with open(filePath, "w") as f: pathHit = False idHit = False testHit = False descriptHit = False - + for line in origLines: if (not testHit) and re.match("^$", line)!=None: #Throw away empty lines until we hit the first test function @@ -71,7 +71,7 @@ def getPartialPath(tc): sys.exit(1) elif not ("." in tc): tc = tc.replace("-", ".0-", 1) - + #Generate the partial path of the test case tempList = tc.split("-",1)[0].split(".") partialPath = "" @@ -96,15 +96,15 @@ if __name__=="__main__": help='Command used to remove a test file from source control') __parser.add_argument('tc', action='store', help='test case to move') - + ARGS = __parser.parse_args() if not os.path.exists(ARGS.path): print "Cannot fix tests in '%s' when it doesn't exist!" % ARGS.path sys.exit(1) elif not os.path.isfile(ARGS.tc): print "Cannot move '%s' when it doesn't exist!" % ARGS.tc - + partialPath = getPartialPath(ARGS.tc) - - - print "Done!", partialPath
\ No newline at end of file + + + print "Done!", partialPath diff --git a/tools/misc/InvalidTestDetector.py b/tools/misc/InvalidTestDetector.py index edf813a91..795781918 100644 --- a/tools/misc/InvalidTestDetector.py +++ b/tools/misc/InvalidTestDetector.py @@ -1,7 +1,7 @@ -# Copyright (c) 2012 Ecma International. All rights reserved. +# Copyright (c) 2012 Ecma International. All rights reserved. # Ecma International makes this code available under the terms and conditions set -# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the -# "Use Terms"). Any redistribution of this code must retain the above +# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +# "Use Terms"). Any redistribution of this code must retain the above # copyright and this notice and otherwise comply with the Use Terms. #--Imports--------------------------------------------------------------------- @@ -14,7 +14,7 @@ import re #List of regular expressions covering suspect code snippets which might be #invalid from an ES5 POV -QUESTIONABLE_RE_LIST = ["window", +QUESTIONABLE_RE_LIST = ["window", "document(?!ation)", "alert", "setTimeout", @@ -42,7 +42,7 @@ def getAllJSFiles(dirName): def handleFile(filePath): with open(filePath, "r") as f: origLines = f.readlines() - + for line in origLines: for tempRe in QUESTIONABLE_RE_LIST: if tempRe.search(line)!=None: @@ -58,8 +58,8 @@ if __name__=="__main__": if not os.path.exists(ARGS.tpath): print "Cannot examine tests in '%s' when it doesn't exist!" % ARGS.tpath sys.exit(1) - + ALL_JS_FILES = getAllJSFiles(ARGS.tpath) for fileName in ALL_JS_FILES: handleFile(fileName) - print "Done!"
\ No newline at end of file + print "Done!" |