mirror of
				https://github.com/arcan1s/ahriman.git
				synced 2025-10-30 21:33:43 +00:00 
			
		
		
		
	add __all__ attribute
This commit is contained in:
		| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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: | ||||
|     """ | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 = [ | ||||
|     """ | ||||
|  | ||||
| @ -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 = [ | ||||
|     """ | ||||
|  | ||||
| @ -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: | ||||
|     """ | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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) | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user