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

Method get_range

IPython/core/history.py:414–449  ·  view source on GitHub ↗

Retrieve input by session. Parameters ---------- session : int Session number to retrieve. start : int First line to retrieve. stop : int End of line range (excluded from output itself). If None, retrieve to the

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

Source from the content-addressed store, hash-verified

412
413 @catch_corrupt_db
414 def get_range(self, session, start=1, stop=None, raw=True,output=False):
415 """Retrieve input by session.
416
417 Parameters
418 ----------
419 session : int
420 Session number to retrieve.
421 start : int
422 First line to retrieve.
423 stop : int
424 End of line range (excluded from output itself). If None, retrieve
425 to the end of the session.
426 raw : bool
427 If True, return untranslated input
428 output : bool
429 If True, attempt to include output. This will be 'real' Python
430 objects for the current session, or text reprs from previous
431 sessions if db_log_output was enabled at the time. Where no output
432 is found, None is used.
433
434 Returns
435 -------
436 entries
437 An iterator over the desired lines. Each line is a 3-tuple, either
438 (session, line, input) if output is False, or
439 (session, line, (input, output)) if output is True.
440 """
441 if stop:
442 lineclause = "line >= ? AND line < ?"
443 params = (session, start, stop)
444 else:
445 lineclause = "line>=?"
446 params = (session, start)
447
448 return self._run_sql("WHERE session==? AND %s" % lineclause,
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

Callers 1

get_range_by_strMethod · 0.95

Calls 1

_run_sqlMethod · 0.95

Tested by

no test coverage detected