From 8f67dd347bc6c229cce19f6890b85684aee80968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 13 Aug 2025 16:12:33 +0200 Subject: [PATCH] [scripts/supportedsites] update 'generate_output()' use f-strings etc --- scripts/supportedsites.py | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/scripts/supportedsites.py b/scripts/supportedsites.py index 74fcff6e..ddbcbb46 100755 --- a/scripts/supportedsites.py +++ b/scripts/supportedsites.py @@ -682,52 +682,50 @@ COLUMNS = ( def generate_output(columns, categories, domains): thead = [] - append = thead.append - append("") + thead.append("") for column in columns: - append(" " + column[0] + "") - append("") + thead.append(f" {column[0]}") + thead.append("") tbody = [] - append = tbody.append - for bcat, base in categories.items(): if bcat and base: name = BASE_MAP.get(bcat) or (bcat.capitalize() + " Instances") - append('\n\n ' + - name + '\n') + tbody.append(f""" + + {name} +\ +""") clist = base.items() else: clist = sorted(base.items(), key=category_key) for category, subcategories in clist: - append("") + tbody.append("") for column in columns: domain = domains[category] content = column[2](bcat, category, subcategories, domain) - append(" " + content + "") - append("") + tbody.append(f" {content}") + tbody.append("") - TEMPLATE = """# Supported Sites + NL = "\n" + GENERATOR = "/".join(os.path.normpath(__file__).split(os.sep)[-2:]) + return f"""\ +# Supported Sites - + Consider all listed sites to potentially be NSFW. -{} +{NL.join(thead)} -{} +{NL.join(tbody)}
""" - return TEMPLATE.format( - "/".join(os.path.normpath(__file__).split(os.sep)[-2:]), - "\n".join(thead), - "\n".join(tbody), - ) categories, domains = build_extractor_list()