MCPcopy Create free account
hub / github.com/open-mmlab/mmengine / __getitem__

Method __getitem__

tests/test_structures/test_instance_data.py:25–32  ·  view source on GitHub ↗
(self, item)

Source from the content-addressed store, hash-verified

23 return len(self.tmp)
24
25 def __getitem__(self, item):
26 if isinstance(item, int):
27 if item >= len(self) or item < -len(self): # type:ignore
28 raise IndexError(f'Index {item} out of range!')
29 else:
30 # keep the dimension
31 item = slice(item, None, len(self))
32 return TmpObject(self.tmp[item])
33
34 @staticmethod
35 def cat(tmp_objs):

Callers

nothing calls this directly

Calls 1

TmpObjectClass · 0.85

Tested by

no test coverage detected