Coverage for seedboxsync/front/views/__init__.py: 100%
14 statements
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-26 17:14 +0000
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-26 17:14 +0000
1#
2# Copyright (C) 2015-2026 Guillaume Kulakowski <guillaume@kulakowski.fr>
3#
4# For the full copyright and license information, please view the LICENSE
5# file that was distributed with this source code.
6#
7"""Package "view" initialization."""
9import importlib
10import pkgutil
11from flask import Blueprint
13bp_auth = Blueprint("auth", __name__)
14bp_frontend = Blueprint("frontend", __name__)
15bp_settings = Blueprint("settings", __name__, url_prefix="/settings")
17SUB_PACKAGES = [
18 "auth",
19 "frontend",
20 "settings",
21]
24def _load_views() -> None:
25 """Dynamically import controller modules from sub-packages."""
26 for subpackage in SUB_PACKAGES:
27 # Import the sub-package itself first
28 subpackage_pkg = importlib.import_module(f"{__name__}.{subpackage}")
30 # Iterate over all modules inside the sub-package directory
31 for _, module_name, is_pkg in pkgutil.iter_modules(subpackage_pkg.__path__):
32 if not is_pkg:
33 importlib.import_module(f"{__name__}.{subpackage}.{module_name}")
36_load_views()