Source code for HALF.Utils.utils
from datetime import datetime
import re
[docs]def now_str() -> str:
"""Get current time
Returns:
str: The current time, formatted
"""
return datetime.now().strftime("%Y%m%d%H%M%S")
[docs]def camel2snake(name_camel: str) -> str:
"""Converts CamelCase to snake_case
Args:
name_camel (str): The name formatted in CamelCase
Returns:
str: The name converted to snake_case
"""
name_snake = re.sub(r'(?<!^)(?=[A-Z])', '_', name_camel).lower()
return name_snake