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

Method __getitem__

codegeex/mindspore/src/sat_dataset.py:41–53  ·  view source on GitHub ↗
(self, idx)

Source from the content-addressed store, hash-verified

39 return self.length
40
41 def __getitem__(self, idx):
42 # print(f"Get {self.path}: {idx}")
43 with self.env.begin(write=False) as txn:
44 key = str(idx).encode("utf-8")
45 # row = pickle.loads(txn.get(key))
46 try:
47 row = pickle.loads(txn.get(key))
48 except TypeError:
49 raise IndexError("Index out of range")
50 if self.process_fn:
51 return self.process_fn(row)
52 else:
53 return row
54
55
56class PadDataset(Dataset):

Callers

nothing calls this directly

Calls 2

encodeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected