MCPcopy Create free account
hub / github.com/ipython/ipython / get_range

Method get_range

IPython/core/history.py:653–686  ·  view source on GitHub ↗

Retrieve input by session. Parameters ---------- session : int Session number to retrieve. The current session is 0, and negative numbers count back from current session, so -1 is previous session. start : int First line to

(self, session=0, start=1, stop=None, raw=True,output=False)

Source from the content-addressed store, hash-verified

651 yield (0, i, line)
652
653 def get_range(self, session=0, start=1, stop=None, raw=True,output=False):
654 """Retrieve input by session.
655
656 Parameters
657 ----------
658 session : int
659 Session number to retrieve. The current session is 0, and negative
660 numbers count back from current session, so -1 is previous session.
661 start : int
662 First line to retrieve.
663 stop : int
664 End of line range (excluded from output itself). If None, retrieve
665 to the end of the session.
666 raw : bool
667 If True, return untranslated input
668 output : bool
669 If True, attempt to include output. This will be 'real' Python
670 objects for the current session, or text reprs from previous
671 sessions if db_log_output was enabled at the time. Where no output
672 is found, None is used.
673
674 Returns
675 -------
676 entries
677 An iterator over the desired lines. Each line is a 3-tuple, either
678 (session, line, input) if output is False, or
679 (session, line, (input, output)) if output is True.
680 """
681 if session <= 0:
682 session += self.session_number
683 if session==self.session_number: # Current session
684 return self._get_range_session(start, stop, raw, output)
685 return super(HistoryManager, self).get_range(session, start, stop, raw,
686 output)
687
688 ## ----------------------------
689 ## Methods for storing history:

Callers 4

test_historyFunction · 0.45
historyMethod · 0.45
notebookMethod · 0.45

Calls 1

_get_range_sessionMethod · 0.95

Tested by 1

test_historyFunction · 0.36