-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #597 from cheshire-cat-ai/develop
version 1.4.0
- Loading branch information
Showing
43 changed files
with
1,513 additions
and
1,041 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,6 @@ core/cat/plugins/* | |
# tests plugin folder | ||
plugin_folder | ||
|
||
# cache embedder | ||
core/local_cache/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
from tinydb import TinyDB | ||
import os | ||
from tinydb import TinyDB | ||
|
||
#TODO can we add a verbose level for logging? | ||
from cat.utils import singleton | ||
|
||
@singleton | ||
class Database: | ||
|
||
_instance = None | ||
|
||
def __new__(cls): | ||
if not cls._instance: | ||
cls._instance = super().__new__(cls) | ||
cls._instance.db = TinyDB(cls._instance.get_file_name()) | ||
return cls._instance.db | ||
def __init__(self): | ||
self.db = TinyDB(self.get_file_name()) | ||
|
||
def get_file_name(self): | ||
tinydb_file = os.getenv("METADATA_FILE", "metadata.json") | ||
return tinydb_file | ||
|
||
def get_db(): | ||
return Database() | ||
return Database().db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.