Docs: better documentation

This commit is contained in:
martin legrand
2025-03-06 11:58:54 +01:00
parent ff1af3b6a9
commit eca688baba
6 changed files with 128 additions and 29 deletions
+20 -1
View File
@@ -6,7 +6,19 @@ import platform
def pretty_print(text, color = "info"):
"""
print text with color
Print text with color formatting.
Args:
text (str): The text to print
color (str, optional): The color to use. Defaults to "info".
Valid colors are:
- "success": Green
- "failure": Red
- "status": Light green
- "code": Light blue
- "warning": Yellow
- "output": Cyan
- "default": Black (Windows only)
"""
if platform.system().lower() != "windows":
color_map = {
@@ -37,6 +49,13 @@ def pretty_print(text, color = "info"):
print(colored(text, color_map[color]))
def timer_decorator(func):
"""
Decorator to measure the execution time of a function.
Usage:
@timer_decorator
def my_function():
# code to execute
"""
from time import time
def wrapper(*args, **kwargs):
start_time = time()