initial commit

This commit is contained in:
2025-07-11 20:22:56 -04:00
commit 1781b3b8b2
8 changed files with 366 additions and 0 deletions

23
app/misc.py Normal file
View File

@@ -0,0 +1,23 @@
import re
# Constants
PROGRESS_BAR_LENGTH = 10
def extract_url_from_string(text: str):
"""
Extracts the first URL from a string
"""
url_pattern = re.compile(r'https?://\S+')
match = url_pattern.search(text)
if match:
return match.group(0)
else:
return None
def render_progress_bar(percent: int, length: int = PROGRESS_BAR_LENGTH) -> str:
"""Renders a progress bar with the given percentage."""
filled = int(length * percent // 100)
bar = "" * filled + " " * (length - filled)
return f"[{bar}] {percent}%"