misc(aurora): pep 604 compliance
All checks were successful
Actions / Build Documentation (MkDocs) (pull_request) Successful in 28s
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 43s

This commit is contained in:
SeaswimmerTheFsh 2024-05-06 21:04:08 -04:00
parent 946e14ee3c
commit ab878739c4
Signed by: cswimr
GPG key ID: 5D671B5D03D65A7F
9 changed files with 45 additions and 45 deletions

View file

@ -9,7 +9,7 @@ class AuroraBaseModel(BaseModel):
model_config = ConfigDict(ignored_types=(Red,), arbitrary_types_allowed=True)
bot: Red
def to_json(self, indent: int = None, file: Any = None, **kwargs):
def to_json(self, indent: int | None = None, file: Any | None = None, **kwargs):
from aurora.utilities.json import ( # pylint: disable=cyclic-import
dump, dumps)
return dump(self.model_dump(exclude={"bot"}), file, indent=indent, **kwargs) if file else dumps(self.model_dump(exclude={"bot"}), indent=indent, **kwargs)
@ -18,7 +18,7 @@ class AuroraGuildModel(AuroraBaseModel):
"""Subclass of AuroraBaseModel that includes a guild_id attribute, and a modified to_json() method to match."""
guild_id: int
def to_json(self, indent: int = None, file: Any = None, **kwargs):
def to_json(self, indent: int | None = None, file: Any | None = None, **kwargs):
from aurora.utilities.json import ( # pylint: disable=cyclic-import
dump, dumps)
return dump(self.model_dump(exclude={"bot", "guild_id"}), file, indent=indent, **kwargs) if file else dumps(self.model_dump(exclude={"bot", "guild_id"}), indent=indent, **kwargs)

View file

@ -223,16 +223,16 @@ class Moderation(AuroraGuildModel):
target_type: str,
target_id: int,
role_id: int,
duration: timedelta = None,
reason: str = None,
database: sqlite3.Connection = None,
timestamp: datetime = None,
duration: timedelta | None = None,
reason: str | None = None,
database: sqlite3.Connection | None = None,
timestamp: datetime | None = None,
resolved: bool = False,
resolved_by: int = None,
resolved_reason: str = None,
expired: bool = None,
changes: list = None,
metadata: dict = None,
resolved_by: int | None = None,
resolved_reason: str | None = None,
expired: bool | None = None,
changes: list | None = None,
metadata: dict | None = None,
) -> "Moderation":
from aurora.utilities.database import connect
from aurora.utilities.json import dumps