From d1795f0ca8f0c3fe90c5b71f4a64262b55bd991b Mon Sep 17 00:00:00 2001 From: snowy Date: Sun, 3 Mar 2024 21:22:49 +0800 Subject: [PATCH] update: r --- main.py | 4 +--- requirements.txt | 3 +-- src/api/data.py | 6 ++---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index 28e8d51..ace4a1b 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,7 @@ from src.liteyuki import * -from pymongo import MongoClient -a = MongoClient("mongodb://localhost:27017/") if __name__ == '__main__': liteyuki = Liteyuki() app = liteyuki.get_asgi() - liteyuki.run(app="main:app") + liteyuki.run(app="main:app") \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 32f13d6..8c9eb89 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ nonebot2[fastapi] -keyvalue-sqlite=1.0.7 -motor=3.3.2 \ No newline at end of file +nonebot-adapter-onebot==2.4.1 \ No newline at end of file diff --git a/src/api/data.py b/src/api/data.py index 6dc4ff8..67b9cf8 100644 --- a/src/api/data.py +++ b/src/api/data.py @@ -1,12 +1,9 @@ import json import sqlite3 import types -import typing from abc import ABC from collections.abc import Iterable -from copy import deepcopy from typing import Any - from pydantic import BaseModel BaseIterable = list | tuple | set | dict @@ -291,7 +288,8 @@ class SqliteORMAdapter(BaseORMAdapter): new_d = {} for k, v in d.items(): if k.startswith(self.FOREIGNID): - new_d[k.replace(self.FOREIGNID, '')] = load(dict(self.cursor.execute(f'SELECT * FROM {v.split(":")[1]} WHERE id = ?', (v.split(":")[2],)).fetchone())) + new_d[k.replace(self.FOREIGNID, '')] = load( + dict(self.cursor.execute(f'SELECT * FROM {v.split(":")[1]} WHERE id = ?', (v.split(":")[2],)).fetchone())) elif k.startswith(self.JSON): new_d[k.replace(self.JSON, '')] = load(json.loads(v)) else: