WIP: Refactor Aurora (3.0.0) #29

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

View file

@ -4,7 +4,6 @@ from typing import Literal, Optional
from redbot.core.bot import Red from redbot.core.bot import Red
from ..utilities.logger import logger
from .base import AuroraBaseModel from .base import AuroraBaseModel
from .partials import PartialUser from .partials import PartialUser
@ -29,10 +28,8 @@ class Change(AuroraBaseModel):
@classmethod @classmethod
def from_dict(cls, bot: Red, data: dict) -> "Change": def from_dict(cls, bot: Red, data: dict) -> "Change":
logger.verbose("Creating Change from dict (%s): %s", type(data), data)
if isinstance(data, str): if isinstance(data, str):
data = json.loads(data) data = json.loads(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): if "duration" in data and data["duration"] and not isinstance(data["duration"], timedelta):
hours, minutes, seconds = map(int, data["duration"].split(':')) hours, minutes, seconds = map(int, data["duration"].split(':'))
duration = timedelta(hours=hours, minutes=minutes, seconds=seconds) duration = timedelta(hours=hours, minutes=minutes, seconds=seconds)

View file

@ -162,7 +162,6 @@ class Moderation(AuroraGuildModel):
@classmethod @classmethod
def from_dict(cls, bot: Red, data: dict) -> "Moderation": 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) return cls(bot=bot, **data)
@classmethod @classmethod