MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / __init__

Method __init__

codegeex/mindspore/src/sat_dataset.py:19–36  ·  view source on GitHub ↗
(self, path, process_fn=None)

Source from the content-addressed store, hash-verified

17
18class LMDBDataset(Dataset):
19 def __init__(self, path, process_fn=None):
20 import lmdb
21
22 self.path = path
23 self.env = lmdb.open(
24 path,
25 max_readers=32,
26 readonly=True,
27 lock=False,
28 readahead=False,
29 meminit=False,
30 )
31 self.process_fn = process_fn
32 if not self.env:
33 raise IOError("Cannot open lmdb dataset", path)
34
35 with self.env.begin(write=False) as txn:
36 self.length = int(txn.get("length".encode("utf-8")).decode("utf-8"))
37
38 def __len__(self):
39 return self.length

Callers

nothing calls this directly

Calls 3

decodeMethod · 0.45
getMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected