Skip to content

Commit

Permalink
api: enable pylint on all the sub-modules
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Jeny Sadadia authored and JenySadadia committed Oct 16, 2024
1 parent ea2ec57 commit 4e0235d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
3 changes: 3 additions & 0 deletions api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pydantic import BaseSettings, EmailStr


# pylint: disable=too-few-public-methods
class AuthSettings(BaseSettings):
"""Authentication settings"""
secret_key: str
Expand All @@ -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/"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion api/email_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 4e0235d

Please sign in to comment.