Format all code.

This commit is contained in:
2025-07-25 23:22:37 +02:00
parent f940470de3
commit 56e0965a5f
19 changed files with 850 additions and 353 deletions

View File

@@ -115,7 +115,7 @@ COMMON_WORDS_BLACKLIST = {
def format_and_print_list(word_set, words_per_line=10):
"""
Sorts a set of words and prints it in a specific format.
Args:
word_set (set): The set of words to process.
words_per_line (int): The number of words to print on each line.
@@ -123,32 +123,33 @@ def format_and_print_list(word_set, words_per_line=10):
# 1. Convert the set to a list to ensure order, and sort it alphabetically.
# The set is also used to remove any duplicates from the initial list.
sorted_words = sorted(list(word_set))
# 2. Start printing the output
print("COMMON_WORDS_BLACKLIST = {")
# 3. Iterate through the sorted list and print words, respecting the line limit
for i in range(0, len(sorted_words), words_per_line):
# Get a chunk of words for the current line
line_chunk = sorted_words[i:i + words_per_line]
line_chunk = sorted_words[i : i + words_per_line]
# Format each word with double quotes
formatted_words = [f'"{word}"' for word in line_chunk]
# Join the words with a comma and a space
line_content = ", ".join(formatted_words)
# Add a trailing comma if it's not the last line
is_last_line = (i + words_per_line) >= len(sorted_words)
if not is_last_line:
line_content += ","
# Print the indented line
print(f" {line_content}")
# 4. Print the closing brace
print("}")
# --- Main execution ---
if __name__ == "__main__":
format_and_print_list(COMMON_WORDS_BLACKLIST)
format_and_print_list(COMMON_WORDS_BLACKLIST)