refactor(KIAUH): add application root to sys path
shortens imports and helps with auto imports from IDE Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from kiauh.core.backup_manager import BACKUP_ROOT_DIR
|
||||
from core.backup_manager import BACKUP_ROOT_DIR
|
||||
|
||||
MODULE_PATH = Path(__file__).resolve().parent
|
||||
INVALID_CHOICE = "Invalid choice. Please select a valid value."
|
||||
|
||||
@@ -13,20 +13,20 @@ from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Dict, Literal, List, Type, Union
|
||||
|
||||
from kiauh.components.klipper.klipper import Klipper
|
||||
from kiauh.core.instance_manager.base_instance import BaseInstance
|
||||
from kiauh.core.instance_manager.instance_manager import InstanceManager
|
||||
from kiauh.utils import PRINTER_CFG_BACKUP_DIR
|
||||
from kiauh.utils.constants import (
|
||||
from components.klipper.klipper import Klipper
|
||||
from core.instance_manager.base_instance import BaseInstance
|
||||
from core.instance_manager.instance_manager import InstanceManager
|
||||
from utils import PRINTER_CFG_BACKUP_DIR
|
||||
from utils.constants import (
|
||||
COLOR_CYAN,
|
||||
RESET_FORMAT,
|
||||
COLOR_YELLOW,
|
||||
COLOR_GREEN,
|
||||
COLOR_RED,
|
||||
)
|
||||
from kiauh.utils.filesystem_utils import check_file_exist
|
||||
from kiauh.utils.logger import Logger
|
||||
from kiauh.utils.system_utils import check_package_install, install_system_packages
|
||||
from utils.filesystem_utils import check_file_exist
|
||||
from utils.logger import Logger
|
||||
from utils.system_utils import check_package_install, install_system_packages
|
||||
|
||||
|
||||
def get_current_date() -> Dict[Literal["date", "time"], str]:
|
||||
@@ -122,7 +122,7 @@ def get_install_status_webui(
|
||||
|
||||
def backup_printer_config_dir():
|
||||
# local import to prevent circular import
|
||||
from kiauh.core.backup_manager.backup_manager import BackupManager
|
||||
from core.backup_manager.backup_manager import BackupManager
|
||||
|
||||
im = InstanceManager(Klipper)
|
||||
instances: List[Klipper] = im.instances
|
||||
|
||||
@@ -13,12 +13,12 @@ import subprocess
|
||||
from pathlib import Path
|
||||
from zipfile import ZipFile
|
||||
|
||||
from kiauh.utils import (
|
||||
from utils import (
|
||||
NGINX_SITES_AVAILABLE,
|
||||
MODULE_PATH,
|
||||
NGINX_CONFD,
|
||||
)
|
||||
from kiauh.utils.logger import Logger
|
||||
from utils.logger import Logger
|
||||
|
||||
|
||||
def check_file_exist(file_path: Path, sudo=False) -> bool:
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
from typing import Optional, List, Union
|
||||
|
||||
from kiauh.utils import INVALID_CHOICE
|
||||
from kiauh.utils.constants import COLOR_CYAN, RESET_FORMAT
|
||||
from kiauh.utils.logger import Logger
|
||||
from utils import INVALID_CHOICE
|
||||
from utils.constants import COLOR_CYAN, RESET_FORMAT
|
||||
from utils.logger import Logger
|
||||
|
||||
|
||||
def get_confirm(
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
# ======================================================================= #
|
||||
|
||||
from kiauh.utils.constants import (
|
||||
from utils.constants import (
|
||||
COLOR_WHITE,
|
||||
COLOR_GREEN,
|
||||
COLOR_YELLOW,
|
||||
|
||||
@@ -21,9 +21,9 @@ import venv
|
||||
from pathlib import Path
|
||||
from typing import List, Literal
|
||||
|
||||
from kiauh.utils.input_utils import get_confirm
|
||||
from kiauh.utils.logger import Logger
|
||||
from kiauh.utils.filesystem_utils import check_file_exist
|
||||
from utils.input_utils import get_confirm
|
||||
from utils.logger import Logger
|
||||
from utils.filesystem_utils import check_file_exist
|
||||
|
||||
|
||||
def kill(opt_err_msg: str = "") -> None:
|
||||
|
||||
Reference in New Issue
Block a user