MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / __getitem__

Method __getitem__

datasets/dataset.py:32–38  ·  view source on GitHub ↗
(self, index)

Source from the content-addressed store, hash-verified

30 return self.max_db_data_num
31
32 def __getitem__(self, index):
33 p = np.random.rand()
34 v = list(self.partition.values())
35 k = list(self.partition.keys())
36 for i,v_i in enumerate(v):
37 if p<=v_i:
38 return self.dataset[k[i]][index % len(self.dataset[k[i]])]

Callers

nothing calls this directly

Calls 2

valuesMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected