diff --git a/src/ahriman/application/ahriman.py b/src/ahriman/application/ahriman.py index 05db2ad1..33ddffb0 100644 --- a/src/ahriman/application/ahriman.py +++ b/src/ahriman/application/ahriman.py @@ -22,7 +22,7 @@ import sys import tempfile from pathlib import Path -from typing import TypeVar +from typing import List, TypeVar from ahriman import version from ahriman.application import handlers @@ -33,6 +33,9 @@ from ahriman.models.sign_settings import SignSettings from ahriman.models.user_access import UserAccess +__all__: List[str] = [] + + # this workaround is for several things # firstly python devs don't think that is it error and asking you for workarounds https://bugs.python.org/issue41592 # secondly linters don't like when you are importing private members diff --git a/src/ahriman/core/auth/helpers.py b/src/ahriman/core/auth/helpers.py index c25d9508..829a1513 100644 --- a/src/ahriman/core/auth/helpers.py +++ b/src/ahriman/core/auth/helpers.py @@ -26,6 +26,9 @@ except ImportError: _has_aiohttp_security = False +__all__ = ["authorized_userid", "check_authorized", "forget", "remember"] + + async def authorized_userid(*args: Any) -> Any: """ handle aiohttp security methods diff --git a/src/ahriman/core/database/data/package_remotes.py b/src/ahriman/core/database/data/package_remotes.py index 5624159c..1a50f414 100644 --- a/src/ahriman/core/database/data/package_remotes.py +++ b/src/ahriman/core/database/data/package_remotes.py @@ -24,6 +24,9 @@ from ahriman.models.remote_source import RemoteSource from ahriman.models.repository_paths import RepositoryPaths +__all__ = ["migrate_package_remotes"] + + # pylint: disable=protected-access def migrate_package_remotes(connection: Connection, paths: RepositoryPaths) -> None: """ diff --git a/src/ahriman/core/database/data/package_statuses.py b/src/ahriman/core/database/data/package_statuses.py index 27777f31..238064c9 100644 --- a/src/ahriman/core/database/data/package_statuses.py +++ b/src/ahriman/core/database/data/package_statuses.py @@ -26,6 +26,9 @@ from ahriman.models.package import Package from ahriman.models.repository_paths import RepositoryPaths +__all__ = ["migrate_package_statuses"] + + def migrate_package_statuses(connection: Connection, paths: RepositoryPaths) -> None: """ perform migration for package statuses diff --git a/src/ahriman/core/database/data/patches.py b/src/ahriman/core/database/data/patches.py index 3e5c6d72..5b182158 100644 --- a/src/ahriman/core/database/data/patches.py +++ b/src/ahriman/core/database/data/patches.py @@ -22,6 +22,9 @@ from sqlite3 import Connection from ahriman.models.repository_paths import RepositoryPaths +__all__ = ["migrate_patches"] + + def migrate_patches(connection: Connection, paths: RepositoryPaths) -> None: """ perform migration for patches diff --git a/src/ahriman/core/database/data/users.py b/src/ahriman/core/database/data/users.py index dc5787b8..05357a8f 100644 --- a/src/ahriman/core/database/data/users.py +++ b/src/ahriman/core/database/data/users.py @@ -22,6 +22,9 @@ from sqlite3 import Connection from ahriman.core.configuration import Configuration +__all__ = ["migrate_users_data"] + + def migrate_users_data(connection: Connection, configuration: Configuration) -> None: """ perform migration for users diff --git a/src/ahriman/core/database/migrations/m000_initial.py b/src/ahriman/core/database/migrations/m000_initial.py index 054b6754..85fd48fd 100644 --- a/src/ahriman/core/database/migrations/m000_initial.py +++ b/src/ahriman/core/database/migrations/m000_initial.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +__all__ = ["steps"] + steps = [ """ diff --git a/src/ahriman/core/database/migrations/m001_package_source.py b/src/ahriman/core/database/migrations/m001_package_source.py index 6c37f7a5..1429e26c 100644 --- a/src/ahriman/core/database/migrations/m001_package_source.py +++ b/src/ahriman/core/database/migrations/m001_package_source.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +__all__ = ["steps"] + steps = [ """ diff --git a/src/ahriman/core/util.py b/src/ahriman/core/util.py index 2ac0810b..aeadf92b 100644 --- a/src/ahriman/core/util.py +++ b/src/ahriman/core/util.py @@ -33,6 +33,10 @@ from ahriman.core.exceptions import InvalidOption, UnsafeRun from ahriman.models.repository_paths import RepositoryPaths +__all__ = ["check_output", "check_user", "exception_response_text", "filter_json", "full_version", "package_like", + "pretty_datetime", "pretty_size", "tmpdir", "walk"] + + def check_output(*args: str, exception: Optional[Exception], cwd: Optional[Path] = None, input_data: Optional[str] = None, logger: Optional[Logger] = None, user: Optional[int] = None) -> str: """ diff --git a/src/ahriman/web/middlewares/auth_handler.py b/src/ahriman/web/middlewares/auth_handler.py index ad4d4ca5..40a029b7 100644 --- a/src/ahriman/web/middlewares/auth_handler.py +++ b/src/ahriman/web/middlewares/auth_handler.py @@ -36,6 +36,9 @@ from ahriman.models.user_identity import UserIdentity from ahriman.web.middlewares import HandlerType, MiddlewareType +__all__ = ["AuthorizationPolicy", "auth_handler", "setup_auth"] + + class AuthorizationPolicy(aiohttp_security.AbstractAuthorizationPolicy): # type: ignore """ authorization policy implementation diff --git a/src/ahriman/web/middlewares/exception_handler.py b/src/ahriman/web/middlewares/exception_handler.py index dcd803f6..fb71e0e0 100644 --- a/src/ahriman/web/middlewares/exception_handler.py +++ b/src/ahriman/web/middlewares/exception_handler.py @@ -25,6 +25,9 @@ from logging import Logger from ahriman.web.middlewares import HandlerType, MiddlewareType +__all__ = ["exception_handler"] + + def exception_handler(logger: Logger) -> MiddlewareType: """ exception handler middleware. Just log any exception (except for client ones) diff --git a/src/ahriman/web/routes.py b/src/ahriman/web/routes.py index 4229d489..fcea5825 100644 --- a/src/ahriman/web/routes.py +++ b/src/ahriman/web/routes.py @@ -33,6 +33,9 @@ from ahriman.web.views.user.login import LoginView from ahriman.web.views.user.logout import LogoutView +__all__ = ["setup_routes"] + + def setup_routes(application: Application, static_path: Path) -> None: """ setup all defined routes diff --git a/src/ahriman/web/web.py b/src/ahriman/web/web.py index 233b7462..3ceb729b 100644 --- a/src/ahriman/web/web.py +++ b/src/ahriman/web/web.py @@ -33,6 +33,9 @@ from ahriman.web.middlewares.exception_handler import exception_handler from ahriman.web.routes import setup_routes +__all__ = ["on_shutdown", "on_startup", "run_server", "setup_service"] + + async def on_shutdown(application: web.Application) -> None: """ web application shutdown handler