fix(aurora): pylint fixes
All checks were successful
Actions / Build Documentation (MkDocs) (pull_request) Successful in 30s
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 49s

This commit is contained in:
Seaswimmer 2024-06-04 23:55:55 -04:00
parent 0d64e3f652
commit 027144f35d
Signed by: cswimr
GPG key ID: 5D671B5D03D65A7F
3 changed files with 7 additions and 6 deletions

View file

@ -116,7 +116,7 @@ class ImportAuroraView(ui.View):
database=database,
return_obj=False
)
except Exception as e:
except Exception as e: # pylint: disable=broad-exception-caught
failed_cases.append(str(case["moderation_id"]) + f": {e}")
await interaction.edit_original_response(content="Import complete.")

View file

@ -299,7 +299,7 @@ class Moderation(AuroraGuildModel):
changes: list | None = None,
metadata: dict | None = None,
return_obj: bool = True,
) -> Union["Moderation", None]:
) -> Union["Moderation", int]:
from ..utilities.database import connect
from ..utilities.json import dumps
if not timestamp:
@ -325,7 +325,7 @@ class Moderation(AuroraGuildModel):
if reason == "NULL":
reason = None
if resolved_by == "NULL" or resolved_by == '?':
if resolved_by in ["NULL", "?"]:
resolved_by = None
if resolved_reason == "NULL":
@ -393,3 +393,4 @@ class Moderation(AuroraGuildModel):
if return_obj:
return cls.find_by_id(bot=bot, moderation_id=moderation_id, guild_id=guild_id)
return moderation_id

View file

@ -199,10 +199,10 @@ def timedelta_from_string(string: str) -> timedelta:
hours, minutes, seconds = map(int, string.split(":"))
return timedelta(hours=hours, minutes=minutes, seconds=seconds)
def timedelta_to_string(timedelta: timedelta) -> str:
def timedelta_to_string(td: timedelta) -> str:
"""Converts a timedelta object to a string."""
days = timedelta.days * 24
hours, remainder = divmod(timedelta.seconds, 3600)
days = td.days * 24
hours, remainder = divmod(td.seconds, 3600)
minutes, seconds = divmod(remainder, 60)
return f"{days + hours}:{minutes:02}:{seconds:02}"