WIP: Refactor Aurora (3.0.0) #29

Draft
cswimr wants to merge 347 commits from aurora-pydantic into main
2 changed files with 5 additions and 2 deletions
Showing only changes of commit ff66006b8a - Show all commits

View file

@ -29,10 +29,10 @@ class Change(AuroraBaseModel):
@classmethod
def from_dict(cls, bot: Red, data: dict) -> "Change":
logger.trace("Creating Change from dict (%s): %s", type(data), data)
logger.verbose("Creating Change from dict (%s): %s", type(data), data)
if isinstance(data, str):
data = json.loads(data)
logger.trace("Change data was a string, converted to dict: %s", data)
logger.verbose("Change data was a string, converted to dict: %s", data)
if "duration" in data and data["duration"] and not isinstance(data["duration"], timedelta):
hours, minutes, seconds = map(int, data["duration"].split(':'))
duration = timedelta(hours=hours, minutes=minutes, seconds=seconds)

View file

@ -162,6 +162,7 @@ class Moderation(AuroraGuildModel):
@classmethod
def from_dict(cls, bot: Red, data: dict) -> "Moderation":
logger.verbose("Creating Moderation from dict (%s): %s", type(data), data)
return cls(bot=bot, **data)
@classmethod
@ -208,6 +209,8 @@ class Moderation(AuroraGuildModel):
@classmethod
def execute(cls, bot: Red, guild_id: int, query: str, parameters: tuple | None = None, cursor: Cursor | None = None) -> Tuple["Moderation"]:
from ..utilities.database import connect
logger.trace("Executing query: %s", query)
logger.trace("With parameters: %s", parameters)
if not parameters:
parameters = ()
if not cursor: