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

Method __init__

IPython/core/history.py:200–229  ·  view source on GitHub ↗

Create a new history accessor. Parameters ---------- profile : str The name of the profile from which to open history. hist_file : str Path to an SQLite history database stored by IPython. If specified, hist_file overrides profil

(self, profile='default', hist_file=u'', **traits)

Source from the content-addressed store, hash-verified

198 raise TraitError(msg)
199
200 def __init__(self, profile='default', hist_file=u'', **traits):
201 """Create a new history accessor.
202
203 Parameters
204 ----------
205 profile : str
206 The name of the profile from which to open history.
207 hist_file : str
208 Path to an SQLite history database stored by IPython. If specified,
209 hist_file overrides profile.
210 config : :class:`~traitlets.config.loader.Config`
211 Config object. hist_file can also be set through this.
212 """
213 # We need a pointer back to the shell for various tasks.
214 super(HistoryAccessor, self).__init__(**traits)
215 # defer setting hist_file from kwarg until after init,
216 # otherwise the default kwarg value would clobber any value
217 # set by config
218 if hist_file:
219 self.hist_file = hist_file
220
221 if self.hist_file == u'':
222 # No one has set the hist_file, yet.
223 self.hist_file = self._get_hist_file_name(profile)
224
225 if sqlite3 is None and self.enabled:
226 warn("IPython History requires SQLite, your history will not be saved")
227 self.enabled = False
228
229 self.init_db()
230
231 def _get_hist_file_name(self, profile='default'):
232 """Find the history file for the given profile name.

Callers

nothing calls this directly

Calls 3

_get_hist_file_nameMethod · 0.95
init_dbMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected