Refactor utils module structure and update imports

Moved utility modules from src/utils/ to ytsage/utils/ and updated all relative imports accordingly. Adjusted docstring usage examples and fixed a path reference in LocalizationManager to reflect the new directory structure.
This commit is contained in:
oop7
2026-01-25 14:06:41 +02:00
parent ad5f304d4e
commit ca6b53715e
6 changed files with 11 additions and 11 deletions
@@ -20,7 +20,7 @@ Features
Usage
-----
from src.utils.ytsage_config_manager import ConfigManager
from .ytsage_config_manager import ConfigManager
# Load settings (auto-loads if not already loaded)
download_path = ConfigManager.get("download_path")
@@ -54,8 +54,8 @@ import threading
from pathlib import Path
from typing import Any, Dict, Optional
from src.utils.ytsage_constants import APP_CONFIG_FILE, USER_HOME_DIR
from src.utils.ytsage_logger import logger
from .ytsage_constants import APP_CONFIG_FILE, USER_HOME_DIR
from .ytsage_logger import logger
class ConfigManager:
@@ -70,7 +70,7 @@ def get_asset_path(asset_relative_path: str) -> Path:
# Fallback to relative path (for development environment)
current_file = Path(__file__)
# Go up from src/utils to ytsage root, then to asset
# Go up from utils to ytsage root, then to asset
ytsage_root = current_file.parent.parent.parent
asset_path = ytsage_root / asset_relative_path
@@ -14,7 +14,7 @@ Features
Usage
-----
from src.utils.ytsage_history_manager import HistoryManager
from .ytsage_history_manager import HistoryManager
# Add a download to history
HistoryManager.add_entry(...)
@@ -38,8 +38,8 @@ from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Optional
from src.utils.ytsage_constants import APP_HISTORY_FILE, APP_DATA_DIR
from src.utils.ytsage_logger import logger
from .ytsage_constants import APP_HISTORY_FILE, APP_DATA_DIR
from .ytsage_logger import logger
class HistoryManager:
@@ -15,7 +15,7 @@ Features
Usage
-----
from src.utils.ytsage_localization import LocalizationManager
from .ytsage_localization import LocalizationManager
# Get localized text
text = LocalizationManager.get_text("download.ready")
@@ -33,7 +33,7 @@ import threading
from pathlib import Path
from typing import Any, Dict
from src.utils.ytsage_logger import logger
from .ytsage_logger import logger
class LocalizationManager:
@@ -46,7 +46,7 @@ class LocalizationManager:
_lock = threading.RLock()
_current_language = "en"
_languages: Dict[str, Dict[str, Any]] = {}
_languages_dir = Path(__file__).parent.parent.parent / "languages"
_languages_dir = Path(__file__).parent.parent / "languages"
# Fallback English strings embedded in code
_fallback_strings = {
@@ -9,7 +9,7 @@ import sys
from loguru import logger
from src.utils.ytsage_constants import APP_LOG_DIR, IS_FROZEN
from .ytsage_constants import APP_LOG_DIR, IS_FROZEN
# Separate configs for each handler
CONSOLE_CONFIG = {