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

Method get_range_by_str

IPython/core/history.py:573–595  ·  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". If empty string is used, this will return everything from curr

(
        self, rangestr: str, raw: bool = True, output: bool = False
    )

Source from the content-addressed store, hash-verified

571 )
572
573 def get_range_by_str(
574 self, rangestr: str, raw: bool = True, output: bool = False
575 ) -> Iterable[tuple[int, int, InOrInOut]]:
576 """Get lines of history from a string of ranges, as used by magic
577 commands %hist, %save, %macro, etc.
578
579 Parameters
580 ----------
581 rangestr : str
582 A string specifying ranges, e.g. "5 ~2/1-4". If empty string is used,
583 this will return everything from current session's history.
584
585 See the documentation of :func:`%history` for the full details.
586
587 raw, output : bool
588 As :meth:`get_range`
589
590 Returns
591 -------
592 Tuples as :meth:`get_range`
593 """
594 for sess, s, e in extract_hist_ranges(rangestr):
595 yield from self.get_range(sess, s, e, raw=raw, output=output)
596
597
598@dataclass

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