class_docstr: A class to organize all history-related functionality in one place.
      
class_docstr_tok: ["A","class","to","organize","all","history-related","functionality","in","one","place","."]
docstr: Create a new history manager associated with a shell instance.
          
docstr_tok: ["Create","a","new","history","manager","associated","with","a","shell","instance","."]
code: def __init__(self, shell=None, config=None, **traits):
      """Create a new history manager associated with a shell instance."""
      # We need a pointer back to the shell for various tasks.
      super(HistoryManager, self).__init__(
          shell=shell, config=config, **traits
      )
      self.save_flag = threading.Event()
      self.db_input_cache_lock = threading.Lock()
      self.db_output_cache_lock = threading.Lock()
  
      try:
          self.new_session()
      except OperationalError:
          self.log.error(
              "Failed to create history session in %s. History will not be saved.",
              self.hist_file,
              exc_info=True,
          )
          self.hist_file = ":memory:"
  
      if self.enabled and self.hist_file != ":memory:":
          self.save_thread = HistorySavingThread(self)
          self.save_thread.start()
  
imports: from __future__ import print_function
  import atexit
  import datetime
  import os
  import re
  import threading
  from traitlets.config.configurable import LoggingConfigurable
  from decorator import decorator
  from IPython.utils.decorators import undoc
  from IPython.paths import locate_profile
  from IPython.utils import py3compat
  from traitlets import Any, Bool, Dict, Instance, Integer, List, Unicode, TraitError, default, observe
  from warnings import warn
label_desc: Use image node_id 2 to create a new HistoryManager object from inherited base classes: HistoryAccessor with example: obj = HistoryManager(shell, config)