file_contents = final_file.read() # Save content.
final_file.seek(0) # Write at the top.
- write_data(
- final_file,
- "# This hosts file is a merged collection "
- "of hosts from reputable sources,\n",
- )
- write_data(final_file, "# with a dash of crowd sourcing via Github\n#\n")
- write_data(
- final_file,
- "# Date: " + time.strftime("%d %B %Y %H:%M:%S (%Z)", time.gmtime()) + "\n",
- )
if header_params["extensions"]:
- write_data(
- final_file,
- "# Extensions added to this file: "
- + ", ".join(header_params["extensions"])
- + "\n",
- )
-
if len(header_params["extensions"]) > 1:
write_data(
final_file,
- "# Title: StevenBlack/hosts with the {0} and {1} extensions\n".format(
+ "# Title: StevenBlack/hosts with the {0} and {1} extensions\n#\n".format(
", ".join(header_params["extensions"][:-1]),
header_params["extensions"][-1],
),
else:
write_data(
final_file,
- "# Title: StevenBlack/hosts with the {0} extension\n".format(
+ "# Title: StevenBlack/hosts with the {0} extension\n#\n".format(
", ".join(header_params["extensions"])
),
)
else:
write_data(
final_file,
- "# Title: StevenBlack/hosts\n".format(
+ "# Title: StevenBlack/hosts\n#\n".format(
", ".join(header_params["extensions"])
),
)
+ write_data(
+ final_file,
+ "# This hosts file is a merged collection "
+ "of hosts from reputable sources,\n",
+ )
+ write_data(final_file, "# with a dash of crowd sourcing via Github\n#\n")
+ write_data(
+ final_file,
+ "# Date: " + time.strftime("%d %B %Y %H:%M:%S (%Z)", time.gmtime()) + "\n",
+ )
+
+ if header_params["extensions"]:
+ write_data(
+ final_file,
+ "# Extensions added to this file: "
+ + ", ".join(header_params["extensions"])
+ + "\n",
+ )
+
write_data(
final_file,
(