mirror of
https://github.com/StevenBlack/hosts.git
synced 2024-07-07 13:02:27 +02:00
Remove unnecessary space between print and parenthesis
This commit is contained in:
parent
83af37862c
commit
118a8e78a5
@ -46,7 +46,7 @@ except NameError: # Python 3
|
|||||||
raw_input = input
|
raw_input = input
|
||||||
|
|
||||||
# Detecting Python 3 for version-dependent implementations
|
# Detecting Python 3 for version-dependent implementations
|
||||||
Python3 = sys.version_info >= (3,0)
|
Python3 = sys.version_info >= (3, 0)
|
||||||
|
|
||||||
# This function handles both Python 2 and Python 3
|
# This function handles both Python 2 and Python 3
|
||||||
def getFileByUrl(url):
|
def getFileByUrl(url):
|
||||||
@ -54,7 +54,7 @@ def getFileByUrl(url):
|
|||||||
f = urlopen(url)
|
f = urlopen(url)
|
||||||
return f.read().decode("UTF-8")
|
return f.read().decode("UTF-8")
|
||||||
except:
|
except:
|
||||||
print ("Problem getting file: ", url)
|
print("Problem getting file: ", url)
|
||||||
# raise
|
# raise
|
||||||
|
|
||||||
# In Python 3 "print" is a function, braces are added everywhere
|
# In Python 3 "print" is a function, braces are added everywhere
|
||||||
@ -265,7 +265,7 @@ def updateAllSources():
|
|||||||
updateURL = updateData["url"]
|
updateURL = updateData["url"]
|
||||||
updateFile.close()
|
updateFile.close()
|
||||||
|
|
||||||
print ("Updating source " + os.path.dirname(source) + " from " + updateURL)
|
print("Updating source " + os.path.dirname(source) + " from " + updateURL)
|
||||||
# Cross-python call
|
# Cross-python call
|
||||||
updatedFile = getFileByUrl(updateURL)
|
updatedFile = getFileByUrl(updateURL)
|
||||||
try:
|
try:
|
||||||
@ -276,7 +276,7 @@ def updateAllSources():
|
|||||||
writeData(hostsFile, updatedFile)
|
writeData(hostsFile, updatedFile)
|
||||||
hostsFile.close()
|
hostsFile.close()
|
||||||
except:
|
except:
|
||||||
print ("Skipping.")
|
print("Skipping.")
|
||||||
# End Update Logic
|
# End Update Logic
|
||||||
|
|
||||||
# File Logic
|
# File Logic
|
||||||
@ -380,7 +380,7 @@ def normalizeRule(rule):
|
|||||||
return hostname, "%s %s #%s\n" % (settings["targetip"], hostname, suffix)
|
return hostname, "%s %s #%s\n" % (settings["targetip"], hostname, suffix)
|
||||||
else:
|
else:
|
||||||
return hostname, "%s %s\n" % (settings["targetip"], hostname)
|
return hostname, "%s %s\n" % (settings["targetip"], hostname)
|
||||||
print ("==>%s<==" % rule)
|
print("==>%s<==" % rule)
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
def finalizeFile(finalFile):
|
def finalizeFile(finalFile):
|
||||||
@ -448,8 +448,8 @@ def updateReadmeData():
|
|||||||
|
|
||||||
def moveHostsFileIntoPlace(finalFile):
|
def moveHostsFileIntoPlace(finalFile):
|
||||||
if os.name == "posix":
|
if os.name == "posix":
|
||||||
print ("Moving the file requires administrative privileges. " +
|
print("Moving the file requires administrative privileges. "
|
||||||
"You might need to enter your password.")
|
"You might need to enter your password.")
|
||||||
if subprocess.call(["/usr/bin/sudo", "cp", os.path.abspath(finalFile.name), "/etc/hosts"]):
|
if subprocess.call(["/usr/bin/sudo", "cp", os.path.abspath(finalFile.name), "/etc/hosts"]):
|
||||||
printFailure("Moving the file failed.")
|
printFailure("Moving the file failed.")
|
||||||
elif os.name == "nt":
|
elif os.name == "nt":
|
||||||
@ -567,12 +567,13 @@ def query_yes_no(question, default="yes"):
|
|||||||
|
|
||||||
def isValidDomainFormat(domain):
|
def isValidDomainFormat(domain):
|
||||||
if domain == "":
|
if domain == "":
|
||||||
print ("You didn't enter a domain. Try again.")
|
print("You didn't enter a domain. Try again.")
|
||||||
return False
|
return False
|
||||||
domainRegex = re.compile("www\d{0,3}[.]|https?")
|
domainRegex = re.compile("www\d{0,3}[.]|https?")
|
||||||
if domainRegex.match(domain):
|
if domainRegex.match(domain):
|
||||||
print ("The domain " + domain + " is not valid. " +
|
print("The domain " + domain +
|
||||||
"Do not include www.domain.com or http(s)://domain.com. Try again.")
|
" is not valid. Do not include "
|
||||||
|
"www.domain.com or http(s)://domain.com. Try again.")
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
@ -602,10 +603,10 @@ def colorize(text, color):
|
|||||||
return color + text + colors.ENDC
|
return color + text + colors.ENDC
|
||||||
|
|
||||||
def printSuccess(text):
|
def printSuccess(text):
|
||||||
print (colorize(text, colors.SUCCESS))
|
print(colorize(text, colors.SUCCESS))
|
||||||
|
|
||||||
def printFailure(text):
|
def printFailure(text):
|
||||||
print (colorize(text, colors.FAIL))
|
print(colorize(text, colors.FAIL))
|
||||||
# End Helper Functions
|
# End Helper Functions
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user