-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.py
More file actions
19 lines (17 loc) · 804 Bytes
/
Copy pathexample.py
File metadata and controls
19 lines (17 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from pathlib import Path
import shutil
from lmdb_cache import LMDBCacheCompressed, LMDBCache, lmdb_exists
from tempfile import TemporaryDirectory
if __name__ in "__main__":
with TemporaryDirectory() as db_path:
data_iterable = [(i, f"data_compressed_{i}") for i in range(1000)]
shutil.rmtree(db_path)
compressed_lmdb = LMDBCacheCompressed.from_iterable(Path(db_path), data_iterable)
for i in range(len(compressed_lmdb)):
print(i, compressed_lmdb[i])
with TemporaryDirectory() as db_path:
data_iterable = [(i, f"data_{i}") for i in range(1000)]
shutil.rmtree(db_path)
compressed_lmdb = LMDBCache.from_iterable(Path(db_path), data_iterable)
for i in range(len(compressed_lmdb)):
print(i, compressed_lmdb[i])