-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e02a27d
commit 82b7518
Showing
2 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import time | ||
from rich.console import Console | ||
from rich.progress import Progress | ||
|
||
console = Console() | ||
|
||
def error(message: str): | ||
"""Display critical errors that need immediate attention.""" | ||
console.print(message, style="bold red") | ||
|
||
# ==================== | ||
|
||
def success(message: str): | ||
"""Indicate successful operations or completed tasks.""" | ||
console.print(message, style="bold green") | ||
|
||
# ==================== | ||
|
||
def warning(message: str): | ||
"""Notify users of potential issues or cautions.""" | ||
console.print(message, style="bold yellow") | ||
|
||
# ==================== | ||
|
||
def info(message: str): | ||
"""Provide general information or updates about processes.""" | ||
console.print(message, style="bold blue") | ||
|
||
# ==================== | ||
|
||
def debug(message: str): | ||
"""Log debug information for troubleshooting purposes.""" | ||
console.print(message, style="bold white") | ||
|
||
# ==================== | ||
|
||
def prompt_user(prompt_message: str) -> str: | ||
"""Ask for user input or confirmations.""" | ||
return console.input(prompt_message) | ||
|
||
# ==================== | ||
|
||
def show_progress(total: int): | ||
"""Show the status of long-running operations.""" | ||
with Progress() as progress: | ||
task = progress.add_task("[cyan]Processing...", total=total) | ||
while not progress.finished: | ||
time.sleep(0.1) # Simulate work being done | ||
progress.update(task, advance=1) | ||
|
||
# ==================== | ||
|
||
def completion(message: str): | ||
"""Indicate the end of a process with a summary of results.""" | ||
console.print(message, style="bold green") | ||
|
||
# ==================== | ||
|
||
def critical_alert(message: str): | ||
"""Highlight urgent alerts or critical issues requiring immediate action.""" | ||
console.print(message, style="bold magenta") | ||
|
||
# ==================== | ||
|
||
def network_status(message: str): | ||
"""Indicate the status of network connections or related operations.""" | ||
console.print(message, style="bold bright_blue") | ||
|
||
# ==================== | ||
|
||
def config_loaded(message: str): | ||
"""Confirm that a configuration file has been successfully loaded.""" | ||
console.print(message, style="bold blue") | ||
|
||
# ==================== | ||
|
||
def resource_status(message: str): | ||
"""Report on the status of system resources (e.g., CPU, memory).""" | ||
console.print(message, style="bold yellow") | ||
|
||
# ==================== | ||
|
||
def execution_time(duration: float): | ||
"""Display the time taken to complete a task.""" | ||
console.print(f"Execution time: {duration:.2f} seconds", style="bold white") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ yt_dlp | |
fastapi | ||
pydantic | ||
typing | ||
uvicorn | ||
uvicorn | ||
rich |