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

Method _get_range_session

IPython/core/history.py:908–932  ·  view source on GitHub ↗

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

(
        self,
        start: int = 1,
        stop: Optional[int] = None,
        raw: bool = True,
        output: bool = False,
    )

Source from the content-addressed store, hash-verified

906 return list(everything)[::-1]
907
908 def _get_range_session(
909 self,
910 start: int = 1,
911 stop: Optional[int] = None,
912 raw: bool = True,
913 output: bool = False,
914 ) -> Iterable[tuple[int, int, InOrInOut]]:
915 """Get input and output history from the current session. Called by
916 get_range, and takes similar parameters."""
917 input_hist = self.input_hist_raw if raw else self.input_hist_parsed
918
919 n = len(input_hist)
920 if start < 0:
921 start += n
922 if not stop or (stop > n):
923 stop = n
924 elif stop < 0:
925 stop += n
926 line: InOrInOut
927 for i in range(start, stop):
928 if output:
929 line = (input_hist[i], self.output_hist_reprs.get(i))
930 else:
931 line = input_hist[i]
932 yield (0, i, line)
933
934 def get_range(
935 self,

Callers 1

get_rangeMethod · 0.95

Calls 1

getMethod · 0.80

Tested by

no test coverage detected