From 4c4b225a27a64f5149983a8dd67818dce8cbb215 Mon Sep 17 00:00:00 2001 From: maropboia <164220066+maropboia@users.noreply.github.com> Date: Fri, 3 May 2024 11:38:26 +0600 Subject: [PATCH] comment --- .github/single-page.py | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/single-page.py b/.github/single-page.py index 4f9fc407d..31d2806ca 100644 --- a/.github/single-page.py +++ b/.github/single-page.py @@ -1,11 +1,13 @@ -import glob -import time +import glob # Import the glob module, which allows for file name pattern matching +import time # Import the time module, which provides various time-related functions def output(): + # Read all markdown files in the current directory, excluding README.md, feedback.md, posts.md, and index.md read = glob.glob("*.md") - content = "" - nsfw_content = "" + content = "" # Initialize an empty string to store the combined content of all markdown files + nsfw_content = "" # Initialize an empty string to store the content of the NSFWPiracy.md file + for file in read: if ( file != "README.md" @@ -13,22 +15,23 @@ def output(): or file != "posts.md" or file != "index.md" ): - with open(file, "r") as f: + with open(file, "r") as f: # Open each file in read mode if "NSFWPiracy.md" == file: - nsfw_content += f.read() - continue - content += f.read() - return content + nsfw_content + nsfw_content += f.read() # If the file is NSFWPiracy.md, add its content to nsfw_content + continue # Skip to the next iteration of the loop + content += f.read() # Add the content of the current file to content + + return content + nsfw_content # Return the combined content of all markdown files and the NSFWPiracy.md file def main(): - content = output() - with open("single-page", "w") as file: - file.write(content) + content = output() # Call the output function and store its result in the content variable + with open("single-page", "w") as file: # Open a new file named "single-page" in write mode + file.write(content) # Write the content to the "single-page" file if __name__ == "__main__": - s = time.perf_counter() - main() - elapsed = time.perf_counter() - s - print(f"{__file__} executed in {elapsed:0.2f} seconds.") + s = time.perf_counter() # Record the start time + main() # Call the main function + elapsed = time.perf_counter() - s # Calculate the elapsed time + print(f"{__file__} executed in {elapsed:0.2f} seconds.") # Print the elapsed time and the name of the executed file