Spaces:
Running
Running
File size: 1,749 Bytes
a8fdab7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | from termcolor import colored
def error(message: str, show_emoji: bool = True) -> None:
"""
Prints an error message.
Args:
message (str): The error message
show_emoji (bool): Whether to show the emoji
Returns:
None
"""
emoji = "❌" if show_emoji else ""
print(colored(f"{emoji} {message}", "red"))
def success(message: str, show_emoji: bool = True) -> None:
"""
Prints a success message.
Args:
message (str): The success message
show_emoji (bool): Whether to show the emoji
Returns:
None
"""
emoji = "✅" if show_emoji else ""
print(colored(f"{emoji} {message}", "green"))
def info(message: str, show_emoji: bool = True) -> None:
"""
Prints an info message.
Args:
message (str): The info message
show_emoji (bool): Whether to show the emoji
Returns:
None
"""
emoji = "ℹ️" if show_emoji else ""
print(colored(f"{emoji} {message}", "magenta"))
def warning(message: str, show_emoji: bool = True) -> None:
"""
Prints a warning message.
Args:
message (str): The warning message
show_emoji (bool): Whether to show the emoji
Returns:
None
"""
emoji = "⚠️" if show_emoji else ""
print(colored(f"{emoji} {message}", "yellow"))
def question(message: str, show_emoji: bool = True) -> str:
"""
Prints a question message and returns the user's input.
Args:
message (str): The question message
show_emoji (bool): Whether to show the emoji
Returns:
user_input (str): The user's input
"""
emoji = "❓" if show_emoji else ""
return input(colored(f"{emoji} {message}", "magenta"))
|