add __all__ attribute

This commit is contained in:
Evgenii Alekseev 2022-05-03 01:31:21 +03:00
parent c73a2a4aa9
commit fe9711d24f
13 changed files with 39 additions and 1 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__all__ = ["steps"]
steps = [
"""

View File

@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__all__ = ["steps"]
steps = [
"""

View File

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

View File

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

View File

@ -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)

View File

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

View File

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