Removed unnecessary semicolons.
authorSteven Black <redacted>
Mon, 8 Feb 2016 00:28:31 +0000 (19:28 -0500)
committerSteven Black <redacted>
Mon, 8 Feb 2016 00:28:31 +0000 (19:28 -0500)
updateHostsFile.py

index ffe0a431c6b5f9a5c416378b4b7f2637c6822818..107d787a4366e2819c6a55a82d6784d1b544b82b 100644 (file)
@@ -37,23 +37,23 @@ def getFileByUrl(url):
         f = urlopen(url)
         return f.read().decode("UTF-8")
     except:
-        print ("Problem getting file: ", url);
+        print ("Problem getting file: ", url)
         # raise
 
 # In Python 3   "print" is a function, braces are added everywhere
 
 # Detecting Python 3 for version-dependent implementations
-Python3     = False;
+Python3     = False
 cur_version = sys.version_info
 if cur_version >= (3, 0):
-    Python3 = True;
+    Python3 = True
 
 # This function works in both Python 2 and Python 3
 def myInput(msg = ""):
     if Python3:
-        return input(msg);
+        return input(msg)
     else:
-        return raw_input(msg);
+        return raw_input(msg)
 
 
 # Cross-python writing function
@@ -178,19 +178,19 @@ def updateAllSources():
     for source in SOURCES:
         updateURL = getUpdateURLFromFile(source)
         if updateURL == None:
-            continue;
+            continue
         print ('Updating source ' + source + ' from ' + updateURL)
         # Cross-python call
-        updatedFile = getFileByUrl(updateURL);
+        updatedFile = getFileByUrl(updateURL)
 
         try:
             updatedFile = updatedFile.replace('\r', '') #get rid of carriage-return symbols
             # This is cross-python code
             dataFile = open(os.path.join(DATA_PATH, source, DATA_FILENAMES), 'wb')
-            writeData(dataFile, updatedFile);
+            writeData(dataFile, updatedFile)
             dataFile.close()
         except:
-            print ("Skipping.");
+            print ("Skipping.")
 
 
 def getUpdateURLFromFile(source):
@@ -290,7 +290,7 @@ def stripRule(line):
 def writeOpeningHeader(finalFile):
     global numberOfRules
     finalFile.seek(0) #reset file pointer
-    fileContents = finalFile.read(); #save content
+    fileContents = finalFile.read()  #save content
     finalFile.seek(0) #write at the top
     writeData(finalFile, '# This file is a merged collection of hosts from reputable sources,\n')
     writeData(finalFile, '# with a dash of crowd sourcing via Github\n#\n')
@@ -301,10 +301,10 @@ def writeOpeningHeader(finalFile):
     writeData(finalFile, '::1 localhost\n')
     writeData(finalFile, '\n')
 
-    preamble = os.path.join(BASEDIR_PATH, "myhosts");
+    preamble = os.path.join(BASEDIR_PATH, "myhosts")
     if os.path.isfile(preamble):
         with open(preamble, "r") as f:
-            writeData(finalFile, f.read());
+            writeData(finalFile, f.read())
 
     finalFile.write(fileContents)
 
@@ -336,7 +336,7 @@ def moveHostsFileIntoPlace(finalFile):
 def removeOldHostsFile():               # hotfix since merging with an already existing hosts file leads to artefacts and duplicates
     oldFilePath = os.path.join(BASEDIR_PATH, 'hosts')
     open(oldFilePath, 'a').close()        # create if already removed, so remove wont raise an error
-    os.remove(oldFilePath);
+    os.remove(oldFilePath)
     open(oldFilePath, 'a').close()        # create new empty hostsfile
 
 # End File Logic
git clone https://git.99rst.org/PROJECT