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

Method get_range_by_str

IPython/core/history.py:451–469  ·  view source on GitHub ↗

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". See :func:`magic_history` for full details. raw, output :

(self, rangestr, raw=True, output=False)

Source from the content-addressed store, hash-verified

449 params, raw=raw, output=output)
450
451 def get_range_by_str(self, rangestr, raw=True, output=False):
452 """Get lines of history from a string of ranges, as used by magic
453 commands %hist, %save, %macro, etc.
454
455 Parameters
456 ----------
457 rangestr : str
458 A string specifying ranges, e.g. "5 ~2/1-4". See
459 :func:`magic_history` for full details.
460 raw, output : bool
461 As :meth:`get_range`
462
463 Returns
464 -------
465 Tuples as :meth:`get_range`
466 """
467 for sess, s, e in extract_hist_ranges(rangestr):
468 for line in self.get_range(sess, s, e, raw=raw, output=output):
469 yield line
470
471
472class HistoryManager(HistoryAccessor):

Callers 4

extract_input_linesMethod · 0.45
historyMethod · 0.45
recallMethod · 0.45
rerunMethod · 0.45

Calls 2

get_rangeMethod · 0.95
extract_hist_rangesFunction · 0.85

Tested by

no test coverage detected