From dd243a757c695c3000f27e2c71ed41964cb33119 Mon Sep 17 00:00:00 2001
From: Domenic Denicola <d@domenic.me>
Date: Mon, 1 Dec 2014 15:46:34 -0500
Subject: [PATCH] Remove trailing whitespace from the Python

---
 tools/CoverageAnalyzer.py                    | 16 +++----
 tools/misc/FindTestCaseIssues.py             | 18 ++++----
 tools/misc/FixLicenseHeader.py               | 28 ++++++-------
 tools/misc/FixPathsAndIds.py                 | 20 ++++-----
 tools/misc/FixTestCasePlacement.py           | 26 ++++++------
 tools/misc/InvalidTestDetector.py            | 14 +++----
 tools/packaging/common.py                    |  8 ++--
 tools/packaging/monkeyYaml.py                |  6 +--
 tools/packaging/packager.py                  | 40 +++++++++---------
 tools/packaging/packagerConfig.py            | 26 ++++++------
 tools/packaging/parseTestRecord.py           |  4 +-
 tools/packaging/test/test_common.py          |  2 +-
 tools/packaging/test/test_parseTestRecord.py | 10 ++---
 tools/packaging/test/test_test262.py         |  2 +-
 tools/packaging/test262.py                   | 44 ++++++++++----------
 15 files changed, 132 insertions(+), 132 deletions(-)

diff --git a/tools/CoverageAnalyzer.py b/tools/CoverageAnalyzer.py
index d1ced43dfd..08cdcae1fe 100644
--- a/tools/CoverageAnalyzer.py
+++ b/tools/CoverageAnalyzer.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.
 
 
@@ -19,13 +19,13 @@ def getCoverageData(directory):
   dirList = [x for x in tempList if os.path.isdir(os.path.join(directory, x))]
   #Build up a list of JavaScript files under the current directory
   jsList = [x for xin in tempList if x.endswith(".js")]
-  
-  #If the directory contains JavaScript files we'll assume they're all test 
+
+  #If the directory contains JavaScript files we'll assume they're all test
   #cases
   if len(jsList)!=0:
     CVG_DICT[os.path.split(directory)[1]] = len(jsList)
-  
-  #This might have just been a directory containing other dirs. Call ourself on 
+
+  #This might have just been a directory containing other dirs. Call ourself on
   #it as well
   for x in dirList:
     getCoverageData(os.path.join(directory, x))
@@ -61,4 +61,4 @@ def chapterCompare(x, y):
 startDir = sys.argv[1]
 getCoverageData(startDir)
 print "Emitting ECMAScript 5 coverage data for", startDir, "..."
-emitCoverageData(CVG_DICT)
\ No newline at end of file
+emitCoverageData(CVG_DICT)
diff --git a/tools/misc/FindTestCaseIssues.py b/tools/misc/FindTestCaseIssues.py
index e89a0f2b15..c23248c5a0 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 f5124c3004..372a66743d 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 81302de697..d9cb6a0585 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 570a8de119..d95b174716 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 edf813a912..7957819189 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!"
diff --git a/tools/packaging/common.py b/tools/packaging/common.py
index 90b483542e..21859f5a68 100644
--- a/tools/packaging/common.py
+++ b/tools/packaging/common.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---------------------------------------------------------------------
@@ -17,5 +17,5 @@ def convertDocString(docString):
     envelope = parseTestRecord.parseTestRecord(docString, '')
     envelope.pop('header', None)
     envelope.pop('test', None)
-    
+
     return envelope
diff --git a/tools/packaging/monkeyYaml.py b/tools/packaging/monkeyYaml.py
index 2adbea7f6b..d86c03ab93 100644
--- a/tools/packaging/monkeyYaml.py
+++ b/tools/packaging/monkeyYaml.py
@@ -21,7 +21,7 @@ def load(str):
         line = lines.pop(0)
         if myIsAllSpaces(line):
             continue
-        result = mYamlKV.match(line) 
+        result = mYamlKV.match(line)
         if result:
             if not dict:
                 dict = {}
@@ -62,7 +62,7 @@ def myMultilineList(lines, value):
             indent = indent or leading
             value += [myReadOneLine(myRemoveListHeader(indent, line))]
     return (lines, value)
-    
+
 def myRemoveListHeader(indent, line):
     line = line[indent:]
     return mYamlMultilineList.match(line).group(1)
@@ -81,7 +81,7 @@ def myReadOneLine(value):
         except ValueError:
             pass
     return value
-        
+
 def myFlowList(value):
     result = mYamlListPattern.match(value)
     values = result.group(1).split(",")
diff --git a/tools/packaging/packager.py b/tools/packaging/packager.py
index 163173210e..4433850f3d 100644
--- a/tools/packaging/packager.py
+++ b/tools/packaging/packager.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---------------------------------------------------------------------
@@ -87,14 +87,14 @@ def createDepDirs(dirName):
             os.mkdir(dirName)
 
 def test262PathToConsoleFile(path):
-    stuff = os.path.join(TEST262_CONSOLE_CASES_DIR, 
+    stuff = os.path.join(TEST262_CONSOLE_CASES_DIR,
                          path.replace("/", os.path.sep))
     createDepDirs(os.path.dirname(stuff))
     return stuff
-    
+
 def getJSCount(dirName):
     '''
-    Returns the total number of *.js files (recursively) under a given 
+    Returns the total number of *.js files (recursively) under a given
     directory, dirName.
     '''
     retVal = 0
@@ -143,7 +143,7 @@ def dirWalker(dirName):
 def isTestStarted(line):
     '''
     Used to detect if we've gone past extraneous test comments in a test case.
-    
+
     Note this is a naive approach on the sense that "/*abc*/" could be on one
     line.  However, we know for a fact this is not the case in IE Test Center
     or Sputnik tests.
@@ -170,7 +170,7 @@ for temp in os.listdir(TEST262_CASES_DIR):
     if not os.path.exists(temp):
         print "The expected ES5 test directory,", temp, "did not exist!"
         sys.exit(1)
-    
+
     if temp.find("/.") != -1:
         # skip hidden files on Unix, such as ".DS_Store" on Mac
         continue
@@ -187,11 +187,11 @@ for chapter in TEST_SUITE_SECTIONS:
     testsList = {}
     sect = {}
     sect["name"] = "Chapter - " + chapterName
-    
+
     #create an array for tests in a chapter
     tests = []
     sourceFiles = getAllJSFiles(chapter)
-    
+
     if len(sourceFiles)!=0:
         excluded = 0
         testCount = 0
@@ -199,13 +199,13 @@ for chapter in TEST_SUITE_SECTIONS:
             #TODO - use something other than the hard-coded 'TestCases' below
             testPath =  "TestCases" + \
                 test.split(TEST262_CASES_DIR, 1)[1].replace("\\", "/")
-            testName=test.rsplit(".", 1)[0] 
+            testName=test.rsplit(".", 1)[0]
             testName=testName.rsplit(os.path.sep, 1)[1]
             if EXCLUDE_LIST.count(testName)==0:
                 # dictionary for each test
                 testDict = {}
                 testDict["path"] = testPath
-                
+
                 tempFile = open(test, "rb")
                 scriptCode = tempFile.readlines()
                 tempFile.close()
@@ -232,7 +232,7 @@ for chapter in TEST_SUITE_SECTIONS:
                 scriptCodeContentB64 = base64.b64encode(scriptCodeContent)
 
                 #add the test encoded code node to our test dictionary
-                testDict["code"] = scriptCodeContentB64 
+                testDict["code"] = scriptCodeContentB64
                 #now close the dictionary for the test
 
                 #now get the metadata added.
@@ -245,7 +245,7 @@ for chapter in TEST_SUITE_SECTIONS:
 
                 #this adds the test to our tests array
                 tests.append(testDict)
-                
+
                 if ARGS.console:
                     with open(test262PathToConsoleFile(testDict["path"]),
                                   "w") as fConsole:
@@ -268,7 +268,7 @@ for chapter in TEST_SUITE_SECTIONS:
 
         #create a node for the tests and add it to our testsLists
         testsList["testsCollection"] = sect
-        with open(os.path.join(TEST262_WEB_CASES_DIR, chapterName + ".json"), 
+        with open(os.path.join(TEST262_WEB_CASES_DIR, chapterName + ".json"),
                   "w") as f:
             json.dump(testsList, f, separators=(',',':'), sort_keys=True,
                       indent=0)
@@ -279,12 +279,12 @@ for chapter in TEST_SUITE_SECTIONS:
             CHAPTER_TEST_CASES_JSON["numTests"] = int(sect["numTests"])
             CHAPTER_TEST_CASES_JSON["testSuite"] = \
                 [WEBSITE_CASES_PATH + chapterName + ".json"]
-            with open(os.path.join(TEST262_WEB_CASES_DIR, 
-                                   "testcases_%s.json" % chapterName), 
+            with open(os.path.join(TEST262_WEB_CASES_DIR,
+                                   "testcases_%s.json" % chapterName),
                       "w") as f:
                 json.dump(CHAPTER_TEST_CASES_JSON, f, separators=(',',':'),
                           sort_keys=True, indent=0)
-            generateHarness(ARGS.type, "testcases_%s.json" % chapterName, 
+            generateHarness(ARGS.type, "testcases_%s.json" % chapterName,
                             chapterName.replace("ch", "Chapter "))
 
         #add the name of the chapter test to our complete list
@@ -321,9 +321,9 @@ if TEST262_HARNESS_DIR!=TEST262_WEB_HARNESS_DIR:
                          if x.endswith(".js")]:
         toFilenameList = [ os.path.join(TEST262_WEB_HARNESS_DIR, filename)]
         if ARGS.console:
-            toFilenameList.append(os.path.join(TEST262_CONSOLE_HARNESS_DIR, 
+            toFilenameList.append(os.path.join(TEST262_CONSOLE_HARNESS_DIR,
                                                filename))
-        
+
         for toFilename in toFilenameList:
             if not os.path.exists(os.path.dirname(toFilename)):
                 os.mkdir(os.path.dirname(toFilename))
diff --git a/tools/packaging/packagerConfig.py b/tools/packaging/packagerConfig.py
index 16fe7dbc63..adbd253203 100644
--- a/tools/packaging/packagerConfig.py
+++ b/tools/packaging/packagerConfig.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---------------------------------------------------------------------
@@ -22,7 +22,7 @@ ONE_JSON_PER_CHAPTER = False
 TESTCASELIST_PER_JSON = True
 
 #Path to the root of the Hg repository (relative to this file's location)
-TEST262_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), 
+TEST262_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             "..", "..")
 TEST262_ROOT = os.path.abspath(TEST262_ROOT)
 
@@ -40,9 +40,9 @@ TEST262_CONSOLE_CASES_DIR = os.path.join(TEST262_ROOT, CONSOLE_SHORT_NAME)
 
 #Directory containing the website's test harness (ported over from
 #TEST262_HARNESS_DIR)
-TEST262_WEB_HARNESS_DIR = os.path.join(TEST262_ROOT, WEBSITE_SHORT_NAME, 
+TEST262_WEB_HARNESS_DIR = os.path.join(TEST262_ROOT, WEBSITE_SHORT_NAME,
                                        "harness")
-TEST262_CONSOLE_HARNESS_DIR = os.path.join(TEST262_ROOT, CONSOLE_SHORT_NAME, 
+TEST262_CONSOLE_HARNESS_DIR = os.path.join(TEST262_ROOT, CONSOLE_SHORT_NAME,
                                            "harness")
 
 #Path to the ported test case files on the actual website as opposed
@@ -66,20 +66,20 @@ __lastHarnessType = None
 def generateHarness(harnessType, jsonName, title):
     global TEMPLATE_LINES
     global __lastHarnessType
-    
+
     #TODO: temp hack to make experimental internationalization tests work
     if jsonName=="testcases_intl402.json":
         harnessType = "intl402"
     elif jsonName=="testcases_bestPractice.json":
         harnessType = "bestPractice"
-        
+
     if TEMPLATE_LINES==None or harnessType!=__lastHarnessType:
         __lastHarnessType = harnessType
         TEMPLATE_LINES = []
         with open(os.path.join(os.getcwd(), "templates",
                                "runner." + harnessType + ".html"), "r") as f:
             TEMPLATE_LINES = f.readlines()
-    fileName = os.path.join(TEST262_ROOT, WEBSITE_SHORT_NAME, 
+    fileName = os.path.join(TEST262_ROOT, WEBSITE_SHORT_NAME,
                             jsonName.replace(".json", ".html"))
     fileNameExists = False
     if os.path.exists(fileName):
@@ -91,7 +91,7 @@ def generateHarness(harnessType, jsonName, title):
                 f.write("    var TEST_LIST_PATH = \"json/" + jsonName + \
                         "\";" + os.linesep)
             #elif "ECMAScript 5" in line:
-            #    f.write(line.replace("ECMAScript 5", 
+            #    f.write(line.replace("ECMAScript 5",
             #            "ECMAScript 5: %s" % title))
             else:
                 f.write(line)
@@ -101,7 +101,7 @@ def generateHarness(harnessType, jsonName, title):
 #------------------------------------------------------------------------------
 class SCAbstraction(object):
     '''
-    A class which abstracts working with source control systems in relation to 
+    A class which abstracts working with source control systems in relation to
     generated test262 files.  Useful when test262 is also used internally by
     browser implementors.
     '''
@@ -112,11 +112,11 @@ class SCAbstraction(object):
         '''
         if not(os.stat(filename).st_mode & stat.S_IWRITE):
             os.chmod(filename, stat.S_IWRITE)
-    
+
     def add(self, filename):
         '''
         Source control add of a file.
         '''
         subprocess.call(["git", "add", filename])
-        
+
 SC_HELPER = SCAbstraction()
diff --git a/tools/packaging/parseTestRecord.py b/tools/packaging/parseTestRecord.py
index ce4550a0a4..3a76e85aba 100644
--- a/tools/packaging/parseTestRecord.py
+++ b/tools/packaging/parseTestRecord.py
@@ -69,7 +69,7 @@ def oldAttrParser(testRecord, body, name):
             raise Exception('Malformed "@" attribute: ' + name)
         propName = propMatch.group(0)
         propVal = stripStars(propText[len(propName):])
-            
+
         if propName in testRecord:
             raise Exception('duplicate: ' + propName)
         testRecord[propName] = propVal;
@@ -89,7 +89,7 @@ def yamlAttrParser(testRecord, attrs, name):
         if key == "info":
             key = "commentary"
         testRecord[key] = value
-        
+
     if 'flags' in testRecord:
         for flag in testRecord['flags']:
             testRecord[flag] = ""
diff --git a/tools/packaging/test/test_common.py b/tools/packaging/test/test_common.py
index 3a5f249bff..0d6600b7d7 100644
--- a/tools/packaging/test/test_common.py
+++ b/tools/packaging/test/test_common.py
@@ -47,7 +47,7 @@ class TestYAMLParsing(unittest.TestCase):
         name = 'fixtures/test262-yaml-headers.js'
         contents = slurpFile(name)
         record = convertDocString(contents)
-        
+
         self.assertEqual("The production Block { } in strict code can't contain function declaration;\n", record['commentary'])
 
         self.assertEqual("Trying to declare function at the Block statement",
diff --git a/tools/packaging/test/test_parseTestRecord.py b/tools/packaging/test/test_parseTestRecord.py
index 10da6d519e..7d1e9a64d2 100644
--- a/tools/packaging/test/test_parseTestRecord.py
+++ b/tools/packaging/test/test_parseTestRecord.py
@@ -29,7 +29,7 @@ class TestOldParsing(unittest.TestCase):
         name = 'fixtures/test262-old-headers.js'
         contents = slurpFile(name)
         record = parseTestRecord(contents, name)
-        
+
         self.assertEqual("""// Copyright 2009 the Sputnik authors.  All rights reserved.
 // This code is governed by the BSD license found in the LICENSE file.""",
                          record['header'])
@@ -69,7 +69,7 @@ declaration;""", record['commentary'])
 1;
 """
                             , "name")
-        
+
     def test_malformed(self):
         with self.assertRaisesRegexp(Exception, 'Malformed "@" attribute: name'):
             parseTestRecord("""
@@ -90,7 +90,7 @@ declaration;""", record['commentary'])
         self.assertEqual("@foo bar", stripStars("\n* @foo bar"))
         self.assertEqual("@foo bar", stripStars("\n  *@foo bar"))
 
-        
+
 class TestYAMLParsing(unittest.TestCase):
     def test_test(self):
         self.assertTrue(True)
@@ -112,7 +112,7 @@ flags: [onlyStrict]
 
     def test_yamlParse(self):
         text = """
-info: > 
+info: >
     The production Block { } in strict code can't contain function
     declaration;
 description: Trying to declare function at the Block statement
@@ -150,7 +150,7 @@ flags: [onlyStrict]"""
         name = 'fixtures/test262-yaml-headers.js'
         contents = slurpFile(name)
         record = parseTestRecord(contents, name)
-        
+
         self.assertEqual("""// Copyright 2009 the Sputnik authors.  All rights reserved.
 // This code is governed by the BSD license found in the LICENSE file.""",
                          record['header'])
diff --git a/tools/packaging/test/test_test262.py b/tools/packaging/test/test_test262.py
index fbd3dd4116..8073a3c1f0 100644
--- a/tools/packaging/test/test_test262.py
+++ b/tools/packaging/test/test_test262.py
@@ -43,7 +43,7 @@ class MockResult(object):
     def __init__(self, case):
         self.case = case
 
-    
+
 
 class TestTestSuite(unittest.TestCase):
 
diff --git a/tools/packaging/test262.py b/tools/packaging/test262.py
index 40c756fc95..cc6a83400b 100755
--- a/tools/packaging/test262.py
+++ b/tools/packaging/test262.py
@@ -54,7 +54,7 @@ EXCLUDE_LIST = [x.getAttribute("id") for x in EXCLUDE_LIST]
 def BuildOptions():
   result = optparse.OptionParser()
   result.add_option("--command", default=None, help="The command-line to run")
-  result.add_option("--tests", default=path.abspath('.'), 
+  result.add_option("--tests", default=path.abspath('.'),
                     help="Path to the tests")
   result.add_option("--cat", default=False, action="store_true",
                     help="Print packaged test code that would be run")
@@ -62,18 +62,18 @@ def BuildOptions():
                     help="Print summary after running tests")
   result.add_option("--full-summary", default=False, action="store_true",
                     help="Print summary and test output after running tests")
-  result.add_option("--strict_only", default=False, action="store_true", 
+  result.add_option("--strict_only", default=False, action="store_true",
                     help="Test only strict mode")
-  result.add_option("--non_strict_only", default=False, action="store_true", 
+  result.add_option("--non_strict_only", default=False, action="store_true",
                     help="Test only non-strict mode")
   # TODO: Once enough tests are made strict compat, change the default
   # to "both"
-  result.add_option("--unmarked_default", default="non_strict", 
+  result.add_option("--unmarked_default", default="non_strict",
                     help="default mode for tests of unspecified strictness")
   result.add_option("--logname", help="Filename to save stdout to")
   result.add_option("--junitname", help="Filename to save test results in JUnit XML format")
   result.add_option("--loglevel", default="warning",
-                    help="sets log level to debug, info, warning, error, or critical") 
+                    help="sets log level to debug, info, warning, error, or critical")
   result.add_option("--print-handle", default="print", help="Command to print from console")
   result.add_option("--list-includes", default=False, action="store_true",
                     help="List includes required by tests")
@@ -169,13 +169,13 @@ class TestResult(object):
     err = self.stderr.strip()
     if len(err) > 0:
        target.write("--- errors ---  \n %s" % err)
-    
+
   def XmlAssemble(self, result):
     test_name = self.case.GetName()
     test_mode = self.case.GetMode()
     testCaseElement = xmlj.Element("testcase")
     testpath = self.TestPathManipulation(test_name)
-    testCaseElement.attrib["classname"] = "%s.%s" % (testpath[0] , testpath[1]) 
+    testCaseElement.attrib["classname"] = "%s.%s" % (testpath[0] , testpath[1])
     testCaseElement.attrib["name"] = "%s %s" % (testpath[2].replace('.','_') , test_mode)
     if self.HasUnexpectedOutcome():
       failureElement = xmlj.Element("failure")
@@ -198,19 +198,19 @@ class TestResult(object):
     else:
        testpackage = testclass
     return(testpackage,testclass,testcase)
-  
-  def HasFailed(self):    
+
+  def HasFailed(self):
     return self.exit_code != 0
 
-  def AsyncHasFailed(self):   
+  def AsyncHasFailed(self):
     return 'Test262:AsyncTestComplete' not in self.stdout
 
   def HasUnexpectedOutcome(self):
-    if self.case.IsAsyncTest():		
+    if self.case.IsAsyncTest():
        return self.AsyncHasFailed() or self.HasFailed()
-    elif self.case.IsNegative():      
+    elif self.case.IsNegative():
        return not (self.HasFailed() and self.case.NegativeMatch(self.GetErrorOutput()))
-    else:      
+    else:
        return self.HasFailed()
 
   def GetErrorOutput(self):
@@ -235,7 +235,7 @@ class TestCase(object):
     del testRecord["header"]
     testRecord.pop("commentary", None)    # do not throw if missing
     self.testRecord = testRecord;
-    
+
   def NegativeMatch(self, stderr):
     neg = re.compile(self.GetNegative())
     return re.search(neg, stderr)
@@ -264,7 +264,7 @@ class TestCase(object):
   def IsNoStrict(self):
     return 'noStrict' in self.testRecord
 
-  def IsAsyncTest(self):	
+  def IsAsyncTest(self):
 	return '$DONE' in self.test
 
   def GetIncludeList(self):
@@ -398,7 +398,7 @@ class TestSuite(object):
     self.unmarked_default = unmarked_default
     self.print_handle = print_handle
     self.include_cache = { }
-	
+
 
   def Validate(self):
     if not path.exists(self.test_root):
@@ -530,7 +530,7 @@ class TestSuite(object):
           SkipElement.attrib["message"] = unicode(EXCLUDE_REASON[x].firstChild.nodeValue)
           SkipCaseElement.append(SkipElement)
           TestSuiteElement.append(SkipCaseElement)
-       
+
     for case in cases:
       result = case.Run(command_template)
       if junitfile:
@@ -541,7 +541,7 @@ class TestSuite(object):
       if logname:
         self.WriteLog(result)
       progress.HasRun(result)
-    
+
     if print_summary:
       self.PrintSummary(progress, logname)
       if full_summary:
@@ -582,15 +582,15 @@ class TestSuite(object):
       includes_dict.update(includes)
 
     print includes_dict
-        
+
 
 def Main():
   code = 0
   parser = BuildOptions()
   (options, args) = parser.parse_args()
   ValidateOptions(options)
-  test_suite = TestSuite(options.tests, 
-                         options.strict_only, 
+  test_suite = TestSuite(options.tests,
+                         options.strict_only,
                          options.non_strict_only,
                          options.unmarked_default,
 			 options.print_handle)
@@ -616,7 +616,7 @@ def Main():
                           options.logname,
                           options.junitname)
   return code
-       
+
 if __name__ == '__main__':
   try:
     code = Main()
-- 
GitLab