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

Method item

src/pymgrid/modules/module_container.py:420–437  ·  view source on GitHub ↗

Get the value of a singleton list. Returns ------- module : BaseMicrogridModule Item in a singleton list. Raises ------ ValueError : If there is more than one item in the list.

(self)

Source from the content-addressed store, hash-verified

418
419class ModuleList(UserList):
420 def item(self):
421 """
422 Get the value of a singleton list.
423
424 Returns
425 -------
426 module : BaseMicrogridModule
427 Item in a singleton list.
428
429 Raises
430 ------
431 ValueError :
432 If there is more than one item in the list.
433
434 """
435 if len(self) != 1:
436 raise ValueError("Can only convert a ModuleList of length one to a scalar")
437 return self[0]
438
439 def to_list(self):
440 """

Callers 15

_size_batteryMethod · 0.80
current_loadMethod · 0.80
current_renewableMethod · 0.80
__init__Method · 0.80
logMethod · 0.80
_numpy_represent_intFunction · 0.80
normalizeMethod · 0.80
denormalizeMethod · 0.80
get_genset_moduleFunction · 0.80

Calls

no outgoing calls