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

Method __init__

IPython/core/history.py:532–551  ·  view source on GitHub ↗

Create a new history manager associated with a shell instance.

(self, shell=None, config=None, **traits)

Source from the content-addressed store, hash-verified

530 _exit_re = re.compile(r"(exit|quit)(\s*\(.*\))?$")
531
532 def __init__(self, shell=None, config=None, **traits):
533 """Create a new history manager associated with a shell instance.
534 """
535 # We need a pointer back to the shell for various tasks.
536 super(HistoryManager, self).__init__(shell=shell, config=config,
537 **traits)
538 self.save_flag = threading.Event()
539 self.db_input_cache_lock = threading.Lock()
540 self.db_output_cache_lock = threading.Lock()
541
542 try:
543 self.new_session()
544 except OperationalError:
545 self.log.error("Failed to create history session in %s. History will not be saved.",
546 self.hist_file, exc_info=True)
547 self.hist_file = ':memory:'
548
549 if self.enabled and self.hist_file != ':memory:':
550 self.save_thread = HistorySavingThread(self)
551 self.save_thread.start()
552
553 def _get_hist_file_name(self, profile=None):
554 """Get default history file name based on the Shell's profile.

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 4

new_sessionMethod · 0.95
HistorySavingThreadClass · 0.85
errorMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected