MCPcopy Index your code
hub / github.com/ipython/ipython / get_range

Method get_range

IPython/core/history.py:527–571  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

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

Callers 1

get_range_by_strMethod · 0.95

Calls 1

_run_sqlMethod · 0.95

Tested by

no test coverage detected