mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
🐛 Removed invalid char in output file
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""Utilities."""
|
||||
import re
|
||||
from typing import Dict
|
||||
|
||||
from loguru import logger
|
||||
@@ -55,3 +56,23 @@ def handle_response(response: Response) -> None:
|
||||
if response_code != 200:
|
||||
logger.error(response.text)
|
||||
exit(1)
|
||||
|
||||
|
||||
def slugify(string: str) -> str:
|
||||
"""Converts a string to a slug format."""
|
||||
# Convert to lowercase
|
||||
string = string.lower()
|
||||
|
||||
# Remove special characters
|
||||
string = re.sub(r"[^\w\s-]", "", string)
|
||||
|
||||
# Replace spaces with dashes
|
||||
string = re.sub(r"\s+", "-", string)
|
||||
|
||||
# Remove consecutive dashes
|
||||
string = re.sub(r"-+", "-", string)
|
||||
|
||||
# Remove leading and trailing dashes
|
||||
string = string.strip("-")
|
||||
|
||||
return string
|
||||
|
||||
Reference in New Issue
Block a user