Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use plyvel for the leveldb backend #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions quickumls/toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# installed modules
import numpy
import leveldb
import plyvel
try:
import unqlite
UNQLITE_AVAILABLE = True
Expand Down Expand Up @@ -240,12 +240,12 @@ def __init__(self, path, database_backend='leveldb'):
self.semtypes_db_put = self.semtypes_db.store
self.semtypes_db_get = self.semtypes_db.fetch
elif database_backend == 'leveldb':
self.cui_db = leveldb.LevelDB(os.path.join(path, 'cui.leveldb'))
self.cui_db_put = self.cui_db.Put
self.cui_db_get = self.cui_db.Get
self.semtypes_db = leveldb.LevelDB(os.path.join(path, 'semtypes.leveldb'))
self.semtypes_db_put = self.semtypes_db.Put
self.semtypes_db_get = self.semtypes_db.Get
self.cui_db = plyvel.DB(os.path.join(path, 'cui.leveldb'), create_if_missing=True)
self.cui_db_put = self.cui_db.put
self.cui_db_get = self.cui_db.get
self.semtypes_db = plyvel.DB(os.path.join(path, 'semtypes.leveldb'), create_if_missing=True)
self.semtypes_db_put = self.semtypes_db.put
self.semtypes_db_get = self.semtypes_db.get
else:
raise ValueError(f'database_backend {database_backend} not recognized')

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
leveldb>=0.193
plyvel>=1.5.1
numpy>=1.8.2
spacy>=3.0.6
unidecode>=0.4.19
Expand Down