misc(aurora): pep 604 compliance
This commit is contained in:
parent
946e14ee3c
commit
ab878739c4
9 changed files with 45 additions and 45 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue