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)
| 418 | |
| 419 | class 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 | """ |
no outgoing calls