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

Method _get_range_session

IPython/core/history.py:633–651  ·  view source on GitHub ↗

Get input and output history from the current session. Called by get_range, and takes similar parameters.

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

Source from the content-addressed store, hash-verified

631 return super(HistoryManager, self).get_session_info(session=session)
632
633 def _get_range_session(self, start=1, stop=None, raw=True, output=False):
634 """Get input and output history from the current session. Called by
635 get_range, and takes similar parameters."""
636 input_hist = self.input_hist_raw if raw else self.input_hist_parsed
637
638 n = len(input_hist)
639 if start < 0:
640 start += n
641 if not stop or (stop > n):
642 stop = n
643 elif stop < 0:
644 stop += n
645
646 for i in range(start, stop):
647 if output:
648 line = (input_hist[i], self.output_hist_reprs.get(i))
649 else:
650 line = input_hist[i]
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.

Callers 1

get_rangeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected