chore: revert to use base settings class instead of partial settings

This commit is contained in:
2024-11-27 14:48:47 +01:00
parent 15457383c5
commit 6a2ca5e719

View File

@@ -3,7 +3,7 @@ import inspect
import sqlite3 as sql import sqlite3 as sql
import tempfile import tempfile
from pathlib import Path from pathlib import Path
from src import database from src import settings
from typing import Any, Dict, List, Optional, Tuple, Union from typing import Any, Dict, List, Optional, Tuple, Union
# from icecream import ic # from icecream import ic
from omegaconf import OmegaConf from omegaconf import OmegaConf
@@ -33,7 +33,7 @@ from icecream import ic
ascii_lowercase = "abcdefghijklmnopqrstuvwxyz0123456789)" ascii_lowercase = "abcdefghijklmnopqrstuvwxyz0123456789)"
caller_frame = inspect.stack()[1] caller_frame = inspect.stack()[1]
# get the line that called the function # get the line that called the function
database = settings.database
class Database: class Database:
""" """
Initialize the database and create the tables if they do not exist. Initialize the database and create the tables if they do not exist.
@@ -302,7 +302,7 @@ class Database:
result = self.query_db( result = self.query_db(
"SELECT bookdata FROM media WHERE app_id=? AND prof_id=?", (app_id, prof_id) "SELECT bookdata FROM media WHERE app_id=? AND prof_id=?", (app_id, prof_id)
) )
books = [load_pickle(i[0]) for i in result] books: list[BookData] = [load_pickle(i[0]) for i in result]
book = [i for i in books if i.signature == signature][0] book = [i for i in books if i.signature == signature][0]
return book return book