MCPcopy Create free account
hub / github.com/ahalev/python-microgrid / __getitem__

Method __getitem__

src/pymgrid/modules/module_container.py:300–312  ·  view source on GitHub ↗
(self, item)

Source from the content-addressed store, hash-verified

298 return additions
299
300 def __getitem__(self, item):
301 if item == 'data' or item == 'module_dict':
302 raise KeyError(item)
303 try:
304 return self.data[item]
305 except KeyError:
306 try:
307 if isinstance(item, tuple):
308 return self.to_dict(orient='records')[item]
309 else:
310 return self.to_dict()[item]
311 except KeyError:
312 raise KeyError(item)
313
314 def __getattr__(self, item):
315 if item == 'data' or item.startswith('__'):

Callers

nothing calls this directly

Calls 1

to_dictMethod · 0.95

Tested by

no test coverage detected