Truncate the length of the history, dropping the oldest items if necessary. :param max_length: the maximum length of the history, if negative, all history items will be deleted :return: nothing
(self, max_length: int)
| 312 | return self._build_result_dictionary(start, len(self), isin) |
| 313 | |
| 314 | def truncate(self, max_length: int) -> None: |
| 315 | """Truncate the length of the history, dropping the oldest items if necessary. |
| 316 | |
| 317 | :param max_length: the maximum length of the history, if negative, all history |
| 318 | items will be deleted |
| 319 | :return: nothing |
| 320 | """ |
| 321 | if max_length <= 0: |
| 322 | # remove all history |
| 323 | del self[:] |
| 324 | elif len(self) > max_length: |
| 325 | last_element = len(self) - max_length |
| 326 | del self[0:last_element] |
| 327 | |
| 328 | def _build_result_dictionary( |
| 329 | self, start: int, end: int, filter_func: Callable[[HistoryItem], bool] | None = None |
no outgoing calls