mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-03-03 18:04:40 +01:00
Indent generate-domains-blocklist.py
This commit is contained in:
parent
d469ad1396
commit
b74b46c6cd
1 changed files with 4 additions and 8 deletions
|
@ -93,8 +93,7 @@ def parse_list(content, trusted=False):
|
||||||
|
|
||||||
def print_restricted_name(output_fd, name, time_restrictions):
|
def print_restricted_name(output_fd, name, time_restrictions):
|
||||||
if name in time_restrictions:
|
if name in time_restrictions:
|
||||||
print("{}\t{}".format(
|
print("{}\t{}".format(name, time_restrictions[name]), file=output_fd, end="\n")
|
||||||
name, time_restrictions[name]), file=output_fd, end="\n")
|
|
||||||
else:
|
else:
|
||||||
print(
|
print(
|
||||||
"# ignored: [{}] was in the time-restricted list, "
|
"# ignored: [{}] was in the time-restricted list, "
|
||||||
|
@ -122,8 +121,7 @@ def load_from_url(url):
|
||||||
except urllib.URLError as err:
|
except urllib.URLError as err:
|
||||||
raise Exception("[{}] could not be loaded: {}\n".format(url, err))
|
raise Exception("[{}] could not be loaded: {}\n".format(url, err))
|
||||||
if trusted is False and response.getcode() != 200:
|
if trusted is False and response.getcode() != 200:
|
||||||
raise Exception("[{}] returned HTTP code {}\n".format(
|
raise Exception("[{}] returned HTTP code {}\n".format(url, response.getcode()))
|
||||||
url, response.getcode()))
|
|
||||||
content = response.read()
|
content = response.read()
|
||||||
if URLLIB_NEW:
|
if URLLIB_NEW:
|
||||||
content = content.decode("utf-8", errors="replace")
|
content = content.decode("utf-8", errors="replace")
|
||||||
|
@ -265,12 +263,10 @@ def blocklists_from_config_file(
|
||||||
|
|
||||||
list_names.sort(key=name_cmp)
|
list_names.sort(key=name_cmp)
|
||||||
if ignored:
|
if ignored:
|
||||||
print("# Ignored duplicates: {}".format(
|
print("# Ignored duplicates: {}".format(ignored), file=output_fd, end="\n")
|
||||||
ignored), file=output_fd, end="\n")
|
|
||||||
if glob_ignored:
|
if glob_ignored:
|
||||||
print(
|
print(
|
||||||
"# Ignored due to overlapping local patterns: {}".format(
|
"# Ignored due to overlapping local patterns: {}".format(glob_ignored),
|
||||||
glob_ignored),
|
|
||||||
file=output_fd,
|
file=output_fd,
|
||||||
end="\n",
|
end="\n",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue