WIP: Refactor Aurora (3.0.0) #29

Draft
cswimr wants to merge 347 commits from aurora-pydantic into main
Showing only changes of commit 278bd98349 - Show all commits

View file

@ -1,5 +1,6 @@
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
import json import json
from ast import literal_eval
from datetime import datetime, timedelta from datetime import datetime, timedelta
from typing import Optional, Union from typing import Optional, Union
@ -137,7 +138,7 @@ def generate_dict(bot: Red, result: dict, guild_id: int) -> dict:
if result[14] is not None: if result[14] is not None:
json_str = result[14].replace('\\"', '"').replace('["{', '[{').replace('}"]', '}]') json_str = result[14].replace('\\"', '"').replace('["{', '[{').replace('}"]', '}]')
logger.debug('%s\n%s', result[14], json_str) logger.debug('%s\n%s', result[14], json_str)
changes = json.loads(json_str) changes = literal_eval(json_str)
change_obj_list = [] change_obj_list = []
for change in changes: for change in changes:
change_obj_list.append(Change.from_dict(bot=bot, data=change)) change_obj_list.append(Change.from_dict(bot=bot, data=change))