File size: 608 Bytes
4ed7d03 | 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 | """
Utility Functions
Common helper functions and utilities
"""
import logging
from pathlib import Path
# Setup logging
logger = logging.getLogger(__name__)
def ensure_dir(directory: Path) -> Path:
"""
Ensure directory exists, create if needed
Args:
directory: Path to directory
Returns:
Path object
"""
directory.mkdir(parents=True, exist_ok=True)
return directory
def get_project_root() -> Path:
"""
Get root directory of NETRA project
Returns:
Path to project root
"""
return Path(__file__).parent.parent.parent
|