mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-04 12:00:21 +00:00
remove unused clean_string
This commit is contained in:
parent
9b30c7df6e
commit
66a14cf389
@ -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"]
|
||||
|
Loading…
Reference in New Issue
Block a user