From 66a14cf389334c11a7d424dc4c85d2ba90b94be0 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 20 May 2023 16:08:43 +0700 Subject: [PATCH] remove unused clean_string --- tubearchivist/home/src/ta/helper.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tubearchivist/home/src/ta/helper.py b/tubearchivist/home/src/ta/helper.py index 99345986..6016d3c9 100644 --- a/tubearchivist/home/src/ta/helper.py +++ b/tubearchivist/home/src/ta/helper.py @@ -6,25 +6,13 @@ Loose collection of helper functions import json import os import random -import re import string -import unicodedata from datetime import datetime from urllib.parse import urlparse import requests -def clean_string(file_name: str) -> str: - """clean string to only asci characters""" - whitelist = "-_.() " + string.ascii_letters + string.digits - normalized = unicodedata.normalize("NFKD", file_name) - ascii_only = normalized.encode("ASCII", "ignore").decode().strip() - white_listed: str = "".join(c for c in ascii_only if c in whitelist) - cleaned: str = re.sub(r"[ ]{2,}", " ", white_listed) - return cleaned - - def ignore_filelist(filelist: list[str]) -> list[str]: """ignore temp files for os.listdir sanitizer""" to_ignore = ["Icon\r\r", "Temporary Items", "Network Trash Folder"]