Enter a record of event in the logbook as a list of key-value pairs. The information are appended chronologically to a list as a dictionary. When the value part of a pair is a dictionary, the information contained in the dictionary are recorded in a chapter entitled as the na
(self, **infos)
| 331 | """ |
| 332 | |
| 333 | def record(self, **infos): |
| 334 | """Enter a record of event in the logbook as a list of key-value pairs. |
| 335 | The information are appended chronologically to a list as a dictionary. |
| 336 | When the value part of a pair is a dictionary, the information contained |
| 337 | in the dictionary are recorded in a chapter entitled as the name of the |
| 338 | key part of the pair. Chapters are also Logbook. |
| 339 | """ |
| 340 | apply_to_all = {k: v for k, v in infos.items() if not isinstance(v, dict)} |
| 341 | for key, value in list(infos.items()): |
| 342 | if isinstance(value, dict): |
| 343 | chapter_infos = value.copy() |
| 344 | chapter_infos.update(apply_to_all) |
| 345 | self.chapters[key].record(**chapter_infos) |
| 346 | del infos[key] |
| 347 | self.append(infos) |
| 348 | |
| 349 | def select(self, *names): |
| 350 | """Return a list of values associated to the *names* provided |