From 4e0235d96ac915e4049fc83082659911e36046b6 Mon Sep 17 00:00:00 2001 From: Jeny Sadadia Date: Tue, 1 Oct 2024 12:58:51 +0530 Subject: [PATCH] api: enable pylint on all the sub-modules Enable `pylint` on all the sub-modules of `api`. Fix pylint errors for `email_sender.py`, `config.py` and `admin.py`. Signed-off-by: Jeny Sadadia --- api/admin.py | 9 +++++++-- api/config.py | 3 +++ api/email_sender.py | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/api/admin.py b/api/admin.py index 6d73aa6c..8ca5fd3d 100644 --- a/api/admin.py +++ b/api/admin.py @@ -47,6 +47,11 @@ async def setup_admin_user(db, username, email): async def main(args): + """ + Create database instance, initialize Beanie to use DB wrapper from + `fastapi-users`, and create an initial admin user with unique + index on `username` and `email` fields + """ db = Database(args.mongo, args.database) await db.initialize_beanie() await db.create_indexes() @@ -64,5 +69,5 @@ async def main(args): help="KernelCI database name") parser.add_argument('--email', required=True, help="Admin user email address") - args = parser.parse_args() - sys.exit(0 if asyncio.run(main(args)) else 1) + arguments = parser.parse_args() + sys.exit(0 if asyncio.run(main(arguments)) else 1) diff --git a/api/config.py b/api/config.py index 1be0ae72..dc7ae282 100644 --- a/api/config.py +++ b/api/config.py @@ -8,6 +8,7 @@ from pydantic import BaseSettings, EmailStr +# pylint: disable=too-few-public-methods class AuthSettings(BaseSettings): """Authentication settings""" secret_key: str @@ -16,6 +17,7 @@ class AuthSettings(BaseSettings): access_token_expire_seconds: float = 315360000 +# pylint: disable=too-few-public-methods class PubSubSettings(BaseSettings): """Pub/Sub settings loaded from the environment""" cloud_events_source: str = "https://api.kernelci.org/" @@ -24,6 +26,7 @@ class PubSubSettings(BaseSettings): keep_alive_period: int = 45 +# pylint: disable=too-few-public-methods class EmailSettings(BaseSettings): """Email settings""" smtp_host: str diff --git a/api/email_sender.py b/api/email_sender.py index 5da61d0f..4e3f3a1e 100644 --- a/api/email_sender.py +++ b/api/email_sender.py @@ -15,7 +15,7 @@ from .config import EmailSettings -class EmailSender: +class EmailSender: # pylint: disable=too-few-public-methods """Class to send email report using SMTP""" def __init__(self): self._settings = EmailSettings()