| """ | |
| 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 | |