remove unused clean_string

This commit is contained in:
simon 2023-05-20 16:08:43 +07:00
parent 9b30c7df6e
commit 66a14cf389
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 0 additions and 12 deletions

View File

@ -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"]