Retrieve input by session. Parameters ---------- session : int Session number to retrieve. start : int First line to retrieve. stop : int End of line range (excluded from output itself). If None, retrieve to the
(
self,
session: int,
start: int = 1,
stop: Optional[int] = None,
raw: bool = True,
output: bool = False,
)
| 525 | |
| 526 | @catch_corrupt_db |
| 527 | def get_range( |
| 528 | self, |
| 529 | session: int, |
| 530 | start: int = 1, |
| 531 | stop: Optional[int] = None, |
| 532 | raw: bool = True, |
| 533 | output: bool = False, |
| 534 | ) -> Iterable[tuple[int, int, InOrInOut]]: |
| 535 | """Retrieve input by session. |
| 536 | |
| 537 | Parameters |
| 538 | ---------- |
| 539 | session : int |
| 540 | Session number to retrieve. |
| 541 | start : int |
| 542 | First line to retrieve. |
| 543 | stop : int |
| 544 | End of line range (excluded from output itself). If None, retrieve |
| 545 | to the end of the session. |
| 546 | raw : bool |
| 547 | If True, return untranslated input |
| 548 | output : bool |
| 549 | If True, attempt to include output. This will be 'real' Python |
| 550 | objects for the current session, or text reprs from previous |
| 551 | sessions if db_log_output was enabled at the time. Where no output |
| 552 | is found, None is used. |
| 553 | |
| 554 | Returns |
| 555 | ------- |
| 556 | entries |
| 557 | An iterator over the desired lines. Each line is a 3-tuple, either |
| 558 | (session, line, input) if output is False, or |
| 559 | (session, line, (input, output)) if output is True. |
| 560 | """ |
| 561 | params: tuple[typing.Any, ...] |
| 562 | if stop: |
| 563 | lineclause = "line >= ? AND line < ?" |
| 564 | params = (session, start, stop) |
| 565 | else: |
| 566 | lineclause = "line>=?" |
| 567 | params = (session, start) |
| 568 | |
| 569 | return self._run_sql( |
| 570 | "WHERE session==? AND %s" % lineclause, params, raw=raw, output=output |
| 571 | ) |
| 572 | |
| 573 | def get_range_by_str( |
| 574 | self, rangestr: str, raw: bool = True, output: bool = False |
no test coverage detected