Get lines of history from a string of ranges, as used by magic commands %hist, %save, %macro, etc. Parameters ---------- rangestr : str A string specifying ranges, e.g. "5 ~2/1-4". If empty string is used, this will return everything from curr
(
self, rangestr: str, raw: bool = True, output: bool = False
)
| 571 | ) |
| 572 | |
| 573 | def get_range_by_str( |
| 574 | self, rangestr: str, raw: bool = True, output: bool = False |
| 575 | ) -> Iterable[tuple[int, int, InOrInOut]]: |
| 576 | """Get lines of history from a string of ranges, as used by magic |
| 577 | commands %hist, %save, %macro, etc. |
| 578 | |
| 579 | Parameters |
| 580 | ---------- |
| 581 | rangestr : str |
| 582 | A string specifying ranges, e.g. "5 ~2/1-4". If empty string is used, |
| 583 | this will return everything from current session's history. |
| 584 | |
| 585 | See the documentation of :func:`%history` for the full details. |
| 586 | |
| 587 | raw, output : bool |
| 588 | As :meth:`get_range` |
| 589 | |
| 590 | Returns |
| 591 | ------- |
| 592 | Tuples as :meth:`get_range` |
| 593 | """ |
| 594 | for sess, s, e in extract_hist_ranges(rangestr): |
| 595 | yield from self.get_range(sess, s, e, raw=raw, output=output) |
| 596 | |
| 597 | |
| 598 | @dataclass |
no test coverage detected